R1 code for micro:bit based train controller code, requires second micro:bit running rx code to operate - see https://meanderingpi.wordpress.com/ for more information

Fork of nrf51-sdk by Lancaster University

Embed: (wiki syntax)

« Back to documentation index

DFU BLE packet handling in application

DFU BLE packet handling in application

Handling of DFU BLE packets in the application. More...


typedef void(* dfu_app_reset_prepare_t )(void)
 DFU application reset_prepare function.


void dfu_app_on_dfu_evt (ble_dfu_t *p_dfu, ble_dfu_evt_t *p_evt)
 Function for handling events from the DFU Service.
void dfu_app_reset_prepare_set (dfu_app_reset_prepare_t reset_prepare_func)
 Function for registering a function to prepare a reset.
void dfu_app_dm_appl_instance_set (dm_application_instance_t app_instance)
 Function for setting the Device Manager application instance.

Detailed Description

Handling of DFU BLE packets in the application.

This module implements the handling of DFU packets for switching from an application to the bootloader and start DFU mode. The DFU packets are transmitted over BLE. This module handles only the StartDFU packet, which allows a BLE application to expose support for the DFU Service. The actual DFU Service runs in a dedicated environment after a BLE disconnect and reset of the device. The host must reconnect and continue the update procedure with access to the full DFU Service.

The application must propagate DFU events to this module by calling dfu_app_on_dfu_evt from the ble_dfu_evt_handler_t callback.

Typedef Documentation

typedef void(* dfu_app_reset_prepare_t)(void)

DFU application reset_prepare function.

This function is a callback that allows the application to prepare for an upcoming application reset.

Definition at line 68 of file dfu_app_handler.h.

Function Documentation

void dfu_app_dm_appl_instance_set ( dm_application_instance_t  app_instance )

Function for setting the Device Manager application instance.

This function allows to set the dm_application_instance_t value that is returned by the Device Manager when the application registers using dm_register. If this function is not called, it is not be possible to share bonding information from the application to the bootloader/DFU when entering DFU mode.

[in]app_instanceValue for the application instance in use.

Definition at line 206 of file dfu_app_handler.c.

void dfu_app_on_dfu_evt ( ble_dfu_t p_dfu,
ble_dfu_evt_t p_evt 

Function for handling events from the DFU Service.

The application must inject this function into the DFU Service or propagate DFU events to the dfu_app_handler module by calling this function in the application-specific DFU event handler.

[in]p_dfuPointer to the DFU Service structure to which the include event relates.
[in]p_evtPointer to the DFU event.

Definition at line 177 of file dfu_app_handler.c.

void dfu_app_reset_prepare_set ( dfu_app_reset_prepare_t  reset_prepare_func )

Function for registering a function to prepare a reset.

The provided function is executed before resetting the system into bootloader/DFU mode. By registering this function, the caller is notified before the reset and can thus prepare the application for reset. For example, the application can gracefully disconnect any peers on BLE, turn of LEDS, ensure that all pending flash operations have completed, and so on.

[in]reset_prepare_funcFunction to be executed before a reset.

Definition at line 200 of file dfu_app_handler.c.