00001 00020 #ifndef __NEW_SIM_WATCHDOG_H__ 00021 #define __NEW_SIM_WATCHDOG_H__ 00022 00023 00024 #ifndef __NEW_SIM_RDR_H__ 00025 #include "new_sim_rdr.h" 00026 #endif 00027 00028 #ifndef __NEW_SIM_UTILS_H__ 00029 #include "new_sim_utils.h" 00030 #endif 00031 00032 #ifndef __NEW_SIM_TIMER_THREAD_H__ 00033 #include "new_sim_timer_thread.h" 00034 #endif 00035 00036 extern "C" { 00037 #include "SaHpi.h" 00038 } 00039 00045 class NewSimulatorWatchdog : public NewSimulatorRdr, public NewSimulatorTimerThread { 00046 private: 00048 SaHpiWatchdogRecT m_wdt_rec; 00050 SaHpiWatchdogT m_wdt_data; 00052 cTime m_start; 00053 00055 enum WdtStateT { 00056 NONE = 0, 00057 PRETIMEOUT, 00058 TIMEOUT }; 00059 00061 WdtStateT m_state; 00062 00063 void TriggerAction( WdtStateT state ); 00064 void SendEvent( SaHpiWatchdogActionEventT wdtaction, SaHpiSeverityT sev ); 00065 00066 protected: 00067 virtual bool TriggerAction(); 00068 00069 public: 00070 NewSimulatorWatchdog( NewSimulatorResource *res ); 00071 NewSimulatorWatchdog( NewSimulatorResource *res, SaHpiRdrT rdr, 00072 SaHpiWatchdogT wdt_data ); 00073 ~NewSimulatorWatchdog(); 00074 00076 unsigned int Num() const { return m_wdt_rec.WatchdogNum; } 00078 unsigned int Oem() const { return m_wdt_rec.Oem; } 00079 00080 // create an RDR sensor record 00081 bool CreateRdr( SaHpiRptEntryT &resource, SaHpiRdrT &rdr ); 00082 // Dump 00083 void Dump( NewSimulatorLog &dump ) const; 00084 00085 // HPI functions 00086 SaErrorT GetWatchdogInfo( SaHpiWatchdogT &watchdog); 00087 SaErrorT SetWatchdogInfo( SaHpiWatchdogT &watchdog); 00088 SaErrorT ResetWatchdog(); 00089 }; 00090 00091 00092 #endif