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

Bluetooth Serial communication slow #17

Open
theJoey opened this issue Jul 22, 2020 · 1 comment
Open

Bluetooth Serial communication slow #17

theJoey opened this issue Jul 22, 2020 · 1 comment

Comments

@theJoey
Copy link

theJoey commented Jul 22, 2020

I am working on implementing your library into an android app but I am facing a performance issue.
When I use your app (xbee on google play) I can send at least 10 commands per second through the serial interface
However, when I use your library, I can only send 5 commands per seconds with this method :

mXBeeDevice.sendUserDataRelay(
XBeeLocalInterface.SERIAL,
data
)

I followed your github example so I have no idea where the issue comes from.

Can you give me a clue about what happened please?

@DanielLazarHTDM
Copy link

Hi theJoey,

well I had same impression.

than I've put into:
xbee_android_library/src/main/java/com/digi/xbee/api/android/connection/bluetooth/AndroidBluetoothInterface.java

bluetoothGatt.requestConnectionPriority(BluetoothGatt.CONNECTION_PRIORITY_HIGH);

To boost it and after that instead of about 100 ms per write it is able to write 30 ms. Check following log every frame received in serial console.

12-28 16:33:24.642 23047 23047 I PERFORMANCE: 30 [ms] 91226 bytes
12-28 16:33:24.672 23047 23047 I PERFORMANCE: 30 [ms] 91459 bytes
12-28 16:33:24.702 23047 23047 I PERFORMANCE: 30 [ms] 91692 bytes
12-28 16:33:24.733 23047 23047 I PERFORMANCE: 31 [ms] 91925 bytes
12-28 16:33:24.763 23047 23047 I PERFORMANCE: 29 [ms] 92158 bytes
12-28 16:33:24.792 23047 23047 I PERFORMANCE: 29 [ms] 92391 bytes
12-28 16:33:24.822 23047 23047 I PERFORMANCE: 30 [ms] 92624 bytes
12-28 16:33:24.852 23047 23047 I PERFORMANCE: 30 [ms] 92857 bytes
12-28 16:33:24.882 23047 23047 I PERFORMANCE: 30 [ms] 93090 bytes
12-28 16:33:24.883 23047 23047 I PERFORMANCE: Total: 12481 [ms] 93090 bytes => 7.458536976203829 kB/s

Cheers,
Dan

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

No branches or pull requests

2 participants