00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00042
00043
00160 #ifndef _CONSOLEMODULE_H
00161 #define _CONSOLEMODULE_H
00162
00163 #include "../OpenTracker.h"
00164
00165
00166
00178 #ifndef OT_NO_CONSOLE_SUPPORT
00179
00180
00181 namespace ot {
00182
00183 class OPENTRACKER_API ConsoleModule: public Module, public NodeFactory
00184 {
00185 enum DIRECTION { POS = 0, NEG };
00186
00187 protected:
00189 NodeVector sinks;
00191 NodeVector sources;
00193 int cycle;
00195 int interval;
00197 std::string headerline;
00199 float angularSpeed, posSpeed;
00201 int station;
00203 int quit;
00205 int display;
00207 int curses;
00209 std::vector<int> keyMap;
00211 bool delAttribute;
00213 bool addAttribute;
00215 bool changeAttrByVal;
00217 std::string nameOfAttributeToBeChanged;
00219 bool currentChanged;
00221 bool stationChanged;
00222
00223
00224 protected:
00231 void addAttr(const int station, const std::string type, const std::string name, const std::string value) const;
00236 void delAttr(const int station, const std::string name);
00240 void nextAttr(const int station);
00245 void changeAttrToValue(const int station, const std::string value) const;
00250 void changeAttr(const int station, const DIRECTION dir) const;
00255 void clearLastLines(int lines = -1);
00262 void setButton( int station , int button );
00269 void movePos( int station, float * data );
00276 void rotate( int station, float * data );
00282 void reset( int station );
00283 public:
00286 ConsoleModule();
00288 virtual ~ConsoleModule();
00295 virtual void init(StringTable& attributes, ConfigNode * localTree);
00303 virtual Node * createNode( const std::string& name, StringTable& attributes);
00309 virtual void pushEvent();
00314 virtual void pullEvent();
00318 virtual void start();
00321 virtual void close();
00325 virtual int stop();
00326
00327
00328 std::vector<std::string> functionMap;
00329
00330 std::map<std::string,int> keyCodeMap;
00331
00332 static const short MOVE_X_PLUS;
00333 static const short MOVE_X_MINUS;
00334 static const short MOVE_Y_PLUS;
00335 static const short MOVE_Y_MINUS;
00336 static const short MOVE_Z_PLUS;
00337 static const short MOVE_Z_MINUS;
00338 static const short ROT_X_PLUS;
00339 static const short ROT_X_MINUS;
00340 static const short ROT_Y_PLUS;
00341 static const short ROT_Y_MINUS;
00342 static const short ROT_Z_PLUS;
00343 static const short ROT_Z_MINUS;
00344 static const short ACCELL;
00345 static const short BRAKE;
00346 static const short BUTTON_1;
00347 static const short BUTTON_2;
00348 static const short BUTTON_3;
00349 static const short BUTTON_4;
00350 static const short STATION_0;
00351 static const short STATION_1;
00352 static const short STATION_2;
00353 static const short STATION_3;
00354 static const short STATION_4;
00355 static const short STATION_5;
00356 static const short STATION_6;
00357 static const short STATION_7;
00358 static const short STATION_8;
00359 static const short STATION_9;
00360 static const short RESET;
00361 static const short QUIT;
00362 static const short NEXT_ATTR;
00363 static const short ADD_ATTR;
00364 static const short DEL_ATTR;
00365 static const short CHANGE_ATTR_POS;
00366 static const short CHANGE_ATTR_NEG;
00367 static const short CHANGE_ATTR_VAL;
00368 static const short ACCEL_ANG;
00369 static const short BRAKE_ANG;
00370
00371 };
00372
00373 OT_MODULE(ConsoleModule);
00374 }
00375
00376
00377 #endif // OT_NO_CONSOLE_SUPPORT
00378
00379
00380 #endif
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396