Class OTAManager
- java.lang.Object
-
- com.zentri.zentri_ble_ota.OTAManager
public class OTAManager
extends java.lang.Object
Constructor Summary
Constructor and Description |
---|
OTAManager() |
Method Summary
Modifier and Type | Method and Description |
---|---|
boolean |
checkForUpdates(android.content.Context context,
java.lang.String filename)
Check for firmware updates on the remote OTA server
|
boolean |
continueTransitionUpdate()
NOTE: This should not be in public API docs!
Resumes a transition OTA after device connection has been re-established.
|
void |
deinit()
De-initialise OTA Manager, must be called before communicating with a different device
|
OTAState |
getState()
Get current OTA state
|
int |
getTransitionFileSize()
NOTE: This should not be in public API docs!
Return size of transition image (in bytes).
|
int |
getUpdateFileSize()
Return size of update image (in bytes).
|
java.lang.String |
getUpdateVersion() |
boolean |
init(java.lang.String deviceName,
OTACallbacks callbacks)
Initialise OTA Manager
|
boolean |
isInitialised(OTACallbacks callbacks)
Check initialisation state
|
boolean |
isOTAInProgress()
Check if OTA in progress
|
boolean |
isTransitionUpdateInProgress()
NOTE: This should not be in public API docs!
Check if a transition OTA is in progress.
|
boolean |
isUpToDate(java.lang.String version)
Checks if given version matches latest update version
|
boolean |
readFirmwareVersion()
Read firmware version from device
|
boolean |
transitionUpdateStart(android.content.Context context)
Start transition update.
|
boolean |
updateAbort()
Abort update in progress
|
boolean |
updateStart()
Start update using last downloaded image
|
Constructor Detail
-
OTAManager
public OTAManager()
Method Detail
-
init
public boolean init(java.lang.String deviceName, OTACallbacks callbacks)
Initialise OTA Manager- Parameters:
deviceName
- Name of connected devicecallbacks
- Callbacks to use- Returns:
- true if init started
-
deinit
public void deinit()
De-initialise OTA Manager, must be called before communicating with a different device
-
isInitialised
public boolean isInitialised(OTACallbacks callbacks)
Check initialisation state- Parameters:
callbacks
- Callbacks used in init()- Returns:
- true if initialised with given callbacks
-
isOTAInProgress
public boolean isOTAInProgress()
Check if OTA in progress- Returns:
- true if OTA in progress
-
isUpToDate
public boolean isUpToDate(java.lang.String version)
Checks if given version matches latest update version- Parameters:
version
- Version string from device- Returns:
- true if up to date
-
getState
public OTAState getState()
Get current OTA state- Returns:
- State of OTA process
-
readFirmwareVersion
public boolean readFirmwareVersion()
Read firmware version from device- Returns:
- true if read started successfully
-
isTransitionUpdateInProgress
public boolean isTransitionUpdateInProgress()
NOTE: This should not be in public API docs! Check if a transition OTA is in progress. Can be used to check if continueTransitionOTA() should be called on a device connection.- Returns:
- true if a transition OTA is in progress
-
continueTransitionUpdate
public boolean continueTransitionUpdate()
NOTE: This should not be in public API docs! Resumes a transition OTA after device connection has been re-established. Once the first image is uploaded, the device reboots. This should be called after the device is successfully reconnected.- Returns:
- true if resume successful
-
checkForUpdates
public boolean checkForUpdates(android.content.Context context, java.lang.String filename)
Check for firmware updates on the remote OTA server- Parameters:
context
- Activity contextfilename
- Name of file on remote server- Returns:
- true if check started
-
getTransitionFileSize
public int getTransitionFileSize()
NOTE: This should not be in public API docs! Return size of transition image (in bytes). Can be used to set the maximum of a progress bar.- Returns:
- Transition image file size
-
getUpdateFileSize
public int getUpdateFileSize()
Return size of update image (in bytes). Can be used to set the maximum of a progress bar.- Returns:
- Update image file size
-
getUpdateVersion
public java.lang.String getUpdateVersion()
-
updateStart
public boolean updateStart()
Start update using last downloaded image- Returns:
- true if start request submitted, result returned in callback
-
transitionUpdateStart
public boolean transitionUpdateStart(android.content.Context context)
Start transition update. Should be called only after onTransitionUpdateRequired() callback- Parameters:
context
- Activity context- Returns:
- true if start request submitted, result returned in callback
-
updateAbort
public boolean updateAbort()
Abort update in progress- Returns:
- true if start request submitted, result returned in callback