le_ips_interface.h File Reference

#include "legato.h"
#include "le_ips_common.h"

Go to the source code of this file.

Typedefs

typedef void(* le_ips_DisconnectHandler_t) (void *)
 

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

Legato Input Power Supply Monitoring API include file.

Typedef Documentation

◆ le_ips_DisconnectHandler_t

typedef void(* le_ips_DisconnectHandler_t) (void *)

Type for handler called when a server disconnects.

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.