le_avdata_interface.h File Reference

#include "legato.h"

Go to the source code of this file.

Macros

#define LE_AVDATA_ASSET_NAME_LEN   47
 
#define LE_AVDATA_FIELD_NAME_LEN   47
 
#define LE_AVDATA_STRING_VALUE_LEN   255
 
#define LE_AVDATA_BINARY_VALUE_LEN   255
 

Typedefs

typedef struct le_avdata_AssetInstance * le_avdata_AssetInstanceRef_t
 
typedef struct le_avdata_RequestSessionObj * le_avdata_RequestSessionObjRef_t
 
typedef struct le_avdata_FieldEventHandler * le_avdata_FieldEventHandlerRef_t
 
typedef struct le_avdata_SessionStateHandler * le_avdata_SessionStateHandlerRef_t
 
typedef void(* le_avdata_FieldHandlerFunc_t) (le_avdata_AssetInstanceRef_t instRef, const char *fieldName, void *contextPtr)
 
typedef void(* le_avdata_SessionStateHandlerFunc_t) (le_avdata_SessionState_t sessionState, void *contextPtr)
 

Enumerations

enum  le_avdata_SessionState_t { LE_AVDATA_SESSION_STARTED = 0, LE_AVDATA_SESSION_STOPPED = 1 }
 

Functions

void le_avdata_ConnectService (void)
 
le_result_t le_avdata_TryConnectService (void)
 
void le_avdata_DisconnectService (void)
 
le_avdata_FieldEventHandlerRef_t le_avdata_AddFieldEventHandler (le_avdata_AssetInstanceRef_t instRef, const char *fieldName, le_avdata_FieldHandlerFunc_t handlerPtr, void *contextPtr)
 
void le_avdata_RemoveFieldEventHandler (le_avdata_FieldEventHandlerRef_t addHandlerRef)
 
le_avdata_AssetInstanceRef_t le_avdata_Create (const char *assetName)
 
void le_avdata_Delete (le_avdata_AssetInstanceRef_t instRef)
 
void le_avdata_GetInt (le_avdata_AssetInstanceRef_t instRef, const char *fieldName, int32_t *valuePtr)
 
le_result_t le_avdata_SetInt (le_avdata_AssetInstanceRef_t instRef, const char *fieldName, int32_t value)
 
void le_avdata_GetFloat (le_avdata_AssetInstanceRef_t instRef, const char *fieldName, double *valuePtr)
 
le_result_t le_avdata_SetFloat (le_avdata_AssetInstanceRef_t instRef, const char *fieldName, double value)
 
void le_avdata_GetBool (le_avdata_AssetInstanceRef_t instRef, const char *fieldName, bool *valuePtr)
 
le_result_t le_avdata_SetBool (le_avdata_AssetInstanceRef_t instRef, const char *fieldName, bool value)
 
void le_avdata_GetString (le_avdata_AssetInstanceRef_t instRef, const char *fieldName, char *value, size_t valueNumElements)
 
le_result_t le_avdata_SetString (le_avdata_AssetInstanceRef_t instRef, const char *fieldName, const char *value)
 
void le_avdata_GetBinary (le_avdata_AssetInstanceRef_t instRef, const char *fieldName, uint8_t *valuePtr, size_t *valueNumElementsPtr)
 
void le_avdata_SetBinary (le_avdata_AssetInstanceRef_t instRef, const char *fieldName, const uint8_t *valuePtr, size_t valueNumElements)
 
le_result_t le_avdata_StartTimeSeries (le_avdata_AssetInstanceRef_t instRef, const char *fieldName, double factor, double timeStampFactor)
 
le_result_t le_avdata_StopTimeSeries (le_avdata_AssetInstanceRef_t instRef, const char *fieldName)
 
le_result_t le_avdata_PushTimeSeries (le_avdata_AssetInstanceRef_t instRef, const char *fieldName, bool isRestartTimeSeries)
 
le_avdata_SessionStateHandlerRef_t le_avdata_AddSessionStateHandler (le_avdata_SessionStateHandlerFunc_t handlerPtr, void *contextPtr)
 
