connectable false ble issues

Posted on
  • The Manufacturer Data is not removed when you call NRF.setAdvertising({},{});
    I can still see it being advertised.

    The below text might be untrue, still testing...
    The Manufacturer Data is causing another problem. When I try to connect with IDE , whilst the advertising which contains manufacturer data is happening, the ide refuses to connect and causes ALL advertising to STOP. Thus you cannot connect to it because its not advertising its presence and devices cant 'see' it anymore. The only way I recover from this state is by clicking Turn Off in settings menu.

    I think its a bug, I'm curious about it. Any thoughts?

  • Can you post up a snippet of code I can upload to reproduce this? I'm not sure I see how adding manufacturer data can stop advertising...

    You might be able to push enough data that there wasn't enough space for the name, but the Bangle should still be connectable.

  • Ye not sure what led me to think those things. Forget it. But regarding the first 2 lines, How would I clear the manufacturer Data, explicitly?

    NRF.setAdvertising( {} , { manufacturerData: [] } )
    

    ?

  • You might be able to push enough data that there wasn't enough space for the name, but the Bangle should still be connectable.

    Maybe if the nordic uart guid would not fit into advertisement packet the dialog in webide would filter the device out? The service could still be there if connected. Can this happen? If yes, the webide could have some option of showing all BLE devices unfiltered if possible.

  • Okay so I think its actually :
    connectable:false from setAdvertising options
    Which makes it do this, is that expected behaviour? I'm not 100% sure what it does. Shouldn't Make Connectable restore this to true anywaY?

    Here is my code :

    (function() {
    	g.setBgColor(0b000000111111000000);
    	g.clear(false);
    
    	NRF.setAdvertising({},{
          connectable:false,
        });
    })();
    
    

    Steps to reproduce :
    send to ram the above code.
    Disconnect.
    Wait for advertising to resume after disconnecting. Bangle appears in List.
    Try to connect again with ide to bangle.
    Error : Connection Failed in red.
    Now all advertising has stopped on bangle.js suddenly. And can't turn it back on, unless Turn Off in settings.

  • Bump updated example ^

  • The widancs app from the appstore has connectable set to false, so this would affect people who are using that app ( iphone notifications).

  • My firmware version is : 2v08.82

  • So I'm not quite sure I understand the problem...

    Are you saying that:

    If I set connectable:false then the Bangle is not connectable (I can't connect to it).

    Because it seems to me that is intended behaviour. The reference says:

    connectable: true/false // whether device is connectable - default is true
    

    Or is it that after setting connectable:false, even after resetting Bangle.js with a long-press of BTN3 you can no longer connect?

  • The issue isn't so much that it becomes 'unconnectable', because I expect that behaviour.

    When connectable is set to true in the above code, the watch continues to advertise data... Lets assume that is expected too.

    Then when you attempt to connect to the device, its expected to not 'allow' you to connect. This happens, good...But! EXCEPT: It interferes with current expected behaviour above ( the advertising that still occurred ), because the watch no longer starts advertising again, no matter what you do. The only way to restore advertising is Turn Off.

    This bug occurs on the very moment you try to connect with ide. If you don't attempt a connection with ide in this state, then its fine.

  • Attach , i'm just using node-red to see the advertisement of device. Thats how i'm aware of its activity via Debug Panel as described in tutorial somewhere I think.


    1 Attachment

    • debugblepng.png
  • When connectable is set to true in the above code, the watch continues to advertise data... Lets assume that is expected too.

    What data is it advertising? Just its name? Is there some other code that was setting advertising data that isn't in the code you posted above?

    the watch no longer starts advertising again, no matter what you do

    Even a long-press of BTN3?

    Do you think you could check with the nRF Connect app on your phone (not using EspruinoHub at all) whether it is advertising and you're able to connect to it?

    If you're using the EspruinoHub IDE to connect (as you mention in http://forum.espruino.com/conversations/­359160/#comment15777904) and you're using EspruinoHub to detect advertising too, then it might be an issue with EspruinoHub?

    I just tried here, and I think I can get this to happen:

    • Connect with IDE
    • Upload NRF.setAdvertising({},{ connectable:false });
    • Ensure properly disconnected
    • Advertising works fine, but Bangle can't be connected to
    • Long-press BTN3
    • Bangle still can't be connected to (this seems broken)
    • Use BTN1 + BTN2 to reset
    • Bangle is now fine

    So I think there's a problem there, but I wonder whether maybe EspruinoHub trying to connect when the Bangle is nonconnectable is causing it to stay partially connected to Bangle.js, blocking it from advertising.

  • Even a long-press of BTN3?

    Correct.

    Do you think you could check with the nRF Connect app on your phone (not using EspruinoHub at all) whether it is advertising and you're able to connect to it?

    I just checked using a BLE Sniffer on phone. And NRF Connect for connection. I found that your theory :

    I wonder whether maybe EspruinoHub trying to connect when the Bangle is nonconnectable is causing it to stay partially connected to Bangle.js, blocking it from advertising.

    This theory is correct I think. My sniffer says that the watch IS still advertising, and it was indeed a failure of EspruinoHub because it thought it was connected somewhere along the lines, when really it wasn't. I will check if I can resume normal functioning with connectable:True ..

    It seems like this isn't a bug with bangle.js but instead with EspruinoHub!

  • So after changing connectable back to True, it becomes connectable again, as it should do. Nothing broke there.
    But you did say you expected it to reset connectable to True upon BTN3 held? It currently does not do this behavior.

    Strange how you also thought wake() was restored on BTN3 too, is there a relationship between this and the other post?

  • Ok, great. Thanks for bearing with me on this.

    is there a relationship between this and the other post?

    Yes, I think so - in that Bluetooth Advertising doesn't get reset to 'power on' state (sleep/wake or even the connectable/other flags) when Espruino is reset.

    I just filed an issue for it here: https://github.com/espruino/Espruino/iss­ues/1975

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

connectable false ble issues

Posted by Avatar for d3nd3-o0 @d3nd3-o0

Actions