uniset-algorithms 0.2
Automat_SK.h
00001 
00002 // --------------------------------------------------------------------------
00003 /*
00004  DO NOT EDIT THIS FILE. IT IS AUTOGENERATED FILE.
00005  ALL YOUR CHANGES WILL BE LOST.
00006  
00007  НЕ РЕДАКТИРУЙТЕ ЭТОТ ФАЙЛ. ЭТОТ ФАЙЛ СОЗДАН АВТОМАТИЧЕСКИ.
00008  ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
00009 */ 
00010 // --------------------------------------------------------------------------
00011 // generate timestamp: 2013-01-24
00012 // -----------------------------------------------------------------------------
00013 #ifndef Automat_SK_H_
00014 #define Automat_SK_H_
00015 // -----------------------------------------------------------------------------
00016 #include "UniSetObject.h"
00017 #include "LT_Object.h"
00018 #include "UniXML.h"
00019 #include "Trigger.h"
00020 // -----------------------------------------------------------------------------
00021 class Automat_SK:
00022     public UniSetObject,
00023     public LT_Object
00024 {
00025     public:
00026         Automat_SK( UniSetTypes::ObjectId id, xmlNode* node=UniSetTypes::conf->getNode("Automat") );
00027         Automat_SK();
00028         virtual ~Automat_SK();
00029 
00030         
00031 
00032         bool alarm( UniSetTypes::ObjectId sid, bool state );
00033         bool getState( UniSetTypes::ObjectId sid );
00034         bool getValue( UniSetTypes::ObjectId sid );
00035         void setValue( UniSetTypes::ObjectId sid, long value );
00036         void setState( UniSetTypes::ObjectId sid, bool state );
00037         void askState( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand, UniSetTypes::ObjectId node = UniSetTypes::conf->getLocalNode() );
00038         void askValue( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand, UniSetTypes::ObjectId node = UniSetTypes::conf->getLocalNode() );
00039         void updateValues();
00040         void setMsg( UniSetTypes::ObjectId code, bool state );
00041 
00042 
00043         // Используемые идентификаторы
00044         const UniSetTypes::ObjectId State_On_s;         
00045         UniSetTypes::ObjectId node_State_On_s;
00046         const UniSetTypes::ObjectId State_Off_s;        
00047         UniSetTypes::ObjectId node_State_Off_s;
00048         const UniSetTypes::ObjectId Protection_s;       
00049         UniSetTypes::ObjectId node_Protection_s;
00050         const UniSetTypes::ObjectId On_c;       
00051         UniSetTypes::ObjectId node_On_c;
00052         const UniSetTypes::ObjectId Off_c;      
00053         UniSetTypes::ObjectId node_Off_c;
00054         const UniSetTypes::ObjectId Automat_NA_s;       
00055         UniSetTypes::ObjectId node_Automat_NA_s;
00056         const UniSetTypes::ObjectId state_as;       
00057         UniSetTypes::ObjectId node_state_as;
00058         
00059 
00060         // Используемые идентификаторы сообщений
00061         
00062         const UniSetTypes::ObjectId mid_HandOn;     
00063         UniSetTypes::ObjectId node_mid_HandOn;
00064         bool m_mid_HandOn;                          
00065         bool prev_m_mid_HandOn;                     
00067         const UniSetTypes::ObjectId mid_HandOff;    
00068         UniSetTypes::ObjectId node_mid_HandOff;
00069         bool m_mid_HandOff;                             
00070         bool prev_m_mid_HandOff;                    
00072         const UniSetTypes::ObjectId mid_NotOn;  
00073         UniSetTypes::ObjectId node_mid_NotOn;
00074         bool m_mid_NotOn;                           
00075         bool prev_m_mid_NotOn;                  
00077         const UniSetTypes::ObjectId mid_NotOff;     
00078         UniSetTypes::ObjectId node_mid_NotOff;
00079         bool m_mid_NotOff;                          
00080         bool prev_m_mid_NotOff;                     
00082         const UniSetTypes::ObjectId mid_NotResetProtection;     
00083         UniSetTypes::ObjectId node_mid_NotResetProtection;
00084         bool m_mid_NotResetProtection;                          
00085         bool prev_m_mid_NotResetProtection;                     
00087         const UniSetTypes::ObjectId mid_CurrentProtection_Att;  
00088         UniSetTypes::ObjectId node_mid_CurrentProtection_Att;
00089         bool m_mid_CurrentProtection_Att;                           
00090         bool prev_m_mid_CurrentProtection_Att;                  
00092         const UniSetTypes::ObjectId mid_NA_Att;     
00093         UniSetTypes::ObjectId node_mid_NA_Att;
00094         bool m_mid_NA_Att;                          
00095         bool prev_m_mid_NA_Att;                     
00098         // Текущее значение и предыдущее значение
00099         bool in_State_On_s;
00100         bool prev_in_State_On_s;
00101         bool in_State_Off_s;
00102         bool prev_in_State_Off_s;
00103         bool in_Protection_s;
00104         bool prev_in_Protection_s;
00105         bool out_On_c;
00106         bool prev_out_On_c;
00107         bool out_Off_c;
00108         bool prev_out_Off_c;
00109         bool out_Automat_NA_s;
00110         bool prev_out_Automat_NA_s;
00111         long out_state_as;
00112         long prev_out_state_as;
00113         
00114 
00115         // --- public variables ---
00116         
00117         const bool autoResetProtection; 
00118         const int OnTime; 
00119         const int OffTime; 
00120         const int stateTimeOut; 
00121         const int CommandTime; 
00122         const int minWaitingTime; 
00123         const int offPause; 
00124         const int CheckStateTime; 
00125         const int naTime; 
00127         // --- end of public variables ---
00128 
00129     protected:
00130         // --- protected variables ---
00131         
00132         
00133         // ---- end of protected variables ----
00134 
00135         
00136         virtual void callback();
00137         virtual void processingMessage( UniSetTypes::VoidMessage* msg );
00138         virtual void sysCommand( UniSetTypes::SystemMessage* sm );
00139         virtual void askSensors( UniversalIO::UIOCommand cmd ){}
00140         virtual void sensorInfo( UniSetTypes::SensorMessage* sm ){}
00141         virtual void timerInfo( UniSetTypes::TimerMessage* tm ){}
00142         virtual void sigterm( int signo );
00143         virtual bool activateObject();
00144         virtual void testMode( bool state );
00145         void updatePreviousValues();
00146         void checkSensors();
00147         void updateOutputs( bool force );
00148 
00149         void preAskSensors( UniversalIO::UIOCommand cmd );
00150         void preSensorInfo( UniSetTypes::SensorMessage* sm );
00151         void preTimerInfo( UniSetTypes::TimerMessage* tm );
00152         void waitSM( int wait_msec, UniSetTypes::ObjectId testID = UniSetTypes::DefaultObjectId );
00153 
00154         void resetMsg();
00155         Trigger trResetMsg;
00156         PassiveTimer ptResetMsg;
00157         int resetMsgTime;
00158 
00159         // Выполнение очередного шага программы
00160         virtual void step()=0;
00161 
00162         int sleep_msec; 
00163         bool active;
00164 
00165         UniSetTypes::ObjectId smTestID; 
00167         // управление датчиком "сердцебиения"
00168         PassiveTimer ptHeartBeat;               
00169         UniSetTypes::ObjectId idHeartBeat;      
00170         int maxHeartBeat;                       
00172         xmlNode* confnode;
00174         int getIntProp(const std::string name) { return UniSetTypes::conf->getIntProp(confnode, name); }
00176         inline const std::string getProp(const std::string name) { return UniSetTypes::conf->getProp(confnode, name); }
00177 
00178         int smReadyTimeout;     
00179         bool activated;
00180         int activateTimeout;    
00181         PassiveTimer ptStartUpTimeout;  
00182         int askPause; 
00184         IOController_i::SensorInfo si;
00185 
00186 
00187     private:
00188         
00189         // --- private variables ---
00190         // --- end of private variables ---
00191 
00192         
00193 
00194         bool end_private; // вспомогательное поле (для внутреннего использования при генерировании кода)
00195 };
00196 
00197 // -----------------------------------------------------------------------------
00198 #endif // Automat_SK_H_