le_avc_interface.h File Reference

#include "legato.h"
#include "le_limit_interface.h"

Go to the source code of this file.

Macros

#define LE_AVC_APN_NAME_MAX_LEN   48
 
#define LE_AVC_APN_NAME_MAX_LEN_BYTES   49
 
#define LE_AVC_USERNAME_MAX_LEN   28
 
#define LE_AVC_USERNAME_MAX_LEN_BYTES   29
 
#define LE_AVC_PASSWORD_MAX_LEN   28
 
#define LE_AVC_PASSWORD_MAX_LEN_BYTES   29
 
#define LE_AVC_NUM_RETRY_TIMERS   8
 
#define LE_AVC_HTTP_STATUS_INVALID   65535
 

Typedefs

typedef struct le_avc_StatusEventHandler * le_avc_StatusEventHandlerRef_t
 
typedef struct le_avc_SessionRequestEventHandler * le_avc_SessionRequestEventHandlerRef_t
 
typedef struct le_avc_BlockRequest * le_avc_BlockRequestRef_t
 
typedef void(* le_avc_StatusHandlerFunc_t) (le_avc_Status_t updateStatus, int32_t totalNumBytes, int32_t dloadProgress, void *contextPtr)
 
typedef void(* le_avc_SessionRequestHandlerFunc_t) (le_avc_SessionRequest_t request, void *contextPtr)
 

Enumerations

enum  le_avc_Status_t {
  LE_AVC_NO_UPDATE = 0, LE_AVC_DOWNLOAD_PENDING = 1, LE_AVC_DOWNLOAD_IN_PROGRESS = 2, LE_AVC_DOWNLOAD_COMPLETE = 3,
  LE_AVC_DOWNLOAD_FAILED = 4, LE_AVC_INSTALL_PENDING = 5, LE_AVC_INSTALL_IN_PROGRESS = 6, LE_AVC_INSTALL_COMPLETE = 7,
  LE_AVC_INSTALL_FAILED = 8, LE_AVC_UNINSTALL_PENDING = 9, LE_AVC_UNINSTALL_IN_PROGRESS = 10, LE_AVC_UNINSTALL_COMPLETE = 11,
  LE_AVC_UNINSTALL_FAILED = 12, LE_AVC_SESSION_STARTED = 13, LE_AVC_SESSION_STOPPED = 14
}
 
enum  le_avc_SessionRequest_t { LE_AVC_SESSION_ACQUIRE = 0, LE_AVC_SESSION_RELEASE = 1 }
 
enum  le_avc_UpdateType_t { LE_AVC_UNKNOWN_UPDATE = 0, LE_AVC_FIRMWARE_UPDATE = 1, LE_AVC_FRAMEWORK_UPDATE = 2, LE_AVC_APPLICATION_UPDATE = 3 }
 
enum  le_avc_ErrorCode_t { LE_AVC_ERR_NONE = 0, LE_AVC_ERR_BAD_PACKAGE = 1, LE_AVC_ERR_INTERNAL = 2, LE_AVC_ERR_SECURITY_FAILURE = 3 }
 
enum  le_avc_SessionType_t { LE_AVC_BOOTSTRAP_SESSION = 0, LE_AVC_DM_SESSION = 1, LE_AVC_SESSION_INVALID = 2 }
 

Functions

void le_avc_ConnectService (void)
 
le_result_t le_avc_TryConnectService (void)
 
void le_avc_DisconnectService (void)
 
le_avc_StatusEventHandlerRef_t le_avc_AddStatusEventHandler (le_avc_StatusHandlerFunc_t handlerPtr, void *contextPtr)
 
void le_avc_RemoveStatusEventHandler (le_avc_StatusEventHandlerRef_t addHandlerRef)
 
le_avc_SessionRequestEventHandlerRef_t le_avc_AddSessionRequestEventHandler (le_avc_SessionRequestHandlerFunc_t handlerPtr, void *contextPtr)
 
void le_avc_RemoveSessionRequestEventHandler (le_avc_SessionRequestEventHandlerRef_t addHandlerRef)
 
le_result_t le_avc_StartSession (void)
 
le_result_t le_avc_StopSession (void)
 
le_result_t le_avc_AcceptDownload (void)
 
le_result_t le_avc_DeferDownload (uint32_t deferMinutes)
 
le_result_t le_avc_AcceptInstall (void)
 
le_result_t le_avc_DeferInstall (uint32_t deferMinutes)
 
le_result_t le_avc_AcceptUninstall (void)
 
le_result_t le_avc_DeferUninstall (uint32_t deferMinutes)
 
