Permalink
Browse files

parse node identification payload of ATND command response

  • Loading branch information...
1 parent ceedc96 commit eb6ff384f3b00376e5f168226d482e335d5eaf43 @jankolkmeier committed Oct 27, 2013
Showing with 7 additions and 3 deletions.
  1. +3 −3 examples/basic/basic.js
  2. +4 −0 lib/frame-parser.js
View
@@ -8,16 +8,16 @@ var xbeeAPI = new xbee_api.XBeeAPI({
api_mode: 1
});
-var serialport = new SerialPort("COM6", {
+var serialport = new SerialPort("COM5", {
baudrate: 57600,
parser: xbeeAPI.rawParser()
});
serialport.on("open", function() {
- console.log("Serial port open... sending ATNJ");
+ console.log("Serial port open... sending ATND");
var frame = {
type: C.FRAME_TYPE.AT_COMMAND,
- command: "NI",
+ command: "ND",
commandParameter: [],
};
View
@@ -44,6 +44,10 @@ frame_parser[C.FRAME_TYPE.AT_COMMAND_RESPONSE] = function(frame, buffer) {
frame.command = String.fromCharCode(buffer.readUInt8(1), buffer.readUInt8(2));
frame.commandStatus = buffer.readUInt8(3);
frame.commandData = buffer.slice(4).toJSON();
+ if (frame.command == "ND") {
+ frame.nodeIdentification = {};
+ frame_parser.parseNodeIdentificationPayload(frame.nodeIdentification, buffer.slice(4))
+ }
}
frame_parser[C.FRAME_TYPE.REMOTE_COMMAND_RESPONSE] = function(frame, buffer) {

0 comments on commit eb6ff38

Please sign in to comment.