7.10. Sensor functions

In this section I will demonstrate how to implement a sensor function in an openhpi plug-in.

7.10.1. The get_sensor_data function

       static int my_get_sensor_data(
                                        void                    *hnd,
                                        SaHpiResourceIdT        id,
                                        SaHpiSensorNumT         num,
                                        SaHpiSensorReadingT     *data)
    


This function retrieves sensor data such as reading and thresholds. A sensor in HPI context is an RDR record associated with a resource or RPT. An example would be a temperature sensor on a CPU where the CPU is the RPT with the sensor as the RDR associated with it.

This function is an ABI function implemented in a plug-in and gets called from the infrastructure library via a pointer to the function when the HPI saHpiSensorReadingGet() is called.

The first parameter is the the plug-in which reported this sensor originally. The second is the resource id of the the sensor's parent or the resource the sensor is attached/belongs to. The third is the sensor number the caller is requesting the data for. And the fourth is the structure returned with the data.

Depending on the hardware management protocol your plug-in is using, you would write internal routines here to retrieve sensor data from the hardware and return them using the HPI SaHpiSensorReadingT data type.