
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
nodeJS API Library implementing Monitor-and-Test command to control TI-2530 chip for IOT application.
##Overview The CC2530 is a System-on-chip solution for IEEE 802.15.4, Zigbee and RF4CE applications, and the Monitor-and-Test(MT) interface is used for communication between the host testter and a Zigbee device through RS-232 serial port.
As a user/tester, we can issue MT commands to the ZigBee target for your application: tempature sensoring, light sensing and chemical sensing etc. Thus, a nodeJS API Library which encapsulates the MT interface can help nodeJS/JavaScript user easily issue MT commands for their IOT application.
##Features With mt-simple nodeJS API Library, you can issue MT command easily through downloading mt-simple from npm and used in your nodeJS/JavaScript project without the need to look trough handbook issued by Texas Intrusment.
For example, a HTML/CSS + websocket + mt-simple API website to present tempature and brightness in realtime.

##Requirement
cc2530 system-on-chip *1
RS-232 *1
npm installed
light sensor (optional)

##Installation Available via npm:
> $ npm install mt-simple
Or via git:
> $ git clone https://github.com/adwin5/mt-simple.git
> $ npm install
Demo and tutorial youtube video:
##Test Files ####/explain has 4 demo files
####/explain-web has 1 demo file
##How to use
var MT = require("index");
MT.init("/dev/ttyUSB0", function(){
start();
});
function start(){
//set Time
MT.setCurrentTime(function(err, data){
console.log("***User: set current time Successfully");
});
//get Time
MT.getTime(function(err, data){
console.log("***User: the current time is:");
console.log(data.Hour+":"+data.Minute+":"+data.Second+" "+data.Year+"/"+data.Month+"/"+data.Day);
});
}
Result
open
AP sent:
<Buffer fe 0b 21 10 19 8f 7d 1e 0f 33 35 03 11 e0 07 33>
***User: set current time Successfully
AP sent:
<Buffer fe 00 21 11 30>
***User: the current time is:
15:51:53 2016/3/17
###Init
MT.init("/dev/ttyUSB0", function(){
start();
});

