Giter Club home page Giter Club logo

difluid-sdk-demo's Introduction

DiFluid SDK DEMO

Introduction

This is a project demonstrate the usage of SDK protocol on DiFluid serires products.

Here includes the code for the following devices

And these are the ones still WIP

  • Omni

This project is based on vue and implemented uniapp framework for cross-platform.

Get Started

  1. Install npm and HbuilderX
  2. run npm install under the project directory.
  3. Replace the key in config.js with yours. (Contact [email protected] or at discord server for the internal test key now)
  4. Start HbuilderX:
    • Import project
    • Run - Mobile App Playground

Protocol Explanation

DiFluid devices are built with customized transmission protocols, you will need to go through a preparation procedure before opening up the cleartext protocol. Here is the workflow after bluetooth connection is established.

STEP1: Create Bluetooth Connection

This part of work is mainly at home page, it's a standard procedure to connect any ble devices.

  • Search for target devices (according to serviceID)
  • Create BLE connection
  • Subscribe for all the services

Then you should get two services available in total:

  • 0000ff01-0000-1000-8000-00805f9b34fb // encrypted channel
  • 0000aa01-0000-1000-8000-00805f9b34fb // cleartext channel

If you are familiar with how to make this connection under your framework / environment, then you can just skip this part.

STEP2: Create Server Connection (Optional)

DiFluid devices now have the encrypted channel on and the cleartext channel off by default. To enabling the cleartext transmission channel, you need to let device to communicate with difluid server after each power on of the device.

DiFluid devices now have the encrypted channel and cleartext channel both on by default. This step now is an optional step and is only used to making connection to DiFluid Server and enabling OTA function (WIP for third-party usage).

It may seems complicated, but the main principle is just write the cmd from server into device and return the respond content from device to server. Your client is just behavior like a message relay station.

This part of code is mainly at r2Detail.vue, the workflow is shown as below.

preparation-workflow

STEP3: Decode the data

Now you can switch to the cleartext service channel, send the action and decode the result. Here is the table for all the available actions and results for every difluid devices supports SDK.

You can refer to the protocol documents for details and examples.

Other references

This project is mainly written under vue & js and not using the native system features, we are looking for any other third-party demo or well-maintained project to have their links here.

difluid-sdk-demo's People

Contributors

chclk avatar difluid 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.