Buttonless DFU Service

nRF5 SDK v15.2.0

Buttonless DFU Service module. More...

Data Structures

struct ble_dfu_buttonless_t
Type holding memory used by Secure DFU Buttonless Service. More...
struct ble_dfu_buttonless_init_t
Type used to initialize the Secure DFU Buttonless Service. More...

Macros

#define BLE_DFU_SOC_OBSERVER_PRIO 1
SoC observer priority. More...
#define BLE_DFU_BUTTONLESS_CHAR_UUID (0x0003)
#define BLE_DFU_BUTTONLESS_BONDED_CHAR_UUID (0x0004)
#define BLE_NORDIC_VENDOR_BASE_UUID
Nordic vendor-specific base UUID. More...

Typedefs

typedef void(* ble_dfu_buttonless_evt_handler_t )( ble_dfu_buttonless_evt_type_t p_evt)
Nordic Buttonless DFU Service event handler type.

Functions

uint32_t ble_dfu_buttonless_init (const ble_dfu_buttonless_init_t *p_dfu_init)
Function for initializing the Device Firmware Update module. More...
uint32_t ble_dfu_buttonless_async_svci_init (void)
Function for initializing the async SVCI interface. More...
uint32_t ble_dfu_buttonless_backend_init ( ble_dfu_buttonless_t *p_dfu)
Function to initialize the backend Secure DFU Buttonless service which is either supports bonds or not. More...
uint32_t ble_dfu_buttonless_char_add ( ble_dfu_buttonless_t *p_dfu)
Function for adding the buttonless characteristic. More...
uint32_t ble_dfu_buttonless_resp_send ( ble_dfu_buttonless_op_code_t op_code, ble_dfu_buttonless_rsp_code_t rsp_code)
Function for sending a response back to the client. More...
void ble_dfu_buttonless_on_ble_evt ( ble_evt_t const *p_ble_evt, void *p_context)
Function for handling the application's BLE stack events. More...
void ble_dfu_buttonless_on_ctrl_pt_write ( ble_gatts_evt_write_t const *p_evt_write)
Function for handling control point write requests. More...
uint32_t ble_dfu_buttonless_bootloader_start_prepare (void)
Function for preparing to enter the bootloader. More...
uint32_t ble_dfu_buttonless_bootloader_start_finalize (void)
Function for finalizing entering the bootloader. More...

Detailed Description

Buttonless DFU Service module.

This module implements a proprietary Buttonless Secure DFU Service. The service can be configured to support bonds or not. The bond support configuration must correspond to the requirement of Secure DFU bootloader.

Note
Attention! To maintain compliance with Nordic Semiconductor ASA Bluetooth profile qualification listings, this section of source code must not be modified.

Macro Definition Documentation

#define BLE_DFU_BUTTONLESS_BONDED_CHAR_UUID   (0x0004)

Value combined with vendor-specific base to create Bonded Buttonless characteristic UUID.

#define BLE_DFU_BUTTONLESS_CHAR_UUID   (0x0003)

Value combined with vendor-specific base to create Unbonded Buttonless characteristic UUID.

#define BLE_DFU_SOC_OBSERVER_PRIO   1

SoC observer priority.

Priority of this module's SoC event handler.

#define BLE_NORDIC_VENDOR_BASE_UUID
Value:
{{ \
0x50, 0xEA, 0xDA, 0x30, 0x88, 0x83, 0xB8, 0x9F, \
0x60, 0x4F, 0x15, 0xF3, 0x00, 0x00, 0xC9, 0x8E \
}}

Nordic vendor-specific base UUID.

Enumeration Type Documentation

Nordic Buttonless DFU Service event type .

Enumerator
BLE_DFU_EVT_BOOTLOADER_ENTER_PREPARE

Event indicating that the device is preparing to enter bootloader.

BLE_DFU_EVT_BOOTLOADER_ENTER

Event indicating that the bootloader will be entered after return of this event.

BLE_DFU_EVT_BOOTLOADER_ENTER_FAILED

