Skip to content

bt_gatt_discover() retunrs incorrect handle (offset by -1) #35363

@iceananas

Description

@iceananas

Describe the bug
I am build a BLE central which scans for a custom BLE peripheral with it's own custom services and characteristics.
The central scans for peripherals, scans their services and return their characterstic handles. The identification is done with 128bit UUIDs.

bt_gatt_discover() returns the handle which are offset by -1. E.g. The characteristic has the handle 0x20 but the returned handle is 0x19.

To Reproduce
Steps to reproduce the behavior:

  1. Modify a central sample (e.g. Central-HR) with custom UUIDs instead of Hearttrate service.
  2. Observe console output of returned attribute handles in discover_func(),
  3. Compare with the actual handle (e.g. using nRF Connect Desktop).

Expected behavior
bt_gatt_discover() returns the correct handle.

Impact
Potential showstopper, costed me a day of work debugging this.

Logs and console output

Add any other context about the problem here.

Metadata

Metadata

Labels

area: BluetoothbugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions