/*****************************************************************
******************************************************************
***                                                            ***
***        (C)Copyright 2008, American Megatrends Inc.         ***
***                                                            ***
***                    All Rights Reserved                     ***
***                                                            ***
***       5555 Oakbrook Parkway, Norcross, GA 30093, USA       ***
***                                                            ***
***                     Phone 770.246.8600                     ***
***                                                            ***
******************************************************************
******************************************************************
******************************************************************
* 
* Filename: sensor_helpers.h
*
* Description: Prototypes for sensor helper functions 
*
* Author: Andrew McCallum
*
******************************************************************/
#ifndef SENSOR_HELPERS_H_
#define SENSOR_HELPERS_H_

#include "libipmi_sensor.h"
#include "com_IPMI_SDRRecord.h"

int ipmi_convert_reading( uint8_t *sdr_buffer, uint8_t raw_reading, float *converted_reading );
int read_sensor_sdrs( IPMI20_UDS_SESSION_T *pUDSSession, struct sensor_info **sensor_list,
					  int timeout );
int get_sdr_sensor_state( uint8_t sensor_reading, uint8_t *sdr_buffer, uint16_t *current_state );
int GetSensorState(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t sensor_reading, uint8_t *sdr_buffer, uint16_t *current_state, int timeout  );
int ipmi_conv_reading(uint8_t SDRType, uint8_t raw_reading, float *converted_reading ,uint8_t Min,uint8_t Max,uint8_t Units1,uint8_t Lin,uint8_t Mval,uint8_t Bval,uint8_t M_Tol,uint8_t B_Acc,uint8_t R_B_Ex);
int SensorState( uint8_t sensor_reading, uint16_t *current_state,uint8_t SDRType,uint8_t Lin,uint8_t Units1,uint8_t EvtType,uint8_t AssertEvt1,uint8_t AssertEvt2,uint8_t DeassertEvt1,uint8_t DeassertEvt2);
unsigned char sdr_convert_sensor_value_to_raw(FullSensorRec_T	*sdr_record, double val);
#endif
