-
Hi Gordon, thanks for your reply.
I am currently testing out the Eddystone broadcasting function using the
NRF.setAdvertising
examples in the documentation. But when testing the maximum message length that can be sent using Eddystone format, I received an error once the message exceed 24 bytes. I heard that the maximum length supported for a Bluetooth advertising packet is 31 bytes. So why is the packet that I can send much shorter than expected?The code that i used is:
NRF.setAdvertising([0x03, // Length of Service List 0x03, // Param: Service List 0xAA, 0xFE, // Eddystone ID 0x13, // Length of Service Data 0x16, // Service Data 0xAA, 0xFE, // Eddystone ID 0x10, // Frame type: URL 0xF8, // Power 0x03, // https:// '1','2','3','4','5','6','7','8','9','A','B','C','D','E'], {interval:100});
Will result in:
>Uncaught Error: Got BLE error code 9 at line 1 col 37 NRF.setAdvertising(d, {interval:100});
Interestingly enough, I saw your answer on another iBeacon question which uses the code below and it works on the puck with a packet size of 30 bytes:
var d = [0x02, // Number of bytes that follow in first AD structure 0x01, // Flags AD type 0x04, // Flags value 0x1A = 000011010 // bit 0 (OFF) LE Limited Discoverable Mode // bit 1 (OFF) LE General Discoverable Mode // bit 2 (ON) BR/EDR Not Supported // bit 3 (OFF) Simultaneous LE and BR/EDR to Same Device Capable (controller) // bit 4 (OFF) Simultaneous LE and BR/EDR to Same Device Capable (Host) 0x1A, // Number of bytes that follow in second (and last) AD structure 0xFF, // Manufacturer specific data AD type 0x4C, 0x00, // Company identifier code (0x004C == Apple) 0x02, // Byte 0 of iBeacon advertisement indicator 0x15, // Byte 1 of iBeacon advertisement indicator 0xe2, 0xc5, 0x6d, 0xb5, 0xdf, 0xfb, 0x48, 0xd2, 0xb0, 0x60, 0xd0, 0xf5, 0xa7, 0x10, 0x96, 0xe0,// iBeacon proximity uuid 0x00, 0x00, // major 0x00, 0x00, // minor 0xc5]; // The 2's complement of the calibrated Tx Power NRF.setAdvertising(d, {interval:100});
Now I am not sure if this is a Puck issue or a Eddystone issue. Hope you can help me out. Thanks in advance :)
Yes, it should be! You'll just have to decode the data to get the URL (or maybe not? You could just forward the data as-is).
NRF.findDevices
(http://www.espruino.com/Reference#l_NRF_findDevices) is what you want, although you can get finer grain control withNRF.setScan
(http://www.espruino.com/Reference#t_l_NRF_setScan) as you receive individual packets that way.