le_ips API Reference

Files

file  le_ips_common.h
 
file  le_ips_interface.h
 

Typedefs

typedef struct le_ips_ThresholdEventHandler * le_ips_ThresholdEventHandlerRef_t
 
typedef void(* le_ips_ThresholdEventHandlerFunc_t) (le_ips_ThresholdStatus_t event, void *contextPtr)
 
typedef void(* le_ips_DisconnectHandler_t) (void *)
 

Enumerations

enum  le_ips_ThresholdStatus_t { LE_IPS_VOLTAGE_HI_CRITICAL = 0, LE_IPS_VOLTAGE_NORMAL = 1, LE_IPS_VOLTAGE_WARNING = 2, LE_IPS_VOLTAGE_CRITICAL = 3 }
 
enum  le_ips_PowerSource_t { LE_IPS_POWER_SOURCE_EXTERNAL = 0, LE_IPS_POWER_SOURCE_BATTERY = 1 }
 

Functions

void le_ips_ConnectService (void)
 
le_result_t le_ips_TryConnectService (void)
 
LE_FULL_API void le_ips_SetServerDisconnectHandler (le_ips_DisconnectHandler_t disconnectHandler, void *contextPtr)
 
void le_ips_DisconnectService (void)
 
le_ips_ThresholdEventHandlerRef_t le_ips_AddThresholdEventHandler (le_ips_ThresholdEventHandlerFunc_t handlerPtr, void *contextPtr)
 
void le_ips_RemoveThresholdEventHandler (le_ips_ThresholdEventHandlerRef_t handlerRef)
 
le_result_t le_ips_GetInputVoltage (uint32_t *inputVoltagePtr)
 
le_result_t le_ips_SetVoltageThresholds (uint16_t criticalVolt, uint16_t warningVolt, uint16_t normalVolt, uint16_t hiCriticalVolt)
 
le_result_t le_ips_GetVoltageThresholds (uint16_t *criticalVoltPtr, uint16_t *warningVoltPtr, uint16_t *normalVoltPtr, uint16_t *hiCriticalVoltPtr)
 
le_result_t le_ips_GetPowerSource (le_ips_PowerSource_t *powerSourcePtr)
 
le_result_t le_ips_GetBatteryLevel (uint8_t *batteryLevelPtr)
 
le_result_t le_ips_SetBatteryLevel (uint8_t batteryLevel)
 

Detailed Description

Typedef Documentation

◆ le_ips_DisconnectHandler_t

typedef void(* le_ips_DisconnectHandler_t) (void *)

Type for handler called when a server disconnects.

◆ le_ips_ThresholdEventHandlerFunc_t

typedef void(* le_ips_ThresholdEventHandlerFunc_t) (le_ips_ThresholdStatus_t event, void *contextPtr)

Handler for Platform input voltage event.

◆ le_ips_ThresholdEventHandlerRef_t

typedef struct le_ips_ThresholdEventHandler* le_ips_ThresholdEventHandlerRef_t

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

Enumeration Type Documentation

◆ le_ips_PowerSource_t

Platform power source type.

Enumerator
LE_IPS_POWER_SOURCE_EXTERNAL 

Platform is powered by an external source.

LE_IPS_POWER_SOURCE_BATTERY 

Platform is powered by a battery.

◆ le_ips_ThresholdStatus_t

Platform input voltage event type.

Enumerator
LE_IPS_VOLTAGE_HI_CRITICAL 

High Critical input voltage threshold is reached.

LE_IPS_VOLTAGE_NORMAL 

Normal input voltage threshold is reached.

LE_IPS_VOLTAGE_WARNING 

Warning input voltage threshold is reached.

LE_IPS_VOLTAGE_CRITICAL 

Critical input voltage threshold is reached.

Function Documentation

◆ le_ips_AddThresholdEventHandler()

le_ips_ThresholdEventHandlerRef_t le_ips_AddThresholdEventHandler ( le_ips_ThresholdEventHandlerFunc_t  handlerPtr,
void *  contextPtr 
)

Platform input voltage event type. Platform power source type. Handler for Platform input voltage event. Reference type used by Add/Remove functions for EVENT 'le_ips_ThresholdEvent' Add handler function for EVENT 'le_ips_ThresholdEvent'

