-
I think connecting will result in a much more accurate time than relying on the right advertisement being picked up at the right time.
I guess both ways could work. The callback in setScan gives you the packet as it is received, not sure whether with connection you can get it faster. Connection/GATT stuff is another layer on top received packets that may slow things down or make it less deterministic. Advertisement packets are much simpler/lower level. Try with nrfconnect on android, there is history of advertisement packets received - click 'MORE' on device list to see how they arrived to the phone - it is not random at all.
Thanks @diego - I think I might end up using this, I think connecting will result in a much more accurate time than relying on the right advertisement being picked up at the right time.
I had a look at Bleak recently (it is in the Espruino tutorials somewhere), your example will be useful to me for another project I think.