Failure to enter bootloader mode.

BLE_DFU_EVT_RESPONSE_SEND_ERROR

Failure to send response.

Enumeration of Bootloader DFU Operation codes.

Enumerator
DFU_OP_RESERVED

Reserved for future use.

DFU_OP_ENTER_BOOTLOADER

Enter bootloader.

DFU_OP_SET_ADV_NAME

Set advertisement name to use in DFU mode.

DFU_OP_RESPONSE_CODE

Response code.

Enumeration of Bootloader DFU response codes.

Enumerator
DFU_RSP_INVALID

Invalid op code.

DFU_RSP_SUCCESS

Success.

DFU_RSP_OP_CODE_NOT_SUPPORTED

Op code not supported.

DFU_RSP_OPERATION_FAILED

Operation failed.

DFU_RSP_ADV_NAME_INVALID

Requested advertisement name is too short or too long.

DFU_RSP_BUSY

Ongoing async operation.

DFU_RSP_NOT_BONDED

Buttonless unavailable due to device not bonded.

Function Documentation

uint32_t ble_dfu_buttonless_async_svci_init ( void )

Function for initializing the async SVCI interface.

Warning
Ensure that no interrupts are triggered when calling this functions as interrupts and exceptions are forwarded to the bootloader for the period of the call and may be lost.

This configures the async interface for calling to the bootloader through SVCI interface.

Return values
NRF_SUCCESS on success, otherwise an error code.
uint32_t ble_dfu_buttonless_backend_init ( ble_dfu_buttonless_t * p_dfu )

Function to initialize the backend Secure DFU Buttonless service which is either supports bonds or not.

Note
Do not call this function directly. It is called internally by ble_dfu_buttonless_init .
Parameters
[in] p_dfu Nordic DFU Service structure.
Returns
NRF_SUCCESS On sucessfully initializing, otherwise an error code.
uint32_t ble_dfu_buttonless_bootloader_start_finalize ( void )

Function for finalizing entering the bootloader.

Warning
This function is not to be called. (It is called internally).
Return values
NRF_SUCCESS Finalize was started correctly.
uint32_t ble_dfu_buttonless_bootloader_start_prepare ( void )

Function for preparing to enter the bootloader.

Warning
This function is called directly. (It is called internally).
Return values
Any error code from calling sd_ble_gap_disconnect .
uint32_t ble_dfu_buttonless_char_add ( ble_dfu_buttonless_t * p_dfu )

Function for adding the buttonless characteristic.

Note
This will be implemented differently on bonded/unbonded Buttonless DFU service.
Parameters
[in] p_dfu Nordic DFU Service structure.
Returns
NRF_SUCCESS on success, otherwise an error code.
uint32_t ble_dfu_buttonless_init ( const ble_dfu_buttonless_init_t * p_dfu_init )

Function for initializing the Device Firmware Update module.

Parameters
[in] p_dfu_init Structure containing the values of characteristics needed by the service.
Return values
NRF_SUCCESS on successful initialization of the service.
void ble_dfu_buttonless_on_ble_evt ( ble_evt_t const * p_ble_evt ,
void * p_context
)

Function for handling the application's BLE stack events.

Handles all events from the BLE stack of interest to the DFU buttonless service.

Parameters
[in] p_ble_evt Event received from the BLE stack.
[in] p_context BLE context structure.
void ble_dfu_buttonless_on_ctrl_pt_write ( ble_gatts_evt_write_t const * p_evt_write )

Function for handling control point write requests.

Handles write requests to the control point in DFU with bonds or without bonds.

Parameters
[in] p_evt_write GATTS write event.
uint32_t ble_dfu_buttonless_resp_send ( ble_dfu_buttonless_op_code_t op_code ,
ble_dfu_buttonless_rsp_code_t rsp_code
)

Function for sending a response back to the client.

Parameters
[in] op_code Operation code to send the response for.
[in] rsp_code Response code for the operation.
Return values
NRF_SUCCESS on success, otherwise an error code.