Bluetooth

Posted on
  • Sorry for this question, I'm somekind of dumb: How do I enable BLE without exposing the watch to everybody around, but only to the already paired devices?

  • Tue 2020.03.24

    'enable BLE without exposing the watch to everybody around'

    By 'exposing' is the reference to security credentials?

    http://www.espruino.com/Reference#l_NRF_­setSecurity

    List by method

    http://www.espruino.com/Reference#NRF

    Range of detection

    http://www.espruino.com/Reference#l_NRF_­setTxPower

    http://www.espruino.com/Reference#l_Blue­toothDevice_passkey

  • This is what's most useful: http://www.espruino.com/BLE+Security

    To really lock it down right now you're best off adding the code:

    NRF.on('connect',function(addr) {
      if (addr!="69:2d:94:d0:9d:97 public")
        NRF.disconnect();
    });
    

    With your connecting device(s) addresses.

    You could also try NRF.setWhitelist(true) but this hasn't been well tested

  • Thank you for your responses! My question has been much easier: How can I avoid incoming connections as a user (not developer). When I enable BLE in the menu everyone can connect to the Bangle. On the other hand my computer as well as by Phone looses the connection to the Bangle after several minutes.

  • As a user, right now the best thing is to turn Bluetooth off in settings, and to then use Make Connectable when you want to connect to it.

    There is an issue open to add a proper 'whitelist' at https://github.com/espruino/BangleApps/i­ssues/78 but it didn't get included for the release

  • Thank you, Gordon. Thats's the answer.
    (notified about your post on a Bangle.js :) )
    By the way while playing I recognized, that I can only have one connection at a time. Either smartphone with gadgetbridge or PC with Web BT. If an active connection exists any other connection attempt seems to remain unanswered. But yes, the whitelist function is really required for everyday use. I would be happy if it makes it in one of the next releases.

  • A single connection is expected: As soon as something connects to a BLE device, it stops advertising and maintains that single connection. At least in case of a Bangle.

  • @Tx how do you mean by single connection? I can connect two Chrome Tabs to the watch via WebBLE, but I cannot connect via Python when Chrome is connected or visa-versa.

  • @PiOfThings: A mean a single connection between two BLE device adresses. I haven't tried python yet.

  • Ah... I just realised you were implying having a single connection when already connected as a 'good' thing... yes, that is kinda true.

    Nice question though. I always wondered if I could mute all the headphones on train that were returned in my BT Scan via Python Bleak ;-) ;-) ;-)

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

Bluetooth

Posted by Avatar for Tx @Tx

Actions