###Write Code Here
function start(){
...code...
}
###Method Example 1: SYS_TIME_SET
MT.setCurrentTime(callback);
###Method Example 2: SYS_NV_WRITE
var data = { id : 0x0F00, offset : 0x00, len : 0x01, value : [0x55] };
MT.SysNVWrite(data, callback);
###Indication Dealer Example :
MT.startTimer(data, callback);
MT.hub.on('messageIND',callback);
Example:
//set timer 0 ,it will expire in 2 secs//
MT.startTimer({id:0, timeout:2000}, function(err, data){});
MT.hub.on('messageIND',function(data){
//do someting ... when the timer expired ... aka ... the indication comes//
//get tempature//
MT.getTempature(function(err, data){
console.log("***User: the current tempature is:");
console.log(data.AdcRead.toString(16));
});
});
hub.on('messsageIND', cb);
###notRecognized Command Dealer Example :
MT.hub.on('notRecogMessage',function(data){
console.log(data);
});
hub.on('notRecogMessage', cb);
##Demo
demoTempature.js
////////////////////////////////////////////////////////
// Use the mt-simple API library //
// to set time and get time and current tempature //
// of TI CC2530 //
////////////////////////////////////////////////////////
'use strict';
var MT = require("../index");
//check out your portname through the "dmesg" command//
MT.init("/dev/ttyUSB0", function(){
start();
});
function start(){
MT.setCurrentTime(function(err, data){
console.log("***User: set current time Successfully");
});
MT.getTime(function(err, data){
console.log("***User: the current time is:");
console.log(data.Hour+":"+data.Minute+":"+data.Second+" "+data.Year+"/"+data.Month+"/"+data.Day);
});
MT.getTempature(function(err, data){
console.log("***User: the current tempature is:");
console.log(data.AdcRead.toString());
});
}
Result
open
AP sent:
<Buffer fe 0b 21 10 4d 91 7d 1e 10 01 11 03 11 e0 07 70>
***User: set current time Successfully
AP sent:
<Buffer fe 00 21 11 30>
***User: the current time is:
16:1:17 2016/3/17
AP sent:
<Buffer fe 02 21 0d 0e 03 23>
***User: the current tempature is:
564
==================================
demoNV.js
////////////////////////////////////////////////////////////////////////////////////////
// Use the mt-simple API library //
// to write and read none volatial memoryin of TICC2530 //
// Also, here are other command tested : //
// Zigbee write configure, System NV init and system reset request //
////////////////////////////////////////////////////////////////////////////////////////
'use strict';
var MT = require("../index");
//check out your portname through the "dmesg" command//
MT.init("/dev/ttyUSB0", function(){
start();
});
function start(){
//write to NV memory
var commandSysNVWrite = { id : 0x0F00, offset : 0x00, len : 0x01, value : [0x55] };
MT.SysNVWrite(commandSysNVWrite, function(err, data){
console.log("***User: write NV Successfully");
console.log(data);
});
//read from NV memory
var commandSysNVRead = { id : 0x0F00, offset : 0x00 };
MT.SysNVRead(commandSysNVRead, function(err, data){
console.log("***User: Read NV Successfully");
console.log(data);
});
//write ZB configure
var commandZBWriteConfg = { configid : 0x03, len : 0x01, value : [0x02] };
MT.ZBWriteConfg(commandZBWriteConfg, function(err, data){
console.log("***User: ZB write config Successfully");
console.log(data);
});
//create and initialize an item in non-volatial memory
var commandSysNVItemInit = { id: 0x0F00, len : 0x01, initlen: 0x01, initvalue : [0x00]};
MT.SysNVItemInit(commandSysNVItemInit, function(err, data){
console.log("***User: NV write and init Successfully");
console.log(data);
});
//System Reset
MT.SysResetReq(function(err, data){
console.log("***User: System Reset Successfully");
console.log(data);
});
//listen to indication
MT.hub.on('messageIND',function(data){
console.log("***User: Receieved indication");
console.log(data);
});
}
Result
open
AP sent:
<Buffer fe 05 21 09 00 0f 00 01 55 76>
***User: write NV Successfully
{ Status: 0 }
AP sent:
<Buffer fe 03 21 08 00 0f 00 25>
***User: Read NV Successfully
{ Status: 0, Value: <Buffer 55> }
AP sent:
<Buffer fe 03 26 05 03 01 02 20>
***User: ZB write config Successfully
{ Status: 0 }
AP sent:
<Buffer fe 05 21 07 00 0f 01 01 00 2c>
***User: NV write and init Successfully
{ Status: 0 }
AP sent:
<Buffer fe 01 41 00 00 40>
***User: Receieved indication
{ Reason: 2,
TransID: 2,
ProductID: 0,
MajorRel: 2,
MinorRel: 6,
'H/W': 2 }
================================== demoTimer.js
////////////////////////////////////////////////////////
// Use the mt-simple API library //
// to set 4 timers in TI CC2530 and get time and //
// tempature when the timer expires //
////////////////////////////////////////////////////////
'use strict';
var MT = require("../index");
//check out your portname through the "dmesg" command//
MT.init("/dev/ttyUSB0", function(){
start();
});
function start(){
MT.setCurrentTime(function(err, data){
console.log("***User: set current time Successfully");
});
//set timer 0 ,it will expire in 2 secs//
MT.startTimer({id:0, timeout:2000}, function(err, data){
console.log("timer 0 set successfully");
console.log(data);
});
//set timer 1 ,it will expire in 4 secs//
MT.startTimer({id:1, timeout:4000}, function(err, data){
console.log("timer 1 set successfully");
console.log(data);
});
//set timer 2 ,it will expire in 7 secs//
MT.startTimer({id:2, timeout:6000}, function(err, data){
console.log("timer 2 set successfully");
console.log(data);
});
//set timer 3 ,it will expire in 8 secs//
MT.startTimer({id:3, timeout:8000}, function(err, data){
console.log("timer 3 set successfully");
console.log(data);
});
MT.hub.on('messageIND',function(data){
//get time//
MT.getTime(function(err, data){
console.log("***User: the current time is:");
console.log(data.Hour+":"+data.Minute+":"+data.Second+" "+data.Year+"/"+data.Month+"/"+data.Day);
});
//get tempature//
MT.getTempature(function(err, data){
console.log("***User: the current tempature is:");
console.log(data.AdcRead.toString(16));
});
});
//listen to indication/response which the system can't parse
MT.hub.on('notRecogMessage',function(data){
console.log(data);
});
}
Result
open
AP sent:
<Buffer fe 0b 21 10 b1 93 7d 1e 10 0b 1d 03 11 e0 07 88>
***User: set current time Successfully
AP sent:
<Buffer fe 03 21 0a 00 d0 07 ff>
timer 0 set successfully
{ 'Status of SYS_OSAL_START_TIMER: [Success(0) or Failure(1)]': 0 }
AP sent:
<Buffer fe 03 21 0a 01 a0 0f 86>
timer 1 set successfully
{ 'Status of SYS_OSAL_START_TIMER: [Success(0) or Failure(1)]': 0 }
AP sent:
<Buffer fe 03 21 0a 02 70 17 4d>
timer 2 set successfully
{ 'Status of SYS_OSAL_START_TIMER: [Success(0) or Failure(1)]': 0 }
AP sent:
<Buffer fe 03 21 0a 03 40 1f 74>
timer 3 set successfully
{ 'Status of SYS_OSAL_START_TIMER: [Success(0) or Failure(1)]': 0 }
AP sent:
<Buffer fe 00 21 11 30>
***User: the current time is:
16:11:31 2016/3/17
AP sent:
<Buffer fe 02 21 0d 0e 03 23>
***User: the current tempature is:
234
AP sent:
<Buffer fe 00 21 11 30>
***User: the current time is:
16:11:33 2016/3/17
AP sent:
<Buffer fe 02 21 0d 0e 03 23>
***User: the current tempature is:
234
AP sent:
<Buffer fe 00 21 11 30>
***User: the current time is:
16:11:35 2016/3/17
AP sent:
<Buffer fe 02 21 0d 0e 03 23>
***User: the current tempature is:
233
AP sent:
<Buffer fe 00 21 11 30>
***User: the current time is:
16:11:37 2016/3/17
AP sent:
<Buffer fe 02 21 0d 0e 03 23>
***User: the current tempature is:
234
==================================
##Methods
init(portname, cb) - initiate serial port and parsersetCurrentTime([cb]) - reset the value of time in TI-cc2530 chipgetCurrentTime([cb]) - get the value of time in TI-cc2530 chipgetTempature([cb]) - get the value of tempature in TI-cc2530 chipstartTimer(data[,cb]) - start a timer inSysNVWrite(data[,cb]) - write to the Non-volatiale memorySysNVRead(data[,cb]) - read from the Non-volatiale memoryZBWriteConfg(data[,cb]) - write and config Z-StackSysNVItemInit(data[,cb]) - Write and InitialeSysResetReq([cb]) - hard reset of the TI-cc2530 chiphub.on('messageIND',cb) - listener for listening recognized indicationhub.on('notRecogMessage',cb) - listener for listening not recognized indicationFAQs
simple version of API to use TI CC2530 through monitor and test command
We found that mt-simple demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.