00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef SEESControl_SK_H_
00014 #define SEESControl_SK_H_
00015
00016 #include <string>
00017 #include "ObjectsManager.h"
00018 #include "LT_Object.h"
00019 #include "UniXML.h"
00020 #include "Trigger.h"
00021 #include "DebugStream.h"
00022
00023 class SEESControl_SK:
00024 public ObjectsManager,
00025 public LT_Object
00026 {
00027 public:
00028 SEESControl_SK( UniSetTypes::ObjectId id, xmlNode* node=UniSetTypes::conf->getNode("SEESControl"), const std::string& argprefix="" );
00029 SEESControl_SK();
00030 virtual ~SEESControl_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 needResetProtection_f;
00051 UniSetTypes::ObjectId node_needResetProtection_f;
00052 const UniSetTypes::ObjectId QG_RemoteControl_S;
00053 UniSetTypes::ObjectId node_QG_RemoteControl_S;
00054 const UniSetTypes::ObjectId QG_LocalControlLamp_C;
00055 UniSetTypes::ObjectId node_QG_LocalControlLamp_C;
00056
00057
00058
00059
00060 const UniSetTypes::ObjectId mid_ProtectionNotReset_Att;
00061 UniSetTypes::ObjectId node_mid_ProtectionNotReset_Att;
00062 bool m_mid_ProtectionNotReset_Att;
00063 bool prev_m_mid_ProtectionNotReset_Att;
00066
00067 bool out_needResetProtection_f;
00068 bool prev_out_needResetProtection_f;
00069 bool in_QG_RemoteControl_S;
00070 bool prev_in_QG_RemoteControl_S;
00071 long out_QG_LocalControlLamp_C;
00072 long prev_out_QG_LocalControlLamp_C;
00073
00074
00075
00076
00077
00078
00079
00080 protected:
00081
00082
00083
00084
00085
00086
00087 virtual void callback();
00088 virtual void processingMessage( UniSetTypes::VoidMessage* msg );
00089 virtual void sysCommand( UniSetTypes::SystemMessage* sm );
00090 virtual void askSensors( UniversalIO::UIOCommand cmd ){}
00091 virtual void sensorInfo( UniSetTypes::SensorMessage* sm ){}
00092 virtual void timerInfo( UniSetTypes::TimerMessage* tm ){}
00093 virtual void sigterm( int signo );
00094 virtual bool activateObject();
00095 virtual void testMode( bool state );
00096 void updatePreviousValues();
00097 void checkSensors();
00098 void updateOutputs( bool force );
00099
00100 void preAskSensors( UniversalIO::UIOCommand cmd );
00101 void preSensorInfo( UniSetTypes::SensorMessage* sm );
00102 void preTimerInfo( UniSetTypes::TimerMessage* tm );
00103 void waitSM( int wait_msec, UniSetTypes::ObjectId testID = UniSetTypes::DefaultObjectId );
00104
00105 void resetMsg();
00106 Trigger trResetMsg;
00107 PassiveTimer ptResetMsg;
00108 int resetMsgTime;
00109
00110
00111 virtual void step()=0;
00112
00113 int sleep_msec;
00114 bool active;
00115
00116 UniSetTypes::ObjectId smTestID;
00118
00119 PassiveTimer ptHeartBeat;
00120 UniSetTypes::ObjectId idHeartBeat;
00121 int maxHeartBeat;
00123 xmlNode* confnode;
00125 int getIntProp(const std::string& name) { return UniSetTypes::conf->getIntProp(confnode, name); }
00127 inline const std::string getProp(const std::string& name) { return UniSetTypes::conf->getProp(confnode, name); }
00128
00129 int smReadyTimeout;
00130 bool activated;
00131 int activateTimeout;
00132 PassiveTimer ptStartUpTimeout;
00133 int askPause;
00135 IOController_i::SensorInfo si;
00136
00137
00138 private:
00139
00140
00141
00142
00143
00144
00145 bool end_private;
00146 };
00147
00148
00149 #endif // SEESControl_SK_H_