This event provides information on Threshold reached.

Parameters
[in]handlerPtr
[in]contextPtr

◆ le_ips_ConnectService()

void le_ips_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_ips_DisconnectService()

void le_ips_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_ips_GetBatteryLevel()

le_result_t le_ips_GetBatteryLevel ( uint8_t *  batteryLevelPtr)

Get the Platform battery level in percent:

  • 0: battery is exhausted or platform does not have a battery connected
  • 1 to 100: percentage of battery capacity remaining
Returns
  • LE_OK The function succeeded.
  • LE_FAULT The function failed to get the value.
Note
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters
[out]batteryLevelPtr[OUT] The battery level in percent.

◆ le_ips_GetInputVoltage()

le_result_t le_ips_GetInputVoltage ( uint32_t *  inputVoltagePtr)

Get the Platform input voltage in [mV].

Returns
  • LE_OK The function succeeded.
  • LE_FAULT The function failed to get the value.
Note
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters
[out]inputVoltagePtr[OUT] The input voltage in [mV]

◆ le_ips_GetPowerSource()

le_result_t le_ips_GetPowerSource ( le_ips_PowerSource_t powerSourcePtr)

Get the Platform power source.

Returns
  • LE_OK The function succeeded.
  • LE_FAULT The function failed to get the value.
Note
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters
[out]powerSourcePtr[OUT] The power source.

◆ le_ips_GetVoltageThresholds()

le_result_t le_ips_GetVoltageThresholds ( uint16_t *  criticalVoltPtr,
uint16_t *  warningVoltPtr,
uint16_t *  normalVoltPtr,
uint16_t *  hiCriticalVoltPtr 
)

Get the Platform warning and critical input voltage thresholds in [mV].

Returns
  • LE_OK The function succeeded.
  • LE_FAULT The function failed to get the thresholds.
Note
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters
[out]criticalVoltPtr[OUT] The critical input voltage threshold in [mV].
[out]warningVoltPtr[OUT] The warning input voltage threshold in [mV].
[out]normalVoltPtr[OUT] The normal input voltage threshold in [mV].
[out]hiCriticalVoltPtr[IN] The high critical input voltage threshold in [mV].

◆ le_ips_RemoveThresholdEventHandler()

void le_ips_RemoveThresholdEventHandler ( le_ips_ThresholdEventHandlerRef_t  handlerRef)

Remove handler function for EVENT 'le_ips_ThresholdEvent'

Parameters
[in]handlerRef

◆ le_ips_SetBatteryLevel()

le_result_t le_ips_SetBatteryLevel ( uint8_t  batteryLevel)

Set the Platform battery level in percent. This is useful when an external battery is used and its level is provided by the application monitoring it.

Note
The battery level set through this API will be the value reported by le_ips_GetBatteryLevel() until Legato is restarted.
Returns
  • LE_OK The function succeeded.
  • LE_BAD_PARAMETER Incorrect battery level provided.
Parameters
[in]batteryLevel[IN] The battery level in percent.

◆ le_ips_SetServerDisconnectHandler()

LE_FULL_API void le_ips_SetServerDisconnectHandler ( le_ips_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_ips_SetVoltageThresholds()

le_result_t le_ips_SetVoltageThresholds ( uint16_t  criticalVolt,
uint16_t  warningVolt,
uint16_t  normalVolt,
uint16_t  hiCriticalVolt 
)

Set the Platform warning and critical input voltage thresholds in [mV]. When thresholds input voltage are reached, a input voltage event is triggered.

Returns
  • LE_OK The function succeeded.
  • LE_BAD_PARAMETER The hiCriticalVolt threshold is equal or lower than the (normalVolt+1) threshold. The warningVolt threshold is equal to or higher than the normalVolt threshold. The warningVolt threshold is equal to or lower than the criticalVolt threshold.
  • LE_FAULT The function failed to set the thresholds.
Parameters
[in]criticalVolt[IN] The critical input voltage threshold in [mV].
[in]warningVolt[IN] The warning input voltage threshold in [mV].
[in]normalVolt[IN] The normal input voltage threshold in [mV].
[in]hiCriticalVolt[IN] The high critical input voltage threshold in [mV].

◆ le_ips_TryConnectService()

le_result_t le_ips_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.