void le_avdata_RemoveSessionStateHandler (le_avdata_SessionStateHandlerRef_t addHandlerRef)
 
le_result_t le_avdata_GetTimeSeriesStatus (le_avdata_AssetInstanceRef_t instRef, const char *fieldName, bool *isTimeSeriesPtr, int32_t *numDataPointPtr)
 
le_result_t le_avdata_RecordInt (le_avdata_AssetInstanceRef_t instRef, const char *fieldName, int32_t value, uint64_t timestamp)
 
le_result_t le_avdata_RecordFloat (le_avdata_AssetInstanceRef_t instRef, const char *fieldName, double value, uint64_t timestamp)
 
le_result_t le_avdata_RecordBool (le_avdata_AssetInstanceRef_t instRef, const char *fieldName, bool value, uint64_t timeStamp)
 
le_result_t le_avdata_RecordString (le_avdata_AssetInstanceRef_t instRef, const char *fieldName, const char *value, uint64_t timeStamp)
 
le_result_t le_avdata_IsObserve (le_avdata_AssetInstanceRef_t instRef, const char *fieldName, bool *isObservePtr)
 
le_avdata_RequestSessionObjRef_t le_avdata_RequestSession (void)
 
void le_avdata_ReleaseSession (le_avdata_RequestSessionObjRef_t requestRef)
 

Detailed Description

Legato AirVantage Data include file.

Macro Definition Documentation

#define LE_AVDATA_ASSET_NAME_LEN   47

Define the maximum length of an asset name (TODO: verify value)

#define LE_AVDATA_BINARY_VALUE_LEN   255

Define the maximum length of a binary data field (TODO: verify value)

#define LE_AVDATA_FIELD_NAME_LEN   47

Define the maximum length of a field name (TODO: verify value)

#define LE_AVDATA_STRING_VALUE_LEN   255

Define the maximum length of a string field (TODO: verify value)

Typedef Documentation

typedef struct le_avdata_AssetInstance* le_avdata_AssetInstanceRef_t

An asset data instance reference

typedef struct le_avdata_FieldEventHandler* le_avdata_FieldEventHandlerRef_t

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

typedef void(* le_avdata_FieldHandlerFunc_t) (le_avdata_AssetInstanceRef_t instRef, const char *fieldName, void *contextPtr)

Handler for field activity

Parameters
instRef
fieldName
contextPtr
typedef struct le_avdata_RequestSessionObj* le_avdata_RequestSessionObjRef_t

Reference returned by RequestSession function and used by ReleaseSession function

typedef void(* le_avdata_SessionStateHandlerFunc_t) (le_avdata_SessionState_t sessionState, void *contextPtr)

Handler for AV session changes

Parameters
sessionStateSession started or stopped?
contextPtr
typedef struct le_avdata_SessionStateHandler* le_avdata_SessionStateHandlerRef_t

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

Enumeration Type Documentation

AVMS session state

Enumerator
LE_AVDATA_SESSION_STARTED 

AVMS session started.

LE_AVDATA_SESSION_STOPPED 

AVMS session stopped.

Function Documentation

le_avdata_FieldEventHandlerRef_t le_avdata_AddFieldEventHandler ( le_avdata_AssetInstanceRef_t  instRef,
const char *  fieldName,
le_avdata_FieldHandlerFunc_t  handlerPtr,
void *  contextPtr 
)

Add handler function for EVENT 'le_avdata_FieldEvent'

This event provides information on field activity

Parameters
[in]instRef
[in]fieldName
[in]handlerPtr
[in]contextPtr
le_avdata_SessionStateHandlerRef_t le_avdata_AddSessionStateHandler ( le_avdata_SessionStateHandlerFunc_t  handlerPtr,
void *  contextPtr 
)

Add handler function for EVENT 'le_avdata_SessionState'

This event provides information on AV session state changes

Parameters
[in]handlerPtr
[in]contextPtr
void le_avdata_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_avdata_AssetInstanceRef_t le_avdata_Create ( const char *  assetName)

Create an instance of AirVantage asset

