Tutorial: Software updates basics

Software updates basics

Software updates subsystem operations available by using stbUpdate object.
The object provides an interface to the update manager.

Update Manager allows you to initiate and display the status of the software upgrade process.
Attention! Before any software update operation you must stop every single process of media content accessing and displaying.

Possible states of an object

Update manager is a finite state machine.
State is accessible via stbUpdate.getStatus method. Initial state – Idle (value 21). Any active operation upon the update system is allowed only in Idle state.
Right after starting of an operation state machine leaves Idle state and must be considered as busy until Idle state turned back. So, after every start of operation that been committed user should wait for Idle state back.

User interface hints

Additional information

Besides general state of an object there is additional information available to user (in terms of machine-user interface).
Additional information can be accessed via stbUpdate.getStatusStr method.
This information should be sampled on periodic basis (recommended period is 1 sec) to keep user interface up to date with the actual data behind update process.

Progress indicator

Progress indicator reflects measure of completion of current operation and can be read via stbUpdate.getPercents method.

Update file check

There is update file check procedure available before actual update process will be committed.
Update file checking available via stbUpdate.startCheck method. It take path (either URL or path to file) to update file as parameter. For example: /media/usbdisk/mag200/imageupdate or http://mag.infomir.com.ua/mag200/imageupdate.
After checking procedure completion available information could be read via stbUpdate.getImageVersionStr, stbUpdate.getImageDateStr, stbUpdate.getImageDescStr methods.

Bank selection procedure

Active bank could be found via stbUpdate.getActiveBank method.
In case when active bank defined (stbUpdate.getActiveBank method returned either 0 or 1) update should be applied to bank opposite to active. In case of undefined active bank (stbUpdate.getActiveBank method returned -1) selection of bank to update depends on implementation.

Manual software update

Software update procedure could be started via startUpdate method. It takes bank number and path (either URL or path to file) to update file as parameters. For example: /media/usbdisk/mag200/imageupdate or http://mag.infomir.com.ua/mag200/imageupdate.
In general, it takes few minutes to complete the operation. So, it is recommended to show status of the operation to user during the process.
During process execution additional information is available via stbUpdate.getPercents, stbUpdate.getStatus, stbUpdate.getStatusStr, stbUpdate.getImageVersionStr, stbUpdate.getImageDateStr, stbUpdate.getImageDescStr methods.

Software update procedure include following stages:

  1. Waiting for Idle state of manager.
  2. Verification of update file (using stbUpdate.startCheck method).
  3. Analyzing of available update file’s attributes and making a decision about update start.
  4. Selecting memory bank where update will take place (using data received via stbUpdate.getActiveBank method).
  5. Initiate update operation by using stbUpdate.startUpdate method. During execution of operation state of manager is available via stbUpdate.getStatus method, additional information is available via stbUpdate.getStatusStr method and the progress indicator via stbUpdate.getPercents method.
  6. In case of any trouble object will be set to Idle state and additional information would help to understand what happened.
  7. In case of success device will be forced to reboot.

Automatic software update

Initiated by stbUpdate.startAutoUpdate method.
Dedicated status form will be summoned to user interface during execution of this operation. Form will show overall progress.

Automatic software update procedure include following stages:

  1. Verification of the update file’s attributes. In case of any trouble process will be terminated and related status provided
  2. Automatic memory bank selection taking place. When active bank equals 0 then memory bank 1 will be selected. And memory bank 0 will be selected in any other cases.
  3. If there additional software version check was specified then update will happen only if current software version is older than available for update.
  4. Actual software update taking place.