-
Thanks Gordon, I didn't realise the services advertisement was part of the scan response rather than the 'advertisement' as such, but that makes sense now.
I poked around in the source code to see if I could figure out how setAdvertising converts the object to an array, but my C fu is weak :)
nRF Connect on my iPhone doesn't seem to display the raw scan response data, are you referring to the desktop version? If so, I'll have to buy a nordic dongle or wait to see if you come up with something in an update. In the meantime I'll live without the extra services advertisement.
Thanks for your help!
Incidentally if anyone reading this is struggling to understand how advertisements and scan responses fit together I found this article useful: http://www.argenox.com/a-ble-advertising-primer/
Ahh - yes, that's a bit unfortunate... The extra services are advertised in the scan response, which gets overwritten when you use that last bit of code.
The answer is yes, it is possible - but it's not very nice at the moment.
Basically you can supply an array to
setAdvertising
, which will cause it to cycle through different advertisements: https://www.espruino.com/Reference#l_NRF_setAdvertisingThe problem is that you need to specify all the data as arrays - so what you're currently doing (giving it the object) won't work. You'd have to manually make up the advertising packet yourself (you could use something like nRF Connect to read the packet, then just enter the bytes manually?).
I hit this just a few days ago (I added the example code for iBeacon & setScanResponse literally just this week), but there wasn't a nice easy fix. I'll file an issue and will see if I can think of a nice way of getting around it... Maybe allowing something like this: