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 preSensorInfo( UniSetTypes::SensorMessage* sm );
00082 void preTimerInfo( UniSetTypes::TimerMessage* tm );
00083 void waitSM( int wait_msec, UniSetTypes::ObjectId testID = UniSetTypes::DefaultObjectId );
00084
00085 void resetMsg();
00086 Trigger trResetMsg;
00087 PassiveTimer ptResetMsg;
00088 int resetMsgTime;
00089
00090
00091 virtual void step()=0;
00092
00093 int sleep_msec;
00094 bool active;
00095
00096 UniSetTypes::ObjectId smTestID;
00098
00099 PassiveTimer ptHeartBeat;
00100 UniSetTypes::ObjectId idHeartBeat;
00101 int maxHeartBeat;
00103 xmlNode* confnode;
00105 int getIntProp(const std::string name) { return UniSetTypes::conf->getIntProp(confnode, name); }
00107 inline const std::string getProp(const std::string name) { return UniSetTypes::conf->getProp(confnode, name); }
00108
00109 int smReadyTimeout;
00110 bool activated;
00111 int activateTimeout;
00112 PassiveTimer ptStartUpTimeout;
00113 int askPause;
00115 IOController_i::SensorInfo si;
00116
00117
00118 private:
00119
00120 };
00121
00122
00123 #endif // TestGenAlone_SK_H_