le_avdata_interface.h File Reference

#include "legato.h"
#include "le_avdata_common.h"

Go to the source code of this file.

Typedefs

typedef void(* le_avdata_DisconnectHandler_t) (void *)
 

Functions

void le_avdata_ConnectService (void)
 
le_result_t le_avdata_TryConnectService (void)
 
LE_FULL_API void le_avdata_SetServerDisconnectHandler (le_avdata_DisconnectHandler_t disconnectHandler, void *contextPtr)
 
void le_avdata_DisconnectService (void)
 
le_avdata_ResourceEventHandlerRef_t le_avdata_AddResourceEventHandler (const char *LE_NONNULL path, le_avdata_ResourceHandlerFunc_t handlerPtr, void *contextPtr)
 
void le_avdata_RemoveResourceEventHandler (le_avdata_ResourceEventHandlerRef_t handlerRef)
 
le_result_t le_avdata_CreateResource (const char *LE_NONNULL path, le_avdata_AccessMode_t accessMode)
 
le_result_t le_avdata_SetNamespace (le_avdata_Namespace_t _namespace)
 
le_result_t le_avdata_SetNull (const char *LE_NONNULL path)
 
le_result_t le_avdata_GetInt (const char *LE_NONNULL path, int32_t *valuePtr)
 
le_result_t le_avdata_SetInt (const char *LE_NONNULL path, int32_t value)
 
le_result_t le_avdata_GetFloat (const char *LE_NONNULL path, double *valuePtr)
 
le_result_t le_avdata_SetFloat (const char *LE_NONNULL path, double value)
 
le_result_t le_avdata_GetBool (const char *LE_NONNULL path, bool *valuePtr)
 
le_result_t le_avdata_SetBool (const char *LE_NONNULL path, bool value)
 
le_result_t le_avdata_GetString (const char *LE_NONNULL path, char *value, size_t valueSize)
 
le_result_t le_avdata_SetString (const char *LE_NONNULL path, const char *LE_NONNULL value)
 
le_result_t le_avdata_GetBoolArg (le_avdata_ArgumentListRef_t argumentListRef, const char *LE_NONNULL argName, bool *boolArgPtr)
 
le_result_t le_avdata_GetFloatArg (le_avdata_ArgumentListRef_t argumentListRef, const char *LE_NONNULL argName, double *floatArgPtr)
 
le_result_t le_avdata_GetIntArg (le_avdata_ArgumentListRef_t argumentListRef, const char *LE_NONNULL argName, int32_t *intArgPtr)
 
le_result_t le_avdata_GetStringArg (le_avdata_ArgumentListRef_t argumentListRef, const char *LE_NONNULL argName, char *strArg, size_t strArgSize)
 
le_result_t le_avdata_GetStringArgLength (le_avdata_ArgumentListRef_t argumentListRef, const char *LE_NONNULL argName, int32_t *strArgLenPtr)
 
void le_avdata_ReplyExecResult (le_avdata_ArgumentListRef_t argumentListRef, le_result_t result)
 
le_result_t le_avdata_Push (const char *LE_NONNULL path, le_avdata_CallbackResultFunc_t handlerPtr, void *contextPtr)
 
le_result_t le_avdata_PushStream (const char *LE_NONNULL path, int fd, le_avdata_CallbackResultFunc_t handlerPtr, void *contextPtr)
 
le_avdata_RecordRef_t le_avdata_CreateRecord (void)
 
void le_avdata_DeleteRecord (le_avdata_RecordRef_t recordRef)
 
le_result_t le_avdata_RecordInt (le_avdata_RecordRef_t recordRef, const char *LE_NONNULL path, int32_t value, uint64_t timestamp)
 
le_result_t le_avdata_RecordFloat (le_avdata_RecordRef_t recordRef, const char *LE_NONNULL path, double value, uint64_t timestamp)
 
le_result_t le_avdata_RecordBool (le_avdata_RecordRef_t recordRef, const char *LE_NONNULL path, bool value, uint64_t timestamp)
 
