Skip to content

Commit

Permalink
Support 7-bit encoded originators.
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-zaiats committed Apr 3, 2016
1 parent ab9f6ea commit 94d39bb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pdu.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,16 @@ pduParser.parse = function(pdu) {

var senderType = parseInt(buffer[2]).toString(16)

var encodedSender = pdu.slice(cursor, cursor + senderSize);
var senderNum;
if (senderType === '91') {
senderNum = pduParser.deSwapNibbles(encodedSender);
} else if (senderType === 'd0') {
senderNum = this.decode7Bit(encodedSender).replace(/\0/g, '');
} else {
console.error('unsupported sender type.');
}

var senderNum = pduParser.deSwapNibbles(pdu.slice(cursor, cursor+senderSize));
cursor += senderSize;

var protocolIdentifier = pdu.slice(cursor, cursor+2);
Expand Down

0 comments on commit 94d39bb

Please sign in to comment.