uniset-algorithms  0.2
CPanel.h
00001 #ifndef CPanel_H_
00002 #define CPanel_H_
00003 // -----------------------------------------------------------------------------
00004 #include <string>
00005 #include <list>
00006 #include <TriggerOR.h>
00007 #include "CPanel_SK.h"
00008 #include "APSPanel.h"
00009 // -----------------------------------------------------------------------------
00010 class CPanelMode;
00011 // -----------------------------------------------------------------------------
00066 // -----------------------------------------------------------------------------
00068 class CPanel:
00069     public CPanel_SK
00070 {
00071     public:
00072         CPanel( UniSetTypes::ObjectId id, xmlNode* cnode );
00073         virtual ~CPanel();
00074 
00075         enum Timers
00076         {
00077             tmStarting,
00078             tmCommandTimeout,
00079             tmProtResetTimeout
00080         };
00081         
00082         int startTime;      
00083         int commandTimeout;     
00085         inline bool isOnControl(){ return ctlON; }
00086 
00088         enum idFailure
00089         {
00090             fNetFailed,     
00091             fCtlFailed,     
00092             fPanelFailed    
00093         };
00094 
00095         bool waitCommand; 
00096         bool waitProtReset; 
00098         static DebugStream dlog;
00099         static void init_dlog( DebugStream& dlog );
00100     
00101     protected:
00102         virtual void step();
00103         virtual void sigterm( int signo );
00104         virtual void sensorInfo( UniSetTypes::SensorMessage* sm );
00105         virtual void timerInfo( UniSetTypes::TimerMessage* tm );
00106         virtual void sysCommand( UniSetTypes::SystemMessage* sm );
00107         void allLamp( UniSetTypes::LampCommand l );
00108         void changeMode( CPanelMode* m );
00109 
00110         APSPanel* aps;
00111         
00112         bool ctlON; 
00113         TriggerOR<CPanel,idFailure>* ctlPanelFailed;
00114         void setCtlPanelFailed( bool state );
00115 
00116         CPanelMode* mode;
00117         friend class CPanelMode;
00118 
00119         friend std::ostream& operator<<(std::ostream& os, CPanel& cp );
00120         friend std::ostream& operator<<(std::ostream& os, CPanel* cp );
00121 
00122     private:
00123 };
00124 // -----------------------------------------------------------------------------
00125 #endif // CPanel_H_
00126 // -----------------------------------------------------------------------------