BLE_API wrapper library for STMicroelectronics' BlueNRG Bluetooth Low Energy expansion board shield (Component)
Dependents: Nucleo_Zumo_BLE_IDB04A1 contest_IOT5 contest_IOT6 contest_IOT_10 ... more
Fork of X_NUCLEO_IDB0XA1 by
Arduino Connector Compatibility Warning
X-NUCLEO-IDB04A1 and X-NUCLEO-IDB05A1 are Arduino compatible with an exception: instead of using pin D13
for the SPI clock, they use pin D3
.
The default configuration for this library is having the SPI clock on pin D3
.
To be fully Arduino compatible, X-NUCLEO-IDB04A1 and X-NUCLEO-IDB05A1 need a small HW patch.
For X-NUCLEO-IDB04A1 this patch consists in removing zero resistor R10
and instead soldering zero resistor R11
.
For X-NUCLEO-IDB05A1 this patch consists in removing zero resistor R4
and instead soldering zero resistor R6
.
In case you patch your board, then you also have to configure this library to use pin D13
to drive the SPI clock (see macro IDB0XA1_D13_PATCH
in file x_nucleo_idb0xa1_targets.h
).
If you use pin D13
for the SPI clock, please be aware that on STM32 Nucleo boards you may not drive the LED, otherwise you will get a conflict: the LED on STM32 Nucleo boards is connected to pin D13
.
Referring to the current list of tested platforms (see X-NUCLEO-IDB04A1 and X-NUCLEO-IDB05A1 pages), the patch is required by ST-Nucleo-F103RB; ST-Nucleo-F302R8; ST-Nucleo-F411RE; and ST-Nucleo-F446RE.
Diff: source/BlueNRGGattServer.cpp
- Revision:
- 233:488e0e8b9b43
- Parent:
- 229:9981f62cdb1a
- Child:
- 242:058b2e731adc
--- a/source/BlueNRGGattServer.cpp Fri May 20 17:00:21 2016 +0200 +++ b/source/BlueNRGGattServer.cpp Mon May 23 18:32:06 2016 +0200 @@ -244,10 +244,9 @@ /**************************************************************************/ /*! - @brief Reads the value of a characteristic, based on the service - and characteristic index fields + @brief Reads the value of a characteristic, based on char handle - @param[in] charHandle + @param[in] attributeHandle The handle of the GattCharacteristic to read from @param[in] buffer Buffer to hold the the characteristic's value @@ -287,15 +286,17 @@ /**************************************************************************/ /*! - @brief Updates the value of a characteristic, based on the service - and characteristic index fields + @brief Reads the value of a characteristic, based on the connection + and char handle - @param[in] charHandle + @param[in] connectionHandle + The handle of the connection + @param[in] attributeHandle 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 + @param[in] lengthP The number of bytes in buffer @returns ble_error_t @@ -348,6 +349,10 @@ corresponding serviceHandle=%u len=%d\n\r", attributeHandle, bleCharHandleMap.find(charHandle)->second, len); + /* + * If notifications (or indications) are enabled on that characteristic, a notification (or indication) + * will be sent to the client after sending this command to the BlueNRG. + */ ret = aci_gatt_update_char_value(bleCharHandleMap.find(charHandle)->second, charHandle, 0, len, buffer); if (ret != BLE_STATUS_SUCCESS){ @@ -361,15 +366,6 @@ } } - //Generate Data Sent Event Here? (GattServerEvents::GATT_EVENT_DATA_SENT) //FIXME: Is this correct? - //Check if characteristic property is NOTIFY|INDICATE, if yes generate event - GattCharacteristic *p_char = BlueNRGGattServer::getInstance().getCharacteristicFromHandle(charHandle); - if(p_char->getProperties() & (GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY - | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_INDICATE)) { - PRINTF("Generate event after updating\n\r"); - BlueNRGGattServer::getInstance().handleEvent(GattServerEvents::GATT_EVENT_DATA_SENT, charHandle); - } - return BLE_ERROR_NONE; }