le_result_t le_avc_GetUpdateType (le_avc_UpdateType_t *updateTypePtr)
 
le_result_t le_avc_GetAppUpdateName (char *updateName, size_t updateNameNumElements)
 
le_avc_BlockRequestRef_t le_avc_BlockInstall (void)
 
void le_avc_UnblockInstall (le_avc_BlockRequestRef_t blockRef)
 
le_avc_ErrorCode_t le_avc_GetErrorCode (void)
 
le_avc_SessionType_t le_avc_GetSessionType (void)
 
uint16_t le_avc_GetHttpStatus (void)
 
le_result_t le_avc_GetPollingTimer (uint32_t *pollingTimerPtr)
 
le_result_t le_avc_GetRetryTimers (uint16_t *timerValuePtr, size_t *timerValueNumElementsPtr)
 
le_result_t le_avc_GetApnConfig (char *apnName, size_t apnNameNumElements, char *userName, size_t userNameNumElements, char *userPwd, size_t userPwdNumElements)
 
le_result_t le_avc_SetApnConfig (const char *apnName, const char *userName, const char *userPwd)
 
le_result_t le_avc_SetPollingTimer (uint32_t pollingTimer)
 
le_result_t le_avc_SetRetryTimers (const uint16_t *timerValuePtr, size_t timerValueNumElements)
 

Detailed Description

Legato AirVantage Connector include file.

Macro Definition Documentation

#define LE_AVC_APN_NAME_MAX_LEN   48

Maximum APN name length without NULL terminator.

#define LE_AVC_APN_NAME_MAX_LEN_BYTES   49

Maximum APN name length including NULL terminator.

#define LE_AVC_HTTP_STATUS_INVALID   65535

Default HTTP status.

#define LE_AVC_NUM_RETRY_TIMERS   8

Maximum number of retry timers.

#define LE_AVC_PASSWORD_MAX_LEN   28

Maximum password length without NULL terminator..

#define LE_AVC_PASSWORD_MAX_LEN_BYTES   29

Maximum password length including NULL terminator.

#define LE_AVC_USERNAME_MAX_LEN   28

Maximum user name length without NULL terminator.

#define LE_AVC_USERNAME_MAX_LEN_BYTES   29

Maximum user name length including NULL terminator.

Typedef Documentation

typedef struct le_avc_BlockRequest* le_avc_BlockRequestRef_t

Reference returned by BlockInstall function and used by UnblockInstall function

typedef struct le_avc_SessionRequestEventHandler* le_avc_SessionRequestEventHandlerRef_t

Reference type used by Add/Remove functions for EVENT 'le_avc_SessionRequestEvent'

typedef void(* le_avc_SessionRequestHandlerFunc_t) (le_avc_SessionRequest_t request, void *contextPtr)

Handler for receiving session open or close request.

Parameters
requestRequest to open or close AV session
contextPtr
typedef struct le_avc_StatusEventHandler* le_avc_StatusEventHandlerRef_t

Reference type used by Add/Remove functions for EVENT 'le_avc_StatusEvent'

typedef void(* le_avc_StatusHandlerFunc_t) (le_avc_Status_t updateStatus, int32_t totalNumBytes, int32_t dloadProgress, void *contextPtr)

Handler for update availability status

Parameters
updateStatusstatus of pending update, if available
totalNumBytesTotal number of bytes to be downloaded only valid when updateStatus is one of DOWNLOAD_PENDING, DOWNLOAD_IN_PROGRESS or DOWNLOAD_COMPLETE. returns -1 if value is unknown
dloadProgressdownload completion in percentage only valid when updateStatus is one of DOWNLOAD_PENDING, DOWNLOAD_IN_PROGRESS or DOWNLOAD_COMPLETE. returns -1 if value is unknown
contextPtr

Enumeration Type Documentation

Error code used to provide diagnostic information after a failure (includes both download and install failure).

Note
Additional information may also be available in the target device's system log.
Enumerator
LE_AVC_ERR_NONE 

No error.

LE_AVC_ERR_BAD_PACKAGE 

Encountered a bad package.

LE_AVC_ERR_INTERNAL 

Something failed while doing install/download.

LE_AVC_ERR_SECURITY_FAILURE 

Security check failure while installing the package.

Request to open or close avms session.

Enumerator
LE_AVC_SESSION_ACQUIRE 

Request by user app to open AV session.

LE_AVC_SESSION_RELEASE 

Request by user app to close AV session.

Session type indicates whether the device is connected to the bootstrap server or the device management server.

