Giter Site home page Giter Site logo

rpc-service-ota's Introduction

RPC Service - OTA (Over The Air updates)

This service provides an ability to manage OTA on devices remotely. It is possible to call this service programmatically via serial, HTTP/RESTful, Websocket, MQTT or other transports (see RPC section) or via the mos tool.

See in-depth description of our OTA mechanism at Updating firmware reliably - embedded.com.

See OTA video tutorial:

<iframe width="560" src="https://www.youtube.com/embed/o05sBDfaFO8" height="315" align="center" frameborder="0" allowfullscreen></iframe>

Below is a list of exported RPC methods and arguments:

OTA.Update

Trigger OTA firmware update. Arguments:

{
  "url": "https://foo.com/fw123.zip", // Required. URL to the new firmware.
  "commit_timeout": "300"             // Optional. Time frame in seconds to do
                                      // OTA.Commit after reboot. If commit is
                                      // not done during the timeout, OTA rolls back.
}

A new firmware gets downloaded to the separate flash partition, and is marked dirty. When the download is complete, device is rebooted. After reboot, a firmware partition could become committed by calling OTA.Commit - in which case, it is marked as "good". Otherwise, a device reboots back into the old firmware after the commit_timeout seconds. Example usage:

mos call OTA.Update '{"url": "http://1.2.3.4/fw.zip", "commit_timeout": 300}'

OTA.Commit

Commit current firmware. Arguments: none.

Example usage:

mos call OTA.Commit

OTA.Revert

Rolls back to the previous firmware. Arguments: none.

Example usage:

mos call OTA.Revert

OTA.CreateSnapshot

Create new firmware patition with the copy of currently running firmware. Arguments:

{
  // Optional. If true, then current firmware is uncommited, and needs to
  // be explicitly commited after the first reboot. Otherwise, it'll reboot
  // into the created snapshot. This option is useful if a dangerous, risky
  // live update is to be done on the living device. Then, if the update
  // fails and device bricks, it'll revert to the created good snapshot.
  "set_as_revert": false,
  // Optional. Same meaning as for OTA.Update
  "commit_timeout": "300"
}

Example usage:

mos call OTA.CreateSnapshot

OTA.GetBootState

Get current boot state. Arguments: none.

Example usage:

mos call OTA.GetBootState
{
  "active_slot": 0,       # Currently active flash partition.
  "is_committed": true,   # Current firmware is marked as "good" (committed).
  "revert_slot": 0,       # If uncommitted, slot to roll back to.
  "commit_timeout": 0     # Commit timeout.
}

OTA.SetBootState

Get current boot state. Arguments: see OTA.GetBootState reply section.

Example usage:

mos call OTA.SetBootState '{"revert_slot": 1}'

rpc-service-ota's People

Contributors

cpq avatar dimonomid avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.