Skip to content

Conversation

@deadprogram
Copy link
Member

This PR allows the Linux GATT implementation to DiscoverServices/DiscoverCharacteristics without a specific list of UUIDs.

It also adds an examples program to discover the services/characteristics for a known device name:

$ ./discover SK-2A68
scanning...
found device: 28:11:A5:5D:67:1B -97 
found device: 34:9F:7B:67:15:A9 -77 the printer
found device: EE:74:7D:C9:2A:68 -66 SK-2A68
connected to  SK-2A68
discovering services/characteristics
- service 22bb746f-2bb0-7554-2d6f-726568705327
-- characteristic 22bb746f-2bb2-7554-2d6f-726568705327
-- characteristic 22bb746f-2bbf-7554-2d6f-726568705327
-- characteristic 22bb746f-2bbe-7554-2d6f-726568705327
-- characteristic 22bb746f-2bba-7554-2d6f-726568705327
-- characteristic 22bb746f-2bb7-7554-2d6f-726568705327
-- characteristic 22bb746f-2bb9-7554-2d6f-726568705327
-- characteristic 22bb746f-2bbd-7554-2d6f-726568705327
-- characteristic 22bb746f-3bba-7554-2d6f-726568705327
-- characteristic 22bb746f-2bb1-7554-2d6f-726568705327
-- characteristic 22bb746f-2bb8-7554-2d6f-726568705327
-- characteristic 22bb746f-2bb6-7554-2d6f-726568705327
- service 0000180a-0000-1000-8000-00805f9b34fb
-- characteristic 00002a24-0000-1000-8000-00805f9b34fb
-- characteristic 00002a25-0000-1000-8000-00805f9b34fb
-- characteristic 00002a27-0000-1000-8000-00805f9b34fb
-- characteristic 00002a26-0000-1000-8000-00805f9b34fb
-- characteristic 00002a29-0000-1000-8000-00805f9b34fb
- service 22bb746f-2ba0-7554-2d6f-726568705327
-- characteristic 22bb746f-2ba1-7554-2d6f-726568705327
-- characteristic 22bb746f-2ba6-7554-2d6f-726568705327
- service 00001801-0000-1000-8000-00805f9b34fb
-- characteristic 00002a05-0000-1000-8000-00805f9b34fb
- service 00001016-d102-11e1-9b23-00025b00a5a5
-- characteristic 00001014-d102-11e1-9b23-00025b00a5a5
-- characteristic 00001013-d102-11e1-9b23-00025b00a5a5
-- characteristic 00001017-d102-11e1-9b23-00025b00a5a5

Signed-off-by: Ron Evans <ron@hybridgroup.com>
Signed-off-by: deadprogram <ron@hybridgroup.com>
Signed-off-by: deadprogram <ron@hybridgroup.com>
…er all when no specific list of UUIDs

Signed-off-by: deadprogram <ron@hybridgroup.com>
Copy link
Member

@aykevl aykevl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. However I have one comment on the API.

// DeviceCharacteristic is a BLE characteristic on a connected peripheral
// device.
type DeviceCharacteristic struct {
UUID
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't catch this with the darwin support, but I wonder whether this would perhaps be better implemented as a getter?
The reason is that the SoftDevice has a special format for UUIDs that takes up just 3 or 4 bytes instead of the usual 16, and it would thus be possible to support them with less overhead (because many applications will just be looking for specific UUIDs and thus won't need to read the UUID field).

This could also be done in a separate PR, but seeing that the example heavily relies on UUIDs it may be best to do that in this PR.

(The same argument goes for DeviceService.UUID).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that is a good idea, but perhaps best done in another PR.

@aykevl aykevl merged commit fd89ad2 into dev Sep 3, 2020
@aykevl aykevl deleted the discover-example branch September 3, 2020 13:26
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.

3 participants