File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
features/FEATURE_BLE/targets/TARGET_NORDIC
TARGET_MCU_NRF51822/source Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
65
65
return BLE_ERROR_NO_MEM;
66
66
}
67
67
GattCharacteristic *p_char = service.getCharacteristic (i);
68
+ GattAttribute *p_description_descriptor = NULL ;
68
69
69
70
/* Skip any incompletely defined, read-only characteristics. */
70
71
if ((p_char->getValueAttribute ().getValuePtr () == NULL ) &&
@@ -83,6 +84,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
83
84
for (uint8_t j = 0 ; j < p_char->getDescriptorCount (); j++) {
84
85
GattAttribute *p_desc = p_char->getDescriptor (j);
85
86
if (p_desc->getUUID () == BLE_UUID_DESCRIPTOR_CHAR_USER_DESC) {
87
+ p_description_descriptor = p_desc;
86
88
userDescriptionDescriptorValuePtr = p_desc->getValuePtr ();
87
89
userDescriptionDescriptorValueLen = p_desc->getLength ();
88
90
}
@@ -107,6 +109,11 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
107
109
/* Update the characteristic handle */
108
110
p_characteristics[characteristicCount] = p_char;
109
111
p_char->getValueAttribute ().setHandle (nrfCharacteristicHandles[characteristicCount].value_handle );
112
+ if (p_description_descriptor) {
113
+ p_description_descriptor->setHandle (
114
+ nrfCharacteristicHandles[characteristicCount].user_desc_handle
115
+ );
116
+ }
110
117
characteristicCount++;
111
118
112
119
/* Add optional descriptors if any */
Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
106
106
return BLE_ERROR_NO_MEM;
107
107
}
108
108
GattCharacteristic *p_char = service.getCharacteristic (i);
109
+ GattAttribute *p_description_descriptor = NULL ;
109
110
110
111
/* Skip any incompletely defined, read-only characteristics. */
111
112
if ((p_char->getValueAttribute ().getValuePtr () == NULL ) &&
@@ -124,6 +125,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
124
125
for (uint8_t j = 0 ; j < p_char->getDescriptorCount (); j++) {
125
126
GattAttribute *p_desc = p_char->getDescriptor (j);
126
127
if (p_desc->getUUID () == BLE_UUID_DESCRIPTOR_CHAR_USER_DESC) {
128
+ p_description_descriptor = p_desc;
127
129
userDescriptionDescriptorValuePtr = p_desc->getValuePtr ();
128
130
userDescriptionDescriptorValueLen = p_desc->getLength ();
129
131
}
@@ -148,6 +150,11 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
148
150
/* Update the characteristic handle */
149
151
p_characteristics[characteristicCount] = p_char;
150
152
p_char->getValueAttribute ().setHandle (nrfCharacteristicHandles[characteristicCount].value_handle );
153
+ if (p_description_descriptor) {
154
+ p_description_descriptor->setHandle (
155
+ nrfCharacteristicHandles[characteristicCount].user_desc_handle
156
+ );
157
+ }
151
158
characteristicCount++;
152
159
153
160
/* Add optional descriptors if any */
You can’t perform that action at this time.
0 commit comments