Skip to content
/ MCSjs Public

MCSjs: A Javascript library for Mediatek cloud sandbox

Notifications You must be signed in to change notification settings

iamblue/MCSjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MCSjs: A Javascript library for Mediatek cloud sandbox

Installation

  $ npm install mcsjs --save

Documentation

Complete documentation can be found in Here.

Usage For TCP

var mcs = require('mcsjs');

var myApp = mcs.register({
  deviceId: 'Input your deviceId',
  deviceKey: 'Input your deviceKey',
});

// Listening the command from MCS.
myApp.on('control_channel_name', function(data, timestamp) {
  console.log('blink');
});

// Uploading data to MCS.
myApp.on('display_channel_name', '', 'your data');

// myApp.catch(function(err) {
//   console.log(err);
// })
// myApp.end();

Usage for MQTT

var mcs = require('mcsjs');

var myApp = mcs.register({
  deviceId: 'your deviceId',
  deviceKey: 'your deviceKey',
  mqttHost: 'mqtt.mcs.mediatek.com',
  method: 'mqtt',
  port: 1883,
  qos: 0,
});

myApp.on('switch', function(data) {
  console.log(data);
});

setTimeout(function() {
  myApp.emit('integer','', 456);
}, 5000)

How to test

About

MCSjs: A Javascript library for Mediatek cloud sandbox

Resources

Stars

Watchers

Forks

Packages

No packages published