[Bangle.js 2] how to get connected device name?

Posted on
  • Happy New Year, everyone!
    I wanted to show a device name that’s connected to my watch. I can get the address using NRF.getSecurityStatus().connected_addr
    , but I wanted the name of the device.
    Is there any way to get the connected device name instead of the address?
    Thanks.

  • Name is not relevant when connection is made. The device that is initiating the connection does not tell its name and may not have one.

    If you have the address you may try to scan for nearby devices and see if some name has same address but most likely it won't be visible.

  • Thank you, @fanoush.
    I'm using a couple of different laptops for updating firmware or apps and programming for my watch and normally my watch is connected to my iPhone. Sometimes, even though I thought I had disconnected one device to connect to the other, it's still connected to the previous device. So I thought it would be useful to show which device my watch is connected to. It works fine with the NRF.getSecurityStatus().connected_addr for my laptops, but because of the security feature on the iPhone, BLE address randomization, which I can't disable it, my watch shows random looking BLE addresses. That's why I wanted to find out whether there is any way to get the device name instead of the address.
    I will look into other options.
    Thanks.

  • The address you are currently seeing is a random privat resolvable address. Espruino will be able to resolve it using the NRF.resolveAddress(private_addr) method, once you have bonded the two devices, e.g. via NRF.startBonding(forceRepair).

    As shown in the docs, you can resolve a private address already in the NRF connect callback.

  • @Jay, thank you for your comment. I will try it.

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

[Bangle.js 2] how to get connected device name?

Posted by Avatar for JeonLab @JeonLab

Actions