RSSI for connections - help with setRSSIHandler()

Posted on
  • Hi,
    I need some help understanding setRSSIHandler(). I want to get RSSI for individual connections that are made from the puck-js when operating as a Central. The scenario is: device connects to puck (puck as peripheral), puck connects to another device (puck as central) simultaneously. What does setRSSIHandler report?

    A code snippet would also be helpful; the documentation shows a commented snippet without context and is probably part of my confusion.

    Thanks!
    Bill

  • Right now, you can:

    • Get the RSSI of the device that is connecting to Puck.js (so the central connecting to the puck.js peripheral) - as follows:

      // Start scanning
      NRF.setRSSIHandler(function(rssi) {
      console.log(rssi);
      });
      // prints -85 (or similar)
      
      // Stop Scanning
      NRF.setRSSIHandler();
      
    • And you can use NRF.findDevices to get a list of advertising devices and their RSSIs

    I'm afraid there isn't a way to get the RSSI of the other device if the Puck is central - you'd have to disconnect and use NRF.findDevices

    edit: I'll try and fix those docs too

  • Hi @Gordon, Hope I'm not taking too much of your bandwidth, but really appreciate the help as I explore the puck with some practical applications.

    I've been in contact with the Nordic folks and the SoftDevice does support getting RSSI for each handle (connection). It would be great to have a way to access this on the puck. See below:

    In order to measure the RSSI on a connected peripheral, you can use
    the SoftDevice functions sd_ble_gap_rssi_get(),
    sd_ble_gap_rssi_start() and sd_ble_gap_rssi_stop(). Provide the
    conn_handle for the peripheral you want to get the RSSI from. You can
    read more about these functions
    here.

  • I've filed a bug for it here: https://github.com/espruino/Espruino/iss­ues/1047

    But it's pretty low priority IMO since if you're disconnected you can just scan for advertising packets.

    It is all Open Source so if you're desperate it's possible to add it yourself :)

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

RSSI for connections - help with setRSSIHandler()

Posted by Avatar for billsalt @billsalt

Actions