le_ips_interface.h File Reference

#include "legato.h"

Go to the source code of this file.

Typedefs

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

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)
 
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)
 

Detailed Description

Legato Input Power Supply Monitoring API include file.

Typedef Documentation

typedef void(* le_ips_DisconnectHandler_t) (void *)

Type for handler called when a server disconnects.

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

Handler for Platform input voltage event.

typedef struct le_ips_ThresholdEventHandler* le_ips_ThresholdEventHandlerRef_t

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

Enumeration Type Documentation

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.

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_ThresholdEventHandlerRef_t le_ips_AddThresholdEventHandler ( le_ips_ThresholdEventHandlerFunc_t  handlerPtr,
void *  contextPtr 
)

Add handler function for EVENT 'le_ips_ThresholdEvent'

This event provides information on Threshold reached.

Parameters
[in]handlerPtr
[in]contextPtr
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.

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_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.
Parameters
[out]batteryLevelPtr[OUT] The battery level in percent.
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.
Parameters
[out]inputVoltagePtr[OUT] The input voltage in [mV]
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.
Parameters
[out]powerSourcePtr[OUT] The power source.
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.
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].
void le_ips_RemoveThresholdEventHandler ( le_ips_ThresholdEventHandlerRef_t  handlerRef)

Remove handler function for EVENT 'le_ips_ThresholdEvent'

Parameters
[in]handlerRef
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_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_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.