/* ***************************-*- andrew-c -*-****************************** */
/* Filename:    libsensor.h                                                  */
/* Author:      Andrew McCallum (andrewm@ami.com)                            */
/* Format:      Indent: 4 spaces, no tabs                                    */
/* Created:     09/21/2004                                                   */
/* Modified:    09/21/2004                                                   */
/* Description: Prototypes and defines for sensor helper functions           */
/* ************************************************************************* */

#ifndef LIBSENSOR_H_
#define LIBSENSOR_H_

#include "libipmi_session.h"

/* IPMI threshold state definitions for monitoring */
#define THRESH_UNINITIALIZED        ( (u16)0x00 )
#define THRESH_NORMAL               ( (u16)0x01 )
#define THRESH_UP_NONCRIT           ( (u16)0x02 )
#define THRESH_UP_CRITICAL          ( (u16)0x04 )
#define THRESH_LOW_NONCRIT          ( (u16)0x08 )
#define THRESH_LOW_CRITICAL         ( (u16)0x10 )
#define THRESH_ACCESS_FAILED        ( (u16)0x20 )
#define THRESH_UP_NON_RECOV         ( (u16)0x40 )
#define THRESH_LOW_NON_RECOV        ( (u16)0x80 )

//#pragma pack(1)
struct sensor_data
{
	/*
		sensor_name array length increased from 17 to 20.
		In some cases sensor_name length is more than 17 characters. webgo was giving some special character to web page in those cases and webpage was giving some weird behaviour when it found that special character.
	*/
    uint8_t sensor_num;
    char sensor_name[ 20 ];
    uint8_t owner_id;
    uint8_t owner_lun;
    uint8_t sensor_type;
    uint8_t sensor_units[ 3 ];
    float sensor_reading;
    uint8_t raw_reading;
    uint16_t sensor_state;
    uint8_t discrete_state;
    float low_non_recov_thresh;
    float low_crit_thresh;
    float low_non_crit_thresh;
    float high_non_crit_thresh;
    float high_crit_thresh;
    float high_non_recov_thresh;
    int SensorAccessibleFlags;
    uint16_t Settable_Readable_ThreshMask;    
};

int getsensorcount( IPMI20_SESSION_T *pSession );
int getallsensorreadings( struct sensor_data *sensors, IPMI20_SESSION_T *pSession );


#endif
