Skip to content

Commit

Permalink
Do not parse ATIS responses if lines are not enabled
Browse files Browse the repository at this point in the history
See Issue jankolkmeier#37. When using the ParseIOSamplePayload function to parse Payload to on packages from nodes with disabled IO lines it will break. Checking the commandStatus of the AT response fixes this.
  • Loading branch information
jankolkmeier committed Mar 13, 2016
1 parent 5569df6 commit 931d833
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/frame-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ frame_parser.parseNodeIdentificationPayload = function(frame, reader) {
frame_parser.ParseIOSamplePayload = function(frame, reader) {
frame.digitalSamples = {};
frame.analogSamples = {};
frame.numSamples = 0;
// When parsing responses to ATIS, there is no data to parse if IO lines are not enabled
if (frame.commandStatus !== undefined && frame.commandStatus !== 0) return;
frame.numSamples = reader.nextUInt8();
var mskD = reader.nextUInt16BE();
var mskA = reader.nextUInt8();
Expand Down

0 comments on commit 931d833

Please sign in to comment.