innoveit / react-native-ble-manager

React Native BLE communication module
http://innoveit.github.io/react-native-ble-manager/
Apache License 2.0
2.11k stars 761 forks source link

How do I set the connection interval? #1259

Open yinghuochongfire opened 1 month ago

yinghuochongfire commented 1 month ago

In my current project, I need to transfer a large amount of data from the device to the APP, so I want to set the Bluetooth connection interval. What should I do? Also, what is the default connection interval?

lucaswitch commented 1 month ago

In my current project, I need to transfer a large amount of data from the device to the APP, so I want to set the Bluetooth connection interval. What should I do? Also, what is the default connection interval?

Not sure if that exists on Bluetooth Low Energy but i can negotiate the bluetooth MTU size. You can use: https://innoveit.github.io/react-native-ble-manager/methods/#requestmtuperipheralid-mtu-android-only-api-21 after retrieving peripheral services.

Make sure to read the requestMtu docs for Android and iOS cause both have different behaviors for the mtu size(up to ~512 bytes which is very small).

Also take note that: "BLE isn't intended for large data streaming but focuses on periodic transfers of small amounts of data. This fundamental difference makes it an ideal choice for applications where conserving battery life is crucial."