Giter Site home page Giter Site logo

rpc-service-config's Introduction

RPC Service - Config

This service provides an ability to manage device configuration remotely. It is required by the mos config-get and mos config-set commands. If this library is not included in the app, those commands won't work. It is possible to call this service programmatically via serial, HTTP/RESTful, Websocket, MQTT or other transports (see RPC section) or use mos tool.

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

Below is a list of exported RPC methods and arguments:

Config.Get

Get device configuration subtree. Arguments:

{
  // Optional. Path to a config object, e.g. `wifi.sta.ssid`.
  // If not specified, a full configuration tree is returned.
  "key": "..."
}

Example usage:

mos call Config.Get
{
  "http": {
    "enable": true,
    "listen_addr": "80",
    ...
mos call Config.Get '{"key": "wifi.sta.enable"}'
true

This RPC command has a shortcut: mos config-get:

mos config-get
{
  "http": {
    "enable": true,
    "listen_addr": "80",
    ...
mos config-get wifi.sta.enable
true

Config.Set

Set device configuration parameters. Arguments:

{
  // Required. Contains a sparse object with configuration parameters.
  // These parameters are applied on top of the existing device configuration.
  "config": { ... }
}

Example usage - set debug.level to 3:

mos call Config.Set '{"config": {"debug": {"level": 3}}}'

This RPC command has a shortcut: mos config-set which sets the config option, saves it, and reboots the device (since some config options take effect only after reboot):

mos config-set debug.level=3
Getting configuration...
Setting new configuration...
Saving and rebooting...

Config.Save

Writes an existing device confuguration on flash, as a sequence of confX.json files (see description). This makes configuration permament, preserved after device reboot. Arguments:

{
  "reboot": false  // Optional. Whether to reboot the device after the call
}

Example usage:

mos call Config.Save '{"reboot": true}'

rpc-service-config'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.