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: Hello_BLE F446RE-BLE
Fork of X_NUCLEO_IDB0XA1 by
Diff: BlueNRGGattServer.cpp
- Revision:
- 26:047d45ea379e
- Parent:
- 23:72e56ddfad5b
- Child:
- 27:b4c21a9e8b39
--- a/BlueNRGGattServer.cpp Tue Aug 19 05:41:48 2014 +0000 +++ b/BlueNRGGattServer.cpp Tue Aug 19 08:43:19 2014 +0000 @@ -197,3 +197,47 @@ return BLE_ERROR_NONE; } +/**************************************************************************/ +/*! + @brief Reads a value according to the handle provided + + @param[in] charHandle + The handle of the GattCharacteristic to write to + @param[in] buffer + Data to use when updating the characteristic's value + (raw byte array in LSB format) + @param[in] len + The number of bytes in buffer + + @returns ble_error_t + + @retval BLE_ERROR_NONE + Everything executed properly + + @section EXAMPLE + + @code + + @endcode +*/ +/**************************************************************************/ +ble_error_t BlueNRGGattServer::Read_Request_CB(tHalUint16 handle) +{ + //signed short refvalue; + uint16_t gapConnectionHandle = BlueNRGGap::getInstance().getConnectionHandle(); + + tBleStatus ret; + uint16_t data; + tHalUint8 buff[2]; + + data = 450 + ((uint64_t)rand()*100)/RAND_MAX; + STORE_LE_16(buff,data); + + ret = aci_gatt_update_char_value(hrmServHandle, handle, 0, sizeof(buff), buff); + + + //EXIT: + if(gapConnectionHandle != 0) + aci_gatt_allow_read(gapConnectionHandle); +} +