-
Notifications
You must be signed in to change notification settings - Fork 0
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
Getting Started with Android BLE blog post #15
base: master
Are you sure you want to change the base?
Conversation
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.
Have another look at the services/characteristic configuration and let me know what you reckon. If you'd like to look at Tim's code together ping me on Slack and we can go through it in detail.
//App service UUID | ||
val chatDiscoveryServiceID = UUID.fromString("42332fe8-9915-11ea-bb37-0242ac130002") | ||
|
||
//Gatt service message characteric ID used | ||
val chatMessageCharacteristicID = UUID.fromString("43eb0d29-4188-4c84-b1e8-73231e02af95") | ||
|
||
//UUID to confirm device connection | ||
val confirmCharacteristicID = UUID.fromString("f0ab5a15-b003-4653-a248-73fd504c128f") |
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.
While the values are the same, the names and comments of these UUIDs should match what's in the iOS app.
Specifically, the second UUID is used as a service ID rather than a characteristic; the third UUID is a a chat characteristic where messages are written, rather than playing any sort of "confirmation" role.
chatMessageCharacteristicID, | ||
BluetoothGattCharacteristic.PROPERTY_WRITE, | ||
BluetoothGattCharacteristic.PERMISSION_WRITE | ||
) |
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.
Is the app intended to be compatible with the iOS one? The GATT hierarchy is different so I don't think it would work.
Specifically, iOS uses one service UUID to locate other peers (discovery phase), then a second UUID to negotiate a chat connection. Then it has a single characteristic to exchange/notify chat message, both for write & notify.
BluetoothGattCharacteristic.PERMISSION_WRITE | ||
) | ||
gattService.addCharacteristic(gattCharacteristic) | ||
gattService.addCharacteristic(confirmCharacteristic) |
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.
This confirmCharacteristic
isn't queried or used on the central side.
This is the porting of the iOS BLE chat app, on Android. There is a PR in the getditto/website-2021 for the blog post, which is linked in the README