High level Bluetooth Low Energy API and radio abstraction layer
Fork of BLE_API by
Revision 123:fede41ce9407, committed 2014-11-05
- Comitter:
- Rohit Grover
- Date:
- Wed Nov 05 14:08:42 2014 +0000
- Parent:
- 122:4b68a819ab4f
- Child:
- 124:acf0d0c49867
- Commit message:
- Release 0.2.3
=============
Features
~~~~~~~~
* add API for getAddress() to fetch the MAC address.
Bugfixes
~~~~~~~~
* DFUService object needs to remain alive after ble.init(); declaring as static.
Compatibility
~~~~~~~~~~~~~
One new API has been added between 0.2.0 and this release. Applications should be updated.
Changed in this revision
--- a/public/BLEDevice.h Tue Sep 30 01:03:56 2014 +0100 +++ b/public/BLEDevice.h Wed Nov 05 14:08:42 2014 +0000 @@ -41,9 +41,15 @@ public: /** * Set the BTLE MAC address and type. - * @return + * @return BLE_ERROR_NONE on success. */ - ble_error_t setAddress(Gap::addr_type_t type, const uint8_t address[6]); + ble_error_t setAddress(Gap::addr_type_t type, const uint8_t address[Gap::ADDR_LEN]); + + /** + * Fetch the BTLE MAC address and type. + * @return BLE_ERROR_NONE on success. + */ + ble_error_t getAddress(Gap::addr_type_t *typeP, uint8_t address[Gap::ADDR_LEN]); /** * @param[in] advType @@ -360,11 +366,17 @@ } inline ble_error_t -BLEDevice::setAddress(Gap::addr_type_t type, const uint8_t address[6]) +BLEDevice::setAddress(Gap::addr_type_t type, const uint8_t address[Gap::ADDR_LEN]) { return transport->getGap().setAddress(type, address); } +inline ble_error_t +BLEDevice::getAddress(Gap::addr_type_t *typeP, uint8_t address[Gap::ADDR_LEN]) +{ + return transport->getGap().getAddress(typeP, address); +} + inline void BLEDevice::setAdvertisingType(GapAdvertisingParams::AdvertisingType advType) {
--- a/public/Gap.h Tue Sep 30 01:03:56 2014 +0100 +++ b/public/Gap.h Wed Nov 05 14:08:42 2014 +0000 @@ -40,6 +40,8 @@ ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE } addr_type_t; + static const unsigned ADDR_LEN = 6; + /** * enumeration for disconnection reasons. The values for these reasons are * derived from Nordic's implementation; but the reasons are meant to be @@ -70,7 +72,8 @@ public: /* These functions must be defined in the sub-class */ - virtual ble_error_t setAddress(addr_type_t type, const uint8_t address[6]) = 0; + virtual ble_error_t setAddress(addr_type_t type, const uint8_t address[ADDR_LEN]) = 0; + virtual ble_error_t getAddress(addr_type_t *typeP, uint8_t address[ADDR_LEN]) = 0; virtual ble_error_t setAdvertisingData(const GapAdvertisingData &, const GapAdvertisingData &) = 0; virtual ble_error_t startAdvertising(const GapAdvertisingParams &) = 0; virtual ble_error_t stopAdvertising(void) = 0;
--- a/services/HeartRateService.h Tue Sep 30 01:03:56 2014 +0100 +++ b/services/HeartRateService.h Wed Nov 05 14:08:42 2014 +0000 @@ -92,10 +92,8 @@ } /** - * This callback allows the UART service to receive updates to the - * txCharacteristic. The application should forward the call to this - * function from the global onDataWritten() callback handler; or if that's - * not used, this method can be used as a callback directly. + * This callback allows the HeartRateService to receive updates to the + * controlPoint Characteristic. */ virtual void onDataWritten(const GattCharacteristicWriteCBParams *params) { if (params->charHandle == controlPoint.getValueAttribute().getHandle()) {