-
Notifications
You must be signed in to change notification settings - Fork 4
Bluetooth control functions #12
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
base: main
Are you sure you want to change the base?
Conversation
Changing the rpc name etc. doesn't seem like the best idea, so leaving as is. With the address of the RPI device the goal would be to try to get easier pairing between the RPI and phone in Cedar Aim (using flutter_blue_classic for pairing).
server/src/cedar_server.rs
Outdated
| adapter.set_powered(true).await?; | ||
|
|
||
| let profile = Profile { | ||
| uuid: Uuid::parse_str("4e5d4c88-2965-423f-9111-28a506720760").unwrap(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this UUID, and where does it come from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's randomly generated, and needs to be the same on both the server and client side.
UUIDs used for Bluetooth can be 16-bit assigned numbers (either for Bluetooth SIG defined features or purchased by member companies) or 128-bit for custom services (typically randomly generated by whoever is using them).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this also appear somewhere on the cedar aim side?
Can both sides have a comment explaining this magic value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to a constant here and added a comment.
No pull request yet for cedar-aim (still some polish needed), but it's used here.
The main addition here is a server that uses Bluetooth RFCOMM to expose the cedar grpc service. The server only runs when use_bluetooth is set to true in preferences.
A smaller addition is the exposure of the RPI's Bluetooth address in the GetBluetoothName API (I thought renaming this isn't a good idea for backwards compatibility). The address can be used to initiate pairing from an Android phone to the RPI in Cedar Aim directly (using the flutter_blue_classic package), without requiring the user to leave Cedar Aim to start Bluetooth pairing in their phone's settings.