le_avdata_interface.h

Go to the documentation of this file.
1 
2 
3 /*
4  * ====================== WARNING ======================
5  *
6  * THE CONTENTS OF THIS FILE HAVE BEEN AUTO-GENERATED.
7  * DO NOT MODIFY IN ANY WAY.
8  *
9  * ====================== WARNING ======================
10  */
11 
12 /**
13  * @page c_le_avdata AirVantage Data API
14  *
15  * @ref le_avdata_interface.h "API Reference" <br>
16  * @ref avData "How To Manage Data"
17  *
18  * This API provides a data service to allow Apps to manage App-specific data on the AirVantage
19  * server.
20  *
21  * @section le_avdata_binding IPC Interfaces Binding
22  *
23  * All the functions of this API are provided by the @b avcService platform service.
24  *
25  * Code sample for binding to avcService:
26  * @verbatim
27  bindings:
28  {
29  clientExe.clientComponent.le_avdata -> avcService.le_avdata
30  }
31  @endverbatim
32  *
33  *
34  * @section le_avdata_overview AirVantage Data Overview
35  *
36  * Data is setup as @b Assets &mdash; a collection of fields that can be managed by the AirVantage
37  * server.
38  *
39  * An @b asset @b field is a single data point taken from a sensor that can be managed by the
40  * AirVantage server.
41  *
42  * A field can be:
43  * - @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.
45  * - @b command allowing the AirVantage server to invoke a function in the App.
46  *
47  * Fields are referred to by paths and need to follow these rules:
48  *
49  * - A parent path @b can't contain a field, parent path or child path that has the same name.
50  * - Paths must be separated by a slash ("/") or a dot (".").
51  * - When using a ("/") the path must start with a ("/") (e.g., /a/b/c)
52  * - When using a (".") the path must start with the first field, (e.g., a.b.c)
53  *
54  * @note There is no leading "." when using "." delimiter.
55  *
56  * Variable and setting fields also have types. The available field types are:
57  * - string
58  * - integer
59  * - float
60  * - boolean
61  *
62  * Variable and setting fields have no default values. When they are first created with the
63  * le_avdata_CreateResource() , all values are "null". They can also be set to "null" values with
64  * the le_avdata_SetNull() .
65  *
66  * Fields do not have a fixed data type, so any of the SetInt/Float/Bool/String can
67  * be called for a certain field to change its value and its type. However, A
68  * GetInt/Float/Bool/String API must be called on a field with the matching type. In other words,
69  * a Get API does not perform type-casting.
70  *
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 set
73  * for the float data type to be zero.
74  *
75  * @section le_avdata_field Field Values and Activity
76  *
77  * Set functions are available to set field values (including "null"). Get functions are
78  * available to get field values.
79  *
80  * An App can register a handler so that it can be called when an activity occurs on a field.
81  * This is optional for variable and setting fields, but is @b required for command fields.
82  * Registered handlers are called only when activities from AV server occurs. Client activities do
83  * not trigger handlers.
84  *
85  * A handler registered with a command field is invoked with an optional argument list sent from the
86  * AirVantage server. The APIs GetInt/Float/Bool/StringArg and le_avdata_GetStringArgLength() are
87  * available to extract the arguments in the handler definition. AV server does not send argument
88  * lists for handlers registered with variable and setting fields.
89  *
90  * A handler registered with a command field must call the le_avdata_ReplyExecResult() at the end of
91  * its definition, in order to reply the command execution result to the AV server.
92  *
93  * Sometimes instead of waiting for activity to occur on a field, users may want to have their
94  * application notify the server of their asset data details. Asset data can also be pushed from
95  * the device to the server by using le_avdata_Push().
96  *
97  * This code sample shows how to push asset data to the server (assuming session is opened)
98  *
99  * @code
100  * static void PushCallbackHandler
101  * (
102  * le_avdata_PushStatus_t status,
103  * void* contextPtr
104  * )
105  * {
106  * if (status == LE_AVDATA_PUSH_SUCCESS)
107  * {
108  * // data pushed successfully
109  * }
110  * }
111  *
112  * COMPONENT_INIT
113  * {
114  * le_result_t result;
115  * result = le_avdata_CreateResource("/livingRoom/sensor1", LE_AVDATA_ACCESS_VARIABLE);
116  * if (result != LE_OK)
117  * {
118  * LE_FATAL("Error in creating livingRoom resource.");
119  * }
120  *
121  * result = le_avdata_SetInt("/livingRoom/sensor1", 5) == LE_OK);
122  * if (result != LE_OK)
123  * {
124  * LE_FATAL("Failed to set value for livingRoom resource.");
125  * }
126  *
127  * le_avdata_Push("/livingRoom/sensor1", PushCallbackHandler, NULL);
128  * }
129  * @endcode
130  *
131  * If users simply want to push a data dump to the server without creating resources,
132  * le_avdata_PushStream() is available.
133  * @note The push stream API has a limit of 20K.
134  *
135  * @code
136  * COMPONENT_INIT
137  * {
138  * int fd = open("data.txt", O_RDONLY);
139  * if (fd == -1)
140  * {
141  * LE_FATAL("Failed to open file.");
142  * }
143  *
144  * // The data dump sent to the server will be display under <Path>
145  * le_avdata_PushStream("<Path>", fd, PushCallbackHandler, NULL);
146  * }
147  * @endcode
148  *
149  * @section le_avdata_namespace Namespace
150  *
151  * By default all asset data paths are created and managed under the application namespace.
152  * Calling @c le_avdata_GetXXX / @c le_avdata_SetXXX/ le_avdata_AddResourceEventHandler() /
153  * le_avdata_Push() with the path "/a/b/c" will search for the "/a/b/c" data under the apps
154  * namespace. In order to query any paths created under an application namespace, user must append
155  * the app name in front of the request on the server side. If creating asset data under application
156  * namespace is not desired, users must call le_avdata_SetNamespace() and set the value to global.
157  * An application that changes its namespace to global will be creating asset data in the global
158  * space. All asset data API will use the last namespace set until the function is called again and
159  * the namespace is set to something new.
160  *
161  * @note Asset data settings are persistent after an application restart or device reboot,
162  * regardless of the namespace used to create it. The asset data settings are restored lazily when
163  * the app or server reads the setting.
164  *
165  * Example:
166  *
167  * @code
168  * #define RESOURCE_A "/test/resourceA"
169  *
170  * COMPONENT_INIT
171  * {
172  * int intVal;
173  * LE_ASSERT(le_avdata_CreateResource(RESOURCE_A, LE_AVDATA_ACCESS_VARIABLE) == LE_OK);
174  * LE_ASSERT(le_avdata_SetInt(RESOURCE_A, 1) == LE_OK);
175  * LE_ASSERT(le_avdata_GetInt(RESOURCE_A, &intVal) == LE_OK);
176  * LE_ASSERT(intVal == 1); // value obtained under the application namespace
177  *
178  * // Switch to global namespace
179  * LE_ASSERT(le_avdata_SetNamespace(LE_AVDATA_NAMESPACE_GLOBAL) == LE_OK);
180  *
181  * LE_ASSERT(le_avdata_CreateResource(RESOURCE_A, LE_AVDATA_ACCESS_VARIABLE) == LE_OK);
182  * LE_ASSERT(le_avdata_SetInt(RESOURCE_A, 2) == LE_OK);
183  * LE_ASSERT(le_avdata_GetInt(RESOURCE_A, &intVal) == LE_OK);
184  * LE_ASSERT(intVal == 2); // value obtained under the global namespace
185  * }
186  * @endcode
187  *
188  * An application starts by creating a path "/test/resourceA" under the default application
189  * namespace and sets it to 1. Then it sets the namespace to global and creates another path
190  * "/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 the
192  * server on a parent node will result in reading multiple resources together. For example, a read
193  * request on "<appName>/test" will result in a response containing relative paths and values of
194  * resourceA and resourceB.
195  *
196  * @section le_avdata_timeseries Time Series
197  *
198  * This feature enables user Apps to collect and keep in memory data when the device is off-line and
199  * send the data to the AirVantage Server when the device is on-line.
200  *
201  * Time series records can be initialized using le_avdata_CreateRecord().
202  * Data can be accumulated using the following data types along with a specified time stamp
203  * (milliseconds elapsed since epoch).
204  * - le_avdata_RecordInt()
205  * - le_avdata_RecordFloat()
206  * - le_avdata_RecordBool()
207  * - le_avdata_RecordString()
208  *
209  * User apps can then open an @c avms session, and push the collected history data using
210  * le_avdata_PushRecord(). The callback used when calling le_avdata_PushRecord() will indicate
211  * whether the push has been successful or not.
212  *
213  * This code sample shows how to collect data and send to the server (assuming session is opened)
214  *
215  * @code
216  *
217  * static void PushCallbackHandler
218  * (
219  * le_avdata_PushStatus_t status,
220  * void* contextPtr
221  * )
222  * {
223  * if (status == LE_AVDATA_PUSH_SUCCESS)
224  * {
225  * // data pushed successfully
226  * }
227  * }
228  *
229  * static void SendData()
230  * {
231  * struct timeval tv;
232  * uint64_t utcMilliSec;
233  * le_result_t result;
234  *
235  * le_avdata_RecordRef_t recRef = le_avdata_CreateRecord();
236  *
237  * gettimeofday(&tv, NULL);
238  * utcMilliSec = (uint64_t)(tv.tv_sec) * 1000 + (uint64_t)(tv.tv_usec) / 1000; // get current time
239  * result = le_avdata_RecordFloat(recRef, "speed", 0.08, utcMilliSec);
240  *
241  * if (result == LE_OK)
242  * {
243  * le_avdata_PushRecord(recRef, PushCallbackHandler, NULL);
244  * }
245  *
246  * le_avdata_DeleteRecord(recRef);
247  * }
248  * @endcode
249  *
250  * @section le_avdata_session User App Session Management
251  *
252  * An App can request to open a session and register a handler to get notified of a session
253  * events. le_avdata_RequestSession() and le_avdata_ReleaseSession() can be used to
254  * open a session and close a session respectively. If the session was initiated by an
255  * user app, the session will be closed when all apps release their session reference.
256  * le_avdata_AddSessionStateHandler() and le_avdata_RemoveSessionStateHandler() can be used to add
257  * and remove notification handlers.
258  *
259  * @section le_avdata_fatal Fatal Behavior
260  *
261  * An invalid asset name or field name is treated as a fatal error (i.e. non-recoverable)
262  * and will result in the client App being terminated.
263  *
264  * @section le_avdata_buffer AV Data Buffer Limitation
265  *
266  * The number of resources that can be read/written together is limited by the buffer size
267  * defined by avc client. There are three buffers that determines how many resources can be
268  * read/written/pushed together.
269  *
270  * - COAP_BLOCK1_SIZE - Determines the number of resource that can be written together
271  * - AVDATA_READ_BUFFER_BYTES - Determines the number of resource that can be read together
272  * - AVDATA_PUSH_BUFFER_BYTES - Determines the number of resource that can be pushed together
273  *
274  * All the buffers are set to 4096 bytes by default. Users can increase the buffer size if an
275  * application needs to operate on a parent path with a large number of resources under it.
276  *
277  * @note Having more than 5000 resources under a parent path is not advisable for
278  * several reasons: If the network is lost or device resets while the payload is being
279  * transferred, the read/write operation will fail and has to be re-triggered. Large number
280  * of settings will also slow down avc startup.
281  *
282  * Copyright (C) Sierra Wireless Inc.
283  */
284 /**
285  * @file le_avdata_interface.h
286  *
287  * Legato @ref c_le_avdata include file.
288  *
289  * Copyright (C) Sierra Wireless Inc.
290  */
291 
292 #ifndef LE_AVDATA_INTERFACE_H_INCLUDE_GUARD
293 #define LE_AVDATA_INTERFACE_H_INCLUDE_GUARD
294 
295 
296 #include "legato.h"
297 
298 
299 //--------------------------------------------------------------------------------------------------
300 /**
301  * Type for handler called when a server disconnects.
302  */
303 //--------------------------------------------------------------------------------------------------
304 typedef void (*le_avdata_DisconnectHandler_t)(void *);
305 
306 //--------------------------------------------------------------------------------------------------
307 /**
308  *
309  * Connect the current client thread to the service providing this API. Block until the service is
310  * available.
311  *
312  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
313  * called before any other functions in this API. Normally, ConnectService is automatically called
314  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
315  *
316  * This function is created automatically.
317  */
318 //--------------------------------------------------------------------------------------------------
320 (
321  void
322 );
323 
324 //--------------------------------------------------------------------------------------------------
325 /**
326  *
327  * Try to connect the current client thread to the service providing this API. Return with an error
328  * if the service is not available.
329  *
330  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
331  * called before any other functions in this API. Normally, ConnectService is automatically called
332  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
333  *
334  * This function is created automatically.
335  *
336  * @return
337  * - LE_OK if the client connected successfully to the service.
338  * - LE_UNAVAILABLE if the server is not currently offering the service to which the client is
339  * bound.
340  * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
341  * - LE_COMM_ERROR if the Service Directory cannot be reached.
342  */
343 //--------------------------------------------------------------------------------------------------
345 (
346  void
347 );
348 
349 //--------------------------------------------------------------------------------------------------
350 /**
351  * Set handler called when server disconnection is detected.
352  *
353  * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants
354  * to continue without exiting, it should call longjmp() from inside the handler.
355  */
356 //--------------------------------------------------------------------------------------------------
358 (
359  le_avdata_DisconnectHandler_t disconnectHandler,
360  void *contextPtr
361 );
362 
363 //--------------------------------------------------------------------------------------------------
364 /**
365  *
366  * Disconnect the current client thread from the service providing this API.
367  *
368  * Normally, this function doesn't need to be called. After this function is called, there's no
369  * longer a connection to the service, and the functions in this API can't be used. For details, see
370  * @ref apiFilesC_client.
371  *
372  * This function is created automatically.
373  */
374 //--------------------------------------------------------------------------------------------------
376 (
377  void
378 );
379 
380 
381 //--------------------------------------------------------------------------------------------------
382 /**
383  * Define the maximum characters and bytes of a path name
384  */
385 //--------------------------------------------------------------------------------------------------
386 #define LE_AVDATA_PATH_NAME_LEN 511
387 
388 //--------------------------------------------------------------------------------------------------
389 /**
390  */
391 //--------------------------------------------------------------------------------------------------
392 #define LE_AVDATA_PATH_NAME_BYTES 512
393 
394 //--------------------------------------------------------------------------------------------------
395 /**
396  * Define the maximum characters and bytes of a string
397  */
398 //--------------------------------------------------------------------------------------------------
399 #define LE_AVDATA_STRING_VALUE_LEN 255
400 
401 //--------------------------------------------------------------------------------------------------
402 /**
403  */
404 //--------------------------------------------------------------------------------------------------
405 #define LE_AVDATA_STRING_VALUE_BYTES 256
406 
407 //--------------------------------------------------------------------------------------------------
408 /**
409  * Resource access modes:
410  * - Variable: read (server), read/write (client)
411  * - Setting: read/write (server), read/write (client)
412  * - Command: execute (server)
413  */
414 //--------------------------------------------------------------------------------------------------
415 typedef enum
416 {
418  ///< read(server) or read/write(client)
420  ///< read/write (server) or read/write (client)
422  ///< execute (server)
423 }
425 
426 
427 //--------------------------------------------------------------------------------------------------
428 /**
429  * Resource access types
430  */
431 //--------------------------------------------------------------------------------------------------
432 typedef enum
433 {
434  LE_AVDATA_ACCESS_READ = 0x1, ///< read access type
435  LE_AVDATA_ACCESS_WRITE = 0x2, ///< write access type
436  LE_AVDATA_ACCESS_EXEC = 0x4 ///< execute access type
437 }
439 
440 
441 //--------------------------------------------------------------------------------------------------
442 /**
443  * Resource namespace
444  */
445 //--------------------------------------------------------------------------------------------------
446 typedef enum
447 {
448  LE_AVDATA_NAMESPACE_APPLICATION = 0,
449  ///<
450  LE_AVDATA_NAMESPACE_GLOBAL = 1
451  ///<
452 }
454 
455 
456 //--------------------------------------------------------------------------------------------------
457 /**
458  * Data types
459  */
460 //--------------------------------------------------------------------------------------------------
461 typedef enum
462 {
464  ///< Null Data Type
466  ///< Integer Data Type
468  ///< Float Data Type
470  ///< Boolean Data Type
472  ///< String Data Type
473 }
475 
476 
477 //--------------------------------------------------------------------------------------------------
478 /**
479  * Status of the data push
480  * @todo Provide additional status to troubleshoot delivery problems
481  */
482 //--------------------------------------------------------------------------------------------------
483 typedef enum
484 {
486  ///< Push was successful
488  ///< Push has failed
489 }
491 
492 
493 //--------------------------------------------------------------------------------------------------
494 /**
495  * Argument list reference, for command only.
496  */
497 //--------------------------------------------------------------------------------------------------
498 typedef struct le_avdata_ArgumentList* le_avdata_ArgumentListRef_t;
499 
500 
501 //--------------------------------------------------------------------------------------------------
502 /**
503  * Reference type used by Add/Remove functions for EVENT 'le_avdata_ResourceEvent'
504  */
505 //--------------------------------------------------------------------------------------------------
506 typedef struct le_avdata_ResourceEventHandler* le_avdata_ResourceEventHandlerRef_t;
507 
508 
509 //--------------------------------------------------------------------------------------------------
510 /**
511  * A record reference
512  */
513 //--------------------------------------------------------------------------------------------------
514 typedef struct le_avdata_Record* le_avdata_RecordRef_t;
515 
516 
517 //--------------------------------------------------------------------------------------------------
518 /**
519  * Reference returned by RequestSession function and used by ReleaseSession function
520  */
521 //--------------------------------------------------------------------------------------------------
522 typedef struct le_avdata_RequestSessionObj* le_avdata_RequestSessionObjRef_t;
523 
524 
525 //--------------------------------------------------------------------------------------------------
526 /**
527  * AVMS session state
528  */
529 //--------------------------------------------------------------------------------------------------
530 typedef enum
531 {
533  ///< AVMS session started
535  ///< AVMS session stopped
536 }
538 
539 
540 //--------------------------------------------------------------------------------------------------
541 /**
542  * Reference type used by Add/Remove functions for EVENT 'le_avdata_SessionState'
543  */
544 //--------------------------------------------------------------------------------------------------
545 typedef struct le_avdata_SessionStateHandler* le_avdata_SessionStateHandlerRef_t;
546 
547 
548 //--------------------------------------------------------------------------------------------------
549 /**
550  * Handler for resource activity. Note that the path returned by this event follows the unix format
551  * (e.g. "/a/b/c") even if the app uses the URL format (e.g "a.b.c") when registering
552  * the handler.
553  */
554 //--------------------------------------------------------------------------------------------------
555 typedef void (*le_avdata_ResourceHandlerFunc_t)
556 (
557  const char* LE_NONNULL path,
558  ///<
559  le_avdata_AccessType_t accessType,
560  ///<
561  le_avdata_ArgumentListRef_t argumentListRef,
562  ///<
563  void* contextPtr
564  ///<
565 );
566 
567 //--------------------------------------------------------------------------------------------------
568 /**
569  * Handler for pushing data result.
570  */
571 //--------------------------------------------------------------------------------------------------
572 typedef void (*le_avdata_CallbackResultFunc_t)
573 (
574  le_avdata_PushStatus_t status,
575  ///<
576  void* contextPtr
577  ///<
578 );
579 
580 //--------------------------------------------------------------------------------------------------
581 /**
582  * Handler for AV session changes
583  */
584 //--------------------------------------------------------------------------------------------------
586 (
587  le_avdata_SessionState_t sessionState,
588  ///< Session started or stopped?
589  void* contextPtr
590  ///<
591 );
592 
593 //--------------------------------------------------------------------------------------------------
594 /**
595  * Add handler function for EVENT 'le_avdata_ResourceEvent'
596  *
597  * Upon resource access on the server side, the registered handler is called.
598  *
599  * For "settings" (read/write), the same handler is called for both read and write access.
600  *
601  * For "commands", the handler function must call the "ReplyExecResult" function to send the command
602  * execution result back to the AVC daemon (which then sends the proper response back to the AV
603  * server).
604  */
605 //--------------------------------------------------------------------------------------------------
607 (
608  const char* LE_NONNULL path,
609  ///< [IN]
611  ///< [IN]
612  void* contextPtr
613  ///< [IN]
614 );
615 
616 //--------------------------------------------------------------------------------------------------
617 /**
618  * Remove handler function for EVENT 'le_avdata_ResourceEvent'
619  */
620 //--------------------------------------------------------------------------------------------------
622 (
624  ///< [IN]
625 );
626 
627 //--------------------------------------------------------------------------------------------------
628 /**
629  * Create an asset data with the provided path. Note that asset data type and value are determined
630  * upon the first call to a Set function. When an asset data is created, it contains a null value,
631  * represented by the data type of none.
632  *
633  * @return:
634  * - LE_OK on success
635  * - LE_DUPLICATE if path has already been called by CreateResource before, or path is parent
636  * or child to an existing Asset Data path.
637  * - LE_FAULT on any other error.
638  */
639 //--------------------------------------------------------------------------------------------------
641 (
642  const char* LE_NONNULL path,
643  ///< [IN]
644  le_avdata_AccessMode_t accessMode
645  ///< [IN]
646 );
647 
648 //--------------------------------------------------------------------------------------------------
649 /**
650  * Sets the namespace for asset data.
651  *
652  * @return:
653  * - LE_OK on success
654  * - LE_BAD_PARAMETER if the namespace is unknown
655  */
656 //--------------------------------------------------------------------------------------------------
658 (
659  le_avdata_Namespace_t _namespace
660  ///< [IN]
661 );
662 
663 //--------------------------------------------------------------------------------------------------
664 /**
665  * Sets an asset data to contain a null value, represented by the data type of none.
666  *
667  * @return:
668  * - LE_NOT_FOUND - if the path is invalid and does not point to an asset data
669  * - LE_NOT_PERMITTED - asset data being accessed does not have the right permission
670  * - LE_OK - access successful.
671  */
672 //--------------------------------------------------------------------------------------------------
674 (
675  const char* LE_NONNULL path
676  ///< [IN]
677 );
678 
679 //--------------------------------------------------------------------------------------------------
680 /**
681  * Gets the integer value of an asset data.
682  *
683  * @return:
684  * - LE_BAD_PARAMETER - asset data being accessed is of the wrong data type
685  * - LE_UNAVAILABLE - asset data contains null value
686  * - LE_NOT_FOUND - if the path is invalid and does not point to an asset data
687  * - LE_NOT_PERMITTED - asset data being accessed does not have the right permission
688  * - LE_OK - access successful.
689  */
690 //--------------------------------------------------------------------------------------------------
692 (
693  const char* LE_NONNULL path,
694  ///< [IN]
695  int32_t* valuePtr
696  ///< [OUT]
697 );
698 
699 //--------------------------------------------------------------------------------------------------
700 /**
701  * Sets an asset data to an integer value.
702  *
703  * @return:
704  * - LE_NOT_FOUND - if the path is invalid and does not point to an asset data
705  * - LE_NOT_PERMITTED - asset data being accessed does not have the right permission
706  * - LE_OK - access successful.
707  */
708 //--------------------------------------------------------------------------------------------------
710 (
711  const char* LE_NONNULL path,
712  ///< [IN]
713  int32_t value
714  ///< [IN]
715 );
716 
717 //--------------------------------------------------------------------------------------------------
718 /**
719  * Gets the float value of an asset data.
720  *
721  * @return:
722  * - LE_BAD_PARAMETER - asset data being accessed is of the wrong data type
723  * - LE_UNAVAILABLE - asset data contains null value
724  * - LE_NOT_FOUND - if the path is invalid and does not point to an asset data
725  * - LE_NOT_PERMITTED - asset data being accessed does not have the right permission
726  * - LE_OK - access successful.
727  */
728 //--------------------------------------------------------------------------------------------------
730 (
731  const char* LE_NONNULL path,
732  ///< [IN]
733  double* valuePtr
734  ///< [OUT]
735 );
736 
737 //--------------------------------------------------------------------------------------------------
738 /**
739  * Sets an asset data to a float value.
740  *
741  * @return:
742  * - LE_NOT_FOUND - if the path is invalid and does not point to an asset data
743  * - LE_NOT_PERMITTED - asset data being accessed does not have the right permission
744  * - LE_OK - access successful.
745  */
746 //--------------------------------------------------------------------------------------------------
748 (
749  const char* LE_NONNULL path,
750  ///< [IN]
751  double value
752  ///< [IN]
753 );
754 
755 //--------------------------------------------------------------------------------------------------
756 /**
757  * Gets the bool value of an asset data.
758  *
759  * @return:
760  * - LE_BAD_PARAMETER - asset data being accessed is of the wrong data type
761  * - LE_UNAVAILABLE - asset data contains null value
762  * - LE_NOT_FOUND - if the path is invalid and does not point to an asset data
763  * - LE_NOT_PERMITTED - asset data being accessed does not have the right permission
764  * - LE_OK - access successful.
765  */
766 //--------------------------------------------------------------------------------------------------
768 (
769  const char* LE_NONNULL path,
770  ///< [IN]
771  bool* valuePtr
772  ///< [OUT]
773 );
774 
775 //--------------------------------------------------------------------------------------------------
776 /**
777  * Sets an asset data to a bool value.
778  *
779  * @return:
780  * - LE_NOT_FOUND - if the path is invalid and does not point to an asset data
781  * - LE_NOT_PERMITTED - asset data being accessed does not have the right permission
782  * - LE_OK - access successful.
783  */
784 //--------------------------------------------------------------------------------------------------
786 (
787  const char* LE_NONNULL path,
788  ///< [IN]
789  bool value
790  ///< [IN]
791 );
792 
793 //--------------------------------------------------------------------------------------------------
794 /**
795  * Gets the string value of an asset data.
796  *
797  * @return:
798  * - LE_BAD_PARAMETER - asset data being accessed is of the wrong data type
799  * - LE_UNAVAILABLE - asset data contains null value
800  * - LE_NOT_FOUND - if the path is invalid and does not point to an asset data
801  * - LE_NOT_PERMITTED - asset data being accessed does not have the right permission
802  * - LE_OVERFLOW - asset data length exceeds the maximum length
803  * - LE_OK - access successful
804  */
805 //--------------------------------------------------------------------------------------------------
807 (
808  const char* LE_NONNULL path,
809  ///< [IN]
810  char* value,
811  ///< [OUT]
812  size_t valueSize
813  ///< [IN]
814 );
815 
816 //--------------------------------------------------------------------------------------------------
817 /**
818  * Sets an asset data to a string value.
819  *
820  * @return:
821  * - LE_NOT_FOUND - if the path is invalid and does not point to an asset data
822  * - LE_NOT_PERMITTED - asset data being accessed does not have the right permission
823  * - LE_OK - access successful.
824  */
825 //--------------------------------------------------------------------------------------------------
827 (
828  const char* LE_NONNULL path,
829  ///< [IN]
830  const char* LE_NONNULL value
831  ///< [IN]
832 );
833 
834 //--------------------------------------------------------------------------------------------------
835 /**
836  * Get the bool argument with the specified name.
837  *
838  * @return:
839  * - LE_OK on success
840  * - LE_NOT_FOUND if argument doesn't exist, or its data type doesn't match the API.
841  */
842 //--------------------------------------------------------------------------------------------------
844 (
845  le_avdata_ArgumentListRef_t argumentListRef,
846  ///< [IN]
847  const char* LE_NONNULL argName,
848  ///< [IN]
849  bool* boolArgPtr
850  ///< [OUT]
851 );
852 
853 //--------------------------------------------------------------------------------------------------
854 /**
855  * Get the float argument with the specified name.
856  *
857  * @return:
858  * - LE_OK on success
859  * - LE_NOT_FOUND if argument doesn't exist, or its data type doesn't match the API.
860  */
861 //--------------------------------------------------------------------------------------------------
863 (
864  le_avdata_ArgumentListRef_t argumentListRef,
865  ///< [IN]
866  const char* LE_NONNULL argName,
867  ///< [IN]
868  double* floatArgPtr
869  ///< [OUT]
870 );
871 
872 //--------------------------------------------------------------------------------------------------
873 /**
874  * Get the int argument with the specified name.
875  *
876  * @return:
877  * - LE_OK on success
878  * - LE_NOT_FOUND if argument doesn't exist, or its data type doesn't match the API.
879  */
880 //--------------------------------------------------------------------------------------------------
882 (
883  le_avdata_ArgumentListRef_t argumentListRef,
884  ///< [IN]
885  const char* LE_NONNULL argName,
886  ///< [IN]
887  int32_t* intArgPtr
888  ///< [OUT]
889 );
890 
891 //--------------------------------------------------------------------------------------------------
892 /**
893  * Get the string argument with the specified name.
894  *
895  * @return:
896  * - LE_OK on success
897  * - LE_NOT_FOUND if argument doesn't exist, or its data type doesn't match the API
898  * - LE_OVERFLOW - argument length exceeds the maximum length
899  */
900 //--------------------------------------------------------------------------------------------------
902 (
903  le_avdata_ArgumentListRef_t argumentListRef,
904  ///< [IN]
905  const char* LE_NONNULL argName,
906  ///< [IN]
907  char* strArg,
908  ///< [OUT]
909  size_t strArgSize
910  ///< [IN]
911 );
912 
913 //--------------------------------------------------------------------------------------------------
914 /**
915  * Get the length (excluding terminating null byte) of the string argument of the specified name.
916  *
917  * @return:
918  * - LE_OK on success
919  * - LE_NOT_FOUND if argument doesn't exist, or its data type doesn't match the API.
920  */
921 //--------------------------------------------------------------------------------------------------
923 (
924  le_avdata_ArgumentListRef_t argumentListRef,
925  ///< [IN]
926  const char* LE_NONNULL argName,
927  ///< [IN]
928  int32_t* strArgLenPtr
929  ///< [OUT]
930 );
931 
932 //--------------------------------------------------------------------------------------------------
933 /**
934  * Reply command execution result to AVC Daemon, which can then respond to AV server. This function
935  * MUST be called at the end of a command execution, in order for AV server to be notified about the
936  * execution status.
937  */
938 //--------------------------------------------------------------------------------------------------
940 (
941  le_avdata_ArgumentListRef_t argumentListRef,
942  ///< [IN]
943  le_result_t result
944  ///< [IN]
945 );
946 
947 //--------------------------------------------------------------------------------------------------
948 /**
949  * Push asset data to the server.
950  *
951  * @return:
952  * - LE_OK on success
953  * - LE_NOT_FOUND if the provided path doesn't exist
954  * - LE_BUSY if push service is busy. Data added to queue list for later push
955  * - LE_OVERFLOW if data size exceeds the maximum allowed size
956  * - LE_NO_MEMORY if push queue is full, try again later
957  * - LE_FAULT on any other error
958  */
959 //--------------------------------------------------------------------------------------------------
961 (
962  const char* LE_NONNULL path,
963  ///< [IN]
965  ///< [IN]
966  void* contextPtr
967  ///< [IN]
968 );
969 
970 //--------------------------------------------------------------------------------------------------
971 /**
972  * Push data dump to a specified path on the server.
973  *
974  * @return:
975  * - LE_OK on success
976  * - LE_BUSY if push service is busy. Data added to queue list for later push
977  * - LE_OVERFLOW if data size exceeds the maximum allowed size
978  * - LE_NO_MEMORY if push queue is full, try again later
979  * - LE_FAULT on any other error
980  */
981 //--------------------------------------------------------------------------------------------------
983 (
984  const char* LE_NONNULL path,
985  ///< [IN]
986  int fd,
987  ///< [IN]
989  ///< [IN]
990  void* contextPtr
991  ///< [IN]
992 );
993 
994 //--------------------------------------------------------------------------------------------------
995 /**
996  * Create a timeseries record
997  *
998  * @return Reference to the record
999  */
1000 //--------------------------------------------------------------------------------------------------
1002 (
1003  void
1004 );
1005 
1006 //--------------------------------------------------------------------------------------------------
1007 /**
1008  * Delete a timeseries record
1009  */
1010 //--------------------------------------------------------------------------------------------------
1012 (
1013  le_avdata_RecordRef_t recordRef
1014  ///< [IN]
1015 );
1016 
1017 //--------------------------------------------------------------------------------------------------
1018 /**
1019  * Accumulate int data
1020  *
1021  * @note The client will be terminated if the recordRef is not valid, or the resource doesn't exist
1022  *
1023  * @return:
1024  * - LE_OK on success
1025  * - LE_NO_MEMORY if the current entry was NOT added because the time series buffer is full.
1026  * - LE_FAULT on any other error
1027  */
1028 //--------------------------------------------------------------------------------------------------
1030 (
1031  le_avdata_RecordRef_t recordRef,
1032  ///< [IN]
1033  const char* LE_NONNULL path,
1034  ///< [IN]
1035  int32_t value,
1036  ///< [IN]
1037  uint64_t timestamp
1038  ///< [IN]
1039 );
1040 
1041 //--------------------------------------------------------------------------------------------------
1042 /**
1043  * Accumulate float data
1044  *
1045  * @note The client will be terminated if the recordRef is not valid, or the resource doesn't exist
1046  *
1047  * @return:
1048  * - LE_OK on success
1049  * - LE_NO_MEMORY if the current entry was NOT added because the time series buffer is full.
1050  * - LE_FAULT on any other error
1051  */
1052 //--------------------------------------------------------------------------------------------------
1054 (
1055  le_avdata_RecordRef_t recordRef,
1056  ///< [IN]
1057  const char* LE_NONNULL path,
1058  ///< [IN]
1059  double value,
1060  ///< [IN]
1061  uint64_t timestamp
1062  ///< [IN]
1063 );
1064 
1065 //--------------------------------------------------------------------------------------------------
1066 /**
1067  * Accumulate boolean data
1068  *
1069  * @note The client will be terminated if the recordRef is not valid, or the resource doesn't exist
1070  *
1071  * @return:
1072  * - LE_OK on success
1073  * - LE_NO_MEMORY if the current entry was NOT added because the time series buffer is full.
1074  * - LE_FAULT on any other error
1075  */
1076 //--------------------------------------------------------------------------------------------------
1078 (
1079  le_avdata_RecordRef_t recordRef,
1080  ///< [IN]
1081  const char* LE_NONNULL path,
1082  ///< [IN]
1083  bool value,
1084  ///< [IN]
1085  uint64_t timestamp
1086  ///< [IN]
1087 );
1088 
1089 //--------------------------------------------------------------------------------------------------
1090 /**
1091  * Accumulate string data
1092  *
1093  * @note The client will be terminated if the recordRef is not valid, or the resource doesn't exist
1094  *
1095  * @return:
1096  * - LE_OK on success
1097  * - LE_NO_MEMORY if the current entry was NOT added because the time series buffer is full.
1098  * - LE_FAULT on any other error
1099  */
1100 //--------------------------------------------------------------------------------------------------
1102 (
1103  le_avdata_RecordRef_t recordRef,
1104  ///< [IN]
1105  const char* LE_NONNULL path,
1106  ///< [IN]
1107  const char* LE_NONNULL value,
1108  ///< [IN]
1109  uint64_t timestamp
1110  ///< [IN]
1111 );
1112 
1113 //--------------------------------------------------------------------------------------------------
1114 /**
1115  * Push record to the server
1116  *
1117  ** @return:
1118  * - LE_OK on success
1119  * - LE_BUSY if push service is busy. Data added to queue list for later push
1120  * - LE_OVERFLOW if data size exceeds the maximum allowed size
1121  * - LE_NO_MEMORY if push queue is full, try again later
1122  * - LE_FAULT on any other error
1123  *
1124  * * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
1125  * function will not return.
1126  */
1127 //--------------------------------------------------------------------------------------------------
1129 (
1130  le_avdata_RecordRef_t recordRef,
1131  ///< [IN]
1132  le_avdata_CallbackResultFunc_t handlerPtr,
1133  ///< [IN]
1134  void* contextPtr
1135  ///< [IN]
1136 );
1137 
1138 //--------------------------------------------------------------------------------------------------
1139 /**
1140  * Add handler function for EVENT 'le_avdata_SessionState'
1141  *
1142  * This event provides information on AV session state changes
1143  */
1144 //--------------------------------------------------------------------------------------------------
1146 (
1148  ///< [IN]
1149  void* contextPtr
1150  ///< [IN]
1151 );
1152 
1153 //--------------------------------------------------------------------------------------------------
1154 /**
1155  * Remove handler function for EVENT 'le_avdata_SessionState'
1156  */
1157 //--------------------------------------------------------------------------------------------------
1159 (
1161  ///< [IN]
1162 );
1163 
1164 //--------------------------------------------------------------------------------------------------
1165 /**
1166  * Request the avcServer to open a session.
1167  *
1168  * @return
1169  * - SessionRef if session request succeeded
1170  * - NULL if session request failed
1171  */
1172 //--------------------------------------------------------------------------------------------------
1174 (
1175  void
1176 );
1177 
1178 //--------------------------------------------------------------------------------------------------
1179 /**
1180  * Request the avcServer to close a session.
1181  *
1182  */
1183 //--------------------------------------------------------------------------------------------------
1185 (
1187  ///< [IN] Reference to a previously opened AV session.
1188 );
1189 
1190 #endif // LE_AVDATA_INTERFACE_H_INCLUDE_GUARD
le_result_t le_avdata_PushStream(const char *LE_NONNULL path, int fd, le_avdata_CallbackResultFunc_t handlerPtr, void *contextPtr)
void(* le_avdata_CallbackResultFunc_t)(le_avdata_PushStatus_t status, void *contextPtr)
Definition: le_avdata_interface.h:573
le_result_t le_avdata_GetInt(const char *LE_NONNULL path, int32_t *valuePtr)
Push was successful.
Definition: le_avdata_interface.h:485
le_avdata_AccessMode_t
Definition: le_avdata_interface.h:415
void(* le_avdata_SessionStateHandlerFunc_t)(le_avdata_SessionState_t sessionState, void *contextPtr)
Definition: le_avdata_interface.h:586
le_result_t le_avdata_GetFloat(const char *LE_NONNULL path, double *valuePtr)
le_result_t le_avdata_CreateResource(const char *LE_NONNULL path, le_avdata_AccessMode_t accessMode)
le_result_t
Definition: le_basics.h:35
le_result_t le_avdata_RecordFloat(le_avdata_RecordRef_t recordRef, const char *LE_NONNULL path, double value, uint64_t timestamp)
Push has failed.
Definition: le_avdata_interface.h:487
execute (server)
Definition: le_avdata_interface.h:421
le_result_t le_avdata_SetNull(const char *LE_NONNULL path)
le_avdata_SessionStateHandlerRef_t le_avdata_AddSessionStateHandler(le_avdata_SessionStateHandlerFunc_t handlerPtr, void *contextPtr)
read(server) or read/write(client)
Definition: le_avdata_interface.h:417
void le_avdata_ReleaseSession(le_avdata_RequestSessionObjRef_t requestRef)
struct le_avdata_RequestSessionObj * le_avdata_RequestSessionObjRef_t
Definition: le_avdata_interface.h:522
void le_avdata_RemoveResourceEventHandler(le_avdata_ResourceEventHandlerRef_t handlerRef)
le_result_t le_avdata_RecordString(le_avdata_RecordRef_t recordRef, const char *LE_NONNULL path, const char *LE_NONNULL value, uint64_t timestamp)
Null Data Type.
Definition: le_avdata_interface.h:463
Boolean Data Type.
Definition: le_avdata_interface.h:469
void le_avdata_DisconnectService(void)
le_result_t le_avdata_GetBool(const char *LE_NONNULL path, bool *valuePtr)
le_result_t le_avdata_PushRecord(le_avdata_RecordRef_t recordRef, le_avdata_CallbackResultFunc_t handlerPtr, void *contextPtr)
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)
String Data Type.
Definition: le_avdata_interface.h:471
le_result_t le_avdata_GetStringArgLength(le_avdata_ArgumentListRef_t argumentListRef, const char *LE_NONNULL argName, int32_t *strArgLenPtr)
le_avdata_RequestSessionObjRef_t le_avdata_RequestSession(void)
void(* le_avdata_DisconnectHandler_t)(void *)
Definition: le_avdata_interface.h:304
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_RecordInt(le_avdata_RecordRef_t recordRef, const char *LE_NONNULL path, int32_t value, uint64_t timestamp)
Float Data Type.
Definition: le_avdata_interface.h:467
le_result_t le_avdata_RecordBool(le_avdata_RecordRef_t recordRef, const char *LE_NONNULL path, bool value, uint64_t timestamp)
le_avdata_AccessType_t
Definition: le_avdata_interface.h:432
void le_avdata_ConnectService(void)
le_avdata_DataType_t
Definition: le_avdata_interface.h:461
le_avdata_SessionState_t
Definition: le_avdata_interface.h:530
le_result_t le_avdata_GetString(const char *LE_NONNULL path, char *value, size_t valueSize)
le_result_t le_avdata_GetStringArg(le_avdata_ArgumentListRef_t argumentListRef, const char *LE_NONNULL argName, char *strArg, size_t strArgSize)
struct le_avdata_ResourceEventHandler * le_avdata_ResourceEventHandlerRef_t
Definition: le_avdata_interface.h:506
le_result_t le_avdata_TryConnectService(void)
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_interface.h:556
void le_avdata_SetServerDisconnectHandler(le_avdata_DisconnectHandler_t disconnectHandler, void *contextPtr)
le_result_t le_avdata_SetFloat(const char *LE_NONNULL path, double value)
AVMS session started.
Definition: le_avdata_interface.h:532
write access type
Definition: le_avdata_interface.h:435
le_result_t le_avdata_GetFloatArg(le_avdata_ArgumentListRef_t argumentListRef, const char *LE_NONNULL argName, double *floatArgPtr)
struct le_avdata_SessionStateHandler * le_avdata_SessionStateHandlerRef_t
Definition: le_avdata_interface.h:545
le_avdata_Namespace_t
Definition: le_avdata_interface.h:446
struct le_avdata_ArgumentList * le_avdata_ArgumentListRef_t
Definition: le_avdata_interface.h:498
le_result_t le_avdata_SetNamespace(le_avdata_Namespace_t _namespace)
struct le_avdata_Record * le_avdata_RecordRef_t
Definition: le_avdata_interface.h:514
le_avdata_ResourceEventHandlerRef_t le_avdata_AddResourceEventHandler(const char *LE_NONNULL path, le_avdata_ResourceHandlerFunc_t handlerPtr, void *contextPtr)
AVMS session stopped.
Definition: le_avdata_interface.h:534
le_avdata_PushStatus_t
Definition: le_avdata_interface.h:483
execute access type
Definition: le_avdata_interface.h:436
le_result_t le_avdata_GetIntArg(le_avdata_ArgumentListRef_t argumentListRef, const char *LE_NONNULL argName, int32_t *intArgPtr)
read access type
Definition: le_avdata_interface.h:434
le_result_t le_avdata_SetInt(const char *LE_NONNULL path, int32_t value)
le_avdata_RecordRef_t le_avdata_CreateRecord(void)
void le_avdata_DeleteRecord(le_avdata_RecordRef_t recordRef)
Integer Data Type.
Definition: le_avdata_interface.h:465
le_result_t le_avdata_SetBool(const char *LE_NONNULL path, bool value)
read/write (server) or read/write (client)
Definition: le_avdata_interface.h:419
void le_avdata_RemoveSessionStateHandler(le_avdata_SessionStateHandlerRef_t handlerRef)