Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

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

WriteOnlyArrayGattCharacteristic
< uint8_t,
SIZEOF_CONTROL_BYTES > 
controlPoint
 Writing to the control characteristic triggers the handover to DFU bootloader.
GattCharacteristic packet
 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 43 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 50 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 61 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 91 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 characteristic being updated.

Definition at line 103 of file DFUService.h.


Field Documentation

WriteOnlyArrayGattCharacteristic<uint8_t, SIZEOF_CONTROL_BYTES> controlPoint [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 132 of file DFUService.h.

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

Application-specific handover callback.

Definition at line 144 of file DFUService.h.

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 139 of file DFUService.h.