iBeacons
Note: For Eddystone, see this page
iBeacon is a beacon format from Apple that allows you to transmit information which can appear as a notification on a user's iPhone.
All you need to do to use it is use the ble_ibeacon (About Modules) module:
require("ble_ibeacon").advertise({
uuid : [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // ibeacon uuid
major : 0x0001, // optional
minor : 0x0001, // optional
rssi : -59 // optional RSSI at 1 meter distance in dBm
});
Note: you'll need to get an iBeacon UUID from Apple to use this.
From then on, Espruino will broadcast to anything that will listen.
Note: Since you can't advertise while you're connected via Bluetooth LE, you will have to disconnect from your Espruino for it to start transmitting.
To turn iBeacon advertising off simply call NRF.setAdvertising({});
Advanced
require("ble_ibeacon").advertise
will overwrite
Espruino's advertising (name, services, etc) with the iBeacon packet.
You can use require("ble_ibeacon").get
with the same options as
advertise
to get the array of advertising data to use, which you can
feed directly into NRF.setAdvertising()
, allowing you to set other options
such as advertising rate.
In Espruino 1v92 and later you can also supply an array of advertising data to make Espruino send each advertising packet in turn.
For iBeacon and normal Espruino connection info:
NRF.setAdvertising([
require("ble_ibeacon").get(...),
{} // this will add a 'normal' advertising packet showing name/etc
], {interval:100});
Or for iBeacon, Eddystone, and to report battery level:
NRF.setAdvertising([
require("ble_ibeacon").get(...),
require("ble_eddystone").get(...),
{ 0x180F : [95] }
], {interval:100});
This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.