I don't know why this is happening.
Fork of BLE_API by
Diff: services/DFUService.h
- Revision:
- 567:e4b38e43de7c
- Parent:
- 528:8d21604fe31d
- Child:
- 655:4dce7c6d2eb3
--- a/services/DFUService.h Fri Jun 19 15:52:11 2015 +0100 +++ b/services/DFUService.h Fri Jun 19 15:52:28 2015 +0100 @@ -17,7 +17,7 @@ #ifndef __BLE_DFU_SERVICE_H__ #define __BLE_DFU_SERVICE_H__ -#include "BLE.h" +#include "BLEDevice.h" #include "UUID.h" extern "C" void bootloader_start(void); @@ -48,17 +48,17 @@ * @brief Adds Device Firmware Update service to an existing ble object. * * @param[ref] _ble - * BLE object for the underlying controller. + * BLEDevice object for the underlying controller. * @param[in] _handoverCallback * Application specific handover callback. */ - DFUService(BLE &_ble, ResetPrepare_t _handoverCallback = NULL) : + DFUService(BLEDevice &_ble, ResetPrepare_t _handoverCallback = NULL) : ble(_ble), + controlBytes(), + packetBytes(), controlPoint(DFUServiceControlCharacteristicUUID, controlBytes, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY), packet(DFUServicePacketCharacteristicUUID, packetBytes, SIZEOF_PACKET_BYTES, SIZEOF_PACKET_BYTES, - GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE_WITHOUT_RESPONSE), - controlBytes(), - packetBytes() { + GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE_WITHOUT_RESPONSE) { static bool serviceAdded = false; /* We should only ever need to add the DFU service once. */ if (serviceAdded) { return; @@ -94,8 +94,8 @@ * @param[in] params * Information about the characterisitc being updated. */ - virtual void onDataWritten(const GattWriteCallbackParams *params) { - if (params->handle == controlPoint.getValueHandle()) { + virtual void onDataWritten(const GattCharacteristicWriteCBParams *params) { + if (params->charHandle == controlPoint.getValueHandle()) { /* At present, writing anything will do the trick--this needs to be improved. */ if (handoverCallback) { handoverCallback(); @@ -105,12 +105,16 @@ } } -protected: +private: static const unsigned SIZEOF_CONTROL_BYTES = 2; static const unsigned SIZEOF_PACKET_BYTES = 20; -protected: - BLE &ble; + static ResetPrepare_t handoverCallback; /**< application specific handover callback. */ + +private: + BLEDevice &ble; + uint8_t controlBytes[SIZEOF_CONTROL_BYTES]; + uint8_t packetBytes[SIZEOF_PACKET_BYTES]; /**< Writing to the control characteristic triggers the handover to dfu- * bootloader. At present, writing anything will do the trick--this needs @@ -123,11 +127,6 @@ * FOTA clients might get confused as service definitions change after * handing control over to the bootloader. */ GattCharacteristic packet; - - uint8_t controlBytes[SIZEOF_CONTROL_BYTES]; - uint8_t packetBytes[SIZEOF_PACKET_BYTES]; - - static ResetPrepare_t handoverCallback; /**< application specific handover callback. */ }; #endif /* #ifndef __BLE_DFU_SERVICE_H__*/ \ No newline at end of file