le_avc_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_avc AirVantage Connector API
14  *
15  * @ref le_avc_interface.h "API Reference" <br>
16  * @ref legatoServicesAirVantage "AirVantage Connector Platform Service"
17  *
18  *
19  * The AirVantage connector service provides an API to communicate with the AirVantage Server to
20  * download and install updates.
21  *
22  * @section c_le_avc_update Firmware/Application Updates
23  *
24  * The API for firmware/application update is divided into two parts:
25  * - Allow an App to contact the server for pending updates. If available,
26  * can select to download or install the update.
27  * - Allow an App to block an update from being installed. An App may need this if it's
28  * performing a critical operation that can't be interrupted (e.g., eCall). This is necessary
29  * as installing an update will cause the App to restart (either the App itself needs to restart
30  * or a firmware change causes the modem to reset).
31  *
32  * @subsection c_le_avc_update_control Update Control
33  *
34  * Any App can start a session with an AirVantage server to determine if there
35  * is a pending update. This is done with le_avc_StartSession().
36  *
37  * The current session can be stopped using le_avc_StopSession(). This cancels any query for pending
38  * update, or suspends a download in progress; however, it <b>won't stop</b> an install in progress.
39  *
40  * The status of a pending update is sent to all Apps registered for receiving a notification.
41  * An App can use le_avc_AddStatusEventHandler() to register a handler function to
42  * receive this notification. The notification will be received after a session is started.
43  *
44  * Example of registering an AVC handler and starting a session with fault checking:
45  * @code
46  * // Start AVC Session
47  * LE_INFO("AirVantage Connection Controller started.");
48  * le_avc_AddStatusEventHandler(avcStatusHandler, NULL); //register a AVC handler
49  *
50  * //Start AVC session. Note: AVC handler must be registered prior starting a session
51  * le_result_t result = le_avc_StartSession();
52  * if (LE_FAULT == result)
53  * {
54  * le_avc_StopSession();
55  * le_avc_StartSession();
56  * }
57  * @endcode
58  *
59  * Sometimes, @c avcService may decide to start a session with the AirVantage
60  * server; for instance if a call to le_avc_AcceptDownload() when the session is stopped,
61  * @c avcService will open a session to proceed with the download. In this case, a session started
62  * notification could also be received, even if le_avc_StartSession() is not called explicitly.
63  *
64  * @subsubsection c_le_avc_updateControl_pending Pending Updates
65  *
66  * There can only be one pending update at a time. To query the type of update, use
67  * le_avc_GetUpdateType(). App updates can call le_avc_GetAppUpdateName() to retrieve the App name.
68  *
69  * If a download is pending, then le_avc_AcceptDownload() can be used to allow the update to be
70  * downloaded. If this API is called while no AirVantage session is active, calling this API will
71  * initiate an AirVantage session. To defer the decision, le_avc_DeferDownload() can be used
72  * to defer the download for the specified number of minutes. After the defer time has elapsed,
73  * the pending download notification will be re-sent again to all registered Apps.
74  *
75  * Once an update has been downloaded, a new notification will be received to indicate that an
76  * install is pending. Apps can then use le_avc_AcceptInstall() to allow the install to proceed.
77  *
78  * If an uninstall is pending, then le_avc_AcceptUninstall() can be used to allow the uninstall to
79  * proceed. To defer the decision, le_avc_DeferUninstall() can be used to defer the uninstall for
80  * the specified number of minutes. In case of an upgrade, the existing application will not be
81  * uninstalled after le_avc_AcceptUninstall() is called. le_avc_AcceptUninstall() is only used to
82  * signal the server to start downloading the new application. To proceed with an upgrade process,
83  * accept the uninstall of the existing version followed by accepting the download and install of
84  * the new version.
85  *
86  * @code
87  * switch (updateStatus)
88  * {
89  * case LE_AVC_DOWNLOAD_PENDING:
90  * LE_INFO("Accepting %s update.", GetUpdateType());
91  * res = le_avc_AcceptDownload();
92  * if (res != LE_OK)
93  * {
94  * LE_ERROR("Failed to accept download from AirVantage (%s)", LE_RESULT_TXT(res));
95  * }
96  * break;
97  *
98  * case LE_AVC_INSTALL_PENDING:
99  * LE_INFO("Accepting %s installation.", GetUpdateType());
100  * res = le_avc_AcceptInstall();
101  * if (res != LE_OK)
102  * {
103  * LE_ERROR("Failed to accept install from AirVantage (%s)", LE_RESULT_TXT(res));
104  * }
105  * break;
106  *
107  * case LE_AVC_UNINSTALL_PENDING:
108  * LE_INFO("Accepting %s uninstall.", GetUpdateType());
109  * res = le_avc_AcceptUninstall();
110  * if (res != LE_OK)
111  * {
112  * LE_ERROR("Failed to accept uninstall from AirVantage (%s)", LE_RESULT_TXT(res));
113  * }
114  * break;
115  *
116  * case LE_AVC_REBOOT_PENDING:
117  * LE_INFO("Accepting device reboot.");
118  * res = le_avc_AcceptReboot();
119  * if (res != LE_OK)
120  * {
121  * LE_ERROR("Failed to accept reboot from AirVantage (%s)", LE_RESULT_TXT(res));
122  * }
123  * break;
124  *
125  * default:
126  * // No action required
127  * break;
128  * }
129  * @endcode
130  *
131  * @note that even if an App calls le_avc_AcceptInstall(), the install may still be blocked by
132  * another App using the @ref c_le_avc_update_app functions. To defer the decision, an App can use
133  * le_avc_DeferInstall() to defer the install for the specified number of minutes. After the defer
134  * time has elapsed, the pending install notification will be re-sent to allow Apps to make a new
135  * decision, or again defer.
136  *
137  *
138  * @subsubsection c_le_avc_updateControl_accepting Accepting Installs/Uninstalls
139  *
140  * Accepting an App install or uninstall will not initiate an AirVantage session if no session
141  * is active. An App should start an AirVantage session before accepting an App install/uninstall,
142  * to ensure the process is completed, and the server is updated.
143  *
144  * If no app has registered for notifications using le_avc_AddStatusEventHandler(),
145  * then any pending downloads and installs will happen automatically, subject to any restrictions
146  * imposed by app using the @ref c_le_avc_update_app functions.
147  *
148  * There is no restriction on the number of Apps registering for notifications.
149  *
150  * In case of any error incurred during App download/install, an error code will be set which can be
151  * retrieved by calling le_avc_GetErrorCode().
152  *
153  * @subsection c_le_avc_update_app Application Installation Blocking
154  *
155  * When an App is about to perform a critical operation, it can block the installation of
156  * an update with le_avc_BlockInstall(), and after it's finished with the critical operation, it
157  * can unblock the install with le_avc_UnblockInstall().
158  *
159  * What constitutes a critical operation depends on the App. An eCall App might
160  * block installs for the duration that it runs. A data collection App that wakes up
161  * once an hour might block installs while it collects and stores and/or transmits a new data
162  * sample, and then unblock installs just before it goes to sleep again.
163  *
164  * If an install can't be applied because it's blocked, another attempt to apply the install
165  * will be made at a later time.
166  *
167  * An App can add a session control handler using le_avc_AddSessionRequestEventHandler(). Requests
168  * by user Apps to open or close session will be forwarded to the session control handler. If no App
169  * has registered a session request handler, AVC session can be opened or closed anytime by
170  * user Apps.
171  *
172  * @section c_le_avc_Timers Timers
173  *
174  * Poling timers sets the time that the Target will communicate with the AirVantage Server to check
175  * for new jobs. Retry timers will try and re-establish a connection to the AirVantage Server in
176  * accordance with the times that are declared.
177  *
178  * @subsection c_le_avc_PollingTimer Polling Timer
179  *
180  * The target will periodically initiate a connection to the AirVantage Server according to the
181  * settings for the polling timer to check if there are any pending jobs.
182  *
183  * If you need to disable the poling timer call le_avc_SetPollingTimer() and set the value to 0.
184  *
185  * The polling timer accepts ranges from 0 to 525600 minutes and is persistent across reboots and
186  * upgrades.
187  *
188  * To read the polling timer call: le_avc_GetPollingTimer()
189  *
190  * To write a new value to the polling timer call: le_avc_SetPollingTimer()
191  *
192  * @subsection c_le_avc_RetryTimers Retry Timers
193  *
194  * If an error occurs during a connection to the Device Services server (WWAN DATA establishment
195  * failed and an http error code is received) the embedded module will initiate a new connection
196  * according to the values defined in the retry timers.
197  *
198  * The timers are tried in sequence until a connection is established, or all enabled retry timers
199  * are exhausted. After all the enabled timers are exhausted, a new session must be initiated again
200  * by calling le_avc_startSession() after the expiry of the retry timer.
201  *
202  * The retry timer values are persistent (reboots and updates do not effect the retry timers).
203  * If you wish to disable a retry timer set the timer value
204  * to 0. You must always pass in at least 8 values to the retry timers.
205  *
206  * Retry timer values range from 0 to 20160 minutes.
207  * The function le_avc_GetRetryTimers() reads the retry timers in an array and the function
208  * le_avc_SetRetryTimers() writes the retry timers. When writing to the retry timers, values of
209  * all the 8 timers have to be defined.
210  *
211  * Example of calling retry timers, the session will be retried after 15 minutes, 1 hour, 4 hours,
212  * 8 hours, 1 day and 2 days, the last two retries are disabled:
213  * @code
214  * uint16_t RetryTimers[LE_AVC_NUM_RETRY_TIMERS] = {15, 60, 240, 480, 1440, 2880, 0, 0};
215  * le_avc_SetRetryTimers(RetryTimers, LE_AVC_NUM_RETRY_TIMERS);
216  * @endcode
217  *
218  * @section c_le_avc_reboot Device reboot
219  *
220  * The AirVantage server can request to reboot the device. If a reboot is requested a notification
221  * is sent to the registered Apps. The App can either accept the reboot with le_avc_AcceptReboot()
222  * or defer it for a specified number of minutes with le_avc_DeferReboot(). After the defer time
223  * has elapsed, the pending reboot notification will be re-sent. This allows the registered app to
224  * make a new decision or defer the reboot again.
225  *
226  * If no App has registered for notifications using le_avc_AddStatusEventHandler(), then
227  * any pending reboot will happen automatically.
228  *
229  * @section c_le_avc_GetCredentialStatus Credential Status
230  * The device is provisioned with bootstrap credentials from factory. The Device Management (DM)
231  * credentials are provisioned by AirVantage Bootstrap Server. This API is used to retrieve the
232  * status of credentials provisioned on the device.
233  *
234  * @section c_le_avc_connection Connection required
235  *
236  * The AirVantage agent can request a connection to the AirVantage server, especially when a
237  * firmware package is installed (after a platform reboot). In this case a notification is sent to
238  * the control App, which can start the connection with le_avc_StartSession().
239  *
240  * @section c_le_avc_routing Data routing
241  *
242  * By default the AirVantage connection uses the default mobile data profile and the default route
243  * set by the data connection service.
244  *
245  * If the user wishes to control the network configuration, e.g. to use the AirVantage agent with
246  * multi-PDP contexts, they should first bind the application to the data connection service:
247  * @verbatim
248  bindings:
249  {
250  clientExe.clientComponent.le_data -> dataConnectionService.le_data
251  }
252  @endverbatim
253  *
254  * The data connection service should then be configured before launching the AirVantage connection:
255  * - le_data_SetCellularProfileIndex() allows to change the data profile to use.
256  * - le_data_GetDefaultRouteStatus() indicates if the default route is activated in the data
257  * connection service. This default route can be deactivated in the data connection service
258  * configuration database, as explained in @ref c_le_data_defaultRoute. If the default route is
259  * deactivated, the AirVantage agent will automatically add routes to be able to reach the
260  * AirVantage server through the connection used by AirVantage.
261  *
262  * @section le_avcService_configdb Service Configuration Tree
263  * @copydoc le_avcService_configdbPage_Hide
264  *
265  *
266  * Copyright (C) Sierra Wireless Inc.
267  */
268 /**
269  * @interface le_avcService_configdbPage_Hide
270  *
271  * The configuration database path for the activityTimeout is:
272  * @verbatim
273  /
274  apps/
275  avcService/
276  activityTimeout
277  @endverbatim
278  *
279  *
280  * After an AirVantage session is started, if there's no activity between the device and the server
281  * within the timer interval, then LE_AVC_NO_UPDATE state will be returned to the app. However,
282  * this activity timeout can be overridden by setting an integer value for
283  * /apps/avcService/activityTimeout. The activity timer is initialized only when the @c avcService
284  * starts. If a valid entry >0 is found, then it will be used instead of the default value of 20
285  * seconds. The following steps should be used to set the activityTimeout.
286  *
287  *
288  * @verbatim
289  config set /apps/avcService/activityTimeout xx
290  app restart avcService
291  @endverbatim
292  *
293  * @note
294  * Everytime a new value is written to activityTimeout, the avcService needs to be
295  * restarted to read the new value.
296  *
297  *
298  */
299 /**
300  * @file le_avc_interface.h
301  *
302  * Legato @ref c_le_avc include file.
303  *
304  * Copyright (C) Sierra Wireless Inc.
305  */
306 
307 #ifndef LE_AVC_INTERFACE_H_INCLUDE_GUARD
308 #define LE_AVC_INTERFACE_H_INCLUDE_GUARD
309 
310 
311 #include "legato.h"
312 
313 // Interface specific includes
314 #include "le_limit_interface.h"
315 
316 
317 //--------------------------------------------------------------------------------------------------
318 /**
319  * Type for handler called when a server disconnects.
320  */
321 //--------------------------------------------------------------------------------------------------
322 typedef void (*le_avc_DisconnectHandler_t)(void *);
323 
324 //--------------------------------------------------------------------------------------------------
325 /**
326  *
327  * Connect the current client thread to the service providing this API. Block until the service is
328  * 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 //--------------------------------------------------------------------------------------------------
338 (
339  void
340 );
341 
342 //--------------------------------------------------------------------------------------------------
343 /**
344  *
345  * Try to connect the current client thread to the service providing this API. Return with an error
346  * if the service is not available.
347  *
348  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
349  * called before any other functions in this API. Normally, ConnectService is automatically called
350  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
351  *
352  * This function is created automatically.
353  *
354  * @return
355  * - LE_OK if the client connected successfully to the service.
356  * - LE_UNAVAILABLE if the server is not currently offering the service to which the client is
357  * bound.
358  * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
359  * - LE_COMM_ERROR if the Service Directory cannot be reached.
360  */
361 //--------------------------------------------------------------------------------------------------
363 (
364  void
365 );
366 
367 //--------------------------------------------------------------------------------------------------
368 /**
369  * Set handler called when server disconnection is detected.
370  *
371  * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants
372  * to continue without exiting, it should call longjmp() from inside the handler.
373  */
374 //--------------------------------------------------------------------------------------------------
376 (
377  le_avc_DisconnectHandler_t disconnectHandler,
378  void *contextPtr
379 );
380 
381 //--------------------------------------------------------------------------------------------------
382 /**
383  *
384  * Disconnect the current client thread from the service providing this API.
385  *
386  * Normally, this function doesn't need to be called. After this function is called, there's no
387  * longer a connection to the service, and the functions in this API can't be used. For details, see
388  * @ref apiFilesC_client.
389  *
390  * This function is created automatically.
391  */
392 //--------------------------------------------------------------------------------------------------
394 (
395  void
396 );
397 
398 
399 //--------------------------------------------------------------------------------------------------
400 /**
401  * Maximum APN name length without NULL terminator.
402  */
403 //--------------------------------------------------------------------------------------------------
404 #define LE_AVC_APN_NAME_MAX_LEN 48
405 
406 //--------------------------------------------------------------------------------------------------
407 /**
408  * Maximum APN name length including NULL terminator.
409  */
410 //--------------------------------------------------------------------------------------------------
411 #define LE_AVC_APN_NAME_MAX_LEN_BYTES 49
412 
413 //--------------------------------------------------------------------------------------------------
414 /**
415  * Maximum user name length without NULL terminator.
416  */
417 //--------------------------------------------------------------------------------------------------
418 #define LE_AVC_USERNAME_MAX_LEN 28
419 
420 //--------------------------------------------------------------------------------------------------
421 /**
422  * Maximum user name length including NULL terminator.
423  */
424 //--------------------------------------------------------------------------------------------------
425 #define LE_AVC_USERNAME_MAX_LEN_BYTES 29
426 
427 //--------------------------------------------------------------------------------------------------
428 /**
429  * Maximum password length without NULL terminator..
430  */
431 //--------------------------------------------------------------------------------------------------
432 #define LE_AVC_PASSWORD_MAX_LEN 28
433 
434 //--------------------------------------------------------------------------------------------------
435 /**
436  * Maximum password length including NULL terminator.
437  */
438 //--------------------------------------------------------------------------------------------------
439 #define LE_AVC_PASSWORD_MAX_LEN_BYTES 29
440 
441 //--------------------------------------------------------------------------------------------------
442 /**
443  * Maximum number of retry timers.
444  */
445 //--------------------------------------------------------------------------------------------------
446 #define LE_AVC_NUM_RETRY_TIMERS 8
447 
448 //--------------------------------------------------------------------------------------------------
449 /**
450  * Polling timer value range in minutes. 525600 minutes = 1 year.
451  */
452 //--------------------------------------------------------------------------------------------------
453 #define LE_AVC_POLLING_TIMER_MAX_VAL 525600
454 
455 //--------------------------------------------------------------------------------------------------
456 /**
457  */
458 //--------------------------------------------------------------------------------------------------
459 #define LE_AVC_POLLING_TIMER_MIN_VAL 0
460 
461 //--------------------------------------------------------------------------------------------------
462 /**
463  * Retry timer value range in minutes. 20160 minutes = 2 weeks.
464  */
465 //--------------------------------------------------------------------------------------------------
466 #define LE_AVC_RETRY_TIMER_MAX_VAL 20160
467 
468 //--------------------------------------------------------------------------------------------------
469 /**
470  */
471 //--------------------------------------------------------------------------------------------------
472 #define LE_AVC_RETRY_TIMER_MIN_VAL 0
473 
474 //--------------------------------------------------------------------------------------------------
475 /**
476  * Default HTTP status.
477  */
478 //--------------------------------------------------------------------------------------------------
479 #define LE_AVC_HTTP_STATUS_INVALID 65535
480 
481 //--------------------------------------------------------------------------------------------------
482 /**
483  * Status of session or update
484  *
485  * If an update is pending, it must first be downloaded and then installed.
486  */
487 //--------------------------------------------------------------------------------------------------
488 typedef enum
489 {
491  ///< No updates pending
493  ///< Update pending download
495  ///< Download in progress
497  ///< Download has completed
499  ///< An error occurred downloading the update
501  ///< Install is pending (implies download complete)
503  ///< Install in progress
505  ///< Update has been successfully installed
507  ///< An error occurred installing the update
509  ///< Uninstall is pending
511  ///< Uninstall in progress
513  ///< App has been successfully uninstalled
515  ///< An error occurred uninstalling the update
517  ///< Session with AV server started
519  ///< Session with AV server stopped
521  ///< Device reboot is pending
523  ///< Connection to the server is required
525  ///< Authentication with AV server started
527  ///< Authentication with AV server failed
528 }
530 
531 
532 //--------------------------------------------------------------------------------------------------
533 /**
534  * Request to open or close avms session.
535  */
536 //--------------------------------------------------------------------------------------------------
537 typedef enum
538 {
540  ///< Request by user app to open AV session
542  ///< Request by user app to close AV session
543 }
545 
546 
547 //--------------------------------------------------------------------------------------------------
548 /**
549  * The type of pending update
550  */
551 //--------------------------------------------------------------------------------------------------
552 typedef enum
553 {
554  LE_AVC_UNKNOWN_UPDATE = 0,
555  ///<
556  LE_AVC_FIRMWARE_UPDATE = 1,
557  ///<
558  LE_AVC_FRAMEWORK_UPDATE = 2,
559  ///<
560  LE_AVC_APPLICATION_UPDATE = 3
561  ///<
562 }
564 
565 
566 //--------------------------------------------------------------------------------------------------
567 /**
568  * Error code used to provide diagnostic information after a failure (includes both download and
569  * install failure).
570  *
571  * @note
572  * Additional information may also be available in the target device's system log.
573  */
574 //--------------------------------------------------------------------------------------------------
575 typedef enum
576 {
578  ///< No error.
580  ///< Encountered a bad package.
582  ///< Something failed while doing install/download.
584  ///< Security check failure while installing the package.
585 }
587 
588 
589 //--------------------------------------------------------------------------------------------------
590 /**
591  * Session type indicates whether the device is connected to the bootstrap server or the
592  * device management server.
593  */
594 //--------------------------------------------------------------------------------------------------
595 typedef enum
596 {
598  ///< Bootstrap session.
600  ///< Device Management session.
602  ///< Session type invalid.
603 }
605 
606 
607 //--------------------------------------------------------------------------------------------------
608 /**
609  * Status of the device credentials
610  */
611 //--------------------------------------------------------------------------------------------------
612 typedef enum
613 {
615  ///< Neither Bootstrap nor Device Management
616  ///< credential is provisioned.
618  ///< Bootstrap credential is provisioned but Device
619  ///< Management credential is not provisioned.
621  ///< Device Management credential is provisioned.
622 }
624 
625 
626 //--------------------------------------------------------------------------------------------------
627 /**
628  * Reference type used by Add/Remove functions for EVENT 'le_avc_StatusEvent'
629  */
630 //--------------------------------------------------------------------------------------------------
631 typedef struct le_avc_StatusEventHandler* le_avc_StatusEventHandlerRef_t;
632 
633 
634 //--------------------------------------------------------------------------------------------------
635 /**
636  * Reference type used by Add/Remove functions for EVENT 'le_avc_SessionRequestEvent'
637  */
638 //--------------------------------------------------------------------------------------------------
639 typedef struct le_avc_SessionRequestEventHandler* le_avc_SessionRequestEventHandlerRef_t;
640 
641 
642 //--------------------------------------------------------------------------------------------------
643 /**
644  * Reference returned by BlockInstall function and used by UnblockInstall function
645  */
646 //--------------------------------------------------------------------------------------------------
647 typedef struct le_avc_BlockRequest* le_avc_BlockRequestRef_t;
648 
649 
650 //--------------------------------------------------------------------------------------------------
651 /**
652  * Handler for update availability status
653  */
654 //--------------------------------------------------------------------------------------------------
655 typedef void (*le_avc_StatusHandlerFunc_t)
656 (
657  le_avc_Status_t updateStatus,
658  ///< status of pending update, if available
659  int32_t totalNumBytes,
660  ///< Total number of bytes to be downloaded
661  ///< only valid when updateStatus is one of
662  ///< DOWNLOAD_PENDING, DOWNLOAD_IN_PROGRESS or DOWNLOAD_COMPLETE.
663  ///< returns -1 if value is unknown
664  int32_t dloadProgress,
665  ///< download completion in percentage
666  ///< only valid when updateStatus is one of
667  ///< DOWNLOAD_PENDING, DOWNLOAD_IN_PROGRESS or DOWNLOAD_COMPLETE.
668  ///< returns -1 if value is unknown
669  void* contextPtr
670  ///<
671 );
672 
673 //--------------------------------------------------------------------------------------------------
674 /**
675  * Handler for receiving session open or close request.
676  */
677 //--------------------------------------------------------------------------------------------------
679 (
680  le_avc_SessionRequest_t request,
681  ///< Request to open or close AV session
682  void* contextPtr
683  ///<
684 );
685 
686 //--------------------------------------------------------------------------------------------------
687 /**
688  * Add handler function for EVENT 'le_avc_StatusEvent'
689  *
690  * This event provides information on update availability status
691  */
692 //--------------------------------------------------------------------------------------------------
694 (
695  le_avc_StatusHandlerFunc_t handlerPtr,
696  ///< [IN]
697  void* contextPtr
698  ///< [IN]
699 );
700 
701 //--------------------------------------------------------------------------------------------------
702 /**
703  * Remove handler function for EVENT 'le_avc_StatusEvent'
704  */
705 //--------------------------------------------------------------------------------------------------
707 (
709  ///< [IN]
710 );
711 
712 //--------------------------------------------------------------------------------------------------
713 /**
714  * Add handler function for EVENT 'le_avc_SessionRequestEvent'
715  *
716  * This event provides information on session open or close request.
717  */
718 //--------------------------------------------------------------------------------------------------
720 (
722  ///< [IN]
723  void* contextPtr
724  ///< [IN]
725 );
726 
727 //--------------------------------------------------------------------------------------------------
728 /**
729  * Remove handler function for EVENT 'le_avc_SessionRequestEvent'
730  */
731 //--------------------------------------------------------------------------------------------------
733 (
735  ///< [IN]
736 );
737 
738 //--------------------------------------------------------------------------------------------------
739 /**
740  * Start a session with the AirVantage server
741  *
742  * This will cause a query to be sent to the server, for pending updates. If a download was
743  * previously suspended, then this resumes the download.
744  *
745  * @return
746  * - LE_OK if connection request has been sent.
747  * - LE_FAULT on failure
748  * - LE_DUPLICATE if already connected.
749  * - LE_BUSY if currently retrying.
750  */
751 //--------------------------------------------------------------------------------------------------
753 (
754  void
755 );
756 
757 //--------------------------------------------------------------------------------------------------
758 /**
759  * Stop a session with the AirVantage server
760  *
761  * If a download is in progress, then this suspends the download.
762  *
763  * @return
764  * - LE_OK on success
765  * - LE_FAULT on failure
766  */
767 //--------------------------------------------------------------------------------------------------
769 (
770  void
771 );
772 
773 //--------------------------------------------------------------------------------------------------
774 /**
775  * Send a specific message to the server to be sure that the route between the device and the server
776  * is available.
777  * This API needs to be called when any package download is over (successfully or not) and before
778  * sending any notification on asset data to the server.
779  *
780  * @return
781  * - LE_OK when the treatment is launched
782  * - LE_FAULT on failure
783  * - LE_UNSUPPORTED when the API is not supported
784  *
785  */
786 //--------------------------------------------------------------------------------------------------
788 (
789  void
790 );
791 
792 //--------------------------------------------------------------------------------------------------
793 /**
794  * Accept the currently pending download
795  *
796  * @return
797  * - LE_OK on success
798  * - LE_FAULT on failure
799  */
800 //--------------------------------------------------------------------------------------------------
802 (
803  void
804 );
805 
806 //--------------------------------------------------------------------------------------------------
807 /**
808  * Defer the currently pending download, for the given number of minutes
809  *
810  * @return
811  * - LE_OK on success
812  * - LE_FAULT on failure
813  */
814 //--------------------------------------------------------------------------------------------------
816 (
817  uint32_t deferMinutes
818  ///< [IN]
819 );
820 
821 //--------------------------------------------------------------------------------------------------
822 /**
823  * Accept the currently pending install
824  *
825  * @return
826  * - LE_OK on success
827  * - LE_FAULT on failure
828  */
829 //--------------------------------------------------------------------------------------------------
831 (
832  void
833 );
834 
835 //--------------------------------------------------------------------------------------------------
836 /**
837  * Defer the currently pending install
838  *
839  * @return
840  * - LE_OK on success
841  * - LE_FAULT on failure
842  */
843 //--------------------------------------------------------------------------------------------------
845 (
846  uint32_t deferMinutes
847  ///< [IN]
848 );
849 
850 //--------------------------------------------------------------------------------------------------
851 /**
852  * Accept the currently pending uninstall
853  *
854  * @return
855  * - LE_OK on success
856  * - LE_FAULT on failure
857  */
858 //--------------------------------------------------------------------------------------------------
860 (
861  void
862 );
863 
864 //--------------------------------------------------------------------------------------------------
865 /**
866  * Defer the currently pending uninstall
867  *
868  * @return
869  * - LE_OK on success
870  * - LE_FAULT on failure
871  */
872 //--------------------------------------------------------------------------------------------------
874 (
875  uint32_t deferMinutes
876  ///< [IN]
877 );
878 
879 //--------------------------------------------------------------------------------------------------
880 /**
881  * Accept the currently pending reboot
882  *
883  * @return
884  * - LE_OK on success
885  * - LE_FAULT on failure
886  */
887 //--------------------------------------------------------------------------------------------------
889 (
890  void
891 );
892 
893 //--------------------------------------------------------------------------------------------------
894 /**
895  * Defer the currently pending reboot
896  *
897  * @return
898  * - LE_OK on success
899  * - LE_FAULT on failure
900  */
901 //--------------------------------------------------------------------------------------------------
903 (
904  uint32_t deferMinutes
905  ///< [IN]
906 );
907 
908 //--------------------------------------------------------------------------------------------------
909 /**
910  * Get the update type of the currently pending update
911  *
912  * @return
913  * - LE_OK on success
914  * - LE_FAULT if not available
915  */
916 //--------------------------------------------------------------------------------------------------
918 (
919  le_avc_UpdateType_t* updateTypePtr
920  ///< [OUT]
921 );
922 
923 //--------------------------------------------------------------------------------------------------
924 /**
925  * Get the name for the currently pending app update
926  *
927  * @return
928  * - LE_OK on success
929  * - LE_FAULT if not available, or isn't APPL_UPDATE type
930  */
931 //--------------------------------------------------------------------------------------------------
933 (
934  char* updateName,
935  ///< [OUT]
936  size_t updateNameSize
937  ///< [IN]
938 );
939 
940 //--------------------------------------------------------------------------------------------------
941 /**
942  * Prevent any pending updates from being installed.
943  *
944  * @return
945  * - Reference for block update request (to be used later for unblocking updates)
946  * - NULL if the operation was not successful
947  */
948 //--------------------------------------------------------------------------------------------------
950 (
951  void
952 );
953 
954 //--------------------------------------------------------------------------------------------------
955 /**
956  * Allow any pending updates to be installed
957  */
958 //--------------------------------------------------------------------------------------------------
960 (
961  le_avc_BlockRequestRef_t blockRef
962  ///< [IN] block request ref returned by le_avc_BlockInstall
963 );
964 
965 //--------------------------------------------------------------------------------------------------
966 /**
967  * Function to get error code when update fails.
968  *
969  * @return
970  * - Error code of encountered error.
971  * - ERR_NONE if update is in any other state.
972  */
973 //--------------------------------------------------------------------------------------------------
975 (
976  void
977 );
978 
979 //--------------------------------------------------------------------------------------------------
980 /**
981  * Function to read the current session type, or the last session type if there is no
982  * active session.
983  *
984  * @return
985  * - SessionType
986  */
987 //--------------------------------------------------------------------------------------------------
989 (
990  void
991 );
992 
993 //--------------------------------------------------------------------------------------------------
994 /**
995  * Function to read the http status of the last download.
996  *
997  * @return
998  * - HttpStatus as defined in RFC 7231, Section 6.
999  */
1000 //--------------------------------------------------------------------------------------------------
1001 uint16_t le_avc_GetHttpStatus
1002 (
1003  void
1004 );
1005 
1006 //--------------------------------------------------------------------------------------------------
1007 /**
1008  * Function to read the polling timer.
1009  *
1010  * @return
1011  * - LE_OK on success
1012  * - LE_FAULT if not available
1013  * - LE_OUT_OF_RANGE if the polling timer value is out of range (0 to 525600).
1014  */
1015 //--------------------------------------------------------------------------------------------------
1017 (
1018  uint32_t* pollingTimerPtr
1019  ///< [OUT] Polling timer
1020 );
1021 
1022 //--------------------------------------------------------------------------------------------------
1023 /**
1024  * Function to read the retry timers.
1025  *
1026  * @return
1027  * - LE_OK on success.
1028  * - LE_FAULT if not able to read the timers.
1029  * - LE_OUT_OF_RANGE if one of the retry timers is out of range (0 to 20160).
1030  */
1031 //--------------------------------------------------------------------------------------------------
1033 (
1034  uint16_t* timerValuePtr,
1035  ///< [OUT] Array of the retry timers.
1036  size_t* timerValueSizePtr
1037  ///< [INOUT]
1038 );
1039 
1040 //--------------------------------------------------------------------------------------------------
1041 /**
1042  * Function to read APN configuration.
1043  *
1044  * @return
1045  * - LE_OK on success.
1046  * - LE_FAULT if there is any error while reading.
1047  * - LE_OVERFLOW if the buffer provided is too small.
1048  */
1049 //--------------------------------------------------------------------------------------------------
1051 (
1052  char* apnName,
1053  ///< [OUT]
1054  size_t apnNameSize,
1055  ///< [IN]
1056  char* userName,
1057  ///< [OUT]
1058  size_t userNameSize,
1059  ///< [IN]
1060  char* userPwd,
1061  ///< [OUT]
1062  size_t userPwdSize
1063  ///< [IN]
1064 );
1065 
1066 //--------------------------------------------------------------------------------------------------
1067 /**
1068  * Function to write APN configuration.
1069  *
1070  * @return
1071  * - LE_OK on success.
1072  * - LE_OVERFLOW if one of the input strings is too long.
1073  */
1074 //--------------------------------------------------------------------------------------------------
1076 (
1077  const char* LE_NONNULL apnName,
1078  ///< [IN]
1079  const char* LE_NONNULL userName,
1080  ///< [IN]
1081  const char* LE_NONNULL userPwd
1082  ///< [IN]
1083 );
1084 
1085 //--------------------------------------------------------------------------------------------------
1086 /**
1087  * Function to set the polling timer.
1088  *
1089  * @return
1090  * - LE_OK on success.
1091  * - LE_OUT_OF_RANGE if the polling timer value is out of range (0 to 525600).
1092  */
1093 //--------------------------------------------------------------------------------------------------
1095 (
1096  uint32_t pollingTimer
1097  ///< [IN] Polling timer
1098 );
1099 
1100 //--------------------------------------------------------------------------------------------------
1101 /**
1102  * Function to set the retry timers.
1103  *
1104  * @return
1105  * - LE_OK on success.
1106  * - LE_FAULT if not able to set the timers.
1107  * - LE_OUT_OF_RANGE if one of the retry timers is out of range (0 to 20160).
1108  */
1109 //--------------------------------------------------------------------------------------------------
1111 (
1112  const uint16_t* timerValuePtr,
1113  ///< [IN] Array of 8 retry timers.
1114  size_t timerValueSize
1115  ///< [IN]
1116 );
1117 
1118 //--------------------------------------------------------------------------------------------------
1119 /**
1120  * Function to retrieve status of the credentials provisioned on the device.
1121  *
1122  * @return
1123  * LE_AVC_NO_CREDENTIAL_PROVISIONED
1124  * - If neither Bootstrap nor Device Management credential is provisioned.
1125  * LE_AVC_BS_CREDENTIAL_PROVISIONED
1126  * - If Bootstrap credential is provisioned but Device Management credential is
1127  * not provisioned.
1128  * LE_AVC_DM_CREDENTIAL_PROVISIONED
1129  * - If Device management key is provisioned.
1130  */
1131 //--------------------------------------------------------------------------------------------------
1133 (
1134  void
1135 );
1136 
1137 #endif // LE_AVC_INTERFACE_H_INCLUDE_GUARD
void le_avc_RemoveSessionRequestEventHandler(le_avc_SessionRequestEventHandlerRef_t handlerRef)
le_result_t le_avc_GetPollingTimer(uint32_t *pollingTimerPtr)
Uninstall in progress.
Definition: le_avc_interface.h:510
void(* le_avc_StatusHandlerFunc_t)(le_avc_Status_t updateStatus, int32_t totalNumBytes, int32_t dloadProgress, void *contextPtr)
Definition: le_avc_interface.h:656
Uninstall is pending.
Definition: le_avc_interface.h:508
Request by user app to close AV session.
Definition: le_avc_interface.h:541
An error occurred installing the update.
Definition: le_avc_interface.h:506
le_result_t le_avc_DeferReboot(uint32_t deferMinutes)
le_result_t le_avc_SetRetryTimers(const uint16_t *timerValuePtr, size_t timerValueSize)
le_avc_SessionRequestEventHandlerRef_t le_avc_AddSessionRequestEventHandler(le_avc_SessionRequestHandlerFunc_t handlerPtr, void *contextPtr)
le_result_t le_avc_SetApnConfig(const char *LE_NONNULL apnName, const char *LE_NONNULL userName, const char *LE_NONNULL userPwd)
le_result_t
Definition: le_basics.h:35
void(* le_avc_SessionRequestHandlerFunc_t)(le_avc_SessionRequest_t request, void *contextPtr)
Definition: le_avc_interface.h:679
le_result_t le_avc_AcceptReboot(void)
An error occurred uninstalling the update.
Definition: le_avc_interface.h:514
Install in progress.
Definition: le_avc_interface.h:502
void le_avc_UnblockInstall(le_avc_BlockRequestRef_t blockRef)
void le_avc_SetServerDisconnectHandler(le_avc_DisconnectHandler_t disconnectHandler, void *contextPtr)
le_avc_StatusEventHandlerRef_t le_avc_AddStatusEventHandler(le_avc_StatusHandlerFunc_t handlerPtr, void *contextPtr)
struct le_avc_SessionRequestEventHandler * le_avc_SessionRequestEventHandlerRef_t
Definition: le_avc_interface.h:639
le_avc_SessionRequest_t
Definition: le_avc_interface.h:537
An error occurred downloading the update.
Definition: le_avc_interface.h:498
le_result_t le_avc_DeferUninstall(uint32_t deferMinutes)
Install is pending (implies download complete)
Definition: le_avc_interface.h:500
le_result_t le_avc_AcceptUninstall(void)
le_result_t le_avc_GetUpdateType(le_avc_UpdateType_t *updateTypePtr)
void(* le_avc_DisconnectHandler_t)(void *)
Definition: le_avc_interface.h:322
Session with AV server stopped.
Definition: le_avc_interface.h:518
Session with AV server started.
Definition: le_avc_interface.h:516
le_avc_SessionType_t
Definition: le_avc_interface.h:595
Download in progress.
Definition: le_avc_interface.h:494
Definition: le_avc_interface.h:614
Device reboot is pending.
Definition: le_avc_interface.h:520
Session type invalid.
Definition: le_avc_interface.h:601
le_result_t le_avc_StartSession(void)
le_result_t le_avc_StopSession(void)
void le_avc_RemoveStatusEventHandler(le_avc_StatusEventHandlerRef_t handlerRef)
Authentication with AV server started.
Definition: le_avc_interface.h:524
Update pending download.
Definition: le_avc_interface.h:492
le_result_t le_avc_AcceptDownload(void)
le_result_t le_avc_TryConnectService(void)
le_result_t le_avc_CheckRoute(void)
Connection to the server is required.
Definition: le_avc_interface.h:522
le_result_t le_avc_DeferInstall(uint32_t deferMinutes)
Update has been successfully installed.
Definition: le_avc_interface.h:504
le_result_t le_avc_AcceptInstall(void)
Something failed while doing install/download.
Definition: le_avc_interface.h:581
Bootstrap session.
Definition: le_avc_interface.h:597
struct le_avc_BlockRequest * le_avc_BlockRequestRef_t
Definition: le_avc_interface.h:647
le_avc_BlockRequestRef_t le_avc_BlockInstall(void)
void le_avc_DisconnectService(void)
le_avc_SessionType_t le_avc_GetSessionType(void)
Device Management session.
Definition: le_avc_interface.h:599
No error.
Definition: le_avc_interface.h:577
Definition: le_avc_interface.h:617
le_result_t le_avc_GetApnConfig(char *apnName, size_t apnNameSize, char *userName, size_t userNameSize, char *userPwd, size_t userPwdSize)
le_avc_UpdateType_t
Definition: le_avc_interface.h:552
le_avc_CredentialStatus_t le_avc_GetCredentialStatus(void)
le_result_t le_avc_DeferDownload(uint32_t deferMinutes)
le_result_t le_avc_SetPollingTimer(uint32_t pollingTimer)
Security check failure while installing the package.
Definition: le_avc_interface.h:583
Request by user app to open AV session.
Definition: le_avc_interface.h:539
le_result_t le_avc_GetAppUpdateName(char *updateName, size_t updateNameSize)
le_avc_ErrorCode_t
Definition: le_avc_interface.h:575
Download has completed.
Definition: le_avc_interface.h:496
le_result_t le_avc_GetRetryTimers(uint16_t *timerValuePtr, size_t *timerValueSizePtr)
No updates pending.
Definition: le_avc_interface.h:490
le_avc_CredentialStatus_t
Definition: le_avc_interface.h:612
uint16_t le_avc_GetHttpStatus(void)
struct le_avc_StatusEventHandler * le_avc_StatusEventHandlerRef_t
Definition: le_avc_interface.h:631
Encountered a bad package.
Definition: le_avc_interface.h:579
le_avc_Status_t
Definition: le_avc_interface.h:488
App has been successfully uninstalled.
Definition: le_avc_interface.h:512
Device Management credential is provisioned.
Definition: le_avc_interface.h:620
Authentication with AV server failed.
Definition: le_avc_interface.h:526
le_avc_ErrorCode_t le_avc_GetErrorCode(void)
void le_avc_ConnectService(void)