00001 00025 #ifndef __NEW_SIM_DOMAIN_H__ 00026 #define __NEW_SIM_DOMAIN_H__ 00027 00028 00029 #include <stdlib.h> 00030 #include <string.h> 00031 00032 00033 extern "C" { 00034 #include "SaHpi.h" 00035 } 00036 00037 #include <openhpi.h> 00038 #include <oh_utils.h> 00039 00040 #ifndef __NEW_SIM_FILE_H__ 00041 #include "new_sim_file.h" 00042 #endif 00043 00044 #ifndef __NEW_SIM_RESOURCE_H__ 00045 #include "new_sim_resource.h" 00046 #endif 00047 00048 #ifndef __NEW_SIM_EVENT_LOG_H__ 00049 #include "new_sim_event_log.h" 00050 #endif 00051 00052 #ifndef __NEW_SIM_SENSOR_H__ 00053 #include "new_sim_sensor.h" 00054 #endif 00055 00056 #ifndef __NEW_SIM_SENSOR_THRESHOLD_H__ 00057 #include "new_sim_sensor_threshold.h" 00058 #endif 00059 00060 #ifndef __NEW_SIM_CONTROL_H__ 00061 #include "new_sim_control.h" 00062 #endif 00063 00064 #ifndef __NEW_SIM_ANNUNCIATOR_H__ 00065 #include "new_sim_annunciator.h" 00066 #endif 00067 00068 #ifndef __NEW_SIM_ANNOUNCEMENT_H__ 00069 #include "new_sim_announcement.h" 00070 #endif 00071 00072 #ifndef __NEW_SIM_INVENTORY_H__ 00073 #include "new_sim_inventory.h" 00074 #endif 00075 00076 #ifndef __NEW_SIM_WATCHDOG_H__ 00077 #include "new_sim_watchdog.h" 00078 #endif 00079 00080 #ifndef __NEW_SIM_FUMI_H__ 00081 #include "new_sim_fumi.h" 00082 #endif 00083 00084 #ifndef __NEW_SIM_DIMI_H__ 00085 #include "new_sim_dimi.h" 00086 #endif 00087 00096 class NewSimulatorDomain : public NewSimulatorEventLog { 00097 00098 protected: 00100 NewSimulatorFile *m_file; 00102 SaHpiDomainIdT m_did; 00104 NewSimulatorTextBuffer m_domain_tag; 00106 SaHpiTimeoutT m_insert_timeout; 00108 SaHpiTimeoutT m_extract_timeout; 00110 bool m_own_domain; 00112 int m_handler_id; 00114 bool m_running_wdt; 00116 bool m_running_fumi; 00117 00118 public: 00120 SaHpiDomainIdT DomainId() { return m_did; } 00122 SaHpiTimeoutT &InsertTimeout() { return m_insert_timeout; } 00124 SaHpiTimeoutT &ExtractTimeout() { return m_extract_timeout; } 00126 int HandlerId() { return m_handler_id; } 00128 bool HasRunningWdt() { return m_running_wdt; } 00130 bool HasRunningFumi() { return m_running_fumi; } 00132 void SetRunningWdt( bool flag ) { m_running_wdt = flag; } 00134 void SetRunningFumi( bool flag ) { m_running_fumi = flag; } 00135 00136 protected: 00138 unsigned int m_major_version; 00140 unsigned int m_minor_version; 00141 00142 protected: 00144 // mcs, entities, sensors, frus, sels 00145 cThreadLockRw m_lock; 00147 cArray<NewSimulatorResource> m_resources; 00148 00149 public: 00151 void ReadLock() { m_lock.ReadLock(); } 00153 void ReadUnlock() { m_lock.ReadUnlock(); } 00155 void WriteLock() { m_lock.WriteLock(); } 00157 void WriteUnlock() { m_lock.WriteUnlock(); } 00159 bool CheckLock() { return m_lock.CheckLock(); } 00160 00162 cThreadLock m_initial_discover_lock; 00163 00165 int m_initial_discover; 00166 00167 00168 public: 00170 int Num() { return m_resources.Num(); } 00171 void AddResource( NewSimulatorResource *res ); 00172 bool CleanupResource( NewSimulatorResource *res ); 00173 void RemResource( NewSimulatorResource *res ); 00174 NewSimulatorResource *GetResource( int i ); 00175 NewSimulatorResource *FindResource( NewSimulatorResource *res ); 00176 NewSimulatorResource *FindResource( const NewSimulatorEntityPath &ep ); 00177 00178 public: 00179 NewSimulatorDomain(); 00180 virtual ~NewSimulatorDomain(); 00181 00182 bool Init( NewSimulatorFile *file ); 00183 void Cleanup(); 00184 00185 NewSimulatorResource *VerifyResource( NewSimulatorResource *res ); 00186 NewSimulatorRdr *VerifyRdr( NewSimulatorRdr *rdr ); 00187 NewSimulatorSensor *VerifySensor( NewSimulatorSensor *s ); 00188 NewSimulatorControl *VerifyControl( NewSimulatorControl *c ); 00189 NewSimulatorAnnunciator *VerifyAnnunciator( NewSimulatorAnnunciator *a ); 00190 NewSimulatorWatchdog *VerifyWatchdog( NewSimulatorWatchdog *c ); 00191 NewSimulatorFumi *VerifyFumi( NewSimulatorFumi *f ); 00192 NewSimulatorDimi *VerifyDimi( NewSimulatorDimi *d ); 00193 NewSimulatorInventory *VerifyInventory( NewSimulatorInventory *i ); 00194 00196 virtual void AddHpiEvent( oh_event *event ) = 0; 00198 virtual oh_evt_queue *GetHpiEventList() = 0; 00199 00201 virtual const NewSimulatorEntityPath &EntityRoot() = 0; 00203 virtual oh_handler_state *GetHandler() = 0; 00205 virtual SaHpiRptEntryT *FindResource( SaHpiResourceIdT id ) = 0; 00206 00207 void Dump( NewSimulatorLog &dump ) const; 00208 }; 00209 00210 00211 #endif