Skip to content

Commit

Permalink
Merge pull request #9 from approce/master
Browse files Browse the repository at this point in the history
Support text originators
  • Loading branch information
emilsedgh committed Apr 3, 2016
2 parents ab9f6ea + d9df9eb commit 409138c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pdu",
"version": "1.1.0",
"version": "1.1.1",
"description": "A PDU parser and generator for browser and node",
"homepage": "http://github.com/emilsedgh/pdu",
"main": "./pdu",
Expand Down
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 409138c

Please sign in to comment.