17 #ifdef TARGET_NRF51822     19 #ifndef __BLE_DFU_SERVICE_H__    20 #define __BLE_DFU_SERVICE_H__    22 #if BLE_FEATURE_GATT_SERVER    28 #include "dfu_app_handler.h"    31 extern const uint8_t  DFUServiceBaseUUID[];
    32 extern const uint16_t DFUServiceShortUUID;
    33 extern const uint16_t DFUServiceControlCharacteristicShortUUID;
    35 extern const uint8_t  DFUServiceUUID[];
    36 extern const uint8_t  DFUServiceControlCharacteristicUUID[];
    37 extern const uint8_t  DFUServicePacketCharacteristicUUID[];
    50     typedef void (*ResetPrepare_t)(void);
    61     DFUService(
BLE &_ble, ResetPrepare_t _handoverCallback = NULL) :
    63         controlPoint(DFUServiceControlCharacteristicUUID, controlBytes, 
GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
    64         packet(DFUServicePacketCharacteristicUUID, packetBytes, SIZEOF_PACKET_BYTES, SIZEOF_PACKET_BYTES,
    68         static bool serviceAdded = 
false; 
    75         controlBytes[0] = 0xFF;
    76         controlBytes[1] = 0xFF;
    81         ble.addService(dfuService);
    82         handoverCallback = _handoverCallback;
    85         ble.onDataWritten(
this, &DFUService::onDataWritten);
    91     uint16_t getControlHandle(
void)
 const {
    92         return controlPoint.getValueHandle();
   104         if (params->
handle == controlPoint.getValueHandle()) {
   106             if (handoverCallback) {
   116             p_evt.ble_dfu_evt_type = BLE_DFU_START;
   118             dfu_app_on_dfu_evt(&p_dfu, &p_evt);
   123     static const unsigned SIZEOF_CONTROL_BYTES = 2;
   124     static const unsigned SIZEOF_PACKET_BYTES  = 20;
   141     uint8_t             controlBytes[SIZEOF_CONTROL_BYTES];
   142     uint8_t             packetBytes[SIZEOF_PACKET_BYTES];
   144     static ResetPrepare_t handoverCallback;  
   147 #endif // BLE_FEATURE_GATT_SERVER ble::connection_handle_t connHandle
Handle of the connection that triggered the event. 
Abstract away BLE-capable radio transceivers or SOCs. 
Helper class that represents a write-only GattCharacteristic with an array value. ...
GATT Write event definition. 
Representation of a GattServer characteristic. 
GattAttribute::Handle_t handle
Handle of the attribute to which the write operation applies. 
Representation of a GattServer service. 
Entry namespace for all BLE API definitions.