Returns
Reference to the asset instance
Note
It is a fatal error if the asset isn't defined.
Parameters
[in]assetName
void le_avdata_Delete ( le_avdata_AssetInstanceRef_t  instRef)

Delete an instance of AirVantage asset

Note
It's a fatal error if the instRef isn't valid
Parameters
[in]instRef
void le_avdata_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.

void le_avdata_GetBinary ( le_avdata_AssetInstanceRef_t  instRef,
const char *  fieldName,
uint8_t *  valuePtr,
size_t *  valueNumElementsPtr 
)

Get the value of a binary data setting field

Note
The client will be terminated if the instRef is not valid, or the field doesn't exist
Parameters
[in]instRef
[in]fieldName
[out]valuePtr
[in,out]valueNumElementsPtr
void le_avdata_GetBool ( le_avdata_AssetInstanceRef_t  instRef,
const char *  fieldName,
bool *  valuePtr 
)

Get the value of a boolean setting field

Note
The client will be terminated if the instRef is not valid, or the field doesn't exist
Parameters
[in]instRef
[in]fieldName
[out]valuePtr
void le_avdata_GetFloat ( le_avdata_AssetInstanceRef_t  instRef,
const char *  fieldName,
double *  valuePtr 
)

Get the value of a float setting field

Note
The client will be terminated if the instRef is not valid, or the field doesn't exist
Parameters
[in]instRef
[in]fieldName
[out]valuePtr
void le_avdata_GetInt ( le_avdata_AssetInstanceRef_t  instRef,
const char *  fieldName,
int32_t *  valuePtr 
)

Get the value of an integer setting field

Note
The client will be terminated if the instRef is not valid, or the field doesn't exist
Parameters
[in]instRef
[in]fieldName
[out]valuePtr
void le_avdata_GetString ( le_avdata_AssetInstanceRef_t  instRef,
const char *  fieldName,
char *  value,
size_t  valueNumElements 
)

Get the value of a string setting field

Note
The client will be terminated if the instRef is not valid, or the field doesn't exist
Parameters
[in]instRef
[in]fieldName
[out]value
[in]valueNumElements
le_result_t le_avdata_GetTimeSeriesStatus ( le_avdata_AssetInstanceRef_t  instRef,
const char *  fieldName,
bool *  isTimeSeriesPtr,
int32_t *  numDataPointPtr 
)

Is time series enabled on this resource, if yes how many data points are recorded so far?

Returns
  • LE_OK on success
  • LE_FAULT if time series not supported
Parameters
[in]instRef
[in]fieldName
[out]isTimeSeriesPtr
[out]numDataPointPtr
le_result_t le_avdata_IsObserve ( le_avdata_AssetInstanceRef_t  instRef,
const char *  fieldName,
bool *  isObservePtr 
)

Is this resource enabled for observe notifications?

Note
client will be terminated if instRef isn't valid, or the field doesn't exist
Returns
  • LE_OK on success
  • LE_NOT_FOUND if field not found
Parameters
[in]instRef
[in]fieldName
[out]isObservePtr
le_result_t le_avdata_PushTimeSeries ( le_avdata_AssetInstanceRef_t  instRef,
const char *  fieldName,
bool  isRestartTimeSeries 
)

Compress the accumulated CBOR encoded time series data and send it to server. After the data is pushed, time series will be stopped and not started again unless isRestartTimeSeries is true.

Note
client will be terminated if instRef isn't valid, or the field doesn't exist
Returns
:
  • LE_OK on success
  • LE_CLOSED if time series not enabled on this field
  • LE_UNAVAILABLE if observe is not enabled on this field
  • LE_FAULT if any other error
Parameters
[in]instRef
[in]fieldName
[in]isRestartTimeSeries
le_result_t le_avdata_RecordBool ( le_avdata_AssetInstanceRef_t  instRef,
const char *  fieldName,
bool  value,
uint64_t  timeStamp 
)

Record the value of a boolean variable field in time series.

