Code Monkey home page Code Monkey logo

wonderbits-sdk's Introduction

WonderBits SDK

使用方法

第一步

安装 WonderBits JS SDK

npm install wonderbits-sdk
或者
npm install git+https://github.com/yunair/wonderbits-sdk

第二步

根据对应平台选择接入方式:

安装MFElink软件并打开的方式:

集成开发 SDK 的方式:

第三步

初始化 WonderBits JS SDK

const wonderBitsSdk = require("wonderbits-sdk");
wonderBitsSdk.initConnection(() => {
  console.log("初始化成功");
});

第四步

使用需要的模块,调用

  • doReport
  • doCommand

来给硬件发送指令。

例子


高级用法说明

监听硬件上传的原始数据

wonderBitsSdk.setOnOriginDataReceivedCallback(data => {
  console.log(data);
});

监听硬件复位回调

wonderBitsSdk.addResetListener(() => {
  console.log("reset");
});

清除监听硬件复位回调

wonderBitsSdk.clearResetListener();

获取连接在板子上的模块

let moduleNames = wonderBitsSdk.getConnectedModuleNames();

事件

含义:当指定情况发生时,会收到板子上传的数据,此时会调用注册事件时的callback(obj),将处理后的数据返回。 返回数据的详细类型参见事件回调

事件回调

事件将会返回 json value 的类型根据对应事件值的不同而不同

{ "module": ${moduleName}, "target": ${target}, "value": ${value}}

wonderbits-sdk's People

Contributors

yunair avatar dependabot[bot] avatar

Stargazers

何锦余 avatar Dottieworks avatar

Watchers

James Cloos avatar Dottieworks 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.