ConsoleModule.h
Go to the documentation of this file.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
00176 #ifndef OT_NO_CONSOLE_SUPPORT
00177
00178
00179 namespace ot {
00180
00181 class OPENTRACKER_API ConsoleModule: public Module, public NodeFactory
00182 {
00183 enum DIRECTION { POS = 0, NEG };
00184
00185 protected:
00187 NodeVector sinks;
00189 NodeVector sources;
00191 int cycle;
00193 int interval;
00195 std::string headerline;
00197 float angularSpeed, posSpeed;
00199 int station;
00201 int quit;
00203 int display;
00205 int curses;
00207 std::vector<int> keyMap;
00209 bool delAttribute;
00211 bool addAttribute;
00213 bool changeAttrByVal;
00215 std::string nameOfAttributeToBeChanged;
00217 bool currentChanged;
00219 bool stationChanged;
00220
00221
00222 protected:
00229 void addAttr(const int station, const std::string type, const std::string name, const std::string value) const;
00234 void delAttr(const int station, const std::string name);
00238 void nextAttr(const int station);
00243 void changeAttrToValue(const int station, const std::string value) const;
00248 void changeAttr(const int station, const DIRECTION dir) const;
00253 void clearLastLines(int lines = -1);
00260 void setButton( int station , int button );
00267 void movePos( int station, float * data );
00274 void rotate( int station, float * data );
00280 void reset( int station );
00281 public:
00284 ConsoleModule();
00286 virtual ~ConsoleModule();
00293 virtual void init(StringTable& attributes, ConfigNode * localTree);
00301 virtual Node * createNode( const std::string& name, StringTable& attributes);
00307 virtual void pushEvent();
00312 virtual void pullEvent();
00316 virtual void start();
00319 virtual void close();
00323 virtual int stop();
00324
00325
00326 std::vector<std::string> functionMap;
00327
00328 std::map<std::string,int> keyCodeMap;
00329
00330 static const short MOVE_X_PLUS;
00331 static const short MOVE_X_MINUS;
00332 static const short MOVE_Y_PLUS;
00333 static const short MOVE_Y_MINUS;
00334 static const short MOVE_Z_PLUS;
00335 static const short MOVE_Z_MINUS;
00336 static const short ROT_X_PLUS;
00337 static const short ROT_X_MINUS;
00338 static const short ROT_Y_PLUS;
00339 static const short ROT_Y_MINUS;
00340 static const short ROT_Z_PLUS;
00341 static const short ROT_Z_MINUS;
00342 static const short ACCELL;
00343 static const short BRAKE;
00344 static const short BUTTON_1;
00345 static const short BUTTON_2;
00346 static const short BUTTON_3;
00347 static const short BUTTON_4;
00348 static const short STATION_0;
00349 static const short STATION_1;
00350 static const short STATION_2;
00351 static const short STATION_3;
00352 static const short STATION_4;
00353 static const short STATION_5;
00354 static const short STATION_6;
00355 static const short STATION_7;
00356 static const short STATION_8;
00357 static const short STATION_9;
00358 static const short RESET;
00359 static const short QUIT;
00360 static const short NEXT_ATTR;
00361 static const short ADD_ATTR;
00362 static const short DEL_ATTR;
00363 static const short CHANGE_ATTR_POS;
00364 static const short CHANGE_ATTR_NEG;
00365 static const short CHANGE_ATTR_VAL;
00366 static const short ACCEL_ANG;
00367 static const short BRAKE_ANG;
00368 };
00369
00370 }
00371
00372
00373 #endif // OT_NO_CONSOLE_SUPPORT
00374
00375
00376 #endif
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392