-
Notifications
You must be signed in to change notification settings - Fork 3k
BLE/HRM : Fix #4661 #4662
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
BLE/HRM : Fix #4661 #4662
Conversation
Maybe you don't want to merge this right now, as I might add other fixes related to this Heart Rate Service. Let me explain: I am currently comparing Cypress's autogenerated configuration with mbed's, and there is a difference in the Heart Rate Measurement characteristic configuration (I have removed unnecessary code that only adds noise): Cypress: // handle, id, permissions, last_handle, {attr_type, pointer}
{ xx, 0x2803u, 0x00100001u, xx, {{0x2A37u, NULL}} }, // characteristic
{ xx, 0x2A37u, 0x01100000u, xx, {{0x0002u, xx}} }, // measurement
{ xx, 0x2902u, 0x030A0101u, xx, {{0x0002u, xx}} }, // Client Characteristic Configuration Mbed: // handle, id, permissions, last_handle, {attr_type, pointer}
{ xx, 0x2803u, 0x00100001u, xx, {{0x2A37u, NULL}} }, // characteristic
{ xx, 0x2A37u, 0x01100000u, xx, {{0x0003u, xx}} }, // measurement The BLE spec specifies that the Client Characteristic Configuration is Mandatory. Therefore, Mbed is not conforming to the spec. I am not sure about the |
My second commit add the missing descriptor to the Heart Rate Mesurement characteristic (source). I spotted another issue, but it might not be worth fixing it, and I think I will be too lazy to fix it: On my side, it is ready for merge (ping @pan-), you may replace the |
Hi ! Just doing a gentle up : my PR is ready :) |
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 PR is not necessary, CCCD should be automatically created and added to the GATT server whenever a characteristic with the notification and/or the indication flag is added to the GATT server.
If you doesn't observe this behavior then the port of BLE API that you are using have a defect. What version of the port are you using ?
Edit: The valuable part of this PR which can stay is the fix of the measurement characteristic properties:
GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY
=> GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY
.
controlPoint(GattCharacteristic::UUID_HEART_RATE_CONTROL_POINT_CHAR, &controlPointValue) | ||
{ | ||
static uint8_t clientCharConfBytes[2] = {0, 0}; // clientCharacteristicConfiguration - length is 16 bits | ||
static GattAttribute clientCharConf(BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG, clientCharConfBytes, 2, 2, false); // clientCharacteristicConfiguration |
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.
static variables shouldn't be used, it prevent the instantiation of multiple, distinct heart rate services.
controlPoint(GattCharacteristic::UUID_HEART_RATE_CONTROL_POINT_CHAR, &controlPointValue) { | ||
controlPoint(GattCharacteristic::UUID_HEART_RATE_CONTROL_POINT_CHAR, &controlPointValue) | ||
{ | ||
static uint8_t clientCharConfBytes[2] = {0, 0}; // clientCharacteristicConfiguration - length is 16 bits |
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.
same as above
Hum, ok I got it, I though it was more logical for a service / characteristic to add its own CCCD if needed instead of relying on the underlying implementation. Also, the constructor of a GattCharacteristic accept a Although the second commit of this PR is therefore not relevant, the first one still holds: what do you think? It fixes issue #4661. |
@Nodraak I would approve the PR if it was just the first commit.
Agreed that the documentation of the |
Great, thanks a lot for the cristal clear feedback ! A rebased my branch against master, and integrated your comments, should be better now. |
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.
Thanks for the changes.
What is the status here ? CI is ok |
We need to run the Austin CI /morph test |
Result: FAILUREYour command has finished executing! Here's what you wrote!
OutputTest failed! |
So, two targets failed during the test For MAX:
And NRF:
This does not seems related to my PR |
It isn't related to the PR. Can we relaunch the tests ? |
I don't know how this works, but let's try (I'm pretty sure one needs some sort of accreditation to start them, but let's try anyway): /morph test |
/morph test |
Result: FAILUREYour command has finished executing! Here's what you wrote!
OutputBuild Prep failed! |
@0xc0170 I've looked at the failure, it is an internal CI error, could you relaunch the tests ? |
/morph test |
Result: FAILUREYour command has finished executing! Here's what you wrote!
OutputExample Build failed! |
/morph test |
1 similar comment
/morph test |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
Uh oh!
There was an error while loading. Please reload this page.