00001 00025 #ifndef __NEW_SIM_RESOURCE_H__ 00026 #define __NEW_SIM_RESOURCE_H__ 00027 00028 #ifndef __NEW_SIM_CONTROL_H__ 00029 #include "new_sim_control.h" 00030 #endif 00031 00032 #ifndef __NEW_SIM_HOTSWAP_H__ 00033 #include "new_sim_hotswap.h" 00034 #endif 00035 00036 #ifndef __ARRAY_H__ 00037 #include "array.h" 00038 #endif 00039 00040 00047 class NewSimulatorResource : cArray<NewSimulatorRdr> { 00048 00049 public: 00050 // find a specific rdr 00051 NewSimulatorRdr *FindRdr( SaHpiRdrTypeT type, unsigned int num ); 00052 bool AddRdr( NewSimulatorRdr *rdr ); 00053 bool RemRdr( NewSimulatorRdr *rdr ); 00054 00056 int FindRdr( NewSimulatorRdr *rdr ) { return Find( rdr ); } 00058 int NumRdr() { return Num(); } 00060 NewSimulatorRdr *GetRdr( int idx ) { return operator[]( idx ); } 00061 00062 00063 protected: 00065 NewSimulatorDomain *m_domain; 00067 NewSimulatorHotSwap m_hotswap; 00069 NewSimulatorEntityPath m_entity_path; 00071 bool m_is_fru; 00072 00073 00075 unsigned int m_oem; 00076 00078 int m_sensor_num[256]; 00079 00081 SaHpiRptEntryT m_rpt_entry; 00083 NewSimulatorTextBuffer m_resource_tag; 00085 unsigned int m_current_control_id; 00087 SaHpiPowerStateT m_power_state; 00089 SaHpiHsIndicatorStateT m_hotswap_indicator; 00091 SaHpiResetActionT m_reset_state; 00092 00093 public: 00094 int CreateSensorNum( SaHpiSensorNumT num ); 00096 unsigned int GetControlNum() { return ++m_current_control_id; } 00097 00098 public: 00099 00100 NewSimulatorDomain *Domain() const; 00102 unsigned int &Oem() { return m_oem; } 00104 NewSimulatorEntityPath &EntityPath() { return m_entity_path; } 00106 bool &IsFru() { return m_is_fru; } 00108 NewSimulatorTextBuffer &ResourceTag() { return m_resource_tag; } 00110 SaHpiHsStateT HotSwapState() { return m_hotswap.GetState(); } 00112 SaHpiPowerStateT &PowerState() { return m_power_state; } 00114 SaHpiHsIndicatorStateT &HSIndicator() { return m_hotswap_indicator; } 00116 SaHpiResetActionT &ResetState() { return m_reset_state; } 00118 SaHpiEntryIdT &EntryId() { return m_rpt_entry.EntryId; } 00120 SaHpiCapabilitiesT &ResourceCapabilities() { return m_rpt_entry.ResourceCapabilities; } 00122 SaHpiHsCapabilitiesT &HotSwapCapabilities() { return m_rpt_entry.HotSwapCapabilities; } 00124 SaHpiResourceIdT ResourceId() { return m_rpt_entry.ResourceId; } 00126 SaHpiSeverityT &ResourceSeverity() { return m_rpt_entry.ResourceSeverity; } 00128 SaHpiBoolT &ResourceFailed() { return m_rpt_entry.ResourceFailed; } 00129 00130 public: 00131 NewSimulatorResource( NewSimulatorDomain *domain ); 00132 virtual ~NewSimulatorResource(); 00133 00134 public: 00135 virtual bool Destroy(); 00136 void Dump( NewSimulatorLog &dump ) const; 00137 00139 SaErrorT SetAutoExtractTimeout( SaHpiTimeoutT timeout ) 00140 { return m_hotswap.SetExtractTimeout( timeout ); } 00141 00143 SaErrorT GetAutoExtractTimeout( SaHpiTimeoutT &timeout ) 00144 { return m_hotswap.SetExtractTimeout( timeout ); } 00145 00147 SaErrorT RequestHotswapAction( SaHpiHsActionT action ) 00148 { return m_hotswap.ActionRequest( action ); } 00149 00151 SaErrorT GetHotswapState( SaHpiHsStateT &state ) 00152 { return m_hotswap.GetState( state ); } 00153 00155 SaErrorT SetStateActive() { return m_hotswap.SetActive(); } 00156 00158 SaErrorT SetStateInactive() { return m_hotswap.SetInactive(); } 00159 00161 SaErrorT HotswapPolicyCancel() { return m_hotswap.CancelPolicy(); } 00162 00163 void SetResourceInfo( SaHpiResourceInfoT resinfo ); 00164 00165 private: 00167 bool m_populate; 00168 00169 public: 00170 // create and populate hpi resource 00171 virtual bool Create( SaHpiRptEntryT &entry ); 00172 virtual bool Populate(); 00173 }; 00174 00175 00176 #endif