Enumerator
LE_AVC_BOOTSTRAP_SESSION 

Bootstrap session.

LE_AVC_DM_SESSION 

Device Management session.

LE_AVC_SESSION_INVALID 

Session type invalid.

Status of session or update

If an update is pending, it must first be downloaded and then installed.

Enumerator
LE_AVC_NO_UPDATE 

No updates pending.

LE_AVC_DOWNLOAD_PENDING 

Update pending download.

LE_AVC_DOWNLOAD_IN_PROGRESS 

Download in progress.

LE_AVC_DOWNLOAD_COMPLETE 

Download has completed.

LE_AVC_DOWNLOAD_FAILED 

An error occurred downloading the update.

LE_AVC_INSTALL_PENDING 

Install is pending (implies download complete)

LE_AVC_INSTALL_IN_PROGRESS 

Install in progress.

LE_AVC_INSTALL_COMPLETE 

Update has been successfully installed.

LE_AVC_INSTALL_FAILED 

An error occurred installing the update.

LE_AVC_UNINSTALL_PENDING 

Uninstall is pending.

LE_AVC_UNINSTALL_IN_PROGRESS 

Uninstall in progress.

LE_AVC_UNINSTALL_COMPLETE 

App has been successfully uninstalled.

LE_AVC_UNINSTALL_FAILED 

An error occurred uninstalling the update.

LE_AVC_SESSION_STARTED 

Session with AV server started.

LE_AVC_SESSION_STOPPED 

Session with AV server stopped.

The type of pending update

Function Documentation

le_result_t le_avc_AcceptDownload ( void  )

Accept the currently pending download

Returns
  • LE_OK on success
  • LE_FAULT on failure
le_result_t le_avc_AcceptInstall ( void  )

Accept the currently pending install

Returns
  • LE_OK on success
  • LE_FAULT on failure
le_result_t le_avc_AcceptUninstall ( void  )

Accept the currently pending uninstall

Returns
  • LE_OK on success
  • LE_FAULT on failure
le_avc_SessionRequestEventHandlerRef_t le_avc_AddSessionRequestEventHandler ( le_avc_SessionRequestHandlerFunc_t  handlerPtr,
void *  contextPtr 
)

Add handler function for EVENT 'le_avc_SessionRequestEvent'

This event provides information on session open or close request.

Parameters
[in]handlerPtr
[in]contextPtr
le_avc_StatusEventHandlerRef_t le_avc_AddStatusEventHandler ( le_avc_StatusHandlerFunc_t  handlerPtr,
void *  contextPtr 
)

Add handler function for EVENT 'le_avc_StatusEvent'

This event provides information on update availability status

Parameters
[in]handlerPtr
[in]contextPtr
le_avc_BlockRequestRef_t le_avc_BlockInstall ( void  )

Prevent any pending updates from being installed.

Returns
  • Reference for block update request (to be used later for unblocking updates)
  • NULL if the operation was not successful
void le_avc_ConnectService ( void  )

Connect the current client thread to the service providing this API. Block until the service is available.

For each thread that wants to use this API, either ConnectService or TryConnectService must be called before any other functions in this API. Normally, ConnectService is automatically called for the main thread, but not for any other thread. For details, see Client-specific Functions.

This function is created automatically.

le_result_t le_avc_DeferDownload ( uint32_t  deferMinutes)

Defer the currently pending download, for the given number of minutes

Returns
  • LE_OK on success
  • LE_FAULT on failure
Parameters
[in]deferMinutes
le_result_t le_avc_DeferInstall ( uint32_t  deferMinutes)

Defer the currently pending install

Returns
  • LE_OK on success
  • LE_FAULT on failure
Parameters
[in]deferMinutes
le_result_t le_avc_DeferUninstall ( uint32_t  deferMinutes)

Defer the currently pending uninstall

Returns
  • LE_OK on success
  • LE_FAULT on failure
Parameters
[in]deferMinutes
void le_avc_DisconnectService ( void  )

Disconnect the current client thread from the service providing this API.

Normally, this function doesn't need to be called. After this function is called, there's no longer a connection to the service, and the functions in this API can't be used. For details, see Client-specific Functions.

This function is created automatically.

le_result_t le_avc_GetApnConfig ( char *  apnName,
size_t  apnNameNumElements,
char *  userName,
size_t  userNameNumElements,
char *  userPwd,
size_t  userPwdNumElements 
)

Function to read APN configuration.

Returns
  • LE_OK on success.
  • LE_FAULT if there is any error while reading.
  • LE_OVERFLOW if the buffer provided is too small.
