00001 #ifndef _NDIMODULE_H
00002 #define _NDIMODULE_H
00003
00004 #include <OpenTracker/OpenTracker.h>
00005 #include <OpenTracker/dllinclude.h>
00006 #include "NDI_commands.h"
00007 #include "NDISource.h"
00008 #include <map>
00009
00010 namespace ot {
00011
00012 enum TrackerType {Aurora,Polaris};
00019 class OPENTRACKER_API NDIModule : public ThreadModule, public NodeFactory
00020 {
00021
00022 protected:
00023
00024
00025
00026 protected:
00028 virtual void run();
00029
00030
00031 public:
00033 NDIModule();
00034
00036 virtual ~NDIModule();
00044 virtual void init(StringTable& attributes, ConfigNode * localTree);
00052 virtual Node * createNode( const std::string& name, StringTable& attributes);
00053
00055 virtual void start();
00058 virtual void close();
00063 virtual void pushEvent();
00064
00066
00067
00068
00070 static const int m_Enabled;
00071
00073 static const int m_Timeout;
00074
00076 static const int m_CRCError;
00077
00079 static const int m_Interference;
00080
00081
00082 static const std::string m_strScope;
00083 static const std::string m_strTooManyActiveNodes;
00084 static const std::string m_strTooManyPassiveNodes;
00085 static const std::string m_strConflictingNodesFound;
00086 static const std::string m_strMissingNodes;
00087 static const std::string m_strNoROMFile;
00088 static const std::string m_strInitializationFailure;
00089 static const std::string m_strStartTrackingFailure;
00090 static const std::string m_strStopTrackingFailure;
00091 static const std::string m_strTrackingFailure;
00092
00093
00094
00095 private:
00096
00097 static const int mv_DefaultDataBits;
00098 static const int mv_DefaultStopBits;
00099 static const long mv_DefaultBaudRate;
00100 static const char mv_cDefaultParity;
00101 static const bool mv_bDefaultHardwareHandshake;
00102 static const std::string mv_strDefaultSerialPort;
00103
00105 static const int mv_MaxTimeouts;
00106
00108 void setupPorts();
00109
00111 bool trackNodes();
00112
00114 const std::string& getVersion() const;
00115
00116
00118 bool isTracking() const;
00119
00120
00121
00122 bool stop;
00123
00124
00126 NDICommands* mt_pNDICommands;
00127
00129 std::string mt_strVersion;
00130
00131
00132 std::string device;
00133
00134
00135
00136 TrackerType trackerType;
00137
00139 bool mt_bTracking;
00140
00142 std::map<std::string, NDISource*> mt_HandleNodeMap;
00143
00144
00145 std::map<std::string, std::string> mt_NodeIDMap;
00146
00147
00148 int mv_CurrentStatus;
00149
00150
00155 int mt_nTimeouts;
00156
00157
00163 int initNDI();
00164
00168 int resetNDI();
00169
00172 int startStreamMode();
00173
00174 void stop_tracking();
00175
00176 };
00177 OT_MODULE(NDIModule);
00178 }
00179 #endif