le_result_t le_avdata_RecordString (le_avdata_RecordRef_t recordRef, const char *LE_NONNULL path, const char *LE_NONNULL value, uint64_t timestamp)
 
le_result_t le_avdata_PushRecord (le_avdata_RecordRef_t recordRef, le_avdata_CallbackResultFunc_t handlerPtr, void *contextPtr)
 
le_avdata_SessionStateHandlerRef_t le_avdata_AddSessionStateHandler (le_avdata_SessionStateHandlerFunc_t handlerPtr, void *contextPtr)
 
void le_avdata_RemoveSessionStateHandler (le_avdata_SessionStateHandlerRef_t handlerRef)
 
le_avdata_RequestSessionObjRef_t le_avdata_RequestSession (void)
 
void le_avdata_ReleaseSession (le_avdata_RequestSessionObjRef_t requestRef)
 

Detailed Description

Legato AirVantage Data API include file.

Typedef Documentation

◆ le_avdata_DisconnectHandler_t

typedef void(* le_avdata_DisconnectHandler_t) (void *)

Type for handler called when a server disconnects.

Function Documentation

◆ le_avdata_AddResourceEventHandler()

le_avdata_ResourceEventHandlerRef_t le_avdata_AddResourceEventHandler ( const char *LE_NONNULL  path,
le_avdata_ResourceHandlerFunc_t  handlerPtr,
void *  contextPtr 
)

Resource access modes:

  • Variable: read (server), read/write (client)
  • Setting: read/write (server), read/write (client)
  • Command: execute (server) Resource access types Resource namespace Data types Status of the data push Argument list reference, for command only. Handler for resource activity. Note that the path returned by this event follows the unix format (e.g. "/a/b/c") even if the app uses the URL format (e.g "a.b.c") when registering the handler. Handler for pushing data result. Reference type used by Add/Remove functions for EVENT 'le_avdata_ResourceEvent' A record reference Reference returned by RequestSession function and used by ReleaseSession function AVMS session state Handler for AV session changes Reference type used by Add/Remove functions for EVENT 'le_avdata_SessionState' Add handler function for EVENT 'le_avdata_ResourceEvent'

Upon resource access on the server side, the registered handler is called.

For "settings" (read/write), the same handler is called for both read and write access.

For "commands", the handler function must call the "ReplyExecResult" function to send the command execution result back to the AVC daemon (which then sends the proper response back to the AV server).

Parameters
[in]path
[in]handlerPtr
[in]contextPtr

◆ le_avdata_AddSessionStateHandler()

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

◆ le_avdata_ConnectService()

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

le_avdata_RecordRef_t le_avdata_CreateRecord ( void  )

Create a timeseries record

Returns
Reference to the record

◆ le_avdata_CreateResource()

le_result_t le_avdata_CreateResource ( const char *LE_NONNULL  path,
le_avdata_AccessMode_t  accessMode 
)

Create an asset data with the provided path. Note that asset data type and value are determined upon the first call to a Set function. When an asset data is created, it contains a null value, represented by the data type of none.

Returns
:
  • LE_OK on success
  • LE_DUPLICATE if path has already been called by CreateResource before, or path is parent or child to an existing Asset Data path.
  • LE_FAULT on any other error.
Parameters
[in]path
[in]accessMode

◆ le_avdata_DeleteRecord()

void le_avdata_DeleteRecord ( le_avdata_RecordRef_t  recordRef)

Delete a timeseries record

Parameters
[in]recordRef

◆ le_avdata_DisconnectService()

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.

◆ le_avdata_GetBool()

le_result_t le_avdata_GetBool ( const char *LE_NONNULL  path,
bool *  valuePtr 
)

Gets the bool value of an asset data.

Returns
:
  • LE_BAD_PARAMETER - asset data being accessed is of the wrong data type
  • LE_UNAVAILABLE - asset data contains null value
  • LE_NOT_FOUND - if the path is invalid and does not point to an asset data
  • LE_NOT_PERMITTED - asset data being accessed does not have the right permission
  • LE_OK - access successful.
Parameters
[in]path
[out]valuePtr

