Device(s) in range / closer than to PuckJS

Posted on
  • Hi there

    For anon-going project, I need to know if some device(s) are within the range of a Puck, and, if within it, how close the device(s) is/are to the Puck.

    From what I could read in the ref, I see we can only "NRF.setRSSIHandler()" on the currently active connection, while we have an "rssi" prop in the "BluetoothDevice" objects returned by "NRF.findDevices()".

    For a single device, I presume that using "NRF.connect()" and then setting an interval to handle the RSSI 'd do the trick, but I was wondering what was the best way to achieve the same behavior for multiple devices: in other words, some sort of "NRF.findDevices()" discarding anything that not in our interest ( ex: devices whose names & stuff are not present in an array ) ?

    Anyway, I'll give both a try as soon as I can (..)
    -> any hints welcome ;)

    +

  • All you need is NRF.setScan(...) - it'll return RSSI of any devices it finds... Should be a lot easier!

    Note that doing stuff like that leaves the radio on, so will drain the batteries a lot faster!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Device(s) in range / closer than to PuckJS

Posted by Avatar for stephaneAG @stephaneAG

Actions