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 @@ -93,6 +93,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
93
93
return BLE_ERROR_NO_MEM;
94
94
}
95
95
GattCharacteristic *p_char = service.getCharacteristic (i);
96
+ GattAttribute *p_description_descriptor = NULL ;
96
97
97
98
/* Skip any incompletely defined, read-only characteristics. */
98
99
if ((p_char->getValueAttribute ().getValuePtr () == NULL ) &&
@@ -111,6 +112,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
111
112
for (uint8_t j = 0 ; j < p_char->getDescriptorCount (); j++) {
112
113
GattAttribute *p_desc = p_char->getDescriptor (j);
113
114
if (p_desc->getUUID () == BLE_UUID_DESCRIPTOR_CHAR_USER_DESC) {
115
+ p_description_descriptor = p_desc;
114
116
userDescriptionDescriptorValuePtr = p_desc->getValuePtr ();
115
117
userDescriptionDescriptorValueLen = p_desc->getLength ();
116
118
}
@@ -135,6 +137,11 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
135
137
/* Update the characteristic handle */
136
138
p_characteristics[characteristicCount] = p_char;
137
139
p_char->getValueAttribute ().setHandle (nrfCharacteristicHandles[characteristicCount].value_handle );
140
+ if (p_description_descriptor) {
141
+ p_description_descriptor->setHandle (
142
+ nrfCharacteristicHandles[characteristicCount].user_desc_handle
143
+ );
144
+ }
138
145
characteristicCount++;
139
146
140
147
/* Add optional descriptors if any */
Original file line number Diff line number Diff line change @@ -130,6 +130,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
130
130
return BLE_ERROR_NO_MEM;
131
131
}
132
132
GattCharacteristic *p_char = service.getCharacteristic (i);
133
+ GattAttribute *p_description_descriptor = NULL ;
133
134
134
135
/* Skip any incompletely defined, read-only characteristics. */
135
136
if ((p_char->getValueAttribute ().getValuePtr () == NULL ) &&
@@ -148,6 +149,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
148
149
for (uint8_t j = 0 ; j < p_char->getDescriptorCount (); j++) {
149
150
GattAttribute *p_desc = p_char->getDescriptor (j);
150
151
if (p_desc->getUUID () == BLE_UUID_DESCRIPTOR_CHAR_USER_DESC) {
152
+ p_description_descriptor = p_desc;
151
153
userDescriptionDescriptorValuePtr = p_desc->getValuePtr ();
152
154
userDescriptionDescriptorValueLen = p_desc->getLength ();
153
155
}
@@ -172,6 +174,11 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
172
174
/* Update the characteristic handle */
173
175
p_characteristics[characteristicCount] = p_char;
174
176
p_char->getValueAttribute ().setHandle (nrfCharacteristicHandles[characteristicCount].value_handle );
177
+ if (p_description_descriptor) {
178
+ p_description_descriptor->setHandle (
179
+ nrfCharacteristicHandles[characteristicCount].user_desc_handle
180
+ );
181
+ }
175
182
characteristicCount++;
176
183
177
184
/* Add optional descriptors if any */
You can’t perform that action at this time.
0 commit comments