capacitor-community / bluetooth-le

Capacitor plugin for Bluetooth Low Energy
MIT License
270 stars 77 forks source link

[iOS] App disconnect after timout time #659

Closed MasDevProject closed 1 month ago

MasDevProject commented 2 months ago

Describe the bug Using the following code on iOS the connection is interrupted after 5000ms even if the device is exchanging data. This happen only on iOS, on Android everything is ok. It seems that the connection is interrupted after the time specified in timeout parameter.

BleClient.connect(deviceId, (deviceId) => this.deviceDisconnected.next(deviceId), { timeout: 5000 })

To Reproduce Use the code above

Expected behavior The timeout should interrupt the connection only if the devices is not able to exchange data.

Plugin version:

laban405 commented 2 months ago

Having same problem, any solution?

MasDevProject commented 2 months ago

As a workaround we used a long timeout on ios platform..

BleClient.connect(deviceId, , { timeout: this.platform.is('ios') ? 60000 * 60 : 5000 })
peitschie commented 2 months ago

This could potentially happen if there are no services to discover on the device, or service discovery somehow fails. Perhaps it's worth trying with another BLE program to confirm the service discovery phase is working correctly for your peripheral?

laban405 commented 2 months ago

This could potentially happen if there are no services to discover on the device, or service discovery somehow fails. Perhaps it's worth trying with another BLE program to confirm the service discovery phase is working correctly for your peripheral?

BLE scanner works well, also nrF Connect on the same device

peitschie commented 2 months ago

What services are available after connection?

github-actions[bot] commented 1 month ago

It looks like this issue didn't get the information it needed, so I'll close it for now. If I made a mistake, sorry! I am just a bot.

Have a great day! Capacitor Community Bot 💙