You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Can you try:

    function Connect(dev){
      NRF.requestDevice({ filters: [{ name: Devname }] }).then(function(device) {
        return device.gatt.connect();
      }).then(function(g) {
        gatt = g;
        console.log(gatt);
        return new Promise(function(resolve) {
          setTimeout(resolve, 1000);
          console.log("delayed for 1000ms...");
        });
      }).then(function() {
        console.log(gatt);
        console.log("end delay - getPrimaryService");
        return gatt.getPrimaryService(serviceUUID);
      }).then(function(service) {
        console.log("getCharacteristic");
        return service.getCharacteristic(characteristic­UUID);
      }).then(function(characteristic) {
        console.log("writeValue");
        return characteristic.writeValue(MessageToSend)­;
      }).then(function() {
        console.log("Done!");
      });
    }
    

    just to be sure that the connection really did drop during that 1 sec?

    But if it's disconnected at that point then in a way it tells us the problem. The connection is failing before you're even doing anything, so it's some problem during the negotiation.

    Googling BLE_HCI_CONN_FAILED_TO_BE_ESTABLISHED seems to imply that it's likely to be an issue with whitelisting/bonding information on the peripheral you're connecting to. Are you in contact with the developers of it? They might have come across this behaviour before.

    Out of interest, can you still connect with a second phone? It might be the actuator only holds bonding information for a single device at a time.

About

Avatar for Gordon @Gordon started