le_avdata_interface.h
Go to the documentation of this file.
36 * Data is setup as @b Assets — a collection of fields that can be managed by the AirVantage43 * - @b variable allowing the AirVantage server to read the value, and can be read/writtten to by an App.44 * - @b setting allowing the AirVantage server to read/write the value, and can be read/written to by an App.71 * @note If a user enters a value 0 for float data type, an error will be returned (LE_NOT_FOUND),72 * as the system infers 0 as an integer value and the data type doesn't match. 0.0 needs to be set82 * Registered handlers are called only when activities from AV server occurs. Client activities do85 * A handler registered with a command field is invoked with an optional argument list sent from the90 * A handler registered with a command field must call the le_avdata_ReplyExecResult() at the end of154 * namespace. In order to query any paths created under an application namespace, user must append155 * the app name in front of the request on the server side. If creating asset data under application156 * namespace is not desired, users must call le_avdata_SetNamespace() and set the value to global.158 * space. All asset data API will use the last namespace set until the function is called again and162 * regardless of the namespace used to create it. The asset data settings are restored lazily when190 * "/test/resourceA" with a value of 2. A read request from the server on "<appName>/test/resourceA"191 * will return 1; whereas a read request on "/test/resourceA" will return 2. A read request from the192 * server on a parent node will result in reading multiple resources together. For example, a read198 * This feature enables user Apps to collect and keep in memory data when the device is off-line and213 * This code sample shows how to collect data and send to the server (assuming session is opened)238 * utcMilliSec = (uint64_t)(tv.tv_sec) * 1000 + (uint64_t)(tv.tv_usec) / 1000; // get current time256 * le_avdata_AddSessionStateHandler() and le_avdata_RemoveSessionStateHandler() can be used to add304 //--------------------------------------------------------------------------------------------------308 //--------------------------------------------------------------------------------------------------311 //--------------------------------------------------------------------------------------------------314 * Connect the current client thread to the service providing this API. Block until the service is317 * For each thread that wants to use this API, either ConnectService or TryConnectService must be318 * called before any other functions in this API. Normally, ConnectService is automatically called323 //--------------------------------------------------------------------------------------------------329 //--------------------------------------------------------------------------------------------------332 * Try to connect the current client thread to the service providing this API. Return with an error335 * For each thread that wants to use this API, either ConnectService or TryConnectService must be336 * called before any other functions in this API. Normally, ConnectService is automatically called345 * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).348 //--------------------------------------------------------------------------------------------------354 //--------------------------------------------------------------------------------------------------358 * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants361 //--------------------------------------------------------------------------------------------------368 //--------------------------------------------------------------------------------------------------374 * longer a connection to the service, and the functions in this API can't be used. For details, see379 //--------------------------------------------------------------------------------------------------386 //--------------------------------------------------------------------------------------------------393 //--------------------------------------------------------------------------------------------------396 //--------------------------------------------------------------------------------------------------400 //--------------------------------------------------------------------------------------------------403 //--------------------------------------------------------------------------------------------------407 //--------------------------------------------------------------------------------------------------410 //--------------------------------------------------------------------------------------------------414 //--------------------------------------------------------------------------------------------------417 //--------------------------------------------------------------------------------------------------422 //--------------------------------------------------------------------------------------------------425 //--------------------------------------------------------------------------------------------------429 //--------------------------------------------------------------------------------------------------432 //--------------------------------------------------------------------------------------------------434 * Handler for resource activity. Note that the path returned by this event follows the unix format438 //--------------------------------------------------------------------------------------------------441 //--------------------------------------------------------------------------------------------------445 //--------------------------------------------------------------------------------------------------448 //--------------------------------------------------------------------------------------------------452 //--------------------------------------------------------------------------------------------------455 //--------------------------------------------------------------------------------------------------459 //--------------------------------------------------------------------------------------------------462 //--------------------------------------------------------------------------------------------------466 //--------------------------------------------------------------------------------------------------469 //--------------------------------------------------------------------------------------------------473 //--------------------------------------------------------------------------------------------------476 //--------------------------------------------------------------------------------------------------480 //--------------------------------------------------------------------------------------------------483 //--------------------------------------------------------------------------------------------------487 //--------------------------------------------------------------------------------------------------490 //--------------------------------------------------------------------------------------------------498 * For "commands", the handler function must call the "ReplyExecResult" function to send the command502 //--------------------------------------------------------------------------------------------------513 //--------------------------------------------------------------------------------------------------517 //--------------------------------------------------------------------------------------------------524 //--------------------------------------------------------------------------------------------------526 * Create an asset data with the provided path. Note that asset data type and value are determined527 * upon the first call to a Set function. When an asset data is created, it contains a null value,536 //--------------------------------------------------------------------------------------------------545 //--------------------------------------------------------------------------------------------------553 //--------------------------------------------------------------------------------------------------560 //--------------------------------------------------------------------------------------------------569 //--------------------------------------------------------------------------------------------------576 //--------------------------------------------------------------------------------------------------587 //--------------------------------------------------------------------------------------------------596 //--------------------------------------------------------------------------------------------------605 //--------------------------------------------------------------------------------------------------614 //--------------------------------------------------------------------------------------------------625 //--------------------------------------------------------------------------------------------------634 //--------------------------------------------------------------------------------------------------643 //--------------------------------------------------------------------------------------------------652 //--------------------------------------------------------------------------------------------------663 //--------------------------------------------------------------------------------------------------672 //--------------------------------------------------------------------------------------------------681 //--------------------------------------------------------------------------------------------------690 //--------------------------------------------------------------------------------------------------702 //--------------------------------------------------------------------------------------------------713 //--------------------------------------------------------------------------------------------------722 //--------------------------------------------------------------------------------------------------731 //--------------------------------------------------------------------------------------------------739 //--------------------------------------------------------------------------------------------------750 //--------------------------------------------------------------------------------------------------758 //--------------------------------------------------------------------------------------------------769 //--------------------------------------------------------------------------------------------------777 //--------------------------------------------------------------------------------------------------788 //--------------------------------------------------------------------------------------------------797 //--------------------------------------------------------------------------------------------------810 //--------------------------------------------------------------------------------------------------812 * Get the length (excluding terminating null byte) of the string argument of the specified name.818 //--------------------------------------------------------------------------------------------------829 //--------------------------------------------------------------------------------------------------831 * Reply command execution result to AVC Daemon, which can then respond to AV server. This function832 * MUST be called at the end of a command execution, in order for AV server to be notified about the835 //--------------------------------------------------------------------------------------------------844 //--------------------------------------------------------------------------------------------------856 //--------------------------------------------------------------------------------------------------867 //--------------------------------------------------------------------------------------------------878 //--------------------------------------------------------------------------------------------------891 //--------------------------------------------------------------------------------------------------897 //--------------------------------------------------------------------------------------------------903 //--------------------------------------------------------------------------------------------------907 //--------------------------------------------------------------------------------------------------914 //--------------------------------------------------------------------------------------------------918 * @note The client will be terminated if the recordRef is not valid, or the resource doesn't exist925 //--------------------------------------------------------------------------------------------------938 //--------------------------------------------------------------------------------------------------942 * @note The client will be terminated if the recordRef is not valid, or the resource doesn't exist949 //--------------------------------------------------------------------------------------------------962 //--------------------------------------------------------------------------------------------------966 * @note The client will be terminated if the recordRef is not valid, or the resource doesn't exist973 //--------------------------------------------------------------------------------------------------986 //--------------------------------------------------------------------------------------------------990 * @note The client will be terminated if the recordRef is not valid, or the resource doesn't exist997 //--------------------------------------------------------------------------------------------------1010 //--------------------------------------------------------------------------------------------------1024 //--------------------------------------------------------------------------------------------------1035 //--------------------------------------------------------------------------------------------------1041 //--------------------------------------------------------------------------------------------------1050 //--------------------------------------------------------------------------------------------------1054 //--------------------------------------------------------------------------------------------------1061 //--------------------------------------------------------------------------------------------------1069 //--------------------------------------------------------------------------------------------------1075 //--------------------------------------------------------------------------------------------------1080 //--------------------------------------------------------------------------------------------------void le_avdata_DeleteRecord(le_avdata_RecordRef_t recordRef)struct le_avdata_Record * le_avdata_RecordRef_tDefinition: le_avdata_common.h:158le_result_t le_avdata_RecordInt(le_avdata_RecordRef_t recordRef, const char *LE_NONNULL path, int32_t value, uint64_t timestamp)void le_avdata_RemoveSessionStateHandler(le_avdata_SessionStateHandlerRef_t handlerRef)void le_avdata_DisconnectService(void)le_result_t le_avdata_SetNull(const char *LE_NONNULL path)void(* le_avdata_DisconnectHandler_t)(void *)Definition: le_avdata_interface.h:309le_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_SetString(const char *LE_NONNULL path, const char *LE_NONNULL value)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_RecordString(le_avdata_RecordRef_t recordRef, const char *LE_NONNULL path, const char *LE_NONNULL value, uint64_t timestamp)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)void le_avdata_RemoveResourceEventHandler(le_avdata_ResourceEventHandlerRef_t handlerRef)LE_FULL_API void le_avdata_SetServerDisconnectHandler(le_avdata_DisconnectHandler_t disconnectHandler, void *contextPtr)le_result_t le_avdata_GetIntArg(le_avdata_ArgumentListRef_t argumentListRef, const char *LE_NONNULL argName, int32_t *intArgPtr)le_result_t le_avdata_SetNamespace(le_avdata_Namespace_t _namespace)le_result_t le_avdata_CreateResource(const char *LE_NONNULL path, le_avdata_AccessMode_t accessMode)void le_avdata_ConnectService(void)void le_avdata_ReplyExecResult(le_avdata_ArgumentListRef_t argumentListRef, le_result_t result)le_result_t le_avdata_SetFloat(const char *LE_NONNULL path, double value)le_result_t le_avdata_RecordBool(le_avdata_RecordRef_t recordRef, const char *LE_NONNULL path, bool value, uint64_t timestamp)struct le_avdata_ResourceEventHandler * le_avdata_ResourceEventHandlerRef_tDefinition: le_avdata_common.h:150le_avdata_SessionStateHandlerRef_t le_avdata_AddSessionStateHandler(le_avdata_SessionStateHandlerFunc_t handlerPtr, void *contextPtr)le_avdata_RequestSessionObjRef_t le_avdata_RequestSession(void)le_result_t le_avdata_GetBool(const char *LE_NONNULL path, bool *valuePtr)struct le_avdata_SessionStateHandler * le_avdata_SessionStateHandlerRef_tDefinition: le_avdata_common.h:189le_result_t le_avdata_PushStream(const char *LE_NONNULL path, int fd, le_avdata_CallbackResultFunc_t handlerPtr, void *contextPtr)le_result_t le_avdata_GetFloatArg(le_avdata_ArgumentListRef_t argumentListRef, const char *LE_NONNULL argName, double *floatArgPtr)le_result_t le_avdata_TryConnectService(void)void le_avdata_ReleaseSession(le_avdata_RequestSessionObjRef_t requestRef)void(* le_avdata_CallbackResultFunc_t)(le_avdata_PushStatus_t status, void *contextPtr)Definition: le_avdata_common.h:217le_result_t le_avdata_PushRecord(le_avdata_RecordRef_t recordRef, le_avdata_CallbackResultFunc_t handlerPtr, void *contextPtr)void(* le_avdata_ResourceHandlerFunc_t)(const char *LE_NONNULL path, le_avdata_AccessType_t accessType, le_avdata_ArgumentListRef_t argumentListRef, void *contextPtr)Definition: le_avdata_common.h:200le_result_t le_avdata_Push(const char *LE_NONNULL path, le_avdata_CallbackResultFunc_t handlerPtr, void *contextPtr)le_avdata_ResourceEventHandlerRef_t le_avdata_AddResourceEventHandler(const char *LE_NONNULL path, le_avdata_ResourceHandlerFunc_t handlerPtr, void *contextPtr)le_result_t le_avdata_GetBoolArg(le_avdata_ArgumentListRef_t argumentListRef, const char *LE_NONNULL argName, bool *boolArgPtr)le_avdata_RecordRef_t le_avdata_CreateRecord(void)struct le_avdata_RequestSessionObj * le_avdata_RequestSessionObjRef_tDefinition: le_avdata_common.h:166le_result_t le_avdata_SetBool(const char *LE_NONNULL path, bool value)le_result_t le_avdata_GetFloat(const char *LE_NONNULL path, double *valuePtr)void(* le_avdata_SessionStateHandlerFunc_t)(le_avdata_SessionState_t sessionState, void *contextPtr)Definition: le_avdata_common.h:230struct le_avdata_ArgumentList * le_avdata_ArgumentListRef_tDefinition: le_avdata_common.h:142le_result_t le_avdata_GetStringArgLength(le_avdata_ArgumentListRef_t argumentListRef, const char *LE_NONNULL argName, int32_t *strArgLenPtr)le_result_t le_avdata_GetString(const char *LE_NONNULL path, char *value, size_t valueSize)