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_user_agreement User Agreement
33  *
34  * By default, user agreements are disabled. This means that avcService automatically accepts
35  * requests from the server without asking for user approval: it initiates a connection to the
36  * server, download/install packages and reboots the target if needed. Thus, if no control app for
37  * the AirVantage service is present on the target, the daemon is still able to update the target.
38  *
39  * User agreements are persistent to reboot/update, they are stored in the file system. The default
40  * settings are only applied when the target boots the first time or when the configuration file is
41  * missing or corrupted. In all other cases, default configuration never overwrites the current one.
42  *
43  * When writing a control app for the AirVantage Service, it is up to the developer to ensure that
44  * user agreements have been enabled for all actions the control app performs. Otherwise, avcService
45  * will automatically accept server requests. User agreements can be retrieved and updated using
46  * le_avc_GetUserAgreement() and le_avc_SetUserAgreement().
47  *
48  * If user agreements are enabled and avcService can't communicate with the control app to report
49  * the pending requests, it waits for 3 minutes and tries again.
50  *
51  * There are 5 events that require user agreements:
52  * - LE_AVC_CONNECTION_PENDING
53  * - LE_AVC_DOWNLOAD_PENDING
54  * - LE_AVC_INSTALL_PENDING
55  * - LE_AVC_REBOOT_PENDING
56  * - LE_AVC_UNINSTALL_PENDING
57  *
58  * An app can respond to these user agreement notification by opening a connection if the
59  * notification is connection pending or by accepting or deferring the operation if the notification
60  * is one of download, install, uninstall or reboot pending.
61  *
62  * Whether avcService should forward these notifications to an app or act on these notifications by
63  * itself is determined by the individual configuration flags that enables or disables user
64  * agreement for these operations. If the user agreement flag is turned off for an operation,
65  * the default action by avcService is to automatically accept that pending operation. An app can
66  * register its handler by calling le_avc_AddStatusEventHandler() described in
67  * c_le_avc_update_control and the configuration flags can be set by le_avc_SetUserAgreement().
68  *
69  * Example of enabling user agreement for LE_AVC_DOWNLOAD_PENDING:
70  * @code
71  * le_result_t result;
72  * result = le_avc_SetUserAgreement(LE_AVC_USER_AGREEMENT_DOWNLOAD, true);
73  *
74  * if (result != LE_OK)
75  * {
76  * LE_ERROR("Failed to enable user agreement for download operation");
77  * }
78  * @endcode
79  *
80  * @subsection c_le_avc_update_control Update Control
81  *
82  * Any App can start a session with an AirVantage server to determine if there
83  * is a pending update. This is done with le_avc_StartSession().
84  *
85  * The current session can be stopped using le_avc_StopSession(). This cancels any query for pending
86  * update, or suspends a download in progress; however, it <b>won't stop</b> an install in progress.
87  *
88  * The status of a pending update is sent to all Apps registered for receiving a notification.
89  * An App can use le_avc_AddStatusEventHandler() to register a handler function to
90  * receive this notification. The notification will be received after a session is started.
91  *
92  * Example of registering an AVC handler and starting a session with fault checking:
93  * @code
94  * // Start AVC Session
95  * LE_INFO("AirVantage Connection Controller started.");
96  * le_avc_AddStatusEventHandler(avcStatusHandler, NULL); //register a AVC handler
97  *
98  * //Start AVC session. Note: AVC handler must be registered prior starting a session
99  * le_result_t result = le_avc_StartSession();
100  * if (LE_FAULT == result)
101  * {
102  * le_avc_StopSession();
103  * le_avc_StartSession();
104  * }
105  * @endcode
106  *
107  * An App can use le_avc_AddCommInfoHandler() to register a handler function and receive
108  * communication information notifications. This function returns a reference. To unregister
109  * the handler, le_avc_RemoveCommInfoHandler() should be called with the previously returned
110  * reference.
111  *
112  *
113  * Sometimes, @c avcService may decide to start a session with the AirVantage
114  * server; for instance if a call to le_avc_AcceptDownload() when the session is stopped,
115  * @c avcService will open a session to proceed with the download. In this case, a session started
116  * notification could also be received, even if le_avc_StartSession() is not called explicitly.
117  *
118  * @subsubsection c_le_avc_updateControl_pending Pending Updates
119  *
120  * There can only be one pending update at a time. To query the type of update, use
121  * le_avc_GetUpdateType(). App updates can call le_avc_GetAppUpdateName() to retrieve the App name.
122  *
123  * If a download is pending, le_avc_AcceptDownload() can be used to allow the update to be
124  * downloaded. An AirVantage session will be initiated if this api is called while there is no
125  * active AirVantage session. le_avc_DeferDownload() can be used to defer the download for the
126  * specified number of minutes. After the defer time has elapsed, the pending download notification
127  * will be re-sent again to all registered apps. le_avc_AcceptDownload() can be used to accept the
128  * download even before the defer timer expires. This behaviour is true for deferring install
129  * and uninstall as well.
130  *
131  * Once an update has been downloaded, a new notification will be received to indicate that an
132  * install is pending. Apps can then use le_avc_AcceptInstall() to allow the install to proceed.
133  *
134  * If an uninstall is pending, then le_avc_AcceptUninstall() can be used to allow the uninstall to
135  * proceed. To defer the decision, le_avc_DeferUninstall() can be used to defer the uninstall for
136  * the specified number of minutes. In case of an upgrade, the existing application will not be
137  * uninstalled after le_avc_AcceptUninstall() is called. le_avc_AcceptUninstall() is only used to
138  * signal the server to start downloading the new application. To proceed with an upgrade process,
139  * accept the uninstall of the existing version followed by accepting the download and install of
140  * the new version.
141  *
142  * @code
143  * switch (updateStatus)
144  * {
145  * case LE_AVC_DOWNLOAD_PENDING:
146  * LE_INFO("Accepting %s update.", GetUpdateType());
147  * res = le_avc_AcceptDownload();
148  * if (res != LE_OK)
149  * {
150  * LE_ERROR("Failed to accept download from AirVantage (%s)", LE_RESULT_TXT(res));
151  * }
152  * break;
153  *
154  * case LE_AVC_INSTALL_PENDING:
155  * LE_INFO("Accepting %s installation.", GetUpdateType());
156  * res = le_avc_AcceptInstall();
157  * if (res != LE_OK)
158  * {
159  * LE_ERROR("Failed to accept install from AirVantage (%s)", LE_RESULT_TXT(res));
160  * }
161  * break;
162  *
163  * case LE_AVC_UNINSTALL_PENDING:
164  * LE_INFO("Accepting %s uninstall.", GetUpdateType());
165  * res = le_avc_AcceptUninstall();
166  * if (res != LE_OK)
167  * {
168  * LE_ERROR("Failed to accept uninstall from AirVantage (%s)", LE_RESULT_TXT(res));
169  * }
170  * break;
171  *
172  * case LE_AVC_REBOOT_PENDING:
173  * LE_INFO("Accepting device reboot.");
174  * res = le_avc_AcceptReboot();
175  * if (res != LE_OK)
176  * {
177  * LE_ERROR("Failed to accept reboot from AirVantage (%s)", LE_RESULT_TXT(res));
178  * }
179  * break;
180  *
181  * default:
182  * // No action required
183  * break;
184  * }
185  * @endcode
186  *
187  * @note Even if an App calls le_avc_AcceptInstall(), the install may still be blocked by another
188  * App using the @ref c_le_avc_update_app functions. To defer the decision, an App can use
189  * le_avc_DeferInstall() to defer the install for the specified number of minutes. After the defer
190  * time has elapsed, the pending install notification will be re-sent to allow Apps to make a new
191  * decision, or again defer.
192  *
193  *
194  * @subsubsection c_le_avc_updateControl_accepting Accepting Installs/Uninstalls
195  *
196  * Accepting an App install or uninstall will not initiate an AirVantage session if no session
197  * is active. An App should start an AirVantage session before accepting an App install/uninstall,
198  * to ensure the process is completed, and the server is updated.
199  *
200  * If no app has registered for notifications using le_avc_AddStatusEventHandler(),
201  * then any pending downloads and installs will happen automatically, subject to any restrictions
202  * imposed by app using the @ref c_le_avc_update_app functions.
203  *
204  * There is no restriction on the number of Apps registering for notifications.
205  *
206  * In case of any error incurred during App download/install, an error code will be set which can be
207  * retrieved by calling le_avc_GetErrorCode().
208  *
209  * @subsection c_le_avc_update_app Application Installation Blocking
210  *
211  * When an App is about to perform a critical operation, it can block the installation of
212  * an update with le_avc_BlockInstall(), and after it's finished with the critical operation, it
213  * can unblock the install with le_avc_UnblockInstall().
214  *
215  * What constitutes a critical operation depends on the App. An eCall App might
216  * block installs for the duration that it runs. A data collection App that wakes up
217  * once an hour might block installs while it collects and stores and/or transmits a new data
218  * sample, and then unblock installs just before it goes to sleep again.
219  *
220  * If an install can't be applied because it's blocked, another attempt to apply the install
221  * will be made at a later time.
222  *
223  * An App can add a session control handler using le_avc_AddSessionRequestEventHandler(). Requests
224  * by user Apps to open or close session will be forwarded to the session control handler. If no App
225  * has registered a session request handler, AVC session can be opened or closed anytime by
226  * user Apps.
227  *
228  * @subsection c_le_avc_suspend_resume Suspend and resume an update
229  *
230  * A firmware/application update can be interrupted or suspended by different events:
231  * - a device reboot
232  * - a network loss
233  * - a manual suspend through a session stop.
234  *
235  * After the update suspension, when the @c avcService is ready to resume the update process:
236  * - If the user agreements are disabled, the update process is automatically restarted.
237  * - If the user agreements are enabled, the previous @c PENDING notification is sent to the App,
238  * as indicated in the table below.
239  *
240  * @note The @c avcService might take a while to suspend the update process (typically a few
241  * minutes), e.g. in some cases of firmware update. The @c PENDING notification will therefore be
242  * sent only when the suspension is over. Trying to resume the update process while the suspension
243  * is not over and the notification is not received has no effect.
244  *
245  * | Last received event | Event sent to resume | Expected action from App |
246  * |--------------------------------|-------------------------------------------------------------|--------------------------|
247  * | @c LE_AVC_DOWNLOAD_PENDING | @c LE_AVC_DOWNLOAD_PENDING | Accept download |
248  * | @c LE_AVC_DOWNLOAD_IN_PROGRESS | @c LE_AVC_DOWNLOAD_PENDING with remaining bytes to download | Accept download |
249  * | @c LE_AVC_DOWNLOAD_COMPLETE | @c LE_AVC_DOWNLOAD_PENDING with zero bytes to download | Accept download |
250  * | @c LE_AVC_INSTALL_PENDING | @c LE_AVC_INSTALL_PENDING | Accept install |
251  * | @c LE_AVC_INSTALL_IN_PROGRESS | @c LE_AVC_INSTALL_PENDING | Accept install |
252  * | @c LE_AVC_UNINSTALL_PENDING | @c LE_AVC_UNINSTALL_PENDING | Accept uninstall |
253  * | @c LE_AVC_CONNECTION_PENDING | @c LE_AVC_CONNECTION_PENDING | Start session |
254  *
255  * @note If firmware is updated (via fwupdate tool) or new legato is installed (via instlegato),
256  * all suspend/resume information stored by avcService is erased. So if developer updates firmware
257  * or legato (via ethernet or ecm etc.) in the middle of any update initiated by avcService, this
258  * need to be cancelled and restarted again from airVantage server.
259  *
260  * @section c_le_avc_Timers Timers
261  *
262  * Polling timers sets the time that the Target will communicate with the AirVantage Server to check
263  * for new jobs. Retry timers will try and re-establish a connection to the AirVantage Server in
264  * accordance with the times that are declared.
265  *
266  * @subsection c_le_avc_PollingTimer Polling Timer
267  *
268  * The target will periodically initiate a connection to the AirVantage Server according to the
269  * settings for the polling timer to check if there are any pending jobs. The polling timer will
270  * initiate a session when it starts the count (at 0 minutes) and then again at the specified time
271  * set.
272  *
273  * To disable the polling timer call le_avc_SetPollingTimer() and set the value to 0.
274  *
275  * The polling timer accepts ranges from 0 to 525600 minutes. The polling timer does not get reset
276  * with reboots or power loss. If the target is powered off during the polling time, it will
277  * connect to the AVC Server upon startup of the app. For example, if the polling timer is set to 1
278  * hour then and the target reboots at the 20 minute mark, the polling timer will still initiate a
279  * connection at the 1 hour mark. If the target is powered off or in the middle of rebooting at the
280  * 1 hour mark, as soon as the app is started again, the polling timer will initiate a connection to
281  * the AirVantage Server.
282  *
283  * Polling timer initiated sessions will be disconnected after 20 seconds of inactivity. This does
284  * not apply to AirVantage sessions that have been initiated by an app. The app is responsible for
285  * disconnecting the session it initiates within a reasonable timeframe. Leaving the session open
286  * for long period will result in power wastage.
287  *
288  * To read the polling timer call: le_avc_GetPollingTimer()
289  *
290  * To write a new value to the polling timer call: le_avc_SetPollingTimer()
291  *
292  * Writing to the polling timer stops the current polling timer if it is running and starts a timer
293  * with the new value. The next connection will be initiated when the new polling timer reaches it's
294  * set value.
295  *
296  * @subsection c_le_avc_RetryTimers Retry Timers
297  *
298  * If an error occurs during a connection to the Device Services server (WWAN DATA establishment
299  * failed and an http error code is received) the embedded module will initiate a new connection
300  * according to the values defined in the retry timers.
301  *
302  * The timers are tried in sequence until a connection is established, or all enabled retry timers
303  * are exhausted. After all the enabled timers are exhausted, a new session must be initiated again
304  * by calling le_avc_startSession() after the expiry of the retry timer.
305  *
306  * The retry timer values are persistent (reboots and updates do not effect the retry timers).
307  * If you wish to disable a retry timer set the timer value
308  * to 0. You must always pass in at least 8 values to the retry timers.
309  *
310  * Retry timer values range from 0 to 20160 minutes.
311  * The function le_avc_GetRetryTimers() reads the retry timers in an array and the function
312  * le_avc_SetRetryTimers() writes the retry timers. When writing to the retry timers, values of
313  * all the 8 timers have to be defined.
314  *
315  * Example of calling retry timers, the session will be retried after 15 minutes, 1 hour, 4 hours,
316  * 8 hours, 1 day and 2 days, the last two retries are disabled:
317  * @code
318  * uint16_t RetryTimers[LE_AVC_NUM_RETRY_TIMERS] = {15, 60, 240, 480, 1440, 2880, 0, 0};
319  * le_avc_SetRetryTimers(RetryTimers, LE_AVC_NUM_RETRY_TIMERS);
320  * @endcode
321  *
322  * @section c_le_avc_reboot Device reboot
323  *
324  * The AirVantage server can request to reboot the device. If a reboot is requested a notification
325  * is sent to the registered Apps. The App can either accept the reboot with le_avc_AcceptReboot()
326  * or defer it for a specified number of minutes with le_avc_DeferReboot(). After the defer time
327  * has elapsed, the pending reboot notification will be re-sent. This allows the registered app to
328  * make a new decision or defer the reboot again.
329  *
330  * If no App has registered for notifications using le_avc_AddStatusEventHandler(), then
331  * any pending reboot will happen automatically.
332  *
333  * @section c_le_avc_GetCredentialStatus Credential Status
334  * The device is provisioned with bootstrap credentials from factory. The Device Management (DM)
335  * credentials are provisioned by AirVantage Bootstrap Server. This API is used to retrieve the
336  * status of credentials provisioned on the device.
337  *
338  * @section c_le_avc_connection Connection pending
339  *
340  * The AirVantage agent can request a connection to the AirVantage server, especially when a
341  * firmware package is installed (after a platform reboot) or device reboots in the middle of
342  * software update (after finishing software update on reboot). In this case a notification is sent
343  * to the control App, which can start the connection with le_avc_StartSession().
344  *
345  * @section c_le_avc_routing Data routing
346  *
347  * By default the AirVantage connection uses the default mobile data profile and the default route
348  * set by the data connection service.
349  *
350  * If the user wishes to control the network configuration, e.g. to use the AirVantage agent with
351  * multi-PDP contexts, they should first bind the application to the data connection service:
352  * @verbatim
353  bindings:
354  {
355  clientExe.clientComponent.le_data -> dataConnectionService.le_data
356  }
357  @endverbatim
358  *
359  * The data connection service should then be configured before launching the AirVantage connection:
360  * - le_data_SetCellularProfileIndex() allows to change the data profile to use.
361  * - le_data_GetDefaultRouteStatus() indicates if the default route is activated in the data
362  * connection service. This default route can be deactivated in the data connection service
363  * configuration database, as explained in @ref c_le_data_defaultRoute. If the default route is
364  * deactivated, the AirVantage agent will automatically add routes to be able to reach the
365  * AirVantage server through the connection used by AirVantage.
366  *
367  * @section c_le_avc_timeout Connection / Download timeout
368  *
369  * The AirVantage connector service will abort FOTA/SOTA download, if it takes more than
370  * 300 seconds to establish a connection. Download will also be aborted, if the download speed is
371  * too low (less than 100 bytes /second) for too long (for more than 1000 seconds).
372  * These values are chosen based on experiments on low speed network. There is no configuration
373  * for these timeouts.
374  *
375  * @section le_avcService_configdb Service Configuration Tree
376  * @copydoc le_avcService_configdbPage_Hide
377  *
378  *
379  * Copyright (C) Sierra Wireless Inc.
380  */
381 /**
382  * @interface le_avcService_configdbPage_Hide
383  *
384  * The configuration database path for the activityTimeout is:
385  * @verbatim
386  /
387  apps/
388  avcService/
389  activityTimeout
390  @endverbatim
391  *
392  *
393  * After an AirVantage session is started, if there's no activity between the device and the server
394  * within the timer interval, then LE_AVC_NO_UPDATE state will be returned to the app. However,
395  * this activity timeout can be overridden by setting an integer value for
396  * /apps/avcService/activityTimeout. The activity timer is initialized only when the @c avcService
397  * starts. If a valid entry >0 is found, then it will be used instead of the default value of 20
398  * seconds. The following steps should be used to set the activityTimeout.
399  *
400  *
401  * @verbatim
402  config set /apps/avcService/activityTimeout xx int
403  app restart avcService
404  @endverbatim
405  *
406  * @note
407  * Everytime a new value is written to activityTimeout, the avcService needs to be
408  * restarted to read the new value.
409  *
410  *
411  */
412 /**
413  * @file le_avc_interface.h
414  *
415  * Legato @ref c_le_avc include file.
416  *
417  * Copyright (C) Sierra Wireless Inc.
418  */
419 
420 #ifndef LE_AVC_INTERFACE_H_INCLUDE_GUARD
421 #define LE_AVC_INTERFACE_H_INCLUDE_GUARD
422 
423 
424 #include "legato.h"
425 
426 // Interface specific includes
427 #include "le_limit_interface.h"
428 
429 
430 //--------------------------------------------------------------------------------------------------
431 /**
432  * Type for handler called when a server disconnects.
433  */
434 //--------------------------------------------------------------------------------------------------
435 typedef void (*le_avc_DisconnectHandler_t)(void *);
436 
437 //--------------------------------------------------------------------------------------------------
438 /**
439  *
440  * Connect the current client thread to the service providing this API. Block until the service is
441  * available.
442  *
443  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
444  * called before any other functions in this API. Normally, ConnectService is automatically called
445  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
446  *
447  * This function is created automatically.
448  */
449 //--------------------------------------------------------------------------------------------------
451 (
452  void
453 );
454 
455 //--------------------------------------------------------------------------------------------------
456 /**
457  *
458  * Try to connect the current client thread to the service providing this API. Return with an error
459  * if the service is not available.
460  *
461  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
462  * called before any other functions in this API. Normally, ConnectService is automatically called
463  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
464  *
465  * This function is created automatically.
466  *
467  * @return
468  * - LE_OK if the client connected successfully to the service.
469  * - LE_UNAVAILABLE if the server is not currently offering the service to which the client is
470  * bound.
471  * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
472  * - LE_COMM_ERROR if the Service Directory cannot be reached.
473  */
474 //--------------------------------------------------------------------------------------------------
476 (
477  void
478 );
479 
480 //--------------------------------------------------------------------------------------------------
481 /**
482  * Set handler called when server disconnection is detected.
483  *
484  * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants
485  * to continue without exiting, it should call longjmp() from inside the handler.
486  */
487 //--------------------------------------------------------------------------------------------------
489 (
490  le_avc_DisconnectHandler_t disconnectHandler,
491  void *contextPtr
492 );
493 
494 //--------------------------------------------------------------------------------------------------
495 /**
496  *
497  * Disconnect the current client thread from the service providing this API.
498  *
499  * Normally, this function doesn't need to be called. After this function is called, there's no
500  * longer a connection to the service, and the functions in this API can't be used. For details, see
501  * @ref apiFilesC_client.
502  *
503  * This function is created automatically.
504  */
505 //--------------------------------------------------------------------------------------------------
507 (
508  void
509 );
510 
511 
512 //--------------------------------------------------------------------------------------------------
513 /**
514  * Maximum APN name length without NULL terminator.
515  */
516 //--------------------------------------------------------------------------------------------------
517 #define LE_AVC_APN_NAME_MAX_LEN 48
518 
519 //--------------------------------------------------------------------------------------------------
520 /**
521  * Maximum APN name length including NULL terminator.
522  */
523 //--------------------------------------------------------------------------------------------------
524 #define LE_AVC_APN_NAME_MAX_LEN_BYTES 49
525 
526 //--------------------------------------------------------------------------------------------------
527 /**
528  * Maximum user name length without NULL terminator.
529  */
530 //--------------------------------------------------------------------------------------------------
531 #define LE_AVC_USERNAME_MAX_LEN 28
532 
533 //--------------------------------------------------------------------------------------------------
534 /**
535  * Maximum user name length including NULL terminator.
536  */
537 //--------------------------------------------------------------------------------------------------
538 #define LE_AVC_USERNAME_MAX_LEN_BYTES 29
539 
540 //--------------------------------------------------------------------------------------------------
541 /**
542  * Maximum password length without NULL terminator..
543  */
544 //--------------------------------------------------------------------------------------------------
545 #define LE_AVC_PASSWORD_MAX_LEN 28
546 
547 //--------------------------------------------------------------------------------------------------
548 /**
549  * Maximum password length including NULL terminator.
550  */
551 //--------------------------------------------------------------------------------------------------
552 #define LE_AVC_PASSWORD_MAX_LEN_BYTES 29
553 
554 //--------------------------------------------------------------------------------------------------
555 /**
556  * Maximum number of retry timers.
557  */
558 //--------------------------------------------------------------------------------------------------
559 #define LE_AVC_NUM_RETRY_TIMERS 8
560 
561 //--------------------------------------------------------------------------------------------------
562 /**
563  * Polling timer value range in minutes. 525600 minutes = 1 year.
564  */
565 //--------------------------------------------------------------------------------------------------
566 #define LE_AVC_POLLING_TIMER_MAX_VAL 525600
567 
568 //--------------------------------------------------------------------------------------------------
569 /**
570  */
571 //--------------------------------------------------------------------------------------------------
572 #define LE_AVC_POLLING_TIMER_MIN_VAL 0
573 
574 //--------------------------------------------------------------------------------------------------
575 /**
576  * Retry timer value range in minutes. 20160 minutes = 2 weeks.
577  */
578 //--------------------------------------------------------------------------------------------------
579 #define LE_AVC_RETRY_TIMER_MAX_VAL 20160
580 
581 //--------------------------------------------------------------------------------------------------
582 /**
583  */
584 //--------------------------------------------------------------------------------------------------
585 #define LE_AVC_RETRY_TIMER_MIN_VAL 0
586 
587 //--------------------------------------------------------------------------------------------------
588 /**
589  * Default HTTP status.
590  */
591 //--------------------------------------------------------------------------------------------------
592 #define LE_AVC_HTTP_STATUS_INVALID 65535
593 
594 //--------------------------------------------------------------------------------------------------
595 /**
596  * Communication info max string size
597  */
598 //--------------------------------------------------------------------------------------------------
599 #define LE_AVC_COMM_INFO_STR_MAX_LEN 256
600 
601 //--------------------------------------------------------------------------------------------------
602 /**
603  * Maximum length of a LwM2M resource excluding any termination character.
604  */
605 //--------------------------------------------------------------------------------------------------
606 #define LE_AVC_MAX_LWM2M_RESOURCE_LEN 512
607 
608 //--------------------------------------------------------------------------------------------------
609 /**
610  * Maximum length of a LwM2M resource. One extra byte is added for the null character.
611  */
612 //--------------------------------------------------------------------------------------------------
613 #define LE_AVC_MAX_LWM2M_RESOURCE_BYTES 513
614 
615 //--------------------------------------------------------------------------------------------------
616 /**
617  * Communication info codes
618  */
619 //--------------------------------------------------------------------------------------------------
620 #define LE_AVC_COMM_INFO_UDP_NO_ERR 0
621 
622 //--------------------------------------------------------------------------------------------------
623 /**
624  */
625 //--------------------------------------------------------------------------------------------------
626 #define LE_AVC_COMM_INFO_UDP_OPEN_ERR 1
627 
628 //--------------------------------------------------------------------------------------------------
629 /**
630  */
631 //--------------------------------------------------------------------------------------------------
632 #define LE_AVC_COMM_INFO_UDP_CLOSE_ERR 2
633 
634 //--------------------------------------------------------------------------------------------------
635 /**
636  */
637 //--------------------------------------------------------------------------------------------------
638 #define LE_AVC_COMM_INFO_UDP_SEND_ERR 3
639 
640 //--------------------------------------------------------------------------------------------------
641 /**
642  */
643 //--------------------------------------------------------------------------------------------------
644 #define LE_AVC_COMM_INFO_UDP_RECV_ERR 4
645 
646 //--------------------------------------------------------------------------------------------------
647 /**
648  */
649 //--------------------------------------------------------------------------------------------------
650 #define LE_AVC_COMM_INFO_UDP_CONNECT_ERR 5
651 
652 //--------------------------------------------------------------------------------------------------
653 /**
654  */
655 //--------------------------------------------------------------------------------------------------
656 #define LE_AVC_COMM_INFO_BEARER_UP 6
657 
658 //--------------------------------------------------------------------------------------------------
659 /**
660  */
661 //--------------------------------------------------------------------------------------------------
662 #define LE_AVC_COMM_INFO_BEARER_DOWN 7
663 
664 //--------------------------------------------------------------------------------------------------
665 /**
666  */
667 //--------------------------------------------------------------------------------------------------
668 #define LE_AVC_COMM_INFO_PDP_CONTEXT 8
669 
670 //--------------------------------------------------------------------------------------------------
671 /**
672  */
673 //--------------------------------------------------------------------------------------------------
674 #define LE_AVC_COMM_INFO_COAP_201_CREATED 65
675 
676 //--------------------------------------------------------------------------------------------------
677 /**
678  */
679 //--------------------------------------------------------------------------------------------------
680 #define LE_AVC_COMM_INFO_COAP_202_DELETED 66
681 
682 //--------------------------------------------------------------------------------------------------
683 /**
684  */
685 //--------------------------------------------------------------------------------------------------
686 #define LE_AVC_COMM_INFO_COAP_204_CHANGED 68
687 
688 //--------------------------------------------------------------------------------------------------
689 /**
690  */
691 //--------------------------------------------------------------------------------------------------
692 #define LE_AVC_COMM_INFO_COAP_205_CONTENT 69
693 
694 //--------------------------------------------------------------------------------------------------
695 /**
696  */
697 //--------------------------------------------------------------------------------------------------
698 #define LE_AVC_COMM_INFO_COAP_231_CONTINUE 95
699 
700 //--------------------------------------------------------------------------------------------------
701 /**
702  */
703 //--------------------------------------------------------------------------------------------------
704 #define LE_AVC_COMM_INFO_COAP_400_BAD_REQUEST 128
705 
706 //--------------------------------------------------------------------------------------------------
707 /**
708  */
709 //--------------------------------------------------------------------------------------------------
710 #define LE_AVC_COMM_INFO_COAP_401_UNAUTHORIZED 129
711 
712 //--------------------------------------------------------------------------------------------------
713 /**
714  */
715 //--------------------------------------------------------------------------------------------------
716 #define LE_AVC_COMM_INFO_COAP_402_BAD_OPTION 130
717 
718 //--------------------------------------------------------------------------------------------------
719 /**
720  */
721 //--------------------------------------------------------------------------------------------------
722 #define LE_AVC_COMM_INFO_COAP_404_NOT_FOUND 132
723 
724 //--------------------------------------------------------------------------------------------------
725 /**
726  */
727 //--------------------------------------------------------------------------------------------------
728 #define LE_AVC_COMM_INFO_COAP_405_METHOD_NOT_ALLOWED 133
729 
730 //--------------------------------------------------------------------------------------------------
731 /**
732  */
733 //--------------------------------------------------------------------------------------------------
734 #define LE_AVC_COMM_INFO_COAP_406_NOT_ACCEPTABLE 134
735 
736 //--------------------------------------------------------------------------------------------------
737 /**
738  */
739 //--------------------------------------------------------------------------------------------------
740 #define LE_AVC_COMM_INFO_COAP_408_REQ_ENTITY_INCOMPLETE 136
741 
742 //--------------------------------------------------------------------------------------------------
743 /**
744  */
745 //--------------------------------------------------------------------------------------------------
746 #define LE_AVC_COMM_INFO_COAP_412_PRECONDITION_FAILED 140
747 
748 //--------------------------------------------------------------------------------------------------
749 /**
750  */
751 //--------------------------------------------------------------------------------------------------
752 #define LE_AVC_COMM_INFO_COAP_413_ENTITY_TOO_LARGE 141
753 
754 //--------------------------------------------------------------------------------------------------
755 /**
756  */
757 //--------------------------------------------------------------------------------------------------
758 #define LE_AVC_COMM_INFO_COAP_500_INTERNAL_SERVER_ERROR 160
759 
760 //--------------------------------------------------------------------------------------------------
761 /**
762  */
763 //--------------------------------------------------------------------------------------------------
764 #define LE_AVC_COMM_INFO_COAP_501_NOT_IMPLEMENTED 161
765 
766 //--------------------------------------------------------------------------------------------------
767 /**
768  */
769 //--------------------------------------------------------------------------------------------------
770 #define LE_AVC_COMM_INFO_COAP_503_SERVICE_UNAVAILABLE 163
771 
772 //--------------------------------------------------------------------------------------------------
773 /**
774  * Status of session or update
775  *
776  * If an update is pending, it must first be downloaded and then installed.
777  */
778 //--------------------------------------------------------------------------------------------------
779 typedef enum
780 {
782  ///< No updates pending
784  ///< Update pending download
786  ///< Download in progress
788  ///< Download has completed
790  ///< An error occurred downloading the update
792  ///< Install is pending (implies download complete)
794  ///< Install in progress
796  ///< Update has been successfully installed
798  ///< An error occurred installing the update
800  ///< Uninstall is pending
802  ///< Uninstall in progress
804  ///< App has been successfully uninstalled
806  ///< An error occurred uninstalling the update
808  ///< Session with AirVantage device management server started
810  ///< Session with bootstrap server started
812  ///< Session with AirVantage device management server or bootstrap
813  ///< server stopped
815  ///< Session with AirVantage device management server or bootstrap
816  ///< server failed
818  ///< Device reboot is pending
820  ///< Connection to the server is required. This is necessary when
821  ///< firmware package is installed (after a platform reboot). Also
822  ///< necessary after software update if device reboots(or session stops)
823  ///< in the middle of software update.
825  ///< Authentication with AirVantage device management server or
826  ///< bootstrap server started
828  ///< Authentication with AirVantage device management server or
829  ///< bootstrap server failed
831  ///< Package is certified sent by a trusted server
833  ///< Package is not certified sent by a trusted server
834 }
836 
837 
838 //--------------------------------------------------------------------------------------------------
839 /**
840  * Operations which require user agreement
841  */
842 //--------------------------------------------------------------------------------------------------
843 typedef enum
844 {
846  ///< User agreement for connection
848  ///< User agreement for download
850  ///< User agreement for install
852  ///< User agreement for uninstall
854  ///< User agreement for reboot
855 }
857 
858 
859 //--------------------------------------------------------------------------------------------------
860 /**
861  * Request to open or close avms session.
862  */
863 //--------------------------------------------------------------------------------------------------
864 typedef enum
865 {
867  ///< Request by user app to open AV session
869  ///< Request by user app to close AV session
870 }
872 
873 
874 //--------------------------------------------------------------------------------------------------
875 /**
876  * The type of pending update
877  */
878 //--------------------------------------------------------------------------------------------------
879 typedef enum
880 {
881  LE_AVC_UNKNOWN_UPDATE = 0,
882  ///<
883  LE_AVC_FIRMWARE_UPDATE = 1,
884  ///<
885  LE_AVC_FRAMEWORK_UPDATE = 2,
886  ///<
887  LE_AVC_APPLICATION_UPDATE = 3
888  ///<
889 }
891 
892 
893 //--------------------------------------------------------------------------------------------------
894 /**
895  * Error code used to provide diagnostic information after a failure (includes both download and
896  * install failure).
897  *
898  * @note
899  * Additional information may also be available in the target device's system log.
900  */
901 //--------------------------------------------------------------------------------------------------
902 typedef enum
903 {
905  ///< No error.
907  ///< Encountered a bad package.
909  ///< Something failed while doing install/download.
911  ///< Security check failure while installing the package.
912 }
914 
915 
916 //--------------------------------------------------------------------------------------------------
917 /**
918  * Session type indicates whether the device is connected to the bootstrap server or the
919  * device management server.
920  */
921 //--------------------------------------------------------------------------------------------------
922 typedef enum
923 {
925  ///< Bootstrap session.
927  ///< Device Management session.
929  ///< Session type invalid.
930 }
932 
933 
934 //--------------------------------------------------------------------------------------------------
935 /**
936  * Status of the device credentials
937  */
938 //--------------------------------------------------------------------------------------------------
939 typedef enum
940 {
942  ///< Neither Bootstrap nor Device Management
943  ///< credential is provisioned.
945  ///< Bootstrap credential is provisioned but Device
946  ///< Management credential is not provisioned.
948  ///< Device Management credential is provisioned.
949 }
951 
952 
953 //--------------------------------------------------------------------------------------------------
954 /**
955  * Reference type used by Add/Remove functions for EVENT 'le_avc_StatusEvent'
956  */
957 //--------------------------------------------------------------------------------------------------
958 typedef struct le_avc_StatusEventHandler* le_avc_StatusEventHandlerRef_t;
959 
960 
961 //--------------------------------------------------------------------------------------------------
962 /**
963  * Reference type used by Add/Remove functions for EVENT 'le_avc_SessionRequestEvent'
964  */
965 //--------------------------------------------------------------------------------------------------
966 typedef struct le_avc_SessionRequestEventHandler* le_avc_SessionRequestEventHandlerRef_t;
967 
968 
969 //--------------------------------------------------------------------------------------------------
970 /**
971  * Reference type used by Add/Remove functions for EVENT 'le_avc_CommInfo'
972  */
973 //--------------------------------------------------------------------------------------------------
974 typedef struct le_avc_CommInfoHandler* le_avc_CommInfoHandlerRef_t;
975 
976 
977 //--------------------------------------------------------------------------------------------------
978 /**
979  * Reference returned by BlockInstall function and used by UnblockInstall function
980  */
981 //--------------------------------------------------------------------------------------------------
982 typedef struct le_avc_BlockRequest* le_avc_BlockRequestRef_t;
983 
984 
985 //--------------------------------------------------------------------------------------------------
986 /**
987  * Handler for update availability status
988  */
989 //--------------------------------------------------------------------------------------------------
990 typedef void (*le_avc_StatusHandlerFunc_t)
991 (
992  le_avc_Status_t updateStatus,
993  ///< status of pending update, if available
994  int32_t totalNumBytes,
995  ///< Total number of bytes to be downloaded
996  ///< only valid when updateStatus is one of
997  ///< DOWNLOAD_PENDING, DOWNLOAD_IN_PROGRESS or DOWNLOAD_COMPLETE.
998  ///< returns -1 if value is unknown
999  int32_t progress,
1000  ///< Task completion in percentage
1001  ///< Valid when updateStatus is one of DOWNLOAD_IN_PROGRESS,
1002  ///< INSTALL_IN_PROGRESS or UNINSTALL_IN_PROGRESS.
1003  ///< returns -1 if value is unknown
1004  void* contextPtr
1005  ///<
1006 );
1007 
1008 //--------------------------------------------------------------------------------------------------
1009 /**
1010  * Handler for receiving session open or close request.
1011  */
1012 //--------------------------------------------------------------------------------------------------
1013 typedef void (*le_avc_SessionRequestHandlerFunc_t)
1015  le_avc_SessionRequest_t request,
1016  ///< Request to open or close AV session
1017  void* contextPtr
1018  ///<
1019 );
1020 
1021 //--------------------------------------------------------------------------------------------------
1022 /**
1023  * Handler for receiving communication information.
1024  */
1025 //--------------------------------------------------------------------------------------------------
1026 typedef void (*le_avc_CommInfoHandlerFunc_t)
1028  uint8_t code,
1029  ///< Communication information code
1030  const char* LE_NONNULL str,
1031  ///< Communication information string
1032  void* contextPtr
1033  ///<
1034 );
1035 
1036 //--------------------------------------------------------------------------------------------------
1037 /**
1038  * Add handler function for EVENT 'le_avc_StatusEvent'
1039  *
1040  * This event provides information on update availability status
1041  */
1042 //--------------------------------------------------------------------------------------------------
1044 (
1045  le_avc_StatusHandlerFunc_t handlerPtr,
1046  ///< [IN]
1047  void* contextPtr
1048  ///< [IN]
1049 );
1050 
1051 //--------------------------------------------------------------------------------------------------
1052 /**
1053  * Remove handler function for EVENT 'le_avc_StatusEvent'
1054  */
1055 //--------------------------------------------------------------------------------------------------
1057 (
1059  ///< [IN]
1060 );
1061 
1062 //--------------------------------------------------------------------------------------------------
1063 /**
1064  * Add handler function for EVENT 'le_avc_SessionRequestEvent'
1065  *
1066  * This event provides information on session open or close request.
1067  */
1068 //--------------------------------------------------------------------------------------------------
1070 (
1072  ///< [IN]
1073  void* contextPtr
1074  ///< [IN]
1075 );
1076 
1077 //--------------------------------------------------------------------------------------------------
1078 /**
1079  * Remove handler function for EVENT 'le_avc_SessionRequestEvent'
1080  */
1081 //--------------------------------------------------------------------------------------------------
1083 (
1085  ///< [IN]
1086 );
1087 
1088 //--------------------------------------------------------------------------------------------------
1089 /**
1090  * Add handler function for EVENT 'le_avc_CommInfo'
1091  *
1092  * This event provides communication errors.
1093  */
1094 //--------------------------------------------------------------------------------------------------
1096 (
1097  le_avc_CommInfoHandlerFunc_t handlerPtr,
1098  ///< [IN]
1099  void* contextPtr
1100  ///< [IN]
1101 );
1102 
1103 //--------------------------------------------------------------------------------------------------
1104 /**
1105  * Remove handler function for EVENT 'le_avc_CommInfo'
1106  */
1107 //--------------------------------------------------------------------------------------------------
1109 (
1110  le_avc_CommInfoHandlerRef_t handlerRef
1111  ///< [IN]
1112 );
1113 
1114 //--------------------------------------------------------------------------------------------------
1115 /**
1116  * Start a session with the AirVantage server
1117  *
1118  * This will cause a query to be sent to the server, for pending updates.
1119  *
1120  * @return
1121  * - LE_OK if connection request has been sent.
1122  * - LE_FAULT on failure
1123  * - LE_DUPLICATE if already connected.
1124  */
1125 //--------------------------------------------------------------------------------------------------
1127 (
1128  void
1129 );
1130 
1131 //--------------------------------------------------------------------------------------------------
1132 /**
1133  * Stop a session with the AirVantage server
1134  *
1135  * If a download is in progress, then this suspends the download.
1136  *
1137  * @return
1138  * - LE_OK on success
1139  * - LE_FAULT on failure
1140  * - LE_DUPLICATE if already disconnected
1141  */
1142 //--------------------------------------------------------------------------------------------------
1144 (
1145  void
1146 );
1147 
1148 //--------------------------------------------------------------------------------------------------
1149 /**
1150  * Send a specific message to the server to be sure that the route between the device and the server
1151  * is available.
1152  * This API needs to be called when any package download is over (successfully or not) and before
1153  * sending any notification on asset data to the server.
1154  *
1155  * @return
1156  * - LE_OK when the treatment is launched
1157  * - LE_FAULT on failure
1158  * - LE_UNSUPPORTED when the API is not supported
1159  *
1160  */
1161 //--------------------------------------------------------------------------------------------------
1163 (
1164  void
1165 );
1166 
1167 //--------------------------------------------------------------------------------------------------
1168 /**
1169  * Defer the currently pending connection, for the given number of minutes
1170  *
1171  * @return
1172  * - LE_OK on success
1173  * - LE_FAULT on failure
1174  */
1175 //--------------------------------------------------------------------------------------------------
1177 (
1178  uint32_t deferMinutes
1179  ///< [IN]
1180 );
1181 
1182 //--------------------------------------------------------------------------------------------------
1183 /**
1184  * Accept the currently pending download
1185  *
1186  * @return
1187  * - LE_OK on success
1188  * - LE_FAULT on failure
1189  */
1190 //--------------------------------------------------------------------------------------------------
1192 (
1193  void
1194 );
1195 
1196 //--------------------------------------------------------------------------------------------------
1197 /**
1198  * Defer the currently pending download, for the given number of minutes
1199  *
1200  * @return
1201  * - LE_OK on success
1202  * - LE_FAULT on failure
1203  */
1204 //--------------------------------------------------------------------------------------------------
1206 (
1207  uint32_t deferMinutes
1208  ///< [IN]
1209 );
1210 
1211 //--------------------------------------------------------------------------------------------------
1212 /**
1213  * Accept the currently pending install
1214  *
1215  * @return
1216  * - LE_OK on success
1217  * - LE_FAULT on failure
1218  */
1219 //--------------------------------------------------------------------------------------------------
1221 (
1222  void
1223 );
1224 
1225 //--------------------------------------------------------------------------------------------------
1226 /**
1227  * Defer the currently pending install
1228  *
1229  * @return
1230  * - LE_OK on success
1231  * - LE_FAULT on failure
1232  */
1233 //--------------------------------------------------------------------------------------------------
1235 (
1236  uint32_t deferMinutes
1237  ///< [IN]
1238 );
1239 
1240 //--------------------------------------------------------------------------------------------------
1241 /**
1242  * Accept the currently pending uninstall
1243  *
1244  * @return
1245  * - LE_OK on success
1246  * - LE_FAULT on failure
1247  */
1248 //--------------------------------------------------------------------------------------------------
1250 (
1251  void
1252 );
1253 
1254 //--------------------------------------------------------------------------------------------------
1255 /**
1256  * Defer the currently pending uninstall
1257  *
1258  * @return
1259  * - LE_OK on success
1260  * - LE_FAULT on failure
1261  */
1262 //--------------------------------------------------------------------------------------------------
1264 (
1265  uint32_t deferMinutes
1266  ///< [IN]
1267 );
1268 
1269 //--------------------------------------------------------------------------------------------------
1270 /**
1271  * Accept the currently pending reboot
1272  *
1273  * @note When this function is called, a 2-second timer is launched and the reboot function is
1274  * called when the timer expires.
1275  *
1276  * @return
1277  * - LE_OK on success
1278  * - LE_FAULT on failure
1279  */
1280 //--------------------------------------------------------------------------------------------------
1282 (
1283  void
1284 );
1285 
1286 //--------------------------------------------------------------------------------------------------
1287 /**
1288  * Defer the currently pending reboot
1289  *
1290  * @return
1291  * - LE_OK on success
1292  * - LE_FAULT on failure
1293  */
1294 //--------------------------------------------------------------------------------------------------
1296 (
1297  uint32_t deferMinutes
1298  ///< [IN]
1299 );
1300 
1301 //--------------------------------------------------------------------------------------------------
1302 /**
1303  * Get the update type of the currently pending update
1304  *
1305  * @return
1306  * - LE_OK on success
1307  * - LE_FAULT if not available
1308  */
1309 //--------------------------------------------------------------------------------------------------
1311 (
1312  le_avc_UpdateType_t* updateTypePtr
1313  ///< [OUT]
1314 );
1315 
1316 //--------------------------------------------------------------------------------------------------
1317 /**
1318  * Get the name for the currently pending app update
1319  *
1320  * @return
1321  * - LE_OK on success
1322  * - LE_FAULT if not available, or isn't APPL_UPDATE type
1323  */
1324 //--------------------------------------------------------------------------------------------------
1326 (
1327  char* updateName,
1328  ///< [OUT]
1329  size_t updateNameSize
1330  ///< [IN]
1331 );
1332 
1333 //--------------------------------------------------------------------------------------------------
1334 /**
1335  * Prevent any pending updates from being installed.
1336  *
1337  * @return
1338  * - Reference for block update request (to be used later for unblocking updates)
1339  * - NULL if the operation was not successful
1340  */
1341 //--------------------------------------------------------------------------------------------------
1343 (
1344  void
1345 );
1346 
1347 //--------------------------------------------------------------------------------------------------
1348 /**
1349  * Allow any pending updates to be installed
1350  */
1351 //--------------------------------------------------------------------------------------------------
1353 (
1354  le_avc_BlockRequestRef_t blockRef
1355  ///< [IN] block request ref returned by le_avc_BlockInstall
1356 );
1357 
1358 //--------------------------------------------------------------------------------------------------
1359 /**
1360  * Function to get error code when update fails.
1361  *
1362  * @return
1363  * - Error code of encountered error.
1364  * - ERR_NONE if update is in any other state.
1365  */
1366 //--------------------------------------------------------------------------------------------------
1368 (
1369  void
1370 );
1371 
1372 //--------------------------------------------------------------------------------------------------
1373 /**
1374  * Function to read the current session type, or the last session type if there is no
1375  * active session.
1376  *
1377  * @return
1378  * - SessionType
1379  */
1380 //--------------------------------------------------------------------------------------------------
1382 (
1383  void
1384 );
1385 
1386 //--------------------------------------------------------------------------------------------------
1387 /**
1388  * Function to read the http status of the last download.
1389  *
1390  * @return
1391  * - HttpStatus as defined in RFC 7231, Section 6.
1392  */
1393 //--------------------------------------------------------------------------------------------------
1394 uint16_t le_avc_GetHttpStatus
1395 (
1396  void
1397 );
1398 
1399 //--------------------------------------------------------------------------------------------------
1400 /**
1401  * Function to read the polling timer.
1402  *
1403  * @return
1404  * - LE_OK on success
1405  * - LE_FAULT if not available
1406  * - LE_OUT_OF_RANGE if the polling timer value is out of range (0 to 525600).
1407  */
1408 //--------------------------------------------------------------------------------------------------
1410 (
1411  uint32_t* pollingTimerPtr
1412  ///< [OUT] Polling timer
1413 );
1414 
1415 //--------------------------------------------------------------------------------------------------
1416 /**
1417  * Function to read the retry timers.
1418  *
1419  * @return
1420  * - LE_OK on success.
1421  * - LE_FAULT if not able to read the timers.
1422  * - LE_OUT_OF_RANGE if one of the retry timers is out of range (0 to 20160).
1423  */
1424 //--------------------------------------------------------------------------------------------------
1426 (
1427  uint16_t* timerValuePtr,
1428  ///< [OUT] Array of the retry timers.
1429  size_t* timerValueSizePtr
1430  ///< [INOUT]
1431 );
1432 
1433 //--------------------------------------------------------------------------------------------------
1434 /**
1435  * Function to read APN configuration.
1436  *
1437  * @return
1438  * - LE_OK on success.
1439  * - LE_FAULT if there is any error while reading.
1440  * - LE_OVERFLOW if the buffer provided is too small.
1441  */
1442 //--------------------------------------------------------------------------------------------------
1444 (
1445  char* apnName,
1446  ///< [OUT]
1447  size_t apnNameSize,
1448  ///< [IN]
1449  char* userName,
1450  ///< [OUT]
1451  size_t userNameSize,
1452  ///< [IN]
1453  char* userPwd,
1454  ///< [OUT]
1455  size_t userPwdSize
1456  ///< [IN]
1457 );
1458 
1459 //--------------------------------------------------------------------------------------------------
1460 /**
1461  * Function to write APN configuration.
1462  *
1463  * @return
1464  * - LE_OK on success.
1465  * - LE_OVERFLOW if one of the input strings is too long.
1466  */
1467 //--------------------------------------------------------------------------------------------------
1469 (
1470  const char* LE_NONNULL apnName,
1471  ///< [IN]
1472  const char* LE_NONNULL userName,
1473  ///< [IN]
1474  const char* LE_NONNULL userPwd
1475  ///< [IN]
1476 );
1477 
1478 //--------------------------------------------------------------------------------------------------
1479 /**
1480  * Function to set the polling timer.
1481  *
1482  * @return
1483  * - LE_OK on success.
1484  * - LE_OUT_OF_RANGE if the polling timer value is out of range (0 to 525600).
1485  */
1486 //--------------------------------------------------------------------------------------------------
1488 (
1489  uint32_t pollingTimer
1490  ///< [IN] Polling timer
1491 );
1492 
1493 //--------------------------------------------------------------------------------------------------
1494 /**
1495  * Function to set the retry timers.
1496  *
1497  * @return
1498  * - LE_OK on success.
1499  * - LE_FAULT if not able to set the timers.
1500  * - LE_OUT_OF_RANGE if one of the retry timers is out of range (0 to 20160).
1501  */
1502 //--------------------------------------------------------------------------------------------------
1504 (
1505  const uint16_t* timerValuePtr,
1506  ///< [IN] Array of 8 retry timers.
1507  size_t timerValueSize
1508  ///< [IN]
1509 );
1510 
1511 //--------------------------------------------------------------------------------------------------
1512 /**
1513  * Function to retrieve status of the credentials provisioned on the device.
1514  *
1515  * @return
1516  * LE_AVC_NO_CREDENTIAL_PROVISIONED
1517  * - If neither Bootstrap nor Device Management credential is provisioned.
1518  * LE_AVC_BS_CREDENTIAL_PROVISIONED
1519  * - If Bootstrap credential is provisioned but Device Management credential is
1520  * not provisioned.
1521  * LE_AVC_DM_CREDENTIAL_PROVISIONED
1522  * - If Device management key is provisioned.
1523  */
1524 //--------------------------------------------------------------------------------------------------
1526 (
1527  void
1528 );
1529 
1530 //--------------------------------------------------------------------------------------------------
1531 /**
1532  * Function to set user agreements for download, install, reboot, connection and uninstall.
1533  *
1534  * @return
1535  * - LE_OK on success.
1536  * - LE_FAULT if failed to configure user agreement.
1537  */
1538 //--------------------------------------------------------------------------------------------------
1540 (
1541  le_avc_UserAgreement_t updateStatus,
1542  ///< [IN] Operation for which user agreements has to be set.
1543  bool enable
1544  ///< [IN] true = enable, false = disable.
1545 );
1546 
1547 //--------------------------------------------------------------------------------------------------
1548 /**
1549  * Function to get user agreements for download, install, reboot, connection and uninstall.
1550  *
1551  * @return
1552  * - LE_OK on success.
1553  * - LE_FAULT if failed to read user agreement state.
1554  */
1555 //--------------------------------------------------------------------------------------------------
1557 (
1558  le_avc_UserAgreement_t updateStatus,
1559  ///< [IN] Operation for which user agreements has to be read.
1560  bool* enablePtr
1561  ///< [OUT] true = enable, false = disable.
1562 );
1563 
1564 //--------------------------------------------------------------------------------------------------
1565 /**
1566  * Function to read a resource from a LWM2M object
1567  *
1568  * @return
1569  * - LE_OK on success.
1570  * - LE_FAULT if failed.
1571  * - LE_UNSUPPORTED if unsupported.
1572  */
1573 //--------------------------------------------------------------------------------------------------
1575 (
1576  uint16_t objectId,
1577  ///< [IN] Object identifier
1578  uint16_t objectInstanceId,
1579  ///< [IN] Object instance identifier
1580  uint16_t resourceId,
1581  ///< [IN] Resource identifier
1582  uint16_t resourceInstanceId,
1583  ///< [IN] Resource instance identifier
1584  char* data,
1585  ///< [OUT] String of requested resources to be read
1586  size_t dataSize
1587  ///< [IN]
1588 );
1589 
1590 #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:801
Uninstall is pending.
Definition: le_avc_interface.h:799
Request by user app to close AV session.
Definition: le_avc_interface.h:868
User agreement for reboot.
Definition: le_avc_interface.h:853
User agreement for connection.
Definition: le_avc_interface.h:845
An error occurred installing the update.
Definition: le_avc_interface.h:797
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 le_avc_DeferConnect(uint32_t deferMinutes)
le_result_t
Definition: le_basics.h:35
le_avc_CommInfoHandlerRef_t le_avc_AddCommInfoHandler(le_avc_CommInfoHandlerFunc_t handlerPtr, void *contextPtr)
Package is certified sent by a trusted server.
Definition: le_avc_interface.h:830
le_result_t le_avc_AcceptReboot(void)
An error occurred uninstalling the update.
Definition: le_avc_interface.h:805
Install in progress.
Definition: le_avc_interface.h:793
void le_avc_UnblockInstall(le_avc_BlockRequestRef_t blockRef)
Package is not certified sent by a trusted server.
Definition: le_avc_interface.h:832
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:966
void le_avc_RemoveCommInfoHandler(le_avc_CommInfoHandlerRef_t handlerRef)
le_avc_SessionRequest_t
Definition: le_avc_interface.h:864
An error occurred downloading the update.
Definition: le_avc_interface.h:789
le_avc_UserAgreement_t
Definition: le_avc_interface.h:843
le_result_t le_avc_DeferUninstall(uint32_t deferMinutes)
Install is pending (implies download complete)
Definition: le_avc_interface.h:791
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:435
Definition: le_avc_interface.h:811
Session with AirVantage device management server started.
Definition: le_avc_interface.h:807
le_avc_SessionType_t
Definition: le_avc_interface.h:922
void(* le_avc_CommInfoHandlerFunc_t)(uint8_t code, const char *LE_NONNULL str, void *contextPtr)
Definition: le_avc_interface.h:1027
Download in progress.
Definition: le_avc_interface.h:785
Definition: le_avc_interface.h:941
Device reboot is pending.
Definition: le_avc_interface.h:817
Session type invalid.
Definition: le_avc_interface.h:928
le_result_t le_avc_StartSession(void)
le_result_t le_avc_StopSession(void)
void le_avc_RemoveStatusEventHandler(le_avc_StatusEventHandlerRef_t handlerRef)
Definition: le_avc_interface.h:814
Definition: le_avc_interface.h:824
le_result_t le_avc_GetUserAgreement(le_avc_UserAgreement_t updateStatus, bool *enablePtr)
Update pending download.
Definition: le_avc_interface.h:783
User agreement for uninstall.
Definition: le_avc_interface.h:851
le_result_t le_avc_AcceptDownload(void)
le_result_t le_avc_TryConnectService(void)
le_result_t le_avc_CheckRoute(void)
le_result_t le_avc_DeferInstall(uint32_t deferMinutes)
Update has been successfully installed.
Definition: le_avc_interface.h:795
User agreement for install.
Definition: le_avc_interface.h:849
le_result_t le_avc_AcceptInstall(void)
Something failed while doing install/download.
Definition: le_avc_interface.h:908
User agreement for download.
Definition: le_avc_interface.h:847
Bootstrap session.
Definition: le_avc_interface.h:924
struct le_avc_BlockRequest * le_avc_BlockRequestRef_t
Definition: le_avc_interface.h:982
le_avc_BlockRequestRef_t le_avc_BlockInstall(void)
void le_avc_DisconnectService(void)
le_avc_SessionType_t le_avc_GetSessionType(void)
Session with bootstrap server started.
Definition: le_avc_interface.h:809
Device Management session.
Definition: le_avc_interface.h:926
No error.
Definition: le_avc_interface.h:904
le_result_t le_avc_SetUserAgreement(le_avc_UserAgreement_t updateStatus, bool enable)
Definition: le_avc_interface.h:944
Definition: le_avc_interface.h:819
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:879
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)
void(* le_avc_SessionRequestHandlerFunc_t)(le_avc_SessionRequest_t request, void *contextPtr)
Definition: le_avc_interface.h:1014
Security check failure while installing the package.
Definition: le_avc_interface.h:910
Request by user app to open AV session.
Definition: le_avc_interface.h:866
le_result_t le_avc_ReadLwm2mResource(uint16_t objectId, uint16_t objectInstanceId, uint16_t resourceId, uint16_t resourceInstanceId, char *data, size_t dataSize)
le_result_t le_avc_GetAppUpdateName(char *updateName, size_t updateNameSize)
le_avc_ErrorCode_t
Definition: le_avc_interface.h:902
Download has completed.
Definition: le_avc_interface.h:787
le_result_t le_avc_GetRetryTimers(uint16_t *timerValuePtr, size_t *timerValueSizePtr)
void(* le_avc_StatusHandlerFunc_t)(le_avc_Status_t updateStatus, int32_t totalNumBytes, int32_t progress, void *contextPtr)
Definition: le_avc_interface.h:991
No updates pending.
Definition: le_avc_interface.h:781
le_avc_CredentialStatus_t
Definition: le_avc_interface.h:939
struct le_avc_CommInfoHandler * le_avc_CommInfoHandlerRef_t
Definition: le_avc_interface.h:974
uint16_t le_avc_GetHttpStatus(void)
struct le_avc_StatusEventHandler * le_avc_StatusEventHandlerRef_t
Definition: le_avc_interface.h:958
Encountered a bad package.
Definition: le_avc_interface.h:906
le_avc_Status_t
Definition: le_avc_interface.h:779
App has been successfully uninstalled.
Definition: le_avc_interface.h:803
Device Management credential is provisioned.
Definition: le_avc_interface.h:947
Definition: le_avc_interface.h:827
le_avc_ErrorCode_t le_avc_GetErrorCode(void)
void le_avc_ConnectService(void)