Open MathJud opened 2 years ago
I'd be interested to have a shot at this issue. To give me little headstart, could you point out at what point the BLE module is started from the flutter app? And regarding the existing prototypes, what branches should I have a look at? Thanks.
@6d7a great!
I'm here for questions and discussions!
There are a few points about compatibility:
The module can be found here: rust/libqaul/src/connections/ble
The protobuf communication between libqaul and the blemodule is defined in this protobuf file: rust/libqaul/src/connections/ble/ble.proto
.
This protobuf file creates the following rust source code: rust/libqaul/src/connections/ble/qaul.sys.ble.rs
The communication principle is relatively simple, libqaul sends a 'request' message and the module responds with the correlating 'response'.
The program flow is the following:
a) At program startup the blemodule is loaded and libqaul sends a BleInfoRequest
BleInfoResponse
message to libqaul.
b) Libqaul checks if a the bluetooth-device is capable of BLE and sends the BleStartRequest
message to the ble module.BleStartRequest
sends the shortened 16 byte 'small qaulid'. (this will be changed in the next weeks to the new shorter 8 byte 'q8id')BleStartResult
message with the start result: Success or the reasons of an Error
c) When the blemodule starts the following happens:BleDeviceDiscovered
message to libqaul.BleDirectSend
message to the blemodule.BleDirectSendResult
message to libqaul
f) When the blemodule receives a message from another device it forwards this message to libqaul via BleDirectReceived
message. android/blemodule
iOS/QaulBLE
We have a custom writable GATT service to send direct messages to a device:
99E91399-80ED-4943-9BCB-39C532A7602
99E91402-80ED-4943-9BCB-39C532A7602
to send a messageAt the moment we are fixing some last issues of the Android module on the branch ble-startup-fixing
We will document the exact behaviour of it for that it can be used as a reference.
The BLE communcation shall be enhanced over the next months. It has been implemented this way for the biggest compatibility (compatible with bluetooth 4 devices). There are more specific BLE-modes in Bluetooth 5 that can increase range and bandwith and have the possibility to broadcast bigger amount of data to all devices nearby.
To have a linux version for developing and testing would be very helpful.
I hope this was helpful and gave you a first overview. Don't hesitate to contact me with any questions.
@MathJud, great! Thanks for the explanation. I'll give it a go and push some WIP PRs along the way. I still haven't wrapped my head around the RPC call chain, so just to recap (using Android):
qaul.net/qaul_ui/android/app
, right? Is qaul.net/android/app
used?)sys
communication between the blemodule and libqaul here, but I don't see that they are called anywhere. I'm assuming that the UI component acts as a proxy in the communication between libqaul and the blemodule.Thanks again for the help
@Kevin
Thanks again for this helpful PR!
The interconnection between libqaul's BLE connectivity-module and the Android BLE module is done in the branch ble-startup-fixing-rebased-06022023
and will be merged to main as soon as all remaining small problems are ironed out.
It is referenced to this PR #533
I rebased your branch on the ble-startup-fixing-rebased-06022023
branch and called it linux_ble
pushed it to the qaul repo:
https://github.com/qaul/qaul.net/tree/linux_ble
And created the following PR from it: #539
I change the following things:
TODO:
The BLE module should send it's messages to libqaul.
Please don't hesitate to interact on it!
Create a BLE (Bluetooth Low Energy) module in rust which compatible to the two existing modules for Android & iOS.
Existing android BLE module: https://github.com/qaul/qaul.net/tree/main/qaul_ui/android/blemodule
It shall do the following things:
The module is independent and will communicate via protobuf to the controlling backend library libqaul.
BlueR
is the official Bluetooth low energy repository for for rust. https://github.com/bluez/bluerPrototypes with partial functionality already exist.