Tutorial: Work with update manager

Work with update manager

Get info about banks available for update:

console.log('total number of banks:', stbUpdate.GetFlashBankCount());

console.log('memory bank number used for current software boot:', stbUpdate.getActiveBank());

Start a metadata inspection for Update Image file:

var uri = 'http://test.com/imageupdate',
    pathFolder = '/media/usbdisk/mag200/imageupdate';

stbUpdate.startCheck(uri);
stbUpdate.startCheck(pathFolder);

Check operation status code:

if ( stbUpdate.getStatus() !== 21 ) {
    console.log('Operation has failed! See status codes description.');
}

Get information about Update Image file (in case status is successful):

console.log('timestamp of "Update Image":', stbUpdate.getImageDateStr());

console.log('description of "Update Image" file:', stbUpdate.getImageDescStr());

console.log('version of "Update Image" file:', stbUpdate.getImageVersionStr());

Different methods to update:

// start a software update using "Update Image" file
stbUpdate.startUpdate(inactiveBank, uri);
stbUpdate.startUpdate(inactiveBank, pathFolder);

// start an automatic software update procedure
stbUpdate.startAutoUpdate(uri, true);
stbUpdate.startAutoUpdate(pathFolder, true);

Get update status:

console.log('the last available status code for an update operation:', stbUpdate.getStatus());

console.log('progress indicator value for pending update operation:', stbUpdate.getPercents());

console.log('the last available status for an update operation:', stbUpdate.getStatusStr());