nRF51 SDK
|
Device Firmware Update Service. More...
Macros | |
#define | BLE_DFU_SERVICE_UUID 0x1530 |
#define | BLE_DFU_PKT_CHAR_UUID 0x1532 |
#define | BLE_DFU_CTRL_PT_UUID 0x1531 |
#define | BLE_DFU_STATUS_REP_UUID 0x1533 |
Typedefs | |
typedef struct ble_dfu_s | ble_dfu_t |
DFU service structure. More... | |
typedef void(* | ble_dfu_evt_handler_t )(ble_dfu_t *p_dfu, ble_dfu_evt_t *p_evt) |
DFU Service event handler type. | |
Enumerations | |
enum | ble_dfu_evt_type_t { BLE_DFU_START, BLE_DFU_RECEIVE_INIT_DATA, BLE_DFU_RECEIVE_APP_DATA, BLE_DFU_VALIDATE, BLE_DFU_ACTIVATE_N_RESET, BLE_DFU_SYS_RESET, BLE_DFU_PKT_RCPT_NOTIF_ENABLED, BLE_DFU_PKT_RCPT_NOTIF_DISABLED, BLE_DFU_PACKET_WRITE, BLE_DFU_BYTES_RECEIVED_SEND } |
DFU Event type. More... | |
enum | ble_dfu_procedure_t { BLE_DFU_START_PROCEDURE = 1, BLE_DFU_INIT_PROCEDURE = 2, BLE_DFU_RECEIVE_APP_PROCEDURE = 3, BLE_DFU_VALIDATE_PROCEDURE = 4, BLE_DFU_PKT_RCPT_REQ_PROCEDURE = 8 } |
DFU Procedure type. More... | |
enum | ble_dfu_resp_val_t { BLE_DFU_RESP_VAL_SUCCESS = 1, BLE_DFU_RESP_VAL_INVALID_STATE, BLE_DFU_RESP_VAL_NOT_SUPPORTED, BLE_DFU_RESP_VAL_DATA_SIZE, BLE_DFU_RESP_VAL_CRC_ERROR, BLE_DFU_RESP_VAL_OPER_FAILED } |
DFU Response value type. More... | |
Functions | |
void | ble_dfu_on_ble_evt (ble_dfu_t *p_dfu, ble_evt_t *p_ble_evt) |
Function for handling a BLE stack event. More... | |
uint32_t | ble_dfu_init (ble_dfu_t *p_dfu, ble_dfu_init_t *p_dfu_init) |
Function for initializing the DFU service. More... | |
uint32_t | ble_dfu_response_send (ble_dfu_t *p_dfu, ble_dfu_procedure_t dfu_proc, ble_dfu_resp_val_t resp_val) |
Function for sending response to a control point command. More... | |
uint32_t | ble_dfu_bytes_rcvd_report (ble_dfu_t *p_dfu, uint32_t num_of_firmware_bytes_rcvd) |
Function for notifying the peer about the number of bytes of firmware data received. More... | |
uint32_t | ble_dfu_pkts_rcpt_notify (ble_dfu_t *p_dfu, uint32_t num_of_firmware_bytes_rcvd) |
Function for sending Packet Receipt Notification to the peer. More... | |
Data Structures | |
struct | ble_dfu_pkt_write_t |
DFU Packet structure. More... | |
struct | ble_pkt_rcpt_notif_req_t |
Packet receipt notification request structure. More... | |
struct | ble_dfu_evt_t |
DFU Event structure. More... | |
struct | ble_dfu_s |
DFU service structure. More... | |
struct | ble_dfu_init_t |
DFU service initialization structure. More... | |
The Device Firmware Update (DFU) service is a GATT based service that can be used for performing firmware updates over BLE. Note that this implementation uses vendor specific UUIDs for service and characteristics and is intended to demonstrate the firmware updates over BLE. Refer DFU Service Specification and DFU Profile Specification for more information on the service and profile respectively.
#define BLE_DFU_SERVICE_UUID 0x1530 |
The UUID of the DFU Service.
#define BLE_DFU_PKT_CHAR_UUID 0x1532 |
The UUID of the DFU Packet Characteristic.
#define BLE_DFU_CTRL_PT_UUID 0x1531 |
The UUID of the DFU Control Point.
#define BLE_DFU_STATUS_REP_UUID 0x1533 |
The UUID of the DFU Status Report Characteristic.
This structure contains status information related to the service.
enum ble_dfu_evt_type_t |
This enumeration contains the types of events that will be received from the DFU Service.
Enumerator | |
---|---|
BLE_DFU_START |
The event indicating that the peer wants the application to prepare for a new firmware update. |
BLE_DFU_RECEIVE_INIT_DATA |
The event indicating that the peer wants the application to prepare to receive init parameters. |
BLE_DFU_RECEIVE_APP_DATA |
The event indicating that the peer wants the application to prepare to receive the new firmware image. |
BLE_DFU_VALIDATE |
The event indicating that the peer wants the application to validate the newly received firmware image. |
BLE_DFU_ACTIVATE_N_RESET |
The event indicating that the peer wants the application to undergo activate new firmware and restart with new valid application |
BLE_DFU_SYS_RESET |
The event indicating that the peer wants the application to undergo a reset and start the currently valid application image. |
BLE_DFU_PKT_RCPT_NOTIF_ENABLED |
The event indicating that the peer has enabled packet receipt notifications. It is the responsibility of the application to call ble_dfu_pkts_rcpt_notify each time the number of packets indicated by num_of_pkts field in ble_dfu_evt_t is received. |
BLE_DFU_PKT_RCPT_NOTIF_DISABLED |
The event indicating that the peer has disabled the packet receipt notifications. |
BLE_DFU_PACKET_WRITE |
The event indicating that the peer has written a value to the 'DFU Packet' characteristic. The data received from the peer will be present in the ble_dfu_pkt_write element contained within ble_dfu_evt_t. |
BLE_DFU_BYTES_RECEIVED_SEND |
The event indicating that the peer is requesting for the number of bytes of firmware data last received by the application. It is the responsibility of the application to call ble_dfu_pkts_rcpt_notify in response to this event. |
enum ble_dfu_procedure_t |
This enumeration contains the types of DFU procedures.
enum ble_dfu_resp_val_t |
The DFU service expects the application to call this function each time an event is received from the BLE stack. This function processes the event, if it is relevant for the DFU service and calls the DFU event handler of the application if necessary.
[in] | p_dfu | Pointer to the DFU service structure. |
[in] | p_ble_evt | Pointer to the event received from BLE stack. |
uint32_t ble_dfu_init | ( | ble_dfu_t * | p_dfu, |
ble_dfu_init_t * | p_dfu_init | ||
) |
[out] | p_dfu | Device Firmware Update service structure. This structure will have to be supplied by the application. It will be initialized by this function, and will later be used to identify the service instance. |
[in] | p_dfu_init | Information needed to initialize the service. |
uint32_t ble_dfu_response_send | ( | ble_dfu_t * | p_dfu, |
ble_dfu_procedure_t | dfu_proc, | ||
ble_dfu_resp_val_t | resp_val | ||
) |
This function will encode a DFU Control Point response using the given input parameters and will send a notification of the same to the peer.
[in] | p_dfu | Pointer to the DFU service structure. |
[in] | dfu_proc | Procedure for which this response is to be sent. |
[in] | resp_val | Response value. |
uint32_t ble_dfu_bytes_rcvd_report | ( | ble_dfu_t * | p_dfu, |
uint32_t | num_of_firmware_bytes_rcvd | ||
) |
[in] | p_dfu | Pointer to the DFU service structure. |
[in] | num_of_firmware_bytes_rcvd | Number of bytes. |
uint32_t ble_dfu_pkts_rcpt_notify | ( | ble_dfu_t * | p_dfu, |
uint32_t | num_of_firmware_bytes_rcvd | ||
) |
This function will encode the number of bytes received as input parameter into a notification of the control point characteristic and send it to the peer.
[in] | p_dfu | Pointer to the DFU service structure. |
[in] | num_of_firmware_bytes_rcvd | Number of bytes of firmware image received. |