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

Getting Started with Android BLE blog post #15

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

npb12
Copy link

@npb12 npb12 commented Mar 8, 2021

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

@npb12 npb12 requested a review from mbalex99 March 8, 2021 16:51
@mbalex99
Copy link
Contributor

mbalex99 commented Mar 8, 2021

I think the best reviewers for this will be @thombles and @kndoshn.

@npb12 npb12 requested review from kndoshn and thombles March 8, 2021 21:17
Copy link

@thombles thombles left a 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.

Comment on lines +4 to +11
//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")
Copy link

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.

https://github.com/getditto/bluetooth-blog-tutorial/blob/d6354958b2e786b7b2a9d5812669355b102c5c5a/iOS/App/BluetoothChat/Constants/BluetoothConstants.swift#L12-L26

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
)
Copy link

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)
Copy link

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.

@kndoshn kndoshn removed their request for review February 3, 2023 01:16
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

Successfully merging this pull request may close these issues.

None yet

3 participants