forked from tommythorsen/uribeacon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
blenoBeacon.js
24 lines (20 loc) · 886 Bytes
/
blenoBeacon.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Manually create a URI Beacon with bleno
var bleno = require('bleno');
var scanData = new Buffer(0); // maximum 31 bytes
var advertisementData = new Buffer(15); // maximum 31 bytes
advertisementData[0] = 0x03; // Length
advertisementData[1] = 0x03; // Parameter: Service List
advertisementData[2] = 0xD8; // URI Beacon ID
advertisementData[3] = 0xFE; // URI Beacon ID
advertisementData[4] = 0x0A; // Length
advertisementData[5] = 0x16; // Service Data
advertisementData[6] = 0xD8; // URI Beacon ID
advertisementData[7] = 0xFE; // URI Beacon ID
advertisementData[8] = 0x00; // Flags
advertisementData[9] = 0xEE; // Power -18 dBm
advertisementData[10] = 0x00; // http://www.
advertisementData[11] = 0x61; // a
advertisementData[12] = 0x62; // b
advertisementData[13] = 0x63; // c
advertisementData[14] = 0x07; // .com
bleno.startAdvertisingWithEIRData(advertisementData, scanData);