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

Nordic: Set handle of user description descriptors. #5589

Merged
merged 1 commit into from Nov 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -65,6 +65,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
return BLE_ERROR_NO_MEM;
}
GattCharacteristic *p_char = service.getCharacteristic(i);
GattAttribute *p_description_descriptor = NULL;

/* Skip any incompletely defined, read-only characteristics. */
if ((p_char->getValueAttribute().getValuePtr() == NULL) &&
Expand All @@ -83,6 +84,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
for (uint8_t j = 0; j < p_char->getDescriptorCount(); j++) {
GattAttribute *p_desc = p_char->getDescriptor(j);
if (p_desc->getUUID() == BLE_UUID_DESCRIPTOR_CHAR_USER_DESC) {
p_description_descriptor = p_desc;
userDescriptionDescriptorValuePtr = p_desc->getValuePtr();
userDescriptionDescriptorValueLen = p_desc->getLength();
}
Expand All @@ -107,6 +109,11 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
/* Update the characteristic handle */
p_characteristics[characteristicCount] = p_char;
p_char->getValueAttribute().setHandle(nrfCharacteristicHandles[characteristicCount].value_handle);
if (p_description_descriptor) {
p_description_descriptor->setHandle(
nrfCharacteristicHandles[characteristicCount].user_desc_handle
);
}
characteristicCount++;

/* Add optional descriptors if any */
Expand Down
Expand Up @@ -106,6 +106,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
return BLE_ERROR_NO_MEM;
}
GattCharacteristic *p_char = service.getCharacteristic(i);
GattAttribute *p_description_descriptor = NULL;

/* Skip any incompletely defined, read-only characteristics. */
if ((p_char->getValueAttribute().getValuePtr() == NULL) &&
Expand All @@ -124,6 +125,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
for (uint8_t j = 0; j < p_char->getDescriptorCount(); j++) {
GattAttribute *p_desc = p_char->getDescriptor(j);
if (p_desc->getUUID() == BLE_UUID_DESCRIPTOR_CHAR_USER_DESC) {
p_description_descriptor = p_desc;
userDescriptionDescriptorValuePtr = p_desc->getValuePtr();
userDescriptionDescriptorValueLen = p_desc->getLength();
}
Expand All @@ -148,6 +150,11 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
/* Update the characteristic handle */
p_characteristics[characteristicCount] = p_char;
p_char->getValueAttribute().setHandle(nrfCharacteristicHandles[characteristicCount].value_handle);
if (p_description_descriptor) {
p_description_descriptor->setHandle(
nrfCharacteristicHandles[characteristicCount].user_desc_handle
);
}
characteristicCount++;

/* Add optional descriptors if any */
Expand Down