le_avdata API Reference
Files | |
file | le_avdata_common.h |
file | le_avdata_interface.h |
Macros | |
#define | LE_AVDATA_PATH_NAME_LEN 511 |
#define | LE_AVDATA_PATH_NAME_BYTES 512 |
#define | LE_AVDATA_STRING_VALUE_LEN 255 |
#define | LE_AVDATA_STRING_VALUE_BYTES 256 |
#define | LE_AVDATA_ACCESS_READ 0x1 |
#define | LE_AVDATA_ACCESS_WRITE 0x2 |
#define | LE_AVDATA_ACCESS_EXEC 0x4 |
Typedefs | |
typedef uint32_t | le_avdata_AccessType_t |
typedef struct le_avdata_ArgumentList * | le_avdata_ArgumentListRef_t |
typedef struct le_avdata_ResourceEventHandler * | le_avdata_ResourceEventHandlerRef_t |
typedef struct le_avdata_Record * | le_avdata_RecordRef_t |
typedef struct le_avdata_RequestSessionObj * | le_avdata_RequestSessionObjRef_t |
typedef struct le_avdata_SessionStateHandler * | le_avdata_SessionStateHandlerRef_t |
typedef void(* | le_avdata_ResourceHandlerFunc_t) (const char *LE_NONNULL path, le_avdata_AccessType_t accessType, le_avdata_ArgumentListRef_t argumentListRef, void *contextPtr) |
typedef void(* | le_avdata_CallbackResultFunc_t) (le_avdata_PushStatus_t status, void *contextPtr) |
typedef void(* | le_avdata_SessionStateHandlerFunc_t) (le_avdata_SessionState_t sessionState, void *contextPtr) |
typedef void(* | le_avdata_DisconnectHandler_t) (void *) |
Enumerations | |
enum | le_avdata_AccessMode_t { LE_AVDATA_ACCESS_VARIABLE = 0, LE_AVDATA_ACCESS_SETTING = 1, LE_AVDATA_ACCESS_COMMAND = 2 } |
enum | le_avdata_Namespace_t { LE_AVDATA_NAMESPACE_APPLICATION = 0, LE_AVDATA_NAMESPACE_GLOBAL = 1 } |
enum | le_avdata_DataType_t { LE_AVDATA_DATA_TYPE_NONE = 0, LE_AVDATA_DATA_TYPE_INT = 1, LE_AVDATA_DATA_TYPE_FLOAT = 2, LE_AVDATA_DATA_TYPE_BOOL = 3, LE_AVDATA_DATA_TYPE_STRING = 4 } |
enum | le_avdata_PushStatus_t { LE_AVDATA_PUSH_SUCCESS = 0, LE_AVDATA_PUSH_FAILED = 1 } |
enum | le_avdata_SessionState_t { LE_AVDATA_SESSION_STARTED = 0, LE_AVDATA_SESSION_STOPPED = 1 } |
Detailed Description
Macro Definition Documentation
◆ LE_AVDATA_ACCESS_READ
#define LE_AVDATA_ACCESS_READ 0x1 |
Resource access types
◆ LE_AVDATA_PATH_NAME_LEN
#define LE_AVDATA_PATH_NAME_LEN 511 |
Define the maximum characters and bytes of a path name
◆ LE_AVDATA_STRING_VALUE_LEN
#define LE_AVDATA_STRING_VALUE_LEN 255 |
Define the maximum characters and bytes of a string
Typedef Documentation
◆ le_avdata_ArgumentListRef_t
typedef struct le_avdata_ArgumentList* le_avdata_ArgumentListRef_t |
Argument list reference, for command only.
◆ le_avdata_CallbackResultFunc_t
typedef void(* le_avdata_CallbackResultFunc_t) (le_avdata_PushStatus_t status, void *contextPtr) |
Handler for pushing data result.
◆ le_avdata_DisconnectHandler_t
typedef void(* le_avdata_DisconnectHandler_t) (void *) |
Type for handler called when a server disconnects.
◆ le_avdata_RecordRef_t
typedef struct le_avdata_Record* le_avdata_RecordRef_t |
A record reference
◆ le_avdata_RequestSessionObjRef_t
typedef struct le_avdata_RequestSessionObj* le_avdata_RequestSessionObjRef_t |
Reference returned by RequestSession function and used by ReleaseSession function
◆ le_avdata_ResourceEventHandlerRef_t
typedef struct le_avdata_ResourceEventHandler* le_avdata_ResourceEventHandlerRef_t |
Reference type used by Add/Remove functions for EVENT 'le_avdata_ResourceEvent'
◆ le_avdata_ResourceHandlerFunc_t
typedef void(* le_avdata_ResourceHandlerFunc_t) (const char *LE_NONNULL path, le_avdata_AccessType_t accessType, le_avdata_ArgumentListRef_t argumentListRef, void *contextPtr) |
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.
◆ le_avdata_SessionStateHandlerFunc_t
typedef void(* le_avdata_SessionStateHandlerFunc_t) (le_avdata_SessionState_t sessionState, void *contextPtr) |
Handler for AV session changes
◆ le_avdata_SessionStateHandlerRef_t
typedef struct le_avdata_SessionStateHandler* le_avdata_SessionStateHandlerRef_t |
Reference type used by Add/Remove functions for EVENT 'le_avdata_SessionState'
Enumeration Type Documentation
◆ le_avdata_AccessMode_t
Resource access modes:
- Variable: read (server), read/write (client)
- Setting: read/write (server), read/write (client)
- Command: execute (server)
Enumerator | |
---|---|
LE_AVDATA_ACCESS_VARIABLE | read(server) or read/write(client) |
LE_AVDATA_ACCESS_SETTING | read/write (server) or read/write (client) |
LE_AVDATA_ACCESS_COMMAND | execute (server) |
◆ le_avdata_DataType_t
enum le_avdata_DataType_t |
◆ le_avdata_Namespace_t
Resource namespace
◆ le_avdata_PushStatus_t
◆ le_avdata_SessionState_t
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] requestRef Reference 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.