Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 OnDisconnected() never reporting error #1160

Open
2 tasks done
Cheryet opened this issue Jan 5, 2024 · 4 comments
Open
2 tasks done

🐛 OnDisconnected() never reporting error #1160

Cheryet opened this issue Jan 5, 2024 · 4 comments
Labels

Comments

@Cheryet
Copy link

Cheryet commented Jan 5, 2024

Prerequisites

  • I checked the documentation and FAQ without finding a solution
  • I checked to make sure that this issue has not already been filed

Expected Behavior

When a device is disconnected from BLE, The OnDisconnected() callback reports an error related to disconnection. When a disconnection is successful via a call to bleManager.cancelDeviceConnection() no error should be shown. When a connection is lost, an error should be reported.

Current Behavior

While setting up my disconnection handler I am never seeing an error for device.OnDisconnected() or manager.onDeviceDisconnected(DeviceId). Although the callback gets called, the Error parameter is always null in my case. This happens on IOS and Android

Library version

3.1.2-rc.0

Device

IPhone 14 (IOS 17.2), Samsung Galaxy S8 (Android 9)

Environment info

System:
    OS: macOS 13.6.1
    CPU: (8) arm64 Apple M2
    Memory: 251.31 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 14.18.2 - ~/.nvm/versions/node/v14.18.2/bin/node
    Yarn: Not Found
    npm: 6.14.15 - ~/.nvm/versions/node/v14.18.2/bin/npm
    Watchman: 2023.12.04.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.10.2 - /Users/cheryet/.rbenv/shims/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 23.2, iOS 17.2, macOS 14.2, tvOS 17.2, watchOS 10.2
    Android SDK: Not Found
  IDEs:
    Android Studio: 2022.2 AI-222.4459.24.2221.10121639
    Xcode: 15.1/15C65 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.19 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0 
    react-native: ^0.71.2 => 0.71.2 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

  1. Create disconect handler for device disconnection
  2. connect to device via ble
  3. remove power from ble hardware to produce loss of connection
  4. no error is shown

Formatted code sample or link to a repository

connectToDevice(peripheralId, onDisconnect) {
    try {
      await this.manager.connectToDevice(peripheralId, {
        timeout: 30000,
        refreshGatt: 'OnConnected',
      });
      const device = await this.discoverCharacteristics(peripheralId);

      //Never Getting an Error from this (error: null)
      device.onDisconnected((error, device) => {
        console.log('From Client: Device is disconnected. Error: ', error);
      });

      if (!this.subscriptions[peripheralId]) {
        this.subscriptions[peripheralId] = [];
        this.manager.onDeviceDisconnected(peripheralId, error => {
          //No errors are ever received from this (Error: null)
          console.log('On Device Disconnected Event, Error: ', error);
          onDisconnect(error, device);
          // Wrap in setTimeout so that other disconnect handlers are processed first
          setTimeout(() => this.removeSubscriptions(peripheralId), 0);
        });
      }
      return device;
    } catch (error) {
      console.log('Erorr connecting to device: ', error);
      throw new Error(errors.CONNECTION_FAILED);
    }
  },

Relevant log output

