From ad1b89a3eeafba8dd57819ff256adce89cb54f08 Mon Sep 17 00:00:00 2001 From: Christoph Pahmeyer Date: Fri, 3 Jan 2020 18:19:42 +0100 Subject: [PATCH 1/2] add support for location event sent from gps tracker board GT02_MT6261D_V2.3 --- gt06.js | 6 ++++++ test/test.js | 10 ++++++++++ 2 files changed, 16 insertions(+) create mode 100644 test/test.js diff --git a/gt06.js b/gt06.js index 1b4f7bf..3612ec1 100644 --- a/gt06.js +++ b/gt06.js @@ -30,6 +30,9 @@ Gt06.prototype.parse = function (data) { case 0x12: // location message Object.assign(parsed, parseLocation(msg)); break; + case 34: // location message + Object.assign(parsed, parseLocation(msg)); + break; case 0x13: // status message Object.assign(parsed, parseStatus(msg)); parsed.expectsResponse = true; @@ -86,6 +89,9 @@ function selectEvent(data) { case 0x12: eventStr = 'location'; break; + case 34: + eventStr = 'location'; + break; case 0x13: eventStr = 'status'; break; diff --git a/test/test.js b/test/test.js new file mode 100644 index 0000000..c3d4f17 --- /dev/null +++ b/test/test.js @@ -0,0 +1,10 @@ +const Gt06 = require('../gt06'); + +const location = new Buffer.from('787822221401030d1532cb0596a9ba00e56911001400010601390a004fb40000000052fc540d0a', 'hex') +try { + var gt06 = new Gt06(); + gt06.parse(location); + console.log(gt06); +} catch (e) { + console.log(e); +} From 891b403f7b339f662645a94151f52c4369cea626 Mon Sep 17 00:00:00 2001 From: Christoph Pahmeyer Date: Sun, 5 Jan 2020 21:37:28 +0100 Subject: [PATCH 2/2] remove unnecessary test file --- test/test.js | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 test/test.js diff --git a/test/test.js b/test/test.js deleted file mode 100644 index c3d4f17..0000000 --- a/test/test.js +++ /dev/null @@ -1,10 +0,0 @@ -const Gt06 = require('../gt06'); - -const location = new Buffer.from('787822221401030d1532cb0596a9ba00e56911001400010601390a004fb40000000052fc540d0a', 'hex') -try { - var gt06 = new Gt06(); - gt06.parse(location); - console.log(gt06); -} catch (e) { - console.log(e); -}