Note
The client will be terminated if the instRef is not valid, or the field doesn't exist
This function is the same as the SetBool() except that it provides an option to pass the timestamp. SetBool() can be used to record time series with system time as the timestamp. Timestamp should be in milli seconds elapsed since epoch.
Returns
:
  • LE_OK on success
  • LE_OVERFLOW if the current entry was NOT added as the time series buffer is full. (This error is applicable only if time series is enabled on this field)
  • LE_NO_MEMORY if the current entry was added but there is no space for next one. (This error is applicable only if time series is enabled on this field)
  • LE_FAULT on any other error
Parameters
[in]instRef
[in]fieldName
[in]value
[in]timeStamp
le_result_t le_avdata_RecordFloat ( le_avdata_AssetInstanceRef_t  instRef,
const char *  fieldName,
double  value,
uint64_t  timestamp 
)

Record the value of a float variable field in time series.

Note
The client will be terminated if the instRef is not valid, or the field doesn't exist
This function is the same as the SetFloat() except that it provides an option to pass the timestamp. SetFloat() can be used to record time series with system time as the timestamp. Timestamp should be in milli seconds elapsed since epoch.
Returns
:
  • LE_OK on success
  • LE_OVERFLOW if the current entry was NOT added as the time series buffer is full. (This error is applicable only if time series is enabled on this field)
  • LE_NO_MEMORY if the current entry was added but there is no space for next one. (This error is applicable only if time series is enabled on this field)
  • LE_FAULT on any other error
Parameters
[in]instRef
[in]fieldName
[in]value
[in]timestamp
le_result_t le_avdata_RecordInt ( le_avdata_AssetInstanceRef_t  instRef,
const char *  fieldName,
int32_t  value,
uint64_t  timestamp 
)

Record the value of an integer variable field in time series.

Note
The client will be terminated if the instRef is not valid, or the field doesn't exist
This function is the same as the SetInt() except that it provides an option to pass the timestamp. SetInt() can be used to record time series with system time as the timestamp. Timestamp should be in milli seconds elapsed since epoch.
Returns
:
  • LE_OK on success
  • LE_OVERFLOW if the current entry was NOT added as the time series buffer is full. (This error is applicable only if time series is enabled on this field)
  • LE_NO_MEMORY if the current entry was added but there is no space for next one. (This error is applicable only if time series is enabled on this field)
  • LE_FAULT on any other error
Parameters
[in]instRef
[in]fieldName
[in]value
[in]timestamp
le_result_t le_avdata_RecordString ( le_avdata_AssetInstanceRef_t  instRef,
const char *  fieldName,
const char *  value,
uint64_t  timeStamp 
)

Record the value of a string variable field in time series

Note
The client will be terminated if the instRef is not valid, or the field doesn't exist
This function is the same as the SetString() except that it provides an option to pass the timestamp. SetString() can be used to record time series with system time as the timestamp. Timestamp should be in milli seconds elapsed since epoch.
Returns
:
  • LE_OK on success
  • LE_OVERFLOW if the stored string was truncated or if the current entry was NOT added as the time series buffer is full.
  • LE_NO_MEMORY if the current entry was added but there is no space for next one. (This error is applicable only if time series is enabled on this field)
  • LE_FAULT on any other error
Parameters
[in]instRef
[in]fieldName
[in]value
[in]timeStamp
void le_avdata_ReleaseSession ( le_avdata_RequestSessionObjRef_t  requestRef)

Request the avcServer to close a session.

Parameters
[in]requestRefReference to a previously opened AV session.
void le_avdata_RemoveFieldEventHandler ( le_avdata_FieldEventHandlerRef_t  addHandlerRef)

Remove handler function for EVENT 'le_avdata_FieldEvent'

Parameters
[in]addHandlerRef
void le_avdata_RemoveSessionStateHandler ( le_avdata_SessionStateHandlerRef_t  addHandlerRef)

Remove handler function for EVENT 'le_avdata_SessionState'

Parameters
[in]addHandlerRef
le_avdata_RequestSessionObjRef_t le_avdata_RequestSession ( void  )

Request the avcServer to open a session.

Returns
  • SessionRef if session request succeeded
  • NULL if session request failed
void le_avdata_SetBinary ( le_avdata_AssetInstanceRef_t  instRef,
const char *  fieldName,
const uint8_t *  valuePtr,
size_t  valueNumElements 
)

