From ecfec8f6ad5ef0fd463dc9c45f9de41c9ba77571 Mon Sep 17 00:00:00 2001 From: Etienne Date: Wed, 13 Jun 2018 17:52:22 +0800 Subject: [PATCH 1/4] adding address field inside beacon object --- lib/eddystone-beacon-scanner.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/eddystone-beacon-scanner.js b/lib/eddystone-beacon-scanner.js index c0c17d6..fea5331 100644 --- a/lib/eddystone-beacon-scanner.js +++ b/lib/eddystone-beacon-scanner.js @@ -139,6 +139,7 @@ EddystoneBeaconScanner.prototype.parseBeacon = function(peripheral) { beacon.id = peripheral.id; beacon.type = type; beacon.rssi = rssi; + beacon.address = peripheral.address var txPower = beacon.txPower; if (txPower !== undefined) { From 619b9fa5f12e9275986f140373ad077199d75a06 Mon Sep 17 00:00:00 2001 From: Etienne Date: Thu, 21 Jun 2018 12:12:44 +0800 Subject: [PATCH 2/4] support EID --- lib/eddystone-beacon-scanner.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/eddystone-beacon-scanner.js b/lib/eddystone-beacon-scanner.js index fea5331..d180e00 100644 --- a/lib/eddystone-beacon-scanner.js +++ b/lib/eddystone-beacon-scanner.js @@ -14,6 +14,7 @@ var SERVICE_UUID = 'feaa'; var UID_FRAME_TYPE = 0x00; var URL_FRAME_TYPE = 0x10; var TLM_FRAME_TYPE = 0x20; +var EID_FRAME_TYPE = 0x30; var EXIT_GRACE_PERIOD = 5000; // milliseconds @@ -132,6 +133,11 @@ EddystoneBeaconScanner.prototype.parseBeacon = function(peripheral) { beacon = this.parseTlmData(data); break; + case EID_FRAME_TYPE: + type = 'eid'; + beacon = this.parseEidData(data); + break; + default: break; } @@ -176,6 +182,13 @@ EddystoneBeaconScanner.prototype.parseTlmData = function(data) { }; }; +EddystoneBeaconScanner.prototype.parseEidData = function(data) { + return { + txPower: data.readInt8(1), + eid: data.slice(2, 10).toString('hex') + }; +}; + EddystoneBeaconScanner.prototype.calculateDistance = function(txPower, rssi) { return Math.pow(10, ((txPower - rssi) - 41) / 20.0); }; From 340da758205d1905452623e4a4e6359fdeb8da8b Mon Sep 17 00:00:00 2001 From: Etienne Date: Wed, 18 Jul 2018 10:21:47 +0800 Subject: [PATCH 3/4] Update (dependencies): updating node sniffer dependencies --- package.json | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index f823e06..a6e5281 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,10 @@ "jshint": "^2.7.0" }, "dependencies": { - "debug": "^2.1.3", - "noble": "^1.1.0", - "eddystone-url-encoding": "^1.0.0" + "bluetooth-hci-socket": "^0.5.1", + "debug": "^3.1.0", + "eddystone-url-encoding": "^1.0.1", + "noble": "^1.9.1", + "usb": "^1.3.2" } } From ccc157dec1dedd53d535b6de4c573e0a3d875916 Mon Sep 17 00:00:00 2001 From: Etienne Date: Wed, 18 Jul 2018 10:42:11 +0800 Subject: [PATCH 4/4] Feature (Frame Type): more infos while scanning != type of Eddystone frames --- lib/eddystone-beacon-scanner.js | 35 +++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/lib/eddystone-beacon-scanner.js b/lib/eddystone-beacon-scanner.js index d180e00..f0109a7 100644 --- a/lib/eddystone-beacon-scanner.js +++ b/lib/eddystone-beacon-scanner.js @@ -166,19 +166,18 @@ EddystoneBeaconScanner.prototype.parseUidData = function(data) { EddystoneBeaconScanner.prototype.parseUrlData = function(data) { return { txPower: data.readInt8(1), - url: urlDecode(data.slice(2)) + url: urlDecode(data.slice(2)), + prefix: this.prefix(data.readInt8(2)) }; }; EddystoneBeaconScanner.prototype.parseTlmData = function(data) { return { - tlm: { - version: data.readUInt8(1), - vbatt: data.readUInt16BE(2), - temp: data.readInt16BE(4) / 256, - advCnt: data.readUInt32BE(6), - secCnt: data.readUInt32BE(10) - } + version: data.readUInt8(1), + battery: data.readUInt16BE(2), + temperature: data.readInt16BE(4) / 256, + pdu: data.readUInt32BE(6), + time: data.readUInt32BE(10) }; }; @@ -193,4 +192,24 @@ EddystoneBeaconScanner.prototype.calculateDistance = function(txPower, rssi) { return Math.pow(10, ((txPower - rssi) - 41) / 20.0); }; +EddystoneBeaconScanner.prototype.prefix = function(number){ + switch(number){ + case 0: + return 'http://www.' + break; + + case 1: + return 'https://www.' + break; + + case 2: + return 'http://' + break; + + case 3: + return 'https://' + break; + } +} + module.exports = EddystoneBeaconScanner;