UObject_SK.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef UObject_SK_H_
00014 #define UObject_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 UObject_SK:
00024 public UniSetObject,
00025 public LT_Object
00026 {
00027 public:
00028 UObject_SK( UniSetTypes::ObjectId id, xmlNode* node=UniSetTypes::conf->getNode("UObject"), const std::string& argprefix="" );
00029 UObject_SK();
00030 virtual ~UObject_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
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063 protected:
00064
00065
00066
00067
00068
00069
00070 virtual void callback();
00071 virtual void processingMessage( UniSetTypes::VoidMessage* msg );
00072 virtual void sysCommand( UniSetTypes::SystemMessage* sm );
00073 virtual void askSensors( UniversalIO::UIOCommand cmd ){}
00074 virtual void sensorInfo( UniSetTypes::SensorMessage* sm ){}
00075 virtual void timerInfo( UniSetTypes::TimerMessage* tm ){}
00076 virtual void sigterm( int signo );
00077 virtual bool activateObject();
00078 virtual void testMode( bool state );
00079 void updatePreviousValues();
00080 void checkSensors();
00081 void updateOutputs( bool force );
00082
00083 void preAskSensors( UniversalIO::UIOCommand cmd );
00084 void preSensorInfo( UniSetTypes::SensorMessage* sm );
00085 void preTimerInfo( UniSetTypes::TimerMessage* tm );
00086 void waitSM( int wait_msec, UniSetTypes::ObjectId testID = UniSetTypes::DefaultObjectId );
00087
00088 void resetMsg();
00089 Trigger trResetMsg;
00090 PassiveTimer ptResetMsg;
00091 int resetMsgTime;
00092
00093
00094 virtual void step()=0;
00095
00096 int sleep_msec;
00097 bool active;
00098
00099 UniSetTypes::ObjectId smTestID;
00101
00102 PassiveTimer ptHeartBeat;
00103 UniSetTypes::ObjectId idHeartBeat;
00104 int maxHeartBeat;
00106 xmlNode* confnode;
00108 int getIntProp(const std::string& name) { return UniSetTypes::conf->getIntProp(confnode, name); }
00110 inline const std::string getProp(const std::string& name) { return UniSetTypes::conf->getProp(confnode, name); }
00111
00112 int smReadyTimeout;
00113 bool activated;
00114 int activateTimeout;
00115 PassiveTimer ptStartUpTimeout;
00116 int askPause;
00118 IOController_i::SensorInfo si;
00119
00120
00121 private:
00122
00123
00124
00125
00126
00127
00128 bool end_private;
00129 };
00130
00131
00132 #endif // UObject_SK_H_