le_avdata_interface.h

Go to the documentation of this file.
1 /*
2  * ====================== WARNING ======================
3  *
4  * THE CONTENTS OF THIS FILE HAVE BEEN AUTO-GENERATED.
5  * DO NOT MODIFY IN ANY WAY.
6  *
7  * ====================== WARNING ======================
8  */
9 
10 /**
11  * @page c_le_avdata AirVantage Data
12  *
13  * @ref le_avdata_interface.h "API Reference" <br>
14  * @ref howToAVData "How To Manage Data"
15  *
16  * <HR>
17  *
18  * This API provides a data service to allow apps to manage app-specific
19  * data on the AirVantage server.
20  *
21  * Data is setup as @b assets &mdash; a collection of fields that can be managed by the AirVantage
22  * server.
23  *
24  * An asset field is a single piece of information that can be managed by the AirVantage server.
25  * There can be multiple fields in an asset.
26  *
27  * A field can be:
28  * - @c variable allows an app to set the value, and can be read from the AV server.
29  * - @c setting allows the AV server to set the value, and can be read by an app.
30  * - @c command allows the AV server to invoke a command or function in the app.
31  *
32  * All fields have names. Variable and setting fields also have a type. The possible field types,
33  * along with the default value are:
34  * - string (empty string)
35  * - integer (0)
36  * - float (0.0)
37  * - boolean (false)
38  * - binary (zero-length block).
39  *
40  * Default values can be overwritten in the asset definition. Currently, string, integer, float
41  * and boolean fields are supported; binary fields will be supported in the future.
42  *
43  *
44  * @section le_avdata_instance Asset Data Instances
45  *
46  * An app that needs to send data to the AirVantage server must first create an asset instance
47  * using le_avc_Create() with the name of the asset definition.
48  * Once an asset instance is created, the app can begin accessing the instance's fields.
49  *
50  * Multiple instances of the same asset can be created, as well as multiple instances of different
51  * assets.
52  *
53  * Asset definitions are specified in the @ref defFilesCdef_assets section of the app's @c cdef file.
54  *
55  * @section le_avdata_field Field Values and Activity
56  *
57  * Set functions are available to set variable field values. Get functions are
58  * available to get settings fields' values.
59  *
60  * An app can register a handler so that it can be called when activity occurs on a field.
61  * This is optional for variable and setting fields, but is required for command fields.
62  * - @c variable called when the field is read by the AV server. The
63  * app can then call the appropriate set function to provide a new value for the field.
64  * - @c setting called when the field has been updated by the AV server
65  * with a new value. The app can use the appropriate get function to retrieve the new value.
66  * - @c command called when the AV server wants to invoke a command. The
67  * app should perform an appropriate action or call a function to execute this command.
68  *
69  * Read action handlers are only called when the server performs the read on a specific
70  * field of an asset instance. i.e, a handler registered on a variable field will
71  * be called if the server reads only that field; it will not be called when the server
72  * reads the whole instance of an asset. Write action handlers are called on write
73  * to asset instance or individual fields.
74  *
75  * An app can request to open avms session and register a handler to get notified of avms session
76  * events. le_avdata_RequestSession() and le_avdata_ReleaseSession() can be used to
77  * open an avms session and close an avms session respectively. If the session was initiated by an
78  * user app, avms session will be closed when all apps release their session reference.
79  * le_avdata_AddSessionStateHandler() and le_avdata_RemoveSessionStateHandler() can be used to add
80  * and remove notification handlers.
81  *
82  * Leaving it optional to register handlers for variable and setting fields allows an
83  * app to decide how it wants to access variable and setting fields. It can decide to
84  * only do something in response to the AV server, or it can work independently of the AV server
85  * updating variables when it has a new value, and reading settings only when it needs the value.
86  *
87  * @section le_avdata_observe Observe
88  *
89  * If the @ref howToAVData_enableObserve "Observe" is enabled, the AirVantage Server will send
90  * observe requests on all user-defined assets of an app.
91  *
92  * Whenever an app (asset) changes a field value by using le_avdata_Set*(), it'll trigger a
93  * notify if Observe is enabled on that asset. The notify contains only the value of the changed
94  * field.
95  *
96  * @section le_avdata_timeseries Time Series
97  *
98  * Time series is an AirVantage-specific LWM2M feature built on top of LWM2M Observe.
99  * This feature enables user apps to collect sensor data when the device is offline. You control
100  * starting and stopping time series data on a resource through the user app.
101  * le_avdata_StartTimeSeries() starts time series data on a resource, and le_avdata_StopTimeSeries()
102  * stops collecting time series data on a resource. User apps can open an @c avms session, and push the
103  * collected history data using le_avdata_PushTimeSeries().
104  *
105  * The buffer size allocated for history data per resource is 1024 bytes. Bytes transmitted
106  * over the air can be reduced by choosing an appropriate factor. For example, if the sampled
107  * integer data is a multiple of 1000, the encoded data will be smaller if a factor of 0.001 is
108  * used. For float fields, if a factor other than 1 is used, the data will be encoded as integer to save
109  * bytes transported over the air. For example, if the resolution of float data is 0.01, a factor of
110  * 100 can be used to represent .01 as 1, and encoding this as integer thus saving memory.
111  *
112  * @note System time is used as timestamp for history data in le_avdata_Set*(). It's up to the
113  * target device administrator to ensure system time is up-to-date before starting time series.
114  * Alternatively, le_avdata_Record*() can be used to pass a user-specified timestamp.
115  *
116  * le_avdata_RecordInt(), le_avdata_RecordFloat(), le_avdata_RecordBool() and
117  * le_avdata_RecordString() can be used to pass an user specified time stamp. The user specified
118  * time stamp must be in milli seconds elapsed since epoch.
119  *
120  * @note Observe has to be enabled on the resource before time series can be pushed out. User apps can
121  * use le_avdata_IsObserve() to know if Observe is enabled on a resource.
122  *
123  * @note LEGATO_FEATURE_TIMESERIES is enabled by default for all WP products. The time series
124  * feature depends on the cbor libraries in yocto. Hence, yocto image has to
125  * be updated on the device together with the legato image. Users who want to update
126  * legato only without the Yocto image should turn off time series in targetdefs.
127  *
128  * @section le_avdata_fatal Fatal Behavior
129  *
130  * An invalid asset name or field name is treated as a fatal error (i.e. non-recoverable)
131  * and will result in the client app being terminated.
132  *
133  * <HR>
134  *
135  * Copyright (C) Sierra Wireless Inc. Use of this work is subject to license.
136  */
137 /**
138  * @file le_avdata_interface.h
139  *
140  * Legato @ref c_le_avdata include file.
141  *
142  * Copyright (C) Sierra Wireless Inc. Use of this work is subject to license.
143  */
144 
145 #ifndef LE_AVDATA_INTERFACE_H_INCLUDE_GUARD
146 #define LE_AVDATA_INTERFACE_H_INCLUDE_GUARD
147 
148 
149 #include "legato.h"
150 
151 //--------------------------------------------------------------------------------------------------
152 /**
153  *
154  * Connect the current client thread to the service providing this API. Block until the service is
155  * available.
156  *
157  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
158  * called before any other functions in this API. Normally, ConnectService is automatically called
159  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
160  *
161  * This function is created automatically.
162  */
163 //--------------------------------------------------------------------------------------------------
165 (
166  void
167 );
168 
169 //--------------------------------------------------------------------------------------------------
170 /**
171  *
172  * Try to connect the current client thread to the service providing this API. Return with an error
173  * if the service is not available.
174  *
175  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
176  * called before any other functions in this API. Normally, ConnectService is automatically called
177  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
178  *
179  * This function is created automatically.
180  *
181  * @return
182  * - LE_OK if the client connected successfully to the service.
183  * - LE_UNAVAILABLE if the server is not currently offering the service to which the client is bound.
184  * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
185  * - LE_COMM_ERROR if the Service Directory cannot be reached.
186  */
187 //--------------------------------------------------------------------------------------------------
189 (
190  void
191 );
192 
193 //--------------------------------------------------------------------------------------------------
194 /**
195  *
196  * Disconnect the current client thread from the service providing this API.
197  *
198  * Normally, this function doesn't need to be called. After this function is called, there's no
199  * longer a connection to the service, and the functions in this API can't be used. For details, see
200  * @ref apiFilesC_client.
201  *
202  * This function is created automatically.
203  */
204 //--------------------------------------------------------------------------------------------------
206 (
207  void
208 );
209 
210 
211 //--------------------------------------------------------------------------------------------------
212 /**
213  * An asset data instance reference
214  */
215 //--------------------------------------------------------------------------------------------------
216 typedef struct le_avdata_AssetInstance* le_avdata_AssetInstanceRef_t;
217 
218 
219 //--------------------------------------------------------------------------------------------------
220 /**
221  * Reference returned by RequestSession function and used by ReleaseSession function
222  */
223 //--------------------------------------------------------------------------------------------------
224 typedef struct le_avdata_RequestSessionObj* le_avdata_RequestSessionObjRef_t;
225 
226 
227 //--------------------------------------------------------------------------------------------------
228 /**
229  * Define the maximum length of an asset name (TODO: verify value)
230  */
231 //--------------------------------------------------------------------------------------------------
232 #define LE_AVDATA_ASSET_NAME_LEN 47
233 
234 
235 //--------------------------------------------------------------------------------------------------
236 /**
237  * Define the maximum length of a field name (TODO: verify value)
238  */
239 //--------------------------------------------------------------------------------------------------
240 #define LE_AVDATA_FIELD_NAME_LEN 47
241 
242 
243 //--------------------------------------------------------------------------------------------------
244 /**
245  * Define the maximum length of a string field (TODO: verify value)
246  */
247 //--------------------------------------------------------------------------------------------------
248 #define LE_AVDATA_STRING_VALUE_LEN 255
249 
250 
251 //--------------------------------------------------------------------------------------------------
252 /**
253  * Define the maximum length of a binary data field (TODO: verify value)
254  */
255 //--------------------------------------------------------------------------------------------------
256 #define LE_AVDATA_BINARY_VALUE_LEN 255
257 
258 
259 //--------------------------------------------------------------------------------------------------
260 /**
261  * AVMS session state
262  */
263 //--------------------------------------------------------------------------------------------------
264 typedef enum
265 {
267  ///< AVMS session started
268 
270  ///< AVMS session stopped
271 }
273 
274 
275 //--------------------------------------------------------------------------------------------------
276 /**
277  * Reference type used by Add/Remove functions for EVENT 'le_avdata_FieldEvent'
278  */
279 //--------------------------------------------------------------------------------------------------
280 typedef struct le_avdata_FieldEventHandler* le_avdata_FieldEventHandlerRef_t;
281 
282 
283 //--------------------------------------------------------------------------------------------------
284 /**
285  * Reference type used by Add/Remove functions for EVENT 'le_avdata_SessionState'
286  */
287 //--------------------------------------------------------------------------------------------------
288 typedef struct le_avdata_SessionStateHandler* le_avdata_SessionStateHandlerRef_t;
289 
290 
291 //--------------------------------------------------------------------------------------------------
292 /**
293  * Handler for field activity
294  *
295  * @param instRef
296  * @param fieldName
297  * @param contextPtr
298  */
299 //--------------------------------------------------------------------------------------------------
300 typedef void (*le_avdata_FieldHandlerFunc_t)
301 (
303  const char* fieldName,
304  void* contextPtr
305 );
306 
307 
308 //--------------------------------------------------------------------------------------------------
309 /**
310  * Handler for AV session changes
311  *
312  * @param sessionState
313  * Session started or stopped?
314  * @param contextPtr
315  */
316 //--------------------------------------------------------------------------------------------------
318 (
319  le_avdata_SessionState_t sessionState,
320  void* contextPtr
321 );
322 
323 //--------------------------------------------------------------------------------------------------
324 /**
325  * Add handler function for EVENT 'le_avdata_FieldEvent'
326  *
327  * This event provides information on field activity
328  */
329 //--------------------------------------------------------------------------------------------------
331 (
333  ///< [IN]
334 
335  const char* fieldName,
336  ///< [IN]
337 
338  le_avdata_FieldHandlerFunc_t handlerPtr,
339  ///< [IN]
340 
341  void* contextPtr
342  ///< [IN]
343 );
344 
345 //--------------------------------------------------------------------------------------------------
346 /**
347  * Remove handler function for EVENT 'le_avdata_FieldEvent'
348  */
349 //--------------------------------------------------------------------------------------------------
351 (
353  ///< [IN]
354 );
355 
356 //--------------------------------------------------------------------------------------------------
357 /**
358  * Create an instance of AirVantage asset
359  *
360  * @return Reference to the asset instance
361  *
362  * @note It is a fatal error if the asset isn't defined.
363  */
364 //--------------------------------------------------------------------------------------------------
366 (
367  const char* assetName
368  ///< [IN]
369 );
370 
371 //--------------------------------------------------------------------------------------------------
372 /**
373  * Delete an instance of AirVantage asset
374  *
375  * @note It's a fatal error if the instRef isn't valid
376  */
377 //--------------------------------------------------------------------------------------------------
378 void le_avdata_Delete
379 (
381  ///< [IN]
382 );
383 
384 //--------------------------------------------------------------------------------------------------
385 /**
386  * Get the value of an integer setting field
387  *
388  * @note The client will be terminated if the instRef is not valid, or the field doesn't exist
389  */
390 //--------------------------------------------------------------------------------------------------
391 void le_avdata_GetInt
392 (
394  ///< [IN]
395 
396  const char* fieldName,
397  ///< [IN]
398 
399  int32_t* valuePtr
400  ///< [OUT]
401 );
402 
403 //--------------------------------------------------------------------------------------------------
404 /**
405  * Set the value of an integer variable field
406  *
407  * @note The client will be terminated if the instRef is not valid, or the field doesn't exist
408  *
409  * @return:
410  * - LE_OK on success
411  * - LE_OVERFLOW if the current entry was NOT added as the time series buffer is full.
412  * (This error is applicable only if time series is enabled on this field)
413  * - LE_NO_MEMORY if the current entry was added but there is no space for next one.
414  * (This error is applicable only if time series is enabled on this field)
415  * - LE_FAULT on any other error
416  */
417 //--------------------------------------------------------------------------------------------------
419 (
421  ///< [IN]
422 
423  const char* fieldName,
424  ///< [IN]
425 
426  int32_t value
427  ///< [IN]
428 );
429 
430 //--------------------------------------------------------------------------------------------------
431 /**
432  * Get the value of a float setting field
433  *
434  * @note The client will be terminated if the instRef is not valid, or the field doesn't exist
435  */
436 //--------------------------------------------------------------------------------------------------
438 (
440  ///< [IN]
441 
442  const char* fieldName,
443  ///< [IN]
444 
445  double* valuePtr
446  ///< [OUT]
447 );
448 
449 //--------------------------------------------------------------------------------------------------
450 /**
451  * Set the value of a float variable field
452  *
453  * @note The client will be terminated if the instRef is not valid, or the field doesn't exist
454  *
455  * @return:
456  * - LE_OK on success
457  * - LE_OVERFLOW if the current entry was NOT added as the time series buffer is full.
458  * (This error is applicable only if time series is enabled on this field)
459  * - LE_NO_MEMORY if the current entry was added but there is no space for next one.
460  * (This error is applicable only if time series is enabled on this field)
461  * - LE_FAULT on any other error
462  */
463 //--------------------------------------------------------------------------------------------------
465 (
467  ///< [IN]
468 
469  const char* fieldName,
470  ///< [IN]
471 
472  double value
473  ///< [IN]
474 );
475 
476 //--------------------------------------------------------------------------------------------------
477 /**
478  * Get the value of a boolean setting field
479  *
480  * @note The client will be terminated if the instRef is not valid, or the field doesn't exist
481  */
482 //--------------------------------------------------------------------------------------------------
484 (
486  ///< [IN]
487 
488  const char* fieldName,
489  ///< [IN]
490 
491  bool* valuePtr
492  ///< [OUT]
493 );
494 
495 //--------------------------------------------------------------------------------------------------
496 /**
497  * Set the value of a boolean variable field
498  *
499  * @note The client will be terminated if the instRef is not valid, or the field doesn't exist
500  *
501  * @return:
502  * - LE_OK on success
503  * - LE_OVERFLOW if the current entry was NOT added as the time series buffer is full.
504  * (This error is applicable only if time series is enabled on this field)
505  * - LE_NO_MEMORY if the current entry was added but there is no space for next one.
506  * (This error is applicable only if time series is enabled on this field)
507  * - LE_FAULT on any other error
508  */
509 //--------------------------------------------------------------------------------------------------
511 (
513  ///< [IN]
514 
515  const char* fieldName,
516  ///< [IN]
517 
518  bool value
519  ///< [IN]
520 );
521 
522 //--------------------------------------------------------------------------------------------------
523 /**
524  * Get the value of a string setting field
525  *
526  * @note The client will be terminated if the instRef is not valid, or the field doesn't exist
527  */
528 //--------------------------------------------------------------------------------------------------
530 (
532  ///< [IN]
533 
534  const char* fieldName,
535  ///< [IN]
536 
537  char* value,
538  ///< [OUT]
539 
540  size_t valueNumElements
541  ///< [IN]
542 );
543 
544 //--------------------------------------------------------------------------------------------------
545 /**
546  * Set the value of a string variable field
547  *
548  * @note The client will be terminated if the instRef is not valid, or the field doesn't exist
549  *
550  * @return:
551  * - LE_OK on success
552  * - LE_OVERFLOW if the stored string was truncated or
553  * if the current entry was NOT added as the time series buffer is full.
554  * - LE_NO_MEMORY if the current entry was added but there is no space for next one.
555  * (This error is applicable only if time series is enabled on this field)
556  * - LE_FAULT on any other error
557  */
558 //--------------------------------------------------------------------------------------------------
560 (
562  ///< [IN]
563 
564  const char* fieldName,
565  ///< [IN]
566 
567  const char* value
568  ///< [IN]
569 );
570 
571 //--------------------------------------------------------------------------------------------------
572 /**
573  * Get the value of a binary data setting field
574  *
575  * @note The client will be terminated if the instRef is not valid, or the field doesn't exist
576  */
577 //--------------------------------------------------------------------------------------------------
579 (
581  ///< [IN]
582 
583  const char* fieldName,
584  ///< [IN]
585 
586  uint8_t* valuePtr,
587  ///< [OUT]
588 
589  size_t* valueNumElementsPtr
590  ///< [INOUT]
591 );
592 
593 //--------------------------------------------------------------------------------------------------
594 /**
595  * Set the value of a binary data variable field
596  *
597  * @note The client will be terminated if the instRef is not valid, or the field doesn't exist
598  */
599 //--------------------------------------------------------------------------------------------------
601 (
603  ///< [IN]
604 
605  const char* fieldName,
606  ///< [IN]
607 
608  const uint8_t* valuePtr,
609  ///< [IN]
610 
611  size_t valueNumElements
612  ///< [IN]
613 );
614 
615 //--------------------------------------------------------------------------------------------------
616 /**
617  * Allocate resources and set up cbor stream so that we can start accumulating time series
618  * data on the specified field.
619  *
620  * @note client will be terminated if instRef isn't valid, or the field doesn't exist
621  *
622  * @note Currently the buffer size of time series data is limited to 1024 bytes. When the buffer
623  * overflows the device has to push the buffer before recording new entries.
624  *
625  * @note Factor is applicable only for integer and float fields. For all other fields factor will be
626  * silently ignored. Also a factor of "0" will be ignored for integer resources. The factor
627  * will be applied (multiplication) before encoding the sample.
628  *
629  * @return
630  * - LE_OK on success
631  * - LE_BUSY if time series already enabled on this field
632  * - LE_FAULT on any other error
633  */
634 //--------------------------------------------------------------------------------------------------
636 (
638  ///< [IN]
639 
640  const char* fieldName,
641  ///< [IN]
642 
643  double factor,
644  ///< [IN]
645 
646  double timeStampFactor
647  ///< [IN]
648 );
649 
650 //--------------------------------------------------------------------------------------------------
651 /**
652  * Stop time series on this field and free resources.
653  *
654  * @note client will be terminated if instRef isn't valid, or the field doesn't exist
655  *
656  * @return
657  * - LE_OK on success
658  * - LE_CLOSED if timeseries already stopped
659  */
660 //--------------------------------------------------------------------------------------------------
662 (
664  ///< [IN]
665 
666  const char* fieldName
667  ///< [IN]
668 );
669 
670 //--------------------------------------------------------------------------------------------------
671 /**
672  * Compress the accumulated CBOR encoded time series data and send it to server. After the data is
673  * pushed, time series will be stopped and not started again unless isRestartTimeSeries is true.
674  *
675  * @note client will be terminated if instRef isn't valid, or the field doesn't exist
676  *
677  * @return:
678  * - LE_OK on success
679  * - LE_CLOSED if time series not enabled on this field
680  * - LE_UNAVAILABLE if observe is not enabled on this field
681  * - LE_FAULT if any other error
682  */
683 //--------------------------------------------------------------------------------------------------
685 (
687  ///< [IN]
688 
689  const char* fieldName,
690  ///< [IN]
691 
692  bool isRestartTimeSeries
693  ///< [IN]
694 );
695 
696 //--------------------------------------------------------------------------------------------------
697 /**
698  * Add handler function for EVENT 'le_avdata_SessionState'
699  *
700  * This event provides information on AV session state changes
701  */
702 //--------------------------------------------------------------------------------------------------
704 (
706  ///< [IN]
707 
708  void* contextPtr
709  ///< [IN]
710 );
711 
712 //--------------------------------------------------------------------------------------------------
713 /**
714  * Remove handler function for EVENT 'le_avdata_SessionState'
715  */
716 //--------------------------------------------------------------------------------------------------
718 (
720  ///< [IN]
721 );
722 
723 //--------------------------------------------------------------------------------------------------
724 /**
725  * Is time series enabled on this resource, if yes how many data points are recorded so far?
726  *
727  * @return
728  * - LE_OK on success
729  * - LE_FAULT if time series not supported
730  */
731 //--------------------------------------------------------------------------------------------------
733 (
735  ///< [IN]
736 
737  const char* fieldName,
738  ///< [IN]
739 
740  bool* isTimeSeriesPtr,
741  ///< [OUT]
742 
743  int32_t* numDataPointPtr
744  ///< [OUT]
745 );
746 
747 //--------------------------------------------------------------------------------------------------
748 /**
749  * Record the value of an integer variable field in time series.
750  *
751  * @note The client will be terminated if the instRef is not valid, or the field doesn't exist
752  *
753  * @note This function is the same as the SetInt() except that it provides an option to pass the
754  * timestamp. SetInt() can be used to record time series with system time as the timestamp.
755  * Timestamp should be in milli seconds elapsed since epoch.
756  *
757  * @return:
758  * - LE_OK on success
759  * - LE_OVERFLOW if the current entry was NOT added as the time series buffer is full.
760  * (This error is applicable only if time series is enabled on this field)
761  * - LE_NO_MEMORY if the current entry was added but there is no space for next one.
762  * (This error is applicable only if time series is enabled on this field)
763  * - LE_FAULT on any other error
764  */
765 //--------------------------------------------------------------------------------------------------
767 (
769  ///< [IN]
770 
771  const char* fieldName,
772  ///< [IN]
773 
774  int32_t value,
775  ///< [IN]
776 
777  uint64_t timestamp
778  ///< [IN]
779 );
780 
781 //--------------------------------------------------------------------------------------------------
782 /**
783  * Record the value of a float variable field in time series.
784  *
785  * @note The client will be terminated if the instRef is not valid, or the field doesn't exist
786  *
787  * @note This function is the same as the SetFloat() except that it provides an option to pass the
788  * timestamp. SetFloat() can be used to record time series with system time as the timestamp.
789  * Timestamp should be in milli seconds elapsed since epoch.
790  *
791  * @return:
792  * - LE_OK on success
793  * - LE_OVERFLOW if the current entry was NOT added as the time series buffer is full.
794  * (This error is applicable only if time series is enabled on this field)
795  * - LE_NO_MEMORY if the current entry was added but there is no space for next one.
796  * (This error is applicable only if time series is enabled on this field)
797  * - LE_FAULT on any other error
798  */
799 //--------------------------------------------------------------------------------------------------
801 (
803  ///< [IN]
804 
805  const char* fieldName,
806  ///< [IN]
807 
808  double value,
809  ///< [IN]
810 
811  uint64_t timestamp
812  ///< [IN]
813 );
814 
815 //--------------------------------------------------------------------------------------------------
816 /**
817  * Record the value of a boolean variable field in time series.
818  *
819  * @note The client will be terminated if the instRef is not valid, or the field doesn't exist
820  *
821  * @note This function is the same as the SetBool() except that it provides an option to pass the
822  * timestamp. SetBool() can be used to record time series with system time as the timestamp.
823  * Timestamp should be in milli seconds elapsed since epoch.
824  *
825  * @return:
826  * - LE_OK on success
827  * - LE_OVERFLOW if the current entry was NOT added as the time series buffer is full.
828  * (This error is applicable only if time series is enabled on this field)
829  * - LE_NO_MEMORY if the current entry was added but there is no space for next one.
830  * (This error is applicable only if time series is enabled on this field)
831  * - LE_FAULT on any other error
832  */
833 //--------------------------------------------------------------------------------------------------
835 (
837  ///< [IN]
838 
839  const char* fieldName,
840  ///< [IN]
841 
842  bool value,
843  ///< [IN]
844 
845  uint64_t timeStamp
846  ///< [IN]
847 );
848 
849 //--------------------------------------------------------------------------------------------------
850 /**
851  * Record the value of a string variable field in time series
852  *
853  * @note The client will be terminated if the instRef is not valid, or the field doesn't exist
854  *
855  * @note This function is the same as the SetString() except that it provides an option to pass the
856  * timestamp. SetString() can be used to record time series with system time as the timestamp.
857  * Timestamp should be in milli seconds elapsed since epoch.
858  *
859  * @return:
860  * - LE_OK on success
861  * - LE_OVERFLOW if the stored string was truncated or
862  * if the current entry was NOT added as the time series buffer is full.
863  * - LE_NO_MEMORY if the current entry was added but there is no space for next one.
864  * (This error is applicable only if time series is enabled on this field)
865  * - LE_FAULT on any other error
866  */
867 //--------------------------------------------------------------------------------------------------
869 (
871  ///< [IN]
872 
873  const char* fieldName,
874  ///< [IN]
875 
876  const char* value,
877  ///< [IN]
878 
879  uint64_t timeStamp
880  ///< [IN]
881 );
882 
883 //--------------------------------------------------------------------------------------------------
884 /**
885  * Is this resource enabled for observe notifications?
886  *
887  * @note client will be terminated if instRef isn't valid, or the field doesn't exist
888  *
889  * @return
890  * - LE_OK on success
891  * - LE_NOT_FOUND if field not found
892  */
893 //--------------------------------------------------------------------------------------------------
895 (
897  ///< [IN]
898 
899  const char* fieldName,
900  ///< [IN]
901 
902  bool* isObservePtr
903  ///< [OUT]
904 );
905 
906 //--------------------------------------------------------------------------------------------------
907 /**
908  * Request the avcServer to open a session.
909  *
910  * @return
911  * - SessionRef if session request succeeded
912  * - NULL if session request failed
913  */
914 //--------------------------------------------------------------------------------------------------
916 (
917  void
918 );
919 
920 //--------------------------------------------------------------------------------------------------
921 /**
922  * Request the avcServer to close a session.
923  *
924  */
925 //--------------------------------------------------------------------------------------------------
927 (
929  ///< [IN] Reference to a previously opened AV session.
930 );
931 
932 
933 #endif // LE_AVDATA_INTERFACE_H_INCLUDE_GUARD
934 
void le_avdata_Delete(le_avdata_AssetInstanceRef_t instRef)
void(* le_avdata_SessionStateHandlerFunc_t)(le_avdata_SessionState_t sessionState, void *contextPtr)
Definition: le_avdata_interface.h:318
le_result_t le_avdata_SetFloat(le_avdata_AssetInstanceRef_t instRef, const char *fieldName, double value)
void le_avdata_RemoveFieldEventHandler(le_avdata_FieldEventHandlerRef_t addHandlerRef)
le_result_t
Definition: le_basics.h:35
void le_avdata_GetString(le_avdata_AssetInstanceRef_t instRef, const char *fieldName, char *value, size_t valueNumElements)
le_result_t le_avdata_RecordInt(le_avdata_AssetInstanceRef_t instRef, const char *fieldName, int32_t value, uint64_t timestamp)
void le_avdata_SetBinary(le_avdata_AssetInstanceRef_t instRef, const char *fieldName, const uint8_t *valuePtr, size_t valueNumElements)
le_result_t le_avdata_StartTimeSeries(le_avdata_AssetInstanceRef_t instRef, const char *fieldName, double factor, double timeStampFactor)
void(* le_avdata_FieldHandlerFunc_t)(le_avdata_AssetInstanceRef_t instRef, const char *fieldName, void *contextPtr)
Definition: le_avdata_interface.h:301
le_avdata_SessionStateHandlerRef_t le_avdata_AddSessionStateHandler(le_avdata_SessionStateHandlerFunc_t handlerPtr, void *contextPtr)
void le_avdata_ReleaseSession(le_avdata_RequestSessionObjRef_t requestRef)
struct le_avdata_RequestSessionObj * le_avdata_RequestSessionObjRef_t
Definition: le_avdata_interface.h:224
le_result_t le_avdata_RecordBool(le_avdata_AssetInstanceRef_t instRef, const char *fieldName, bool value, uint64_t timeStamp)
le_result_t le_avdata_SetBool(le_avdata_AssetInstanceRef_t instRef, const char *fieldName, bool value)
void le_avdata_DisconnectService(void)
le_result_t le_avdata_RecordString(le_avdata_AssetInstanceRef_t instRef, const char *fieldName, const char *value, uint64_t timeStamp)
le_avdata_RequestSessionObjRef_t le_avdata_RequestSession(void)
le_result_t le_avdata_SetInt(le_avdata_AssetInstanceRef_t instRef, const char *fieldName, int32_t value)
struct le_avdata_AssetInstance * le_avdata_AssetInstanceRef_t
Definition: le_avdata_interface.h:216
void le_avdata_RemoveSessionStateHandler(le_avdata_SessionStateHandlerRef_t addHandlerRef)
void le_avdata_ConnectService(void)
le_result_t le_avdata_GetTimeSeriesStatus(le_avdata_AssetInstanceRef_t instRef, const char *fieldName, bool *isTimeSeriesPtr, int32_t *numDataPointPtr)
void le_avdata_GetFloat(le_avdata_AssetInstanceRef_t instRef, const char *fieldName, double *valuePtr)
le_avdata_SessionState_t
Definition: le_avdata_interface.h:264
le_result_t le_avdata_TryConnectService(void)
AVMS session started.
Definition: le_avdata_interface.h:266
struct le_avdata_SessionStateHandler * le_avdata_SessionStateHandlerRef_t
Definition: le_avdata_interface.h:288
le_result_t le_avdata_PushTimeSeries(le_avdata_AssetInstanceRef_t instRef, const char *fieldName, bool isRestartTimeSeries)
void le_avdata_GetBinary(le_avdata_AssetInstanceRef_t instRef, const char *fieldName, uint8_t *valuePtr, size_t *valueNumElementsPtr)
struct le_avdata_FieldEventHandler * le_avdata_FieldEventHandlerRef_t
Definition: le_avdata_interface.h:280
AVMS session stopped.
Definition: le_avdata_interface.h:269
void le_avdata_GetInt(le_avdata_AssetInstanceRef_t instRef, const char *fieldName, int32_t *valuePtr)
le_result_t le_avdata_IsObserve(le_avdata_AssetInstanceRef_t instRef, const char *fieldName, bool *isObservePtr)
le_avdata_AssetInstanceRef_t le_avdata_Create(const char *assetName)
le_avdata_FieldEventHandlerRef_t le_avdata_AddFieldEventHandler(le_avdata_AssetInstanceRef_t instRef, const char *fieldName, le_avdata_FieldHandlerFunc_t handlerPtr, void *contextPtr)
le_result_t le_avdata_RecordFloat(le_avdata_AssetInstanceRef_t instRef, const char *fieldName, double value, uint64_t timestamp)
le_result_t le_avdata_StopTimeSeries(le_avdata_AssetInstanceRef_t instRef, const char *fieldName)
le_result_t le_avdata_SetString(le_avdata_AssetInstanceRef_t instRef, const char *fieldName, const char *value)
void le_avdata_GetBool(le_avdata_AssetInstanceRef_t instRef, const char *fieldName, bool *valuePtr)