Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Peripheral_1_serial_copy Peripheral_1_serial 151006_1st_Scenario_normal
Fork of nRF51822 by
Diff: source/nRF5xGattServer.cpp
- Revision:
- 443:a2693384abdb
- Parent:
- 442:b52f5b70e62a
- Child:
- 445:a54987ce65e1
--- a/source/nRF5xGattServer.cpp Fri Sep 25 15:26:58 2015 +0100 +++ b/source/nRF5xGattServer.cpp Fri Sep 25 15:26:59 2015 +0100 @@ -204,7 +204,6 @@ ble_error_t nRF5xGattServer::write(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, const uint8_t buffer[], uint16_t len, bool localOnly) { - uint16_t gapConnectionHandle = nRF5xGap::getInstance().getConnectionHandle(); ble_error_t returnValue = BLE_ERROR_NONE; ble_gatts_value_t value = { @@ -234,7 +233,10 @@ hvx_params.p_data = const_cast<uint8_t *>(buffer); hvx_params.p_len = &len; - error_t error = (error_t) sd_ble_gatts_hvx(gapConnectionHandle, &hvx_params); + if (connectionHandle == BLE_CONN_HANDLE_INVALID) { /* use the default connection handle if the caller hasn't specified a valid connectionHandle. */ + connectionHandle = nRF5xGap::getInstance().getConnectionHandle(); + } + error_t error = (error_t) sd_ble_gatts_hvx(connectionHandle, &hvx_params); if (error != ERROR_NONE) { switch (error) { case ERROR_BLE_NO_TX_BUFFERS: /* Notifications consume application buffers. The return value can be used for resending notifications. */