◆ le_avdata_GetBoolArg()

le_result_t le_avdata_GetBoolArg ( le_avdata_ArgumentListRef_t  argumentListRef,
const char *LE_NONNULL  argName,
bool *  boolArgPtr 
)

Get the bool argument with the specified name.

Returns
:
  • LE_OK on success
  • LE_NOT_FOUND if argument doesn't exist, or its data type doesn't match the API.
Parameters
[in]argumentListRef
[in]argName
[out]boolArgPtr

◆ le_avdata_GetFloat()

le_result_t le_avdata_GetFloat ( const char *LE_NONNULL  path,
double *  valuePtr 
)

Gets the float value of an asset data.

Returns
:
  • LE_BAD_PARAMETER - asset data being accessed is of the wrong data type
  • LE_UNAVAILABLE - asset data contains null value
  • LE_NOT_FOUND - if the path is invalid and does not point to an asset data
  • LE_NOT_PERMITTED - asset data being accessed does not have the right permission
  • LE_OK - access successful.
Parameters
[in]path
[out]valuePtr

◆ le_avdata_GetFloatArg()

le_result_t le_avdata_GetFloatArg ( le_avdata_ArgumentListRef_t  argumentListRef,
const char *LE_NONNULL  argName,
double *  floatArgPtr 
)

Get the float argument with the specified name.

Returns
:
  • LE_OK on success
  • LE_NOT_FOUND if argument doesn't exist, or its data type doesn't match the API.
Parameters
[in]argumentListRef
[in]argName
[out]floatArgPtr

◆ le_avdata_GetInt()

le_result_t le_avdata_GetInt ( const char *LE_NONNULL  path,
int32_t *  valuePtr 
)

Gets the integer value of an asset data.

Returns
:
  • LE_BAD_PARAMETER - asset data being accessed is of the wrong data type
  • LE_UNAVAILABLE - asset data contains null value
  • LE_NOT_FOUND - if the path is invalid and does not point to an asset data
  • LE_NOT_PERMITTED - asset data being accessed does not have the right permission
  • LE_OK - access successful.
Parameters
[in]path
[out]valuePtr

◆ le_avdata_GetIntArg()

le_result_t le_avdata_GetIntArg ( le_avdata_ArgumentListRef_t  argumentListRef,
const char *LE_NONNULL  argName,
int32_t *  intArgPtr 
)

Get the int argument with the specified name.

Returns
:
  • LE_OK on success
  • LE_NOT_FOUND if argument doesn't exist, or its data type doesn't match the API.
Parameters
[in]argumentListRef
[in]argName
[out]intArgPtr

◆ le_avdata_GetString()

le_result_t le_avdata_GetString ( const char *LE_NONNULL  path,
char *  value,
size_t  valueSize 
)

Gets the string value of an asset data.

Returns
:
  • LE_BAD_PARAMETER - asset data being accessed is of the wrong data type
  • LE_UNAVAILABLE - asset data contains null value
  • LE_NOT_FOUND - if the path is invalid and does not point to an asset data
  • LE_NOT_PERMITTED - asset data being accessed does not have the right permission
  • LE_OVERFLOW - asset data length exceeds the maximum length
  • LE_OK - access successful
Parameters
[in]path
[out]value
[in]valueSize

◆ le_avdata_GetStringArg()

le_result_t le_avdata_GetStringArg ( le_avdata_ArgumentListRef_t  argumentListRef,
const char *LE_NONNULL  argName,
char *  strArg,
size_t  strArgSize 
)

Get the string argument with the specified name.

Returns
:
  • LE_OK on success
  • LE_NOT_FOUND if argument doesn't exist, or its data type doesn't match the API
  • LE_OVERFLOW - argument length exceeds the maximum length
Parameters
[in]argumentListRef
[in]argName
[out]strArg
[in]strArgSize

◆ le_avdata_GetStringArgLength()

le_result_t le_avdata_GetStringArgLength ( le_avdata_ArgumentListRef_t  argumentListRef,
const char *LE_NONNULL  argName,
int32_t *  strArgLenPtr 
)

