node-beacon-scanner
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -73,6 +73,2 @@ /* ------------------------------------------------------------------ | ||
let manu = ad.manufacturerData; | ||
// iBeacon | ||
if(manu && manu.length >= 4 && manu.readUInt32BE(0) === 0x4c000215) { | ||
return 'iBeacon'; | ||
} | ||
// Eddiystone | ||
@@ -95,2 +91,6 @@ let eddystone_service = ad.serviceData.find((el) => { | ||
} | ||
// iBeacon | ||
if(manu && manu.length >= 4 && manu.readUInt32BE(0) === 0x4c000215) { | ||
return 'iBeacon'; | ||
} | ||
// Estimote Telemetry | ||
@@ -111,2 +111,2 @@ let telemetry_service = ad.serviceData.find((el) => { | ||
module.exports = new BeaconParser(); | ||
module.exports = new BeaconParser(); |
{ | ||
"name": "node-beacon-scanner", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "The node-beacon-scanner is a Node.js module which allows you to scan BLE beacon packets and parse the packet data. This module supports iBeacon, Eddystone, and Estimote.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/scanner.js", |
@@ -89,2 +89,33 @@ node-beacon-scanner | ||
### <a id="surviving-restart">Surviving Bluetooth service restart</a> | ||
This sample code shows how to start scanning in a manner which will work even after the Bluetooth service restarts. | ||
```JavaScript | ||
const BeaconScanner = require('node-beacon-scanner'); | ||
const noble = require('noble'); | ||
const scanner = new BeaconScanner({'noble': noble}); | ||
// Set an Event handler for the Bluetooth service | ||
noble.on('stateChange', (state) => { | ||
if (state === "poweredOff") { | ||
scanner.stopScan() | ||
} else if (state === "poweredOn") { | ||
scanner.startScan() | ||
} | ||
}); | ||
// Set an Event handler for becons | ||
scanner.onadvertisement = (ad) => { | ||
console.log(JSON.stringify(ad, null, ' ')); | ||
}; | ||
// Start scanning | ||
scanner.startScan().then(() => { | ||
console.log('Started to scan.') ; | ||
}).catch((error) => { | ||
console.error(error); | ||
}); | ||
``` | ||
--------------------------------------- | ||
@@ -405,4 +436,6 @@ ## <a id="BeaconScanner-object">`BeaconScanner` object</a> | ||
* v0.1.1 (2018-12-27) | ||
* Fixed the bug that Eddystone beacons were not discovered if iBeacons were present as well. ([Thanks to @Tiggu](https://github.com/futomi/node-beacon-scanner/pull/8)) | ||
* v0.1.0 (2018-07-14) | ||
* Supported the Eddystone-UID of [Kontakt](https://kontakt.io/). The [spec of the Eddystone-UID](https://github.com/google/eddystone/tree/master/eddystone-uid) defines that the packet size is 20 bytes (the last 2 bytes are RFU). But the size of the packet form Kontakt device is 18 bytes. | ||
* Supported the Eddystone-UID of [Kontakt](https://kontakt.io/). The [spec of the Eddystone-UID](https://github.com/google/eddystone/tree/master/eddystone-uid) defines that the packet size is 20 bytes (the last 2 bytes are RFU). But the size of the packet form Kontakt device is 18 bytes. ([Thanks to @EwaRvr](https://github.com/futomi/node-beacon-scanner/issues/3)) | ||
* v0.0.3 (2018-06-24) | ||
@@ -409,0 +442,0 @@ * Fixed a bug that an exception was thrown when an unknown packet came. |
44263
748
481