Connection 306: enabling TLS
Connection 306: starting, TC(0x0)
Task <AE1A9B3D-1D0C-4BD0-B261-03EA3FF554B6>.<33> setting up Connection 306
Connection 306: asked to evaluate TLS Trust
[TLSCBQ] Need to invoke to satisfy trust callback
Task <AE1A9B3D-1D0C-4BD0-B261-03EA3FF554B6>.<33> auth completion disp=1 cred=0x0
System Trust Evaluation yielded status(0)
Connection 306: TLS Trust result 0
Connection 306: connected successfully
Connection 306: TLS handshake complete
Connection 306: ready C(N) E(N)
Task <AE1A9B3D-1D0C-4BD0-B261-03EA3FF554B6>.<33> done setting up Connection 306
Connection 306: set is idle false
Task <AE1A9B3D-1D0C-4BD0-B261-03EA3FF554B6>.<33> now using Connection 306
Connection 306: received viability advisory(Y)
Task <AE1A9B3D-1D0C-4BD0-B261-03EA3FF554B6>.<33> sent request, body N 0
Task <AE1A9B3D-1D0C-4BD0-B261-03EA3FF554B6>.<33> received response, status 200 content K
Task <AE1A9B3D-1D0C-4BD0-B261-03EA3FF554B6>.<33> done using Connection 306
Task <AE1A9B3D-1D0C-4BD0-B261-03EA3FF554B6>.<33> response ended
Connection 306: set is idle true
HTTP/2 Connection 306 Stream 1 ended successfully true
Task <AE1A9B3D-1D0C-4BD0-B261-03EA3FF554B6>.<33> finished successfully
TCP Conn [307:0x2820a1360] using empty proxy configuration
Stream client bypassing proxies on TCP Conn [307:0x2820a1360]
TCP Conn 0x2820a1360 started
nw_socket_connect [C307.1.1:1] connectx(34, [srcif=0, srcaddr=<NULL>, dstaddr=::1.9088], SAE_ASSOCID_ANY, 0, NULL, 0, NULL, SAE_CONNID_ANY) failed: [61: Connection refused]
nw_socket_connect [C307.1.1:1] connectx failed (fd 34) [61: Connection refused]
nw_socket_connect connectx failed [61: Connection refused]
nw_socket_handle_socket_event [C307.1.2:1] Socket SO_ERROR [61: Connection refused]
TCP Conn 0x2820a1360 event 3. err: 61
nw_connection_get_connected_socket_block_invoke [C307] Client called nw_connection_get_connected_socket on unconnected nw_connection
TCP Conn 0x2820a1360 complete. fd: -1, err: 61
TCP Conn 0x2820a1360 Failed : error 0:61 [61]
TCP Conn 0x2820a1360 canceled
TCP Conn 0x2820a1360 released
'Connected to device from action :', { id: 'C4A712AE-14BD-8AEB-422C-2BBF707585BC' }
TCP Conn [308:0x2820a6080] using empty proxy configuration
Stream client bypassing proxies on TCP Conn [308:0x2820a6080]
TCP Conn 0x2820a6080 started
nw_socket_handle_socket_event [C308.1.1:1] Socket SO_ERROR [61: Connection refused]
nw_socket_handle_socket_event [C308.1.2:1] Socket SO_ERROR [61: Connection refused]
TCP Conn 0x2820a6080 event 3. err: 61
nw_connection_get_connected_socket_block_invoke [C308] Client called nw_connection_get_connected_socket on unconnected nw_connection
TCP Conn 0x2820a6080 complete. fd: -1, err: 61
TCP Conn 0x2820a6080 Failed : error 0:61 [61]
TCP Conn 0x2820a6080 canceled
TCP Conn 0x2820a6080 released
[0x10595f600] Created session
[0x105962a00] Created session
[0x0] Releasing session
[0x105962a00] Releasing session
[0x10595f600] Releasing session
TCP Conn [309:0x28208b840] using empty proxy configuration
Stream client bypassing proxies on TCP Conn [309:0x28208b840]
TCP Conn 0x28208b840 started
nw_socket_handle_socket_event [C309.1.1:1] Socket SO_ERROR [61: Connection refused]
nw_socket_handle_socket_event [C309.1.2:1] Socket SO_ERROR [61: Connection refused]
TCP Conn 0x28208b840 event 3. err: 61
nw_connection_get_connected_socket_block_invoke [C309] Client called nw_connection_get_connected_socket on unconnected nw_connection
TCP Conn 0x28208b840 complete. fd: -1, err: 61
TCP Conn 0x28208b840 Failed : error 0:61 [61]
TCP Conn 0x28208b840 canceled
TCP Conn 0x28208b840 released
TCP Conn [310:0x28208b840] using empty proxy configuration
Stream client bypassing proxies on TCP Conn [310:0x28208b840]
TCP Conn 0x28208b840 started
nw_socket_handle_socket_event [C310.1.1:1] Socket SO_ERROR [61: Connection refused]
nw_socket_handle_socket_event [C310.1.2:1] Socket SO_ERROR [61: Connection refused]
TCP Conn 0x28208b840 event 3. err: 61
nw_connection_get_connected_socket_block_invoke [C310] Client called nw_connection_get_connected_socket on unconnected nw_connection
TCP Conn 0x28208b840 complete. fd: -1, err: 61
TCP Conn 0x28208b840 Failed : error 0:61 [61]
TCP Conn 0x28208b840 canceled
TCP Conn 0x28208b840 released
'From Client: Device is disconnected. Error: ', null
'On Device Disconnected Event, Error: ', null
'Device is Disconnected from actions.DisconnectHandler() with no Error. Device:', { rawScanRecord: null,
  isConnectable: null,
  txPowerLevel: null,
  overflowServiceUUIDs: null,
  serviceData: null,
  rssi: null,
  mtu: 515,
  name: 'O3-HUB2-En902-2xP-1348660032',
  manufacturerData: null,
  id: 'C4A712AE-14BD-8AEB-422C-2BBF707585BC',
  localName: null,
  serviceUUIDs: null,
  solicitedServiceUUIDs: null,
  _manager: 
   { _eventEmitter: 
      { _nativeModule: 
         { createClient: { [Function: nonPromiseMethodWrapper] type: 'async' },
           destroyClient: { [Function: nonPromiseMethodWrapper] type: 'async' },
           enable: { [Function: promiseMethodWrapper] type: 'promise' },
           disable: { [Function: promiseMethodWrapper] type: 'promise' },
           state: { [Function: promiseMethodWrapper] type: 'promise' },
           startDeviceScan: { [Function: nonPromiseMethodWrapper] type: 'async' },
           stopDeviceScan: { [Function: nonPromiseMethodWrapper] type: 'async' },
           requestConnectionPriorityForDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           readRSSIForDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           requestMTUForDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           devices: { [Function: promiseMethodWrapper] type: 'promise' },
           connectedDevices: { [Function: promiseMethodWrapper] type: 'promise' },
           connectToDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           cancelDeviceConnection: { [Function: promiseMethodWrapper] type: 'promise' },
           isDeviceConnected: { [Function: promiseMethodWrapper] type: 'promise' },
           discoverAllServicesAndCharacteristicsForDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           servicesForDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           characteristicsForDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           characteristicsForService: { [Function: promiseMethodWrapper] type: 'promise' },
           descriptorsForDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           descriptorsForService: { [Function: promiseMethodWrapper] type: 'promise' },
           descriptorsForCharacteristic: { [Function: promiseMethodWrapper] type: 'promise' },
           readCharacteristicForDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           readCharacteristicForService: { [Function: promiseMethodWrapper] type: 'promise' },
           readCharacteristic: { [Function: promiseMethodWrapper] type: 'promise' },
           writeCharacteristicForDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           writeCharacteristicForService: { [Function: promiseMethodWrapper] type: 'promise' },
           writeCharacteristic: { [Function: promiseMethodWrapper] type: 'promise' },
           monitorCharacteristicForDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           monitorCharacteristicForService: { [Function: promiseMethodWrapper] type: 'promise' },
           monitorCharacteristic: { [Function: promiseMethodWrapper] type: 'promise' },
           readDescriptorForDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           readDescriptorForService: { [Function: promiseMethodWrapper] type: 'promise' },
           readDescriptorForCharacteristic: { [Function: promiseMethodWrapper] type: 'promise' },
           readDescriptor: { [Function: promiseMethodWrapper] type: 'promise' },
           writeDescriptorForDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           writeDescriptorForService: { [Function: promiseMethodWrapper] type: 'promise' },
           writeDescriptorForCharacteristic: { [Function: promiseMethodWrapper] type: 'promise' },
           writeDescriptor: { [Function: promiseMethodWrapper] type: 'promise' },
           cancelTransaction: { [Function: nonPromiseMethodWrapper] type: 'async' },
           setLogLevel: { [Function: nonPromiseMethodWrapper] type: 'async' },
           logLevel: { [Function: promiseMethodWrapper] type: 'promise' },
           addListener: { [Function: nonPromiseMethodWrapper] type: 'async' },
           removeListeners: { [Function: nonPromiseMethodWrapper] type: 'async' },
           DisconnectionEvent: 'DisconnectionEvent',
           ScanEvent: 'ScanEvent',
           StateChangeEvent: 'StateChangeEvent',
           ConnectedEvent: 'ConnectedEvent',
           ConnectingEvent: 'ConnectingEvent',
           RestoreStateEvent: 'RestoreStateEvent',
           ReadEvent: 'ReadEvent',
           getConstants: [Function] } },
     _uniqueId: 19,
     _activePromises: {},
     _activeSubscriptions: 
      { '1': { remove: [Function: remove] },
        '7': { remove: [Function: remove] },
        '8': { remove: [Function: remove] } },
     _errorCodesToMessagesMapping: 
      { '0': 'Unknown error occurred. This is probably a bug! Check reason property.',
        '1': 'BleManager was destroyed',
        '2': 'Operation was cancelled',
        '3': 'Operation timed out',
        '4': 'Operation was rejected',
        '5': 'Invalid UUIDs or IDs were passed: {internalMessage}',
        '100': 'BluetoothLE is unsupported on this device',
        '101': 'Device is not authorized to use BluetoothLE',
        '102': 'BluetoothLE is powered off',
        '103': 'BluetoothLE is in unknown state',
        '104': 'BluetoothLE is resetting',
        '105': 'Bluetooth state change failed',
        '200': 'Device {deviceID} connection failed',
        '201': 'Device {deviceID} was disconnected',
        '202': 'RSSI read failed for device {deviceID}',
        '203': 'Device {deviceID} is already connected',
        '204': 'Device {deviceID} not found',
        '205': 'Device {deviceID} is not connected',
        '206': 'Device {deviceID} could not change MTU size',
        '300': 'Services discovery failed for device {deviceID}',
        '301': 'Included services discovery failed for device {deviceID} and service: {serviceUUID}',
        '302': 'Service {serviceUUID} for device {deviceID} not found',
        '303': 'Services not discovered for device {deviceID}',
        '400': 'Characteristic discovery failed for device {deviceID} and service {serviceUUID}',
        '401': 'Characteristic {characteristicUUID} write failed for device {deviceID} and service {serviceUUID}',
        '402': 'Characteristic {characteristicUUID} read failed for device {deviceID} and service {serviceUUID}',
        '403': 'Characteristic {characteristicUUID} notify change failed for device {deviceID} and service {serviceUUID}',
        '404': 'Characteristic {characteristicUUID} not found',
        '405': 'Characteristics not discovered for device {deviceID} and service {serviceUUID}',
        '406': 'Cannot write to characteristic {characteristicUUID} with invalid data format: {internalMessage}',
        '500': 'Descriptor {descriptorUUID} discovery failed for device {deviceID}, service {serviceUUID} and characteristic {characteristicUUID}',
        '501': 'Descriptor {descriptorUUID} write failed for device {deviceID}, service {serviceUUID} and characteristic {characteristicUUID}',
        '502': 'Descriptor {descriptorUUID} read failed for device {deviceID}, service {serviceUUID} and characteristic {characteristicUUID}',
        '503': 'Descriptor {descriptorUUID} not found',
        '504': 'Descriptors not discovered for device {deviceID}, service {serviceUUID} and characteristic {characteristicUUID}',
        '505': 'Cannot write to descriptor {descriptorUUID} with invalid data format: {internalMessage}',
        '506': 'Cannot write to descriptor {descriptorUUID}. It\'s not allowed by iOS and therefore forbidden on Android as well.',
        '600': 'Cannot start scanning operation',
        '601': 'Location services are disabled' },
     _scanEventSubscription: null } }
'From Client: Device is disconnected. Error: ', null
'On Device Disconnected Event, Error: ', null
'Device is Disconnected from actions.DisconnectHandler() with no Error. Device:', { rssi: null,
  mtu: 515,
  solicitedServiceUUIDs: null,
  manufacturerData: null,
  serviceData: null,
  isConnectable: null,
  localName: null,
  serviceUUIDs: null,
  overflowServiceUUIDs: null,
  txPowerLevel: null,
  rawScanRecord: null,
  id: 'C4A712AE-14BD-8AEB-422C-2BBF707585BC',
  name: 'O3-HUB2-En902-2xP-1348660032',
  _manager: 
   { _eventEmitter: 
      { _nativeModule: 
         { createClient: { [Function: nonPromiseMethodWrapper] type: 'async' },
           destroyClient: { [Function: nonPromiseMethodWrapper] type: 'async' },
           enable: { [Function: promiseMethodWrapper] type: 'promise' },
           disable: { [Function: promiseMethodWrapper] type: 'promise' },
           state: { [Function: promiseMethodWrapper] type: 'promise' },
           startDeviceScan: { [Function: nonPromiseMethodWrapper] type: 'async' },
           stopDeviceScan: { [Function: nonPromiseMethodWrapper] type: 'async' },
           requestConnectionPriorityForDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           readRSSIForDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           requestMTUForDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           devices: { [Function: promiseMethodWrapper] type: 'promise' },
           connectedDevices: { [Function: promiseMethodWrapper] type: 'promise' },
           connectToDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           cancelDeviceConnection: { [Function: promiseMethodWrapper] type: 'promise' },
           isDeviceConnected: { [Function: promiseMethodWrapper] type: 'promise' },
           discoverAllServicesAndCharacteristicsForDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           servicesForDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           characteristicsForDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           characteristicsForService: { [Function: promiseMethodWrapper] type: 'promise' },
           descriptorsForDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           descriptorsForService: { [Function: promiseMethodWrapper] type: 'promise' },
           descriptorsForCharacteristic: { [Function: promiseMethodWrapper] type: 'promise' },
           readCharacteristicForDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           readCharacteristicForService: { [Function: promiseMethodWrapper] type: 'promise' },
           readCharacteristic: { [Function: promiseMethodWrapper] type: 'promise' },
           writeCharacteristicForDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           writeCharacteristicForService: { [Function: promiseMethodWrapper] type: 'promise' },
           writeCharacteristic: { [Function: promiseMethodWrapper] type: 'promise' },
           monitorCharacteristicForDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           monitorCharacteristicForService: { [Function: promiseMethodWrapper] type: 'promise' },
           monitorCharacteristic: { [Function: promiseMethodWrapper] type: 'promise' },
           readDescriptorForDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           readDescriptorForService: { [Function: promiseMethodWrapper] type: 'promise' },
           readDescriptorForCharacteristic: { [Function: promiseMethodWrapper] type: 'promise' },
           readDescriptor: { [Function: promiseMethodWrapper] type: 'promise' },
           writeDescriptorForDevice: { [Function: promiseMethodWrapper] type: 'promise' },
           writeDescriptorForService: { [Function: promiseMethodWrapper] type: 'promise' },
           writeDescriptorForCharacteristic: { [Function: promiseMethodWrapper] type: 'promise' },
           writeDescriptor: { [Function: promiseMethodWrapper] type: 'promise' },
           cancelTransaction: { [Function: nonPromiseMethodWrapper] type: 'async' },
           setLogLevel: { [Function: nonPromiseMethodWrapper] type: 'async' },
           logLevel: { [Function: promiseMethodWrapper] type: 'promise' },
           addListener: { [Function: nonPromiseMethodWrapper] type: 'async' },
           removeListeners: { [Function: nonPromiseMethodWrapper] type: 'async' },
           DisconnectionEvent: 'DisconnectionEvent',
           ScanEvent: 'ScanEvent',
           StateChangeEvent: 'StateChangeEvent',
           ConnectedEvent: 'ConnectedEvent',
           ConnectingEvent: 'ConnectingEvent',
           RestoreStateEvent: 'RestoreStateEvent',
           ReadEvent: 'ReadEvent',
           getConstants: [Function] } },
     _uniqueId: 73,
     _activePromises: {},
     _activeSubscriptions: 
      { '1': { remove: [Function: remove] },
        '7': { remove: [Function: remove] },
        '8': { remove: [Function: remove] },
        '21': { remove: [Function: remove] },
        '22': { remove: [Function: remove] },
        '64': { remove: [Function: remove] } },
     _errorCodesToMessagesMapping: 
      { '0': 'Unknown error occurred. This is probably a bug! Check reason property.',
        '1': 'BleManager was destroyed',
        '2': 'Operation was cancelled',
        '3': 'Operation timed out',
        '4': 'Operation was rejected',
        '5': 'Invalid UUIDs or IDs were passed: {internalMessage}',
        '100': 'BluetoothLE is unsupported on this device',
        '101': 'Device is not authorized to use BluetoothLE',
        '102': 'BluetoothLE is powered off',
        '103': 'BluetoothLE is in unknown state',
        '104': 'BluetoothLE is resetting',
        '105': 'Bluetooth state change failed',
        '200': 'Device {deviceID} connection failed',
        '201': 'Device {deviceID} was disconnected',
        '202': 'RSSI read failed for device {deviceID}',
        '203': 'Device {deviceID} is already connected',
        '204': 'Device {deviceID} not found',
        '205': 'Device {deviceID} is not connected',
        '206': 'Device {deviceID} could not change MTU size',
        '300': 'Services discovery failed for device {deviceID}',
        '301': 'Included services discovery failed for device {deviceID} and service: {serviceUUID}',
        '302': 'Service {serviceUUID} for device {deviceID} not found',
        '303': 'Services not discovered for device {deviceID}',
        '400': 'Characteristic discovery failed for device {deviceID} and service {serviceUUID}',
        '401': 'Characteristic {characteristicUUID} write failed for device {deviceID} and service {serviceUUID}',
        '402': 'Characteristic {characteristicUUID} read failed for device {deviceID} and service {serviceUUID}',
        '403': 'Characteristic {characteristicUUID} notify change failed for device {deviceID} and service {serviceUUID}',
        '404': 'Characteristic {characteristicUUID} not found',
        '405': 'Characteristics not discovered for device {deviceID} and service {serviceUUID}',
        '406': 'Cannot write to characteristic {characteristicUUID} with invalid data format: {internalMessage}',
        '500': 'Descriptor {descriptorUUID} discovery failed for device {deviceID}, service {serviceUUID} and characteristic {characteristicUUID}',
        '501': 'Descriptor {descriptorUUID} write failed for device {deviceID}, service {serviceUUID} and characteristic {characteristicUUID}',
        '502': 'Descriptor {descriptorUUID} read failed for device {deviceID}, service {serviceUUID} and characteristic {characteristicUUID}',
        '503': 'Descriptor {descriptorUUID} not found',
        '504': 'Descriptors not discovered for device {deviceID}, service {serviceUUID} and characteristic {characteristicUUID}',
        '505': 'Cannot write to descriptor {descriptorUUID} with invalid data format: {internalMessage}',
        '506': 'Cannot write to descriptor {descriptorUUID}. It\'s not allowed by iOS and therefore forbidden on Android as well.',
        '600': 'Cannot start scanning operation',
        '601': 'Location services are disabled' },
     _scanEventSubscription: null } }
'From Client: Device is disconnected. Error: ', null

Additional information

I have tried multiple versions of BLE PLX to attempt to fix this issue. Down graded to 2.x.x as well as tried some patch versions from similar issues (OnDisconnect() event not firing). To try and get an error I've disconnected power to the BLE device but error still returned as null.

The reason for needing this Error code is to determine if a reconnection should happen on devices that have lost a connection. If a device is disconnected by using the function, no reconnection is required.

@Cheryet Cheryet added the bug label Jan 5, 2024
@zachTrio
Copy link

I've updated to 3.1.2 in hopes it would fix this issue as it was in the patch notes.

This is also still happening to me, despite the issue being resolved in that release.

#1126

@dominik-czupryna-withintent
Copy link
Collaborator

How long have you been waiting for this event? If the connection is lost from the BLE device, the phone BT module usually tries to re-establish the connection itself and there may be a delay between the device turning off and the information that it has been disconnected.

@zachTrio
Copy link

How long have you been waiting for this event?

Well, I am not receiving the event during the tens of minutes I may set the phone down after testing.

The fact it's not happening in the same time frame as the iOS disconnect is suggesting it's not going to happen at all.

@Cheryet
Copy link
Author

Cheryet commented Feb 20, 2024

How long have you been waiting for this event?

Similar here, Not receiving the event during the 10+ minuets after a disconnection has been made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants