@deepcodestudio/ctwing-sdk-browserify
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Purpose

Offer ctwing sdk for browser or react-native enviorment

inspired by ctwing-sdk but change the crypto library and query-params libarary implementation .

Installation

yarn add ctwing-sdk-browserify

Usage

import {CommandOperate, injectCTWingConfiguration} from '@deepcode/ctwing-sdk-browserify';
//you need inject your appKey and appSecret first ( create an application in ctwing platform and you will find them)
injectCTWingConfiguration(appKey, appSecret);
let commandOperate = new CommandOperate(productId, masterKey, deviceId);
//you always need to send json data , and different protocol(mqtt or t-link) have different message format
//following is mqtt message format
const mqttMessage = {
    payload: {
        status: 1,
        temperature: 26,
    },
}
//dispatch message to device
await commandOperate.sendJSON(mqttMessage);

Limitation

For these sdk implementation , I only use dispatch device command functionality , so that I can't ensure other functionality of this library work correctly .

But you also can modify it by your self , I already split the code to multiple file so that the code should be read easily .

In the end , Welcome PR to perfect this library .

Package Sidebar

Install

npm i @deepcodestudio/ctwing-sdk-browserify

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

51.9 kB

Total Files

42

Last publish

Collaborators

  • deepcodestudio