• Hi,

    I installed Espruino Hub on my RPi, and loaded the example code (added a setInterval) from https://www.espruino.com/BLE+HTTP+Proxy on my Bangle.

    response="";
    
    setInterval(function () {
    
    print("connecting");
      
    NRF.requestDevice({ filters: [{ services: ['1823'] }] }).then(function(device) {
      require("ble_http").httpRequest(device, "pur3.co.uk/hello.txt", function(d) {
        response=JSON.stringify(d);
        print(response);
      });
    });
    
    }, 10000);
    

    Sometimes the Bangle gets the expected response from the Hub, sometimes I get error Uncaught Error: Unhandled promise rejection: Disconnected.

     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v06 (c) 2019 G.Williams
    >
    WARNING: Softdevice error BLE error 0x11 (BUSY) (bluetooth.c:818)
    connecting
    Connected
    Got service
    Got characteristic
    Set URI
    Got characteristic
    Written GET
    Disconnected
    {"buffer":[72,101,108,108,111,32,87,111,­114,108,100,33,10],"byteOffset":0,"byteL­ength":13}
    connecting
    Connected
    Uncaught Error: Unhandled promise rejection: Disconnected
    connecting
    Connected
    Uncaught Error: Unhandled promise rejection: Disconnected
    connecting
    Connected
    Got service
    Got characteristic
    Set URI
    Got characteristic
    Written GET
    Disconnected
    {"buffer":[72,101,108,108,111,32,87,111,­114,108,100,33,10],"byteOffset":0,"byteL­ength":13}
    connecting
    Connected
    Got service
    Got characteristic
    Set URI
    Got characteristic
    Written GET
    Disconnected
    {"buffer":[72,101,108,108,111,32,87,111,­114,108,100,33,10],"byteOffset":0,"byteL­ength":13}
    connecting
    Connected
    Got service
    WARNING: Softdevice error BLE error 0x11 (BUSY) (bluetooth.c:818)
    Got characteristic
    Set URI
    Got characteristic
    Written GET
    Disconnected
    {"buffer":[72,101,108,108,111,32,87,111,­114,108,100,33,10],"byteOffset":0,"byteL­ength":13}
    connecting
    Connected
    Uncaught Error: Unhandled promise rejection: Disconnected
    WARNING: Softdevice error BLE error 0x11 (BUSY) (bluetooth.c:818)
    

    I got similar errors when I used my own code in the Bangle and a self-coded BLE server on my Esp32 (ref http://forum.espruino.com/conversations/­349804/#comment15369436);

    Could this be caused be an "issue" in the BLE handling of Espruino, or is it unreliability in the BLE protocol?

About

Avatar for gerardwr @gerardwr started