Get the length (excluding terminating null byte) of the string argument of the specified name.

Returns
:
  • LE_OK on success
  • LE_NOT_FOUND if argument doesn't exist, or its data type doesn't match the API.
Parameters
[in]argumentListRef
[in]argName
[out]strArgLenPtr

◆ le_avdata_Push()

le_result_t le_avdata_Push ( const char *LE_NONNULL  path,
le_avdata_CallbackResultFunc_t  handlerPtr,
void *  contextPtr 
)

Push asset data to the server.

Returns
:
  • LE_OK on success
  • LE_NOT_FOUND if the provided path doesn't exist
  • LE_BUSY if push service is busy. Data added to queue list for later push
  • LE_OVERFLOW if data size exceeds the maximum allowed size
  • LE_NO_MEMORY if push queue is full, try again later
  • LE_FAULT on any other error
Parameters
[in]path
[in]handlerPtr
[in]contextPtr

◆ le_avdata_PushRecord()

le_result_t le_avdata_PushRecord ( le_avdata_RecordRef_t  recordRef,
le_avdata_CallbackResultFunc_t  handlerPtr,
void *  contextPtr 
)

Push record to the server

Returns
:
  • LE_OK on success
  • LE_BUSY if push service is busy. Data added to queue list for later push
  • LE_OVERFLOW if data size exceeds the maximum allowed size
  • LE_NO_MEMORY if push queue is full, try again later
  • LE_FAULT on any other error
  • Note
    If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters
[in]recordRef
[in]handlerPtr
[in]contextPtr

◆ le_avdata_PushStream()

le_result_t le_avdata_PushStream ( const char *LE_NONNULL  path,
int  fd,
le_avdata_CallbackResultFunc_t  handlerPtr,
void *  contextPtr 
)

Push data dump to a specified path on the server.

Returns
:
  • LE_OK on success
  • LE_BUSY if push service is busy. Data added to queue list for later push
  • LE_OVERFLOW if data size exceeds the maximum allowed size
  • LE_NO_MEMORY if push queue is full, try again later
  • LE_FAULT on any other error
Parameters
[in]path
[in]fd
[in]handlerPtr
[in]contextPtr

◆ le_avdata_RecordBool()

le_result_t le_avdata_RecordBool ( le_avdata_RecordRef_t  recordRef,
const char *LE_NONNULL  path,
bool  value,
uint64_t  timestamp 
)

Accumulate boolean data

Note
The client will be terminated if the recordRef is not valid, or the resource doesn't exist
Returns
:
  • LE_OK on success
  • LE_NO_MEMORY if the current entry was NOT added because the time series buffer is full.
  • LE_FAULT on any other error
Parameters
[in]recordRef
[in]path
[in]value
[in]timestamp

◆ le_avdata_RecordFloat()

le_result_t le_avdata_RecordFloat ( le_avdata_RecordRef_t  recordRef,
const char *LE_NONNULL  path,
double  value,
uint64_t  timestamp 
)

Accumulate float data

Note
The client will be terminated if the recordRef is not valid, or the resource doesn't exist
Returns
:
  • LE_OK on success
  • LE_NO_MEMORY if the current entry was NOT added because the time series buffer is full.
  • LE_FAULT on any other error
Parameters
[in]recordRef
[in]path
[in]value
[in]timestamp

◆ le_avdata_RecordInt()

le_result_t le_avdata_RecordInt ( le_avdata_RecordRef_t  recordRef,
const char *LE_NONNULL  path,
int32_t  value,
uint64_t  timestamp 
)

Accumulate int data

Note
The client will be terminated if the recordRef is not valid, or the resource doesn't exist
Returns
:
  • LE_OK on success
  • LE_NO_MEMORY if the current entry was NOT added because the time series buffer is full.
  • LE_FAULT on any other error
Parameters
[in]recordRef
[in]path
[in]value
[in]timestamp

◆ le_avdata_RecordString()

le_result_t le_avdata_RecordString ( le_avdata_RecordRef_t  recordRef,
const char *LE_NONNULL  path,
const char *LE_NONNULL  value,
uint64_t  timestamp 
)

