TestGenAlone_SK.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef TestGenAlone_SK_H_
00014 #define TestGenAlone_SK_H_
00015
00016 #include "UniSetObject.h"
00017 #include "LT_Object.h"
00018 #include "UniXML.h"
00019 #include "Trigger.h"
00020 #include "UniversalInterface.h"
00021
00022 class TestGenAlone_SK:
00023 public UniSetObject,
00024 public LT_Object
00025 {
00026 public:
00027 TestGenAlone_SK( UniSetTypes::ObjectId id = UniSetTypes::conf->getObjectID("TestGenAlone"), xmlNode* node=UniSetTypes::conf->getNode("TestGenAlone") );
00028 TestGenAlone_SK();
00029
00030 virtual ~TestGenAlone_SK();
00031
00032
00033
00034 bool alarm( UniSetTypes::ObjectId sid, bool state );
00035 bool getState( UniSetTypes::ObjectId sid );
00036 bool getValue( UniSetTypes::ObjectId sid );
00037 void setValue( UniSetTypes::ObjectId sid, long value );
00038 void setState( UniSetTypes::ObjectId sid, bool state );
00039 void askState( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand, UniSetTypes::ObjectId node = UniSetTypes::conf->getLocalNode() );
00040 void askValue( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand, UniSetTypes::ObjectId node = UniSetTypes::conf->getLocalNode() );
00041 void updateValues();
00042 void setMsg( UniSetTypes::ObjectId code, bool state );
00043
00044
00045
00046
00047 const UniSetTypes::ObjectId input1_s;
00048 UniSetTypes::ObjectId node_input1_s;
00049 bool in_input1_s;
00050 bool prev_in_input1_s;
00052 const UniSetTypes::ObjectId input2_s;
00053 UniSetTypes::ObjectId node_input2_s;
00054 bool in_input2_s;
00055 bool prev_in_input2_s;
00057 const UniSetTypes::ObjectId output1_c;
00058 UniSetTypes::ObjectId node_output1_c;
00059 bool out_output1_c;
00060 bool prev_out_output1_c;
00063
00064
00065
00066 protected:
00067
00068 virtual void callback();
00069 virtual void processingMessage( UniSetTypes::VoidMessage* msg );
00070 virtual void sysCommand( UniSetTypes::SystemMessage* sm );
00071 virtual void askSensors( UniversalIO::UIOCommand cmd ){}
00072 virtual void sensorInfo( UniSetTypes::SensorMessage* sm ){}
00073 virtual void timerInfo( UniSetTypes::TimerMessage* tm ){}
00074 virtual void sigterm( int signo );
00075 virtual bool activateObject();
00076 virtual void testMode( bool state );
00077 void updatePreviousValues();
00078 void checkSensors();
00079 void updateOutputs( bool force );
00080
00081 void preAskSensors( UniversalIO::UIOCommand cmd );
00082 void preSensorInfo( UniSetTypes::SensorMessage* sm );
00083 void preTimerInfo( UniSetTypes::TimerMessage* tm );
00084 void waitSM( int wait_msec, UniSetTypes::ObjectId testID = UniSetTypes::DefaultObjectId );
00085
00086 void resetMsg();
00087 Trigger trResetMsg;
00088 PassiveTimer ptResetMsg;
00089 int resetMsgTime;
00090
00091
00092 virtual void step()=0;
00093
00094 int sleep_msec;
00095 bool active;
00096
00097 UniSetTypes::ObjectId smTestID;
00099
00100 PassiveTimer ptHeartBeat;
00101 UniSetTypes::ObjectId idHeartBeat;
00102 int maxHeartBeat;
00104 xmlNode* confnode;
00106 int getIntProp(const std::string name) { return UniSetTypes::conf->getIntProp(confnode, name); }
00108 inline const std::string getProp(const std::string name) { return UniSetTypes::conf->getProp(confnode, name); }
00109
00110 int smReadyTimeout;
00111 bool activated;
00112 int activateTimeout;
00113 PassiveTimer ptStartUpTimeout;
00114 int askPause;
00116 IOController_i::SensorInfo si;
00117
00118
00119 private:
00120
00121 };
00122
00123
00124 #endif // TestGenAlone_SK_H_