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