mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #9921 from desmond-blue/fix_Cordio-insert-characteristic-handle-error
BLE:Cordio:Fix insert characteristic not handle errorpull/10081/head
commit
7fa995860f
|
@ -196,22 +196,32 @@ ble_error_t GattServer::insert_characteristic(
|
||||||
|
|
||||||
// Create Characteristic Declaration Attribute
|
// Create Characteristic Declaration Attribute
|
||||||
insert_characteristic_declaration_attribute(characteristic, attribute_it);
|
insert_characteristic_declaration_attribute(characteristic, attribute_it);
|
||||||
insert_characteristic_value_attribute(characteristic, attribute_it);
|
ble_error_t err = insert_characteristic_value_attribute(characteristic, attribute_it);
|
||||||
|
if (err) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// insert descriptors
|
// insert descriptors
|
||||||
bool cccd_created = false;
|
bool cccd_created = false;
|
||||||
for (size_t i = 0; i < characteristic->getDescriptorCount(); i++) {
|
for (size_t i = 0; i < characteristic->getDescriptorCount(); i++) {
|
||||||
insert_descriptor(
|
err = insert_descriptor(
|
||||||
characteristic,
|
characteristic,
|
||||||
characteristic->getDescriptor(i),
|
characteristic->getDescriptor(i),
|
||||||
attribute_it,
|
attribute_it,
|
||||||
cccd_created
|
cccd_created
|
||||||
);
|
);
|
||||||
|
if (err) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// insert implicit CCCD
|
// insert implicit CCCD
|
||||||
if ((properties & UPDATE_PROPERTIES) && (cccd_created == false)) {
|
if ((properties & UPDATE_PROPERTIES) && (cccd_created == false)) {
|
||||||
insert_cccd(characteristic, attribute_it);
|
err = insert_cccd(characteristic, attribute_it);
|
||||||
|
if (err) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return BLE_ERROR_NONE;
|
return BLE_ERROR_NONE;
|
||||||
|
|
Loading…
Reference in New Issue