-
Notifications
You must be signed in to change notification settings - Fork 3k
Add presentation format descriptor support for nRF5x #5727
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
Conversation
shouldn't this apply just as well to nrf51? If so, can you change the title to nrf5x? |
Automatic CI verification build not done, please verify manually. |
@jrobeson: Tested with NRF52_DK and NRF51_DONGLE and can confirm everything works as expected. Changed title to nRF5x. |
@pan- Can you look at this please ? |
Can you change destination branch |
@0xc0170 - changed destination to master. |
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.
Good work!
Once the point I've mentioned is fixed we can move forward.
@@ -179,6 +189,11 @@ ble_error_t nRF5xGattServer::addService(GattService &service) | |||
nrfCharacteristicHandles[characteristicCount].user_desc_handle | |||
); | |||
} | |||
if (p_presentation_format_descriptor) { | |||
p_presentation_format_descriptor->setHandle( | |||
nrfCharacteristicHandles[characteristicCount].value_handle |
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.
Unfortunately the Softdevice doesn't return the handle of the presentation format descriptor. I would set this handle to GattAttribute::INVALID_HANDLE
.
@pan- - changed handle to |
/morph build |
Build : SUCCESSBuild number : 863 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 534 |
Test : SUCCESSBuild number : 709 |
Notes:
Description
Looking through the mbed BTLE sources, I can find the characteristic presentation format descriptor, BLE_UUID_DESCRIPTOR_CHAR_PRESENTATION_FORMAT, as well as a struct to hold the format in GattCharacteristic::PresentationFormat_t. However, when I add this descriptor to a characteristic and test using Nordic's NRF52 DK board, the descriptor does not appear.
Nordic seems to handle this presentation format differently from other descriptors, along with BLE_UUID_DESCRIPTOR_CHAR_USER_DESC. So, here I added a code path to handle the presentation format the similarly. Tested again on the NRF52 DK, everything appears to be working well.
Status
READY
Migrations
This does not change any APIs or behavior, but should allow a user to pass a characteristic presentation format descriptor, which was not possible before.
Related PRs
No related PRs.
Todos
I will create another PR with sample code to use the characteristic presentation format.
Deploy notes
Nothing needs to be done to deploy these changes.
Steps to test or reproduce
To test if this PR works, create a descriptor of type BLE_UUID_DESCRIPTOR_CHAR_PRESENTATION_FORMAT - without these changes, the descriptor will not appear on a Nordic NRF52 target. I assume the NRF51 target will have a similar issue, but I had some unrelated probles getting the NRF51 dongle to work so can't currently test changes to NRF51.