00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef Caller_SK_H_
00014 #define Caller_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 Caller_SK:
00024 public UniSetObject,
00025 public LT_Object
00026 {
00027 public:
00028 Caller_SK( UniSetTypes::ObjectId id, xmlNode* node=UniSetTypes::conf->getNode("Caller"), const std::string& argprefix="" );
00029 Caller_SK();
00030 virtual ~Caller_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 Selected;
00051 UniSetTypes::ObjectId node_Selected;
00052 const UniSetTypes::ObjectId Call;
00053 UniSetTypes::ObjectId node_Call;
00054 const UniSetTypes::ObjectId lmpCall;
00055 UniSetTypes::ObjectId node_lmpCall;
00056 const UniSetTypes::ObjectId MainConfirm;
00057 UniSetTypes::ObjectId node_MainConfirm;
00058 const UniSetTypes::ObjectId Confirm1;
00059 UniSetTypes::ObjectId node_Confirm1;
00060 const UniSetTypes::ObjectId Confirm2;
00061 UniSetTypes::ObjectId node_Confirm2;
00062 const UniSetTypes::ObjectId Confirm3;
00063 UniSetTypes::ObjectId node_Confirm3;
00064 const UniSetTypes::ObjectId Ring;
00065 UniSetTypes::ObjectId node_Ring;
00066 const UniSetTypes::ObjectId Ring2;
00067 UniSetTypes::ObjectId node_Ring2;
00068 const UniSetTypes::ObjectId Ring3;
00069 UniSetTypes::ObjectId node_Ring3;
00070 const UniSetTypes::ObjectId Ring4;
00071 UniSetTypes::ObjectId node_Ring4;
00072 const UniSetTypes::ObjectId aRing;
00073 UniSetTypes::ObjectId node_aRing;
00074 const UniSetTypes::ObjectId aRing2;
00075 UniSetTypes::ObjectId node_aRing2;
00076 const UniSetTypes::ObjectId aRing3;
00077 UniSetTypes::ObjectId node_aRing3;
00078 const UniSetTypes::ObjectId aRing4;
00079 UniSetTypes::ObjectId node_aRing4;
00080
00081
00082
00083
00084 const UniSetTypes::ObjectId msg_NoConfirm;
00085 UniSetTypes::ObjectId node_msg_NoConfirm;
00086 bool m_msg_NoConfirm;
00087 bool prev_m_msg_NoConfirm;
00089 const UniSetTypes::ObjectId msg_Call;
00090 UniSetTypes::ObjectId node_msg_Call;
00091 bool m_msg_Call;
00092 bool prev_m_msg_Call;
00094 const UniSetTypes::ObjectId msg_Confirm;
00095 UniSetTypes::ObjectId node_msg_Confirm;
00096 bool m_msg_Confirm;
00097 bool prev_m_msg_Confirm;
00099 const UniSetTypes::ObjectId msg_Confirm2;
00100 UniSetTypes::ObjectId node_msg_Confirm2;
00101 bool m_msg_Confirm2;
00102 bool prev_m_msg_Confirm2;
00104 const UniSetTypes::ObjectId msg_Confirm3;
00105 UniSetTypes::ObjectId node_msg_Confirm3;
00106 bool m_msg_Confirm3;
00107 bool prev_m_msg_Confirm3;
00110
00111 bool in_Selected;
00112 bool prev_in_Selected;
00113 bool in_Call;
00114 bool prev_in_Call;
00115 long out_lmpCall;
00116 long prev_out_lmpCall;
00117 bool in_MainConfirm;
00118 bool prev_in_MainConfirm;
00119 bool in_Confirm1;
00120 bool prev_in_Confirm1;
00121 bool in_Confirm2;
00122 bool prev_in_Confirm2;
00123 bool in_Confirm3;
00124 bool prev_in_Confirm3;
00125 bool out_Ring;
00126 bool prev_out_Ring;
00127 bool out_Ring2;
00128 bool prev_out_Ring2;
00129 bool out_Ring3;
00130 bool prev_out_Ring3;
00131 bool out_Ring4;
00132 bool prev_out_Ring4;
00133 long out_aRing;
00134 long prev_out_aRing;
00135 long out_aRing2;
00136 long prev_out_aRing2;
00137 long out_aRing3;
00138 long prev_out_aRing3;
00139 long out_aRing4;
00140 long prev_out_aRing4;
00141
00142
00143
00144
00145
00146
00147
00148 protected:
00149
00150
00151
00152
00153
00154
00155 virtual void callback();
00156 virtual void processingMessage( UniSetTypes::VoidMessage* msg );
00157 virtual void sysCommand( UniSetTypes::SystemMessage* sm );
00158 virtual void askSensors( UniversalIO::UIOCommand cmd ){}
00159 virtual void sensorInfo( UniSetTypes::SensorMessage* sm ){}
00160 virtual void timerInfo( UniSetTypes::TimerMessage* tm ){}
00161 virtual void sigterm( int signo );
00162 virtual bool activateObject();
00163 virtual void testMode( bool state );
00164 void updatePreviousValues();
00165 void checkSensors();
00166 void updateOutputs( bool force );
00167
00168 void preAskSensors( UniversalIO::UIOCommand cmd );
00169 void preSensorInfo( UniSetTypes::SensorMessage* sm );
00170 void preTimerInfo( UniSetTypes::TimerMessage* tm );
00171 void waitSM( int wait_msec, UniSetTypes::ObjectId testID = UniSetTypes::DefaultObjectId );
00172
00173 void resetMsg();
00174 Trigger trResetMsg;
00175 PassiveTimer ptResetMsg;
00176 int resetMsgTime;
00177
00178
00179 virtual void step()=0;
00180
00181 int sleep_msec;
00182 bool active;
00183
00184 UniSetTypes::ObjectId smTestID;
00186
00187 PassiveTimer ptHeartBeat;
00188 UniSetTypes::ObjectId idHeartBeat;
00189 int maxHeartBeat;
00191 xmlNode* confnode;
00193 int getIntProp(const std::string& name) { return UniSetTypes::conf->getIntProp(confnode, name); }
00195 inline const std::string getProp(const std::string& name) { return UniSetTypes::conf->getProp(confnode, name); }
00196
00197 int smReadyTimeout;
00198 bool activated;
00199 int activateTimeout;
00200 PassiveTimer ptStartUpTimeout;
00201 int askPause;
00203 IOController_i::SensorInfo si;
00204
00205
00206 private:
00207
00208
00209
00210
00211
00212
00213 bool end_private;
00214 };
00215
00216
00217 #endif // Caller_SK_H_