Parameters
[out]apnName
[in]apnNameNumElements
[out]userName
[in]userNameNumElements
[out]userPwd
[in]userPwdNumElements
le_result_t le_avc_GetAppUpdateName ( char *  updateName,
size_t  updateNameNumElements 
)

Get the name for the currently pending app update

Returns
  • LE_OK on success
  • LE_FAULT if not available, or isn't APPL_UPDATE type
Parameters
[out]updateName
[in]updateNameNumElements
le_avc_ErrorCode_t le_avc_GetErrorCode ( void  )

Function to get error code when update fails.

Returns
  • Error code of encountered error.
  • ERR_NONE if update is in any other state.
uint16_t le_avc_GetHttpStatus ( void  )

Function to read the http status of the last download.

Returns
  • HttpStatus as defined in RFC 7231, Section 6.
le_result_t le_avc_GetPollingTimer ( uint32_t *  pollingTimerPtr)

Function to read the polling timer.

Returns
  • LE_OK on success
  • LE_FAULT if not available
Parameters
[out]pollingTimerPtrPolling timer (0 to 525600 minutes).
le_result_t le_avc_GetRetryTimers ( uint16_t *  timerValuePtr,
size_t *  timerValueNumElementsPtr 
)

Function to read the retry timers.

Returns
  • LE_OK on success.
  • LE_FAULT if not able to read the timers.
Parameters
[out]timerValuePtrArray of the retry timers.
[in,out]timerValueNumElementsPtr
le_avc_SessionType_t le_avc_GetSessionType ( void  )

Function to read the current session type, or the last session type if there is no active session.

Returns
  • SessionType
le_result_t le_avc_GetUpdateType ( le_avc_UpdateType_t updateTypePtr)

Get the update type of the currently pending update

Returns
  • LE_OK on success
  • LE_FAULT if not available
Parameters
[out]updateTypePtr
void le_avc_RemoveSessionRequestEventHandler ( le_avc_SessionRequestEventHandlerRef_t  addHandlerRef)

Remove handler function for EVENT 'le_avc_SessionRequestEvent'

Parameters
[in]addHandlerRef
void le_avc_RemoveStatusEventHandler ( le_avc_StatusEventHandlerRef_t  addHandlerRef)

Remove handler function for EVENT 'le_avc_StatusEvent'

Parameters
[in]addHandlerRef
le_result_t le_avc_SetApnConfig ( const char *  apnName,
const char *  userName,
const char *  userPwd 
)

Function to write APN configuration.

Returns
  • LE_OK on success.
  • LE_FAULT if not able to write the APN configuration.
  • LE_OVERFLOW if one of the input strings is too long.
Parameters
[in]apnName
[in]userName
[in]userPwd
le_result_t le_avc_SetPollingTimer ( uint32_t  pollingTimer)

Function to set the polling timer.

Returns
  • LE_OK on success.
  • LE_FAULT if not able to read the timers.
Parameters
[in]pollingTimerPolling timer (0 to 525600 minutes).
le_result_t le_avc_SetRetryTimers ( const uint16_t *  timerValuePtr,
size_t  timerValueNumElements 
)

Function to set the retry timers.

Returns
  • LE_OK on success.
  • LE_FAULT if not able to write the timers.
Parameters
[in]timerValuePtrArray of 8 retry timers.
[in]timerValueNumElements
le_result_t le_avc_StartSession ( void  )

Start a session with the AirVantage server

This will cause a query to be sent to the server, for pending updates. If a download was previously suspended, then this resumes the download.

Returns
  • LE_OK on success
  • LE_FAULT on failure
le_result_t le_avc_StopSession ( void  )

Stop a session with the AirVantage server

If a download is in progress, then this suspends the download.

Returns
  • LE_OK on success
  • LE_FAULT on failure
le_result_t le_avc_TryConnectService ( void  )

Try to connect the current client thread to the service providing this API. Return with an error if the service is not available.

For each thread that wants to use this API, either ConnectService or TryConnectService must be called before any other functions in this API. Normally, ConnectService is automatically called for the main thread, but not for any other thread. For details, see Client-specific Functions.

This function is created automatically.

Returns
  • LE_OK if the client connected successfully to the service.
  • LE_UNAVAILABLE if the server is not currently offering the service to which the client is bound.
  • LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
  • LE_COMM_ERROR if the Service Directory cannot be reached.
void le_avc_UnblockInstall ( le_avc_BlockRequestRef_t  blockRef)

Allow any pending updates to be installed

Parameters
[in]blockRefblock request ref returned by le_avc_BlockInstall