adaptation for book and plug demo

Dependents:   BookAndPlug

Fork of BLE_API by Bluetooth Low Energy

Embed: (wiki syntax)

« Back to documentation index

DFUService Class Reference

Device Firmware Update Service. More...

#include <DFUService.h>

Public Types

typedef void(* ResetPrepare_t )(void)
 Signature for the handover callback.

Public Member Functions

 DFUService (BLE &_ble, ResetPrepare_t _handoverCallback=NULL)
 Adds Device Firmware Update Service to an existing BLE object.
uint16_t getControlHandle (void) const
 Get the handle for the value attribute of the control characteristic.
virtual void onDataWritten (const GattWriteCallbackParams *params)
 This callback allows the DFU service to receive the initial trigger to hand control over to the bootloader.

Protected Attributes

BLEble
 Writing to the control characteristic triggers the handover to DFU bootloader.
WriteOnlyArrayGattCharacteristic
< uint8_t,
SIZEOF_CONTROL_BYTES > 
controlPoint
 The packet characteristic in this service doesn't do anything meaningful; it is only a placeholder to mimic the corresponding characteristic in the actual DFU service implemented by the bootloader.

Static Protected Attributes

static ResetPrepare_t handoverCallback = NULL
 Application-specific handover callback.

Detailed Description

Device Firmware Update Service.

Definition at line 41 of file DFUService.h.


Member Typedef Documentation

typedef void(* ResetPrepare_t)(void)

Signature for the handover callback.

The application may provide this callback when setting up the DFU service. The callback is then invoked before handing control over to the bootloader.

Definition at line 48 of file DFUService.h.


Constructor & Destructor Documentation

DFUService ( BLE _ble,
ResetPrepare_t  _handoverCallback = NULL 
)

Adds Device Firmware Update Service to an existing BLE object.

Parameters:
ref]_ble BLE object for the underlying controller.
[in]_handoverCallbackApplication-specific handover callback.

Definition at line 59 of file DFUService.h.


Member Function Documentation

uint16_t getControlHandle ( void   ) const

Get the handle for the value attribute of the control characteristic.

Definition at line 89 of file DFUService.h.

virtual void onDataWritten ( const GattWriteCallbackParams *  params ) [virtual]

This callback allows the DFU service to receive the initial trigger to hand control over to the bootloader.

First, the application is given a chance to clean up.

Parameters:
[in]paramsInformation about the characterisitc being updated.

Definition at line 101 of file DFUService.h.


Field Documentation

BLE& ble [protected]

Writing to the control characteristic triggers the handover to DFU bootloader.

At present, writing anything will do the trick - this needs to be improved.

Definition at line 127 of file DFUService.h.

WriteOnlyArrayGattCharacteristic<uint8_t, SIZEOF_CONTROL_BYTES> controlPoint [protected]

The packet characteristic in this service doesn't do anything meaningful; it is only a placeholder to mimic the corresponding characteristic in the actual DFU service implemented by the bootloader.

Without this, some FOTA clients might get confused, because service definitions change after handing control over to the bootloader.

Definition at line 132 of file DFUService.h.

DFUService::ResetPrepare_t handoverCallback = NULL [static, protected]

Application-specific handover callback.

Definition at line 142 of file DFUService.h.