Basic Usage of the API
In order to start an upgrade, first you need to register an OTA file on the OTA server. To do this you have to call the registerOtaFile method of the Gateway class and pass it the full OTA file path string and the connectionInfo object. The code below shows how to do this:
Gateway gw = ...
String otaFilePath = "path/to/ota/file";
for (ConnectionInfo connectionInfo : gw.getConnectionInfo()) {
gw.registerOtaFile(otaFilePath, connectionInfo);
}
To ensure the OTA file was registered successfully, you can use the getRegisteredOtaFiles method in the Gateway class which returns the list of the OTA files registered on the OTA server:
for (ConnectionInfo connectionInfo : gw.getConnectionInfo()) {
List<String> registeredOtaFiles = gw.getRegisteredOtaFiles(connectionInfo);
}
In order to observe the OTA progress you need to register the progress handler on the OTA server. To do this you have to call the registerOtaProgressHandler method of the Gateway class, passing it a UpgradeProgress callback, like below:
gw.registerOtaProgressHandler(otaCallback);
The callback is a consumer of type UpgradeProgress which contains the upgrade information such as progress value, progress status, progress completion and device id. Below is an example of the callback:
Now, we are are ready to start an upgrade. In order to initiate the upgrade process, we need to call the startOtaUpgrade method of the Device class.
In order to abort the upgrade, simply call the abortOtaUpgrade method in the Device class when the upgrade is in progress.
In order to stop seeing the upgrade progress simply call the deregisterOtaProgressHandler and passing it the same call back used in registerOtaProgressHandler.
In order to remove the OTA file from the OTA server, you can use deregisterOtaFile method of the Gateway class, passing it the OTA file name string and the connectionInfo object, like below:
Legal Notices
Copyright © 2020 MMB Networks, Inc. All rights reserved.
Confidential materials prepared and delivered by MMB Networks for receipt and review only by any partner subject to a valid and enforceable MMB Networks confidentiality agreement. Any receipt, review, or misuse of any of the content exchanged hereunder by any party not a party to this confidential exchange shall be subject to any and all rights available under the law. All rights, title and interest to the materials shall remain with MMB Networks.
Any suggestions provided to MMB Networks with respect to MMB Networks' products or services shall be collectively deemed “Feedback.” You, on behalf of yourself, or if you are providing Feedback on behalf of your employer or another entity, represent and warrant that you have full legal authority to bind such entity to these terms, agree to grant and hereby grant to MMB Networks a nonexclusive, perpetual, irrevocable, royalty free, worldwide license to use and otherwise exploit such Feedback within any MMB Networks products and services.