Set the value of a binary data variable field

Note
The client will be terminated if the instRef is not valid, or the field doesn't exist
Parameters
[in]instRef
[in]fieldName
[in]valuePtr
[in]valueNumElements
le_result_t le_avdata_SetBool ( le_avdata_AssetInstanceRef_t  instRef,
const char *  fieldName,
bool  value 
)

Set the value of a boolean variable field

Note
The client will be terminated if the instRef is not valid, or the field doesn't exist
Returns
:
  • LE_OK on success
  • LE_OVERFLOW if the current entry was NOT added as the time series buffer is full. (This error is applicable only if time series is enabled on this field)
  • LE_NO_MEMORY if the current entry was added but there is no space for next one. (This error is applicable only if time series is enabled on this field)
  • LE_FAULT on any other error
Parameters
[in]instRef
[in]fieldName
[in]value
le_result_t le_avdata_SetFloat ( le_avdata_AssetInstanceRef_t  instRef,
const char *  fieldName,
double  value 
)

Set the value of a float variable field

Note
The client will be terminated if the instRef is not valid, or the field doesn't exist
Returns
:
  • LE_OK on success
  • LE_OVERFLOW if the current entry was NOT added as the time series buffer is full. (This error is applicable only if time series is enabled on this field)
  • LE_NO_MEMORY if the current entry was added but there is no space for next one. (This error is applicable only if time series is enabled on this field)
  • LE_FAULT on any other error
Parameters
[in]instRef
[in]fieldName
[in]value
le_result_t le_avdata_SetInt ( le_avdata_AssetInstanceRef_t  instRef,
const char *  fieldName,
int32_t  value 
)

Set the value of an integer variable field

Note
The client will be terminated if the instRef is not valid, or the field doesn't exist
Returns
:
  • LE_OK on success
  • LE_OVERFLOW if the current entry was NOT added as the time series buffer is full. (This error is applicable only if time series is enabled on this field)
  • LE_NO_MEMORY if the current entry was added but there is no space for next one. (This error is applicable only if time series is enabled on this field)
  • LE_FAULT on any other error
Parameters
[in]instRef
[in]fieldName
[in]value
le_result_t le_avdata_SetString ( le_avdata_AssetInstanceRef_t  instRef,
const char *  fieldName,
const char *  value 
)

Set the value of a string variable field

Note
The client will be terminated if the instRef is not valid, or the field doesn't exist
Returns
:
  • LE_OK on success
  • LE_OVERFLOW if the stored string was truncated or if the current entry was NOT added as the time series buffer is full.
  • LE_NO_MEMORY if the current entry was added but there is no space for next one. (This error is applicable only if time series is enabled on this field)
  • LE_FAULT on any other error
Parameters
[in]instRef
[in]fieldName
[in]value
le_result_t le_avdata_StartTimeSeries ( le_avdata_AssetInstanceRef_t  instRef,
const char *  fieldName,
double  factor,
double  timeStampFactor 
)

Allocate resources and set up cbor stream so that we can start accumulating time series data on the specified field.

Note
client will be terminated if instRef isn't valid, or the field doesn't exist
Currently the buffer size of time series data is limited to 1024 bytes. When the buffer overflows the device has to push the buffer before recording new entries.
Factor is applicable only for integer and float fields. For all other fields factor will be silently ignored. Also a factor of "0" will be ignored for integer resources. The factor will be applied (multiplication) before encoding the sample.
Returns
  • LE_OK on success
  • LE_BUSY if time series already enabled on this field
  • LE_FAULT on any other error
Parameters
[in]instRef
[in]fieldName
[in]factor
[in]timeStampFactor
le_result_t le_avdata_StopTimeSeries ( le_avdata_AssetInstanceRef_t  instRef,
const char *  fieldName 
)

Stop time series on this field and free resources.

Note
client will be terminated if instRef isn't valid, or the field doesn't exist
Returns
  • LE_OK on success
  • LE_CLOSED if timeseries already stopped
Parameters
[in]instRef
[in]fieldName
le_result_t le_avdata_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.