项目作者: shiveshnavin

项目描述 :
Mongoose OS emulator
高级语言: JavaScript
项目地址: git://github.com/shiveshnavin/iot_blockchain_exps.git
创建时间: 2019-01-26T07:49:29Z
项目社区:https://github.com/shiveshnavin/iot_blockchain_exps

开源协议:

下载


iot_blockchain_exps

The project aims to support mongoose os mjs emulation on PC.

Install

  1. npm install --save mongoose-os-emulator

In your init.js file include the below line at the top.

  1. require('mongoose-os-emulator')();

Run

  1. node init.js 0

Where 0 is your emulated device_id. The localhost port for the UI can be calculated as
5000 + device_id. E.g.

  1. node init 1
  2. http://127.0.0.1:5001

Test

To Run on Windows

  1. double click run.bat

To run on Linux

  1. ./run.sh

To make a request

run ota_server and send postman or from GUI request

  1. http://127.0.0.1:5001/rpc/on_request
  2. {
  3. "req_id":"123",
  4. "src_ip":"127.0.0.1:8080",
  5. "status":{"message":"under process"},
  6. "job":{"res_id":61,"res_name":"Ultrasound sensor","action":"read"}
  7. }

Alt text
Alt text

Limitations

Currently only these libraries are supported with limited scope. Feel free to add more features and raise a PR.

  1. this.Sys = load('api_sys.js');
  2. this.HTTP = load('api_http.js');
  3. this.RPC = load('api_rpc.js');
  4. this.Cfg = load('api_config.js');
  5. this.ffi = load('api_ffi.js');
  6. this.Event = load('api_events.js');
  7. this.Net = load('api_net.js');
  8. this.File = load('api_file.js');
  9. this.GPIO = ffi('gpio')
  10. this.Timer = load('api_timer.js');
  11. this.UART = load('api_uart.js');