00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef QG_SK_H_
00014 #define QG_SK_H_
00015
00016 #include <string>
00017 #include "UniSetObject.h"
00018 #include "LT_Object.h"
00019 #include "UniXML.h"
00020 #include "Trigger.h"
00021 #include "DebugStream.h"
00022
00023 class QG_SK:
00024 public UniSetObject,
00025 public LT_Object
00026 {
00027 public:
00028 QG_SK( UniSetTypes::ObjectId id, xmlNode* node=UniSetTypes::conf->getNode("QG"), const std::string& argprefix="" );
00029 QG_SK();
00030 virtual ~QG_SK();
00031
00032
00033
00034 bool alarm( UniSetTypes::ObjectId sid, bool state );
00035 bool getState( UniSetTypes::ObjectId sid );
00036 long 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 DebugStream dlog;
00046 void init_dlog(DebugStream& dlog);
00047
00048
00049
00050 const UniSetTypes::ObjectId state_as;
00051 UniSetTypes::ObjectId node_state_as;
00052 const UniSetTypes::ObjectId on_s;
00053 UniSetTypes::ObjectId node_on_s;
00054
00055
00056
00057
00058
00059
00060 long in_state_as;
00061 long prev_in_state_as;
00062 bool in_on_s;
00063 bool prev_in_on_s;
00064
00065
00066
00067
00068
00069
00070
00071 protected:
00072
00073
00074
00075
00076
00077
00078 virtual void callback();
00079 virtual void processingMessage( UniSetTypes::VoidMessage* msg );
00080 virtual void sysCommand( UniSetTypes::SystemMessage* sm );
00081 virtual void askSensors( UniversalIO::UIOCommand cmd ){}
00082 virtual void sensorInfo( UniSetTypes::SensorMessage* sm ){}
00083 virtual void timerInfo( UniSetTypes::TimerMessage* tm ){}
00084 virtual void sigterm( int signo );
00085 virtual bool activateObject();
00086 virtual void testMode( bool state );
00087 void updatePreviousValues();
00088 void checkSensors();
00089 void updateOutputs( bool force );
00090
00091 void preAskSensors( UniversalIO::UIOCommand cmd );
00092 void preSensorInfo( UniSetTypes::SensorMessage* sm );
00093 void preTimerInfo( UniSetTypes::TimerMessage* tm );
00094 void waitSM( int wait_msec, UniSetTypes::ObjectId testID = UniSetTypes::DefaultObjectId );
00095
00096 void resetMsg();
00097 Trigger trResetMsg;
00098 PassiveTimer ptResetMsg;
00099 int resetMsgTime;
00100
00101
00102 virtual void step()=0;
00103
00104 int sleep_msec;
00105 bool active;
00106
00107 UniSetTypes::ObjectId smTestID;
00109
00110 PassiveTimer ptHeartBeat;
00111 UniSetTypes::ObjectId idHeartBeat;
00112 int maxHeartBeat;
00114 xmlNode* confnode;
00116 int getIntProp(const std::string& name) { return UniSetTypes::conf->getIntProp(confnode, name); }
00118 inline const std::string getProp(const std::string& name) { return UniSetTypes::conf->getProp(confnode, name); }
00119
00120 int smReadyTimeout;
00121 bool activated;
00122 int activateTimeout;
00123 PassiveTimer ptStartUpTimeout;
00124 int askPause;
00126 IOController_i::SensorInfo si;
00127
00128
00129 private:
00130
00131
00132
00133
00134
00135
00136 bool end_private;
00137 };
00138
00139
00140 #endif // QG_SK_H_