#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) |
Detailed Description
Legato Temperature Monitoring include file.
Copyright (C) Sierra Wireless Inc.
Macro Definition Documentation
#define LE_TEMP_SENSOR_NAME_MAX_BYTES 101 |
Maximum sensor's name string length. One extra byte is added for the null character.
#define LE_TEMP_SENSOR_NAME_MAX_LEN 100 |
Maximum sensor's name string length.
#define LE_TEMP_THRESHOLD_NAME_MAX_BYTES 101 |
Maximum threshold's name string length. One extra byte is added for the null character.
#define LE_TEMP_THRESHOLD_NAME_MAX_LEN 100 |
Maximum threshold's name string length.
Typedef Documentation
typedef void(* le_temp_DisconnectHandler_t) (void *) |
Type for handler called when a server disconnects.
typedef struct le_temp_Sensor* le_temp_SensorRef_t |
Reference type for a temperature sensor.
typedef void(* le_temp_ThresholdEventHandlerFunc_t) (le_temp_SensorRef_t sensor,const char *LE_NONNULL threshold,void *contextPtr) |
Handler for Temperature event.
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_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
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.
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_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] sensor Temperature sensor reference. [out] sensorName Name of the temperature sensor. [in] sensorNameSize
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] sensor Temperature sensor reference. [out] temperaturePtr Temperature in degree Celsius.
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] sensor Temperature sensor reference. [in] threshold Name of the threshold. [out] temperaturePtr Temperature threshold in degree Celsius.
void le_temp_RemoveThresholdEventHandler | ( | le_temp_ThresholdEventHandlerRef_t | handlerRef | ) |
Remove handler function for EVENT 'le_temp_ThresholdEvent'
- Parameters
-
[in] handlerRef
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] sensorName Name of the temperature sensor.
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_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] sensor Temperature sensor reference. [in] threshold Name of the threshold. [in] temperature Temperature threshold in degree Celsius.
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_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.