fka mod
Fork of BLE_API by
Diff: ble/Gap.h
- Revision:
- 763:36c3e2b1f1ae
- Parent:
- 762:89ec64c66d94
- Child:
- 764:1e560f0d45e1
diff -r 89ec64c66d94 -r 36c3e2b1f1ae ble/Gap.h --- a/ble/Gap.h Fri Aug 07 15:53:49 2015 +0100 +++ b/ble/Gap.h Fri Aug 07 15:53:49 2015 +0100 @@ -550,8 +550,8 @@ * small. * * @param app - * The max transmit power to be used by the controller (in dBm). - * This is only a hint. + * The max transmit power to be used by the controller. This is + * only a hint. */ ble_error_t accumulateAdvertisingPayloadTxPower(int8_t power) { ble_error_t rc; @@ -586,6 +586,27 @@ } /** + * Update the advertising payload filed which has the same adv type as the input + * parameter. Total length of the new data must be the same as the old one. + * + * @param type The type which describes the variable length data. + * @param data data bytes. + * @param len length of data. + */ + ble_error_t updateAdvertisingPayload(GapAdvertisingData::DataType type, const uint8_t *data, uint8_t len) { + if (type == GapAdvertisingData::COMPLETE_LOCAL_NAME) { + setDeviceName(data); + } + + ble_error_t rc; + if ((rc = _advPayload.updateData(type, data, len)) != BLE_ERROR_NONE) { + return rc; + } + + return setAdvertisingData(); + } + + /** * Setup a particular, user-constructed advertisement payload for the * underlying stack. It would be uncommon for this API to be used directly; * there are other APIs to build an advertisement payload (see above).