-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create BLE Beacon #5
Comments
Sure. If you follow the peripheral example at the readme page, modify the part that uses the AdvertisingDataBuilder to create advertising data that matches your desired beacon format. See https://github.com/Emill/node-ble-host/blob/master/docs/api/advertising-data-builder.md for documentation. If you do not want your device to be connectable (i.e. it should only advertise), you can add |
OK - thank you! Do you have an example for an beacon? It is not important which type (iBeacon, AltBeacon,...) |
Could you post a screenshot of what pops up when you press RAW? |
I think this code should work to replicate that beacon, by modifying "Full GATT Server Example (Peripheral)" accordingly: const advDataBuffer = new AdvertisingDataBuilder()
.addFlags(['leGeneralDiscoverableMode', 'brEdrNotSupported'])
.addManufacturerData(0x004C, Buffer.from([ // Apple's manufacturer ID is 0x004C
0x02, // Type: Beacon
0x15, // Length of following data: 21
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, // UUID
0x11, 0x22, // Major
0x33, 0x44, // Minor
0x100-77])); // RSSI at 1m
.build();
manager.setAdvertisingData(advDataBuffer);
const scanRspDataBuffer = new AdvertisingDataBuilder()
.addLocalName(/*isComplete*/ true, deviceName)
.build();
manager.setScanResponseData(scanRspDataBuffer);
startAdv();
function startAdv() {
manager.startAdvertising({advertisingType: 'ADV_SCAN_IND'}, connectCallback); // Make it non-connectable
} Note that that RSSI value should be updated to match the TX power of your Bluetooth controller. |
Is there a way to advertise a BLE Beacon with this lib? @Emill
Thanks in advance!
The text was updated successfully, but these errors were encountered: