noble / bleno

A Node.js module for implementing BLE (Bluetooth Low Energy) peripherals
MIT License
2.12k stars 447 forks source link

BLE Disconnection after some time #477

Open jayjoshi1995 opened 2 years ago

jayjoshi1995 commented 2 years ago

I'm doing some tests with bleno installed on a Raspberry Pi, and i'm experiencing big issues with secure characteristics.

I can replicate this scenario with LightBlue on android and iPhone.

If i define a service with a secure charachteristic, when i try to read this charachteristic, bleno fires the disconnect callback, and it freezes until i restart it.

I've already upgraded to bluez 5.64, nothing changed.

Please find below log of "hciconfig"

`> ACL Data RX: Handle 64 flags 0x02 dlen 7                                                                               #76 [hci0] 13.924110
      ATT: Read Request (0x0a) len 2
        Handle: 0x000d
< ACL Data TX: Handle 64 flags 0x00 dlen 14                                                                              #77 [hci0] 13.928369
      ATT: Read Response (0x0b) len 9
        Value: 526561642044617461
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                   #78 [hci0] 13.939423
        Num handles: 1
        Handle: 64
        Count: 2
> HCI Event: LE Meta Event (0x3e) plen 10                                                                                #79 [hci0] 13.988390
      LE Connection Update Complete (0x03)
        Status: Success (0x00)
        Handle: 64
        Connection interval: 48.75 msec (0x0027)
        Connection latency: 0 (0x0000)
        Supervision timeout: 5000 msec (0x01f4)
< HCI Command: Disconnect (0x01|0x0006) plen 3                                                                           #80 [hci0] 15.973383
        Handle: 64
        Reason: Remote User Terminated Connection (0x13)
> HCI Event: Command Status (0x0f) plen 4                                                                                #81 [hci0] 15.973806
      Disconnect (0x01|0x0006) ncmd 1
        Status: Success (0x00)
> HCI Event: Disconnect Complete (0x05) plen 4                                                                           #82 [hci0] 16.036349
        Status: Success (0x00)
        Handle: 64
        Reason: Connection Terminated By Local Host (0x16)
@ MGMT Event: Device Disconnected (0x000c) plen 8                                                                   {0x0001} [hci0] 16.036431
        LE Address: 7C:82:D0:77:80:7F (Resolvable)
        Reason: Connection terminated by local host (0x02)
< HCI Command: LE Set Advertise Enable (0x08|0x000a) plen 1                                                              #83 [hci0] 16.069625
        Advertising: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4                                                                              #84 [hci0] 16.070132
      LE Set Advertise Enable (0x08|0x000a) ncmd 1
        Status: Success (0x00)
`
rzr commented 1 year ago

May I suggest to try @abandonware fork and report at: Relate-to: https://github.com/abandonware/bleno/issues/17