CHAPTER 8. SENSORS
Sensor/Entity Existance Interaction
Some sensors are present even if the entity they are attached to is not present. The following will return true if the entity should be ignore if the entity is not present. It will return false if the sensor is present even when the entity is not present.
i n t i p m i _ s e n s o r _ g e t _ i g n o r e _ i f _ n o _ e n t i t y ( i p m i _ s e n s o r _ t * s e n s o r ) ;
When reading the value of a sensor or handling an even, a state data structure is generally available in a read-only data structure. This tells the state of the various thresholds or bits in the sensor. This is an opaque data structure, you do not have access to any of the contents. The data structure is defined as:
typedef struct ipmi_states_s ipmi_states_t;
To keep your own copy of a states data structure, you may allocate and copy one using the following functions:
unsigned int ipmi_states_size(void); void ipmi_copy_states(ipmi_states_t *dest, ipmi_states_t *src);
This allows you to find the size and copy the information in one of these structures. For example, to make your own copy, do something like:
m y _ s t a t e s = m a l l o c ( i p m i _ s t a t e s _ s i z e ( ) ) if (!my_states) ;
Information about the whole sensor is available using the following functions:
int ipmi_is_event_messages_enabled(ipmi_states_t *states); int ipmi_is_sensor_scanning_enabled(ipmi_states_t *states); int ipmi_is_initial_update_in_progress(ipmi_states_t *states);
If event messages are enabled, then the sensor may generate events. If scanning is enabled, then the sensor is “turned on” and working. If initial update is in progress, the information from the sensor is not valid since the sensor is still trying to get a valid reading.
Sensor Event State Information
The event state structure is an opaque structure that is used to control the event settings of a sensor, if it supports at least individual sensor event control. This is much like the state data structure defined in section 8.6.1, but it is used to control event settings instead of just get the current state. The data structure is defined as:
t y p e d e f s t r u c t i p m i _ e v e n t _ s t a t e _ s i p m i _ e v e n t _ s t a t e _ t ;