Accumulate string data

Note
The client will be terminated if the recordRef is not valid, or the resource doesn't exist
Returns
:
  • LE_OK on success
  • LE_NO_MEMORY if the current entry was NOT added because the time series buffer is full.
  • LE_FAULT on any other error
Parameters
[in]recordRef
[in]path
[in]value
[in]timestamp

◆ le_avdata_ReleaseSession()

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.

◆ le_avdata_RemoveResourceEventHandler()

void le_avdata_RemoveResourceEventHandler ( le_avdata_ResourceEventHandlerRef_t  handlerRef)

Remove handler function for EVENT 'le_avdata_ResourceEvent'

Parameters
[in]handlerRef

◆ le_avdata_RemoveSessionStateHandler()

void le_avdata_RemoveSessionStateHandler ( le_avdata_SessionStateHandlerRef_t  handlerRef)

Remove handler function for EVENT 'le_avdata_SessionState'

Parameters
[in]handlerRef

◆ le_avdata_ReplyExecResult()

void le_avdata_ReplyExecResult ( le_avdata_ArgumentListRef_t  argumentListRef,
le_result_t  result 
)

Reply command execution result to AVC Daemon, which can then respond to AV server. This function MUST be called at the end of a command execution, in order for AV server to be notified about the execution status.

Parameters
[in]argumentListRef
[in]result

◆ le_avdata_RequestSession()

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

◆ le_avdata_SetBool()

le_result_t le_avdata_SetBool ( const char *LE_NONNULL  path,
bool  value 
)

Sets an asset data to a bool value.

Returns
:
  • LE_NOT_FOUND - if the path is invalid and does not point to an asset data
  • LE_NOT_PERMITTED - asset data being accessed does not have the right permission
  • LE_OK - access successful.
Parameters
[in]path
[in]value

◆ le_avdata_SetFloat()

le_result_t le_avdata_SetFloat ( const char *LE_NONNULL  path,
double  value 
)

Sets an asset data to a float value.

Returns
:
  • LE_NOT_FOUND - if the path is invalid and does not point to an asset data
  • LE_NOT_PERMITTED - asset data being accessed does not have the right permission
  • LE_OK - access successful.
Parameters
[in]path
[in]value

◆ le_avdata_SetInt()

le_result_t le_avdata_SetInt ( const char *LE_NONNULL  path,
int32_t  value 
)

Sets an asset data to an integer value.

Returns
:
  • LE_NOT_FOUND - if the path is invalid and does not point to an asset data
  • LE_NOT_PERMITTED - asset data being accessed does not have the right permission
  • LE_OK - access successful.
Parameters
[in]path
[in]value

◆ le_avdata_SetNamespace()

le_result_t le_avdata_SetNamespace ( le_avdata_Namespace_t  _namespace)

Sets the namespace for asset data.

Returns
:
  • LE_OK on success
  • LE_BAD_PARAMETER if the namespace is unknown
Parameters
[in]_namespace

◆ le_avdata_SetNull()

le_result_t le_avdata_SetNull ( const char *LE_NONNULL  path)

Sets an asset data to contain a null value, represented by the data type of none.

Returns
:
  • LE_NOT_FOUND - if the path is invalid and does not point to an asset data
  • LE_NOT_PERMITTED - asset data being accessed does not have the right permission
  • LE_OK - access successful.
Parameters
[in]path

◆ le_avdata_SetServerDisconnectHandler()

LE_FULL_API void le_avdata_SetServerDisconnectHandler ( le_avdata_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_avdata_SetString()

le_result_t le_avdata_SetString ( const char *LE_NONNULL  path,
const char *LE_NONNULL  value 
)

Sets an asset data to a string value.

Returns
:
  • LE_NOT_FOUND - if the path is invalid and does not point to an asset data
  • LE_NOT_PERMITTED - asset data being accessed does not have the right permission
  • LE_OK - access successful.
Parameters
[in]path
[in]value

◆ le_avdata_TryConnectService()

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.