le_temp_interface.h File Reference

#include "legato.h"

Go to the source code of this file.

Macros

#define LE_TEMP_SENSOR_NAME_MAX_LEN   100
 
#define LE_TEMP_SENSOR_NAME_MAX_BYTES   101
 
#define LE_TEMP_THRESHOLD_NAME_MAX_LEN   100
 
#define LE_TEMP_THRESHOLD_NAME_MAX_BYTES   101
 

Typedefs

typedef void(* le_temp_DisconnectHandler_t) (void *)
 
typedef struct le_temp_Sensor * le_temp_SensorRef_t
 
typedef struct le_temp_ThresholdEventHandler * le_temp_ThresholdEventHandlerRef_t
 
typedef void(* le_temp_ThresholdEventHandlerFunc_t) (le_temp_SensorRef_t sensor, const char *LE_NONNULL threshold, void *contextPtr)
 

Functions

void le_temp_ConnectService (void)
 
le_result_t le_temp_TryConnectService (void)
 
void le_temp_SetServerDisconnectHandler (le_temp_DisconnectHandler_t disconnectHandler, void *contextPtr)
 
void le_temp_DisconnectService (void)
 
le_temp_SensorRef_t le_temp_Request (const char *LE_NONNULL sensorName)
 
le_result_t le_temp_GetSensorName (le_temp_SensorRef_t sensor, char *sensorName, size_t sensorNameSize)
 
le_temp_ThresholdEventHandlerRef_t le_temp_AddThresholdEventHandler (le_temp_ThresholdEventHandlerFunc_t ThresholdEventHandlerPtr, void *contextPtr)
 
void le_temp_RemoveThresholdEventHandler (le_temp_ThresholdEventHandlerRef_t handlerRef)
 
le_result_t le_temp_GetTemperature (le_temp_SensorRef_t sensor, int32_t *temperaturePtr)
 
le_result_t le_temp_SetThreshold (le_temp_SensorRef_t sensor, const char *LE_NONNULL threshold, int32_t temperature)
 
le_result_t le_temp_GetThreshold (le_temp_SensorRef_t sensor, const char *LE_NONNULL threshold, int32_t *temperaturePtr)
 
le_result_t le_temp_StartMonitoring (void)
 

Detailed Description

Legato Temperature Monitoring include file.

Macro Definition Documentation

◆ LE_TEMP_SENSOR_NAME_MAX_BYTES

#define LE_TEMP_SENSOR_NAME_MAX_BYTES   101

Maximum sensor's name string length. One extra byte is added for the null character.

◆ LE_TEMP_SENSOR_NAME_MAX_LEN

#define LE_TEMP_SENSOR_NAME_MAX_LEN   100

Maximum sensor's name string length.

◆ LE_TEMP_THRESHOLD_NAME_MAX_BYTES

#define LE_TEMP_THRESHOLD_NAME_MAX_BYTES   101

Maximum threshold's name string length. One extra byte is added for the null character.

◆ LE_TEMP_THRESHOLD_NAME_MAX_LEN

#define LE_TEMP_THRESHOLD_NAME_MAX_LEN   100

Maximum threshold's name string length.

Typedef Documentation

◆ le_temp_DisconnectHandler_t

typedef void(* le_temp_DisconnectHandler_t) (void *)

Type for handler called when a server disconnects.

◆ le_temp_SensorRef_t

typedef struct le_temp_Sensor* le_temp_SensorRef_t

Reference type for a temperature sensor.

◆ le_temp_ThresholdEventHandlerFunc_t

typedef void(* le_temp_ThresholdEventHandlerFunc_t) (le_temp_SensorRef_t sensor, const char *LE_NONNULL threshold, void *contextPtr)

Handler for Temperature event.

◆ le_temp_ThresholdEventHandlerRef_t

typedef struct le_temp_ThresholdEventHandler* le_temp_ThresholdEventHandlerRef_t

Reference type used by Add/Remove functions for EVENT 'le_temp_ThresholdEvent'

Function Documentation

◆ le_temp_AddThresholdEventHandler()

le_temp_ThresholdEventHandlerRef_t le_temp_AddThresholdEventHandler ( le_temp_ThresholdEventHandlerFunc_t  ThresholdEventHandlerPtr,
void *  contextPtr 
)

Add handler function for EVENT 'le_temp_ThresholdEvent'

This event provides information on the threshold reached.

Parameters
[in]ThresholdEventHandlerPtr
[in]contextPtr

◆ le_temp_ConnectService()

void le_temp_ConnectService ( void  )

