Improve readability with getHandle inline
Fork of BLE_API by
Diff: public/BLEDevice.h
- Revision:
- 136:723d378149be
- Parent:
- 135:6cf6e7bd21c9
- Child:
- 138:3e9f06fd4259
diff -r 6cf6e7bd21c9 -r 723d378149be public/BLEDevice.h --- a/public/BLEDevice.h Fri Nov 21 09:23:23 2014 +0000 +++ b/public/BLEDevice.h Fri Nov 21 09:23:23 2014 +0000 @@ -419,6 +419,7 @@ BLEDevice::accumulateAdvertisingPayload(GapAdvertisingData::Appearance app) { needToSetAdvPayload = true; + transport->getGap().setAppearance(app); return advPayload.addAppearance(app); } @@ -433,6 +434,9 @@ BLEDevice::accumulateAdvertisingPayload(GapAdvertisingData::DataType type, const uint8_t *data, uint8_t len) { needToSetAdvPayload = true; + if (type == GapAdvertisingData::COMPLETE_LOCAL_NAME) { + transport->getGap().setDeviceName(data); + } return advPayload.addData(type, data, len); } @@ -452,8 +456,11 @@ inline ble_error_t BLEDevice::startAdvertising(void) { + ble_error_t rc; + if ((rc = transport->getGattServer().initializeGATTDatabase()) != BLE_ERROR_NONE) { + return rc; + } if (needToSetAdvPayload) { - ble_error_t rc; if ((rc = setAdvertisingPayload()) != BLE_ERROR_NONE) { return rc; }