@billsalt thanks! Actually I think if you use one of the 'cutting edge' builds from http://www.espruino.com/binaries/travis/master/ you'll find there'll be a servicedata field that you can check with device.servicedata["feaa"]. Sorry, I'd assumed it was in 1v94 but it seems it wasn't.
However even as-is, something like this should work to check the device's UID:
NRF.findDevices(function(devices) {
devices.forEach(function(device) {
var uid = (new Uint8Array(device.buffer)).slice(23,30).map(x=>
((256+x).toString(16)).substr(-2)).join("");
if (uid=="123456123456") ...
});
});
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
@billsalt thanks! Actually I think if you use one of the 'cutting edge' builds from http://www.espruino.com/binaries/travis/master/ you'll find there'll be a
servicedata
field that you can check withdevice.servicedata["feaa"]
. Sorry, I'd assumed it was in 1v94 but it seems it wasn't.However even as-is, something like this should work to check the device's UID:
@Frida thanks! As above, I think with new builds you might find the data is exposed a little more cleanly (so you don't have to go diving as deep into the
data
field). When you say 'Manufacturer Specific Data' do you mean the 0xFF AD type from https://www.bluetooth.com/specifications/assigned-numbers/generic-access-profile ?If so, I should ensure Espruino parses that out (and can easily specify it) as well. Any thoughts as to how to specify it? Maybe just:
or