Connect the current client thread to the service providing this API. Block until the service is available.

For each thread that wants to use this API, either ConnectService or TryConnectService must be called before any other functions in this API. Normally, ConnectService is automatically called for the main thread, but not for any other thread. For details, see Client-specific Functions.

This function is created automatically.

◆ le_temp_DisconnectService()

void le_temp_DisconnectService ( void  )

Disconnect the current client thread from the service providing this API.

Normally, this function doesn't need to be called. After this function is called, there's no longer a connection to the service, and the functions in this API can't be used. For details, see Client-specific Functions.

This function is created automatically.

◆ le_temp_GetSensorName()

le_result_t le_temp_GetSensorName ( le_temp_SensorRef_t  sensor,
char *  sensorName,
size_t  sensorNameSize 
)

Retrieve the temperature sensor's name from its reference.

Returns
  • LE_OK The function succeeded.
  • LE_OVERFLOW The name length exceed the maximum length.
  • LE_FAULT The function failed.
Parameters
[in]sensorTemperature sensor reference.
[out]sensorNameName of the temperature sensor.
[in]sensorNameSize

◆ le_temp_GetTemperature()

le_result_t le_temp_GetTemperature ( le_temp_SensorRef_t  sensor,
int32_t *  temperaturePtr 
)

Get the temperature in degree Celsius.

Returns
  • LE_OK The function succeeded.
  • LE_FAULT The function failed to get the temperature.
Parameters
[in]sensorTemperature sensor reference.
[out]temperaturePtrTemperature in degree Celsius.

◆ le_temp_GetThreshold()

le_result_t le_temp_GetThreshold ( le_temp_SensorRef_t  sensor,
const char *LE_NONNULL  threshold,
int32_t *  temperaturePtr 
)

Get the temperature threshold in degree Celsius.

Returns
  • LE_OK The function succeeded.
  • LE_FAULT The function failed.
Parameters
[in]sensorTemperature sensor reference.
[in]thresholdName of the threshold.
[out]temperaturePtrTemperature threshold in degree Celsius.

◆ le_temp_RemoveThresholdEventHandler()

void le_temp_RemoveThresholdEventHandler ( le_temp_ThresholdEventHandlerRef_t  handlerRef)

Remove handler function for EVENT 'le_temp_ThresholdEvent'

Parameters
[in]handlerRef

◆ le_temp_Request()

le_temp_SensorRef_t le_temp_Request ( const char *LE_NONNULL  sensorName)

Request a temperature sensor reference.

Returns
  • Reference to the temperature sensor.
  • NULL when the requested sensor is not supported.
Parameters
[in]sensorNameName of the temperature sensor.

◆ le_temp_SetServerDisconnectHandler()

void le_temp_SetServerDisconnectHandler ( le_temp_DisconnectHandler_t  disconnectHandler,
void *  contextPtr 
)

Set handler called when server disconnection is detected.

When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants to continue without exiting, it should call longjmp() from inside the handler.

◆ le_temp_SetThreshold()

le_result_t le_temp_SetThreshold ( le_temp_SensorRef_t  sensor,
const char *LE_NONNULL  threshold,
int32_t  temperature 
)

Set the temperature threshold in degree Celsius. This function does not start the temperature monitoring, call le_temp_StartMonitoring() to start it.

Returns
  • LE_OK The function succeeded.
  • LE_FAULT The function failed.
Parameters
[in]sensorTemperature sensor reference.
[in]thresholdName of the threshold.
[in]temperatureTemperature threshold in degree Celsius.

◆ le_temp_StartMonitoring()

le_result_t le_temp_StartMonitoring ( void  )

Start the temperature monitoring with the temperature thresholds configured by le_temp_SetThreshold() function.

Returns
  • LE_OK The function succeeded.
  • LE_BAD_PARAMETER There is a mismatch with the configured threshold values.
  • LE_FAULT The function failed to apply the thresholds.

◆ le_temp_TryConnectService()

le_result_t le_temp_TryConnectService ( void  )

Try to connect the current client thread to the service providing this API. Return with an error if the service is not available.

For each thread that wants to use this API, either ConnectService or TryConnectService must be called before any other functions in this API. Normally, ConnectService is automatically called for the main thread, but not for any other thread. For details, see Client-specific Functions.

This function is created automatically.

Returns
  • LE_OK if the client connected successfully to the service.
  • LE_UNAVAILABLE if the server is not currently offering the service to which the client is bound.
  • LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
  • LE_COMM_ERROR if the Service Directory cannot be reached.