dotintent / react-native-ble-plx

React Native BLE library
Apache License 2.0
3.05k stars 508 forks source link

unable to auto connect or manually reconnect with device #796

Closed sulabh9999 closed 3 years ago

sulabh9999 commented 3 years ago

I paired with fitness band all done, when ble device goes out of range it should reconnect but couldn't also getting failure while connectToDeivce(id) {autoConnect: true} as well, i can see Bluetooth connected symbol in fitness band but unable to get characteristic and read/write in services, getting failure.

Am i going wrong, Please suggest.

manager.connectToDevice(deviceId)
 .then(device => {
      console.log('device reconnectd..', device)
 })
.catch(e => console.warn('got error while reconnecting..'))

I tried this also

device.connect()
.then(() => {
   return device.discoverAllServicesAndCharacteristics();
})
.then(device => {
     console.log('details: ', device);
})
.catch(e => console.warn('got error while reconnecting..'))

getting response

[Sat Jan 09 2021 18:31:36.800]  LOG      device reconnectd.. {
  "_manager": {
    "_activePromises": {

    },
    "_activeSubscriptions": {
    },
    "_errorCodesToMessagesMapping": {
      "0": "Unknown error occurred. This is probably a bug! Check reason property.",
      "601": "Location services are disabled"
      .....
    },
    "_eventEmitter": {
      "_subscriber": [
        EventSubscriptionVendor
      ]
    },
    "_scanEventSubscription": null,
    "_uniqueId": 3
  },
  "id": "C0:A0:6D:AC:41:F5",
  "isConnectable": null,
  "localName": null,
  "manufacturerData": null,
  "mtu": null,
  "name": "Mi Band 3",
  "overflowServiceUUIDs": null,
  "rssi": null,
  "serviceData": null,
  "serviceUUIDs": null,
  "solicitedServiceUUIDs": null,
  "txPowerLevel": null
}
[Sat Jan 09 2021 18:31:36.838]  WARN     got error while reconnecting..
stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.