00001 #ifndef _FLASHPOINT_MODULE_H
00002 #define _FLAHSPOINT_MODULE_H
00003
00004 #ifndef PLATFORM_WIN32
00005
00006 #include <vector>
00007 #include <OpenTracker/OpenTracker.h>
00008 #include <termios.h>
00009 #include <unistd.h>
00010 #include <sys/types.h>
00011 #include <sys/stat.h>
00012 #include <fcntl.h>
00013
00014 #include "FlashpointSource.h"
00015
00016
00017 #define CR "\x0A"
00018
00019 using namespace std;
00020 namespace ot {
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 class OPENTRACKER_API FlashpointModule : public ThreadModule, public NodeFactory {
00032
00033
00034 protected:
00035 char *serial_port;
00036
00037
00038 NodeVector sources;
00039 int stop;
00040
00041
00042 void run();
00043 public:
00044 int bodyID;
00045 int maxbodies;
00046
00047
00048 FlashpointModule();
00049
00050
00051 ~FlashpointModule();
00052
00053 virtual void start();
00054 virtual void close(){
00055
00056 }
00057
00058 Node *createNode(const std::string &name, StringTable &attributes);
00059
00060 void pushEvent();
00061 virtual void init(StringTable& attributes, ConfigNode * localTree);
00062
00063 void MatToQuat(float m[4][4], float * quat);
00064
00065
00066
00067 void open_serial_port();
00068 void set_tool(char *tool, int port);
00069 void send_command(char *command);
00070 void get_response(char *buff);
00071 void fatal(string message);
00072 void notice(string message);
00073 track_data* get_coord();
00074 private:
00075 int fd;
00076 char buf_prev[MAXLENGTH];
00077
00078 };
00079 OT_MODULE(FlashpointModule);
00080 }
00081 #endif // _FLASHPOINT_MODULE_H
00082 #endif