nRF5 SDK v12.1.0
Data Structures | Enumerations | Functions
Request handling

Data Structures

struct  nrf_dfu_req_t
 Definition of a DFU request sent from the transport layer. More...
 
struct  nrf_dfu_res_t
 Response used during DFU operations. More...
 

Enumerations

enum  nrf_dfu_obj_type_t {
  NRF_DFU_OBJ_TYPE_INVALID,
  NRF_DFU_OBJ_TYPE_COMMAND,
  NRF_DFU_OBJ_TYPE_DATA
}
 DFU object types. More...
 
enum  nrf_dfu_req_op_t {
  NRF_DFU_OBJECT_OP_NONE = 0,
  NRF_DFU_OBJECT_OP_CREATE = 1,
  NRF_DFU_OBJECT_OP_WRITE = 2,
  NRF_DFU_OBJECT_OP_EXECUTE = 3,
  NRF_DFU_OBJECT_OP_CRC = 4,
  NRF_DFU_OBJECT_OP_SELECT = 6,
  NRF_DFU_OBJECT_OP_OTHER = 7
}
 DFU request operation codes. More...
 
enum  nrf_dfu_res_code_t {
  NRF_DFU_RES_CODE_INVALID = 0x00,
  NRF_DFU_RES_CODE_SUCCESS = 0x01,
  NRF_DFU_RES_CODE_OP_CODE_NOT_SUPPORTED = 0x02,
  NRF_DFU_RES_CODE_INVALID_PARAMETER = 0x03,
  NRF_DFU_RES_CODE_INSUFFICIENT_RESOURCES = 0x04,
  NRF_DFU_RES_CODE_INVALID_OBJECT = 0x05,
  NRF_DFU_RES_CODE_UNSUPPORTED_TYPE = 0x07,
  NRF_DFU_RES_CODE_OPERATION_NOT_PERMITTED = 0x08,
  NRF_DFU_RES_CODE_OPERATION_FAILED = 0x0A,
  NRF_DFU_RES_CODE_EXT_ERROR = 0x0B
}
 DFU request result codes. More...
 

Functions

uint32_t nrf_dfu_req_handler_init (void)
 Function for initializing the request handling module. More...
 
nrf_dfu_res_code_t nrf_dfu_req_handler_on_req (void *p_context, nrf_dfu_req_t *p_req, nrf_dfu_res_t *p_res)
 Function type for handling a DFU request. More...
 

Detailed Description

Enumeration Type Documentation

DFU object types.

Enumerator
NRF_DFU_OBJ_TYPE_INVALID 

Invalid object type.

NRF_DFU_OBJ_TYPE_COMMAND 

Command object packet.

NRF_DFU_OBJ_TYPE_DATA 

Data object.

DFU request operation codes.

The DFU transport layer creates request events of these types. The implementation of nrf_dfu_req_handler_on_req handles requests of these types.

Enumerator
NRF_DFU_OBJECT_OP_NONE 

No operation set.

NRF_DFU_OBJECT_OP_CREATE 

Create operation. The length of the request indicates the required size. When called, the created object is selected.

NRF_DFU_OBJECT_OP_WRITE 

Write operation. When called, offset and CRC of the selected object are reported back.

NRF_DFU_OBJECT_OP_EXECUTE 

Execute operation. When called, the selected object is executed.

NRF_DFU_OBJECT_OP_CRC 

Calculate checksum operation. When called, offset and CRC of the selected object are reported back.

NRF_DFU_OBJECT_OP_SELECT 

Select operation. When called, the object of the given type is selected, and information about the object is reported back.

NRF_DFU_OBJECT_OP_OTHER 

A user-defined DFU request type. The application must define how to interpret the request.

DFU request result codes.

The DFU transport layer creates request events of types nrf_dfu_req_op_t, which are handled by nrf_dfu_req_handler_on_req. That functions returns one of these result codes.

Enumerator
NRF_DFU_RES_CODE_INVALID 

Invalid opcode.

NRF_DFU_RES_CODE_SUCCESS 

Operation successful.

NRF_DFU_RES_CODE_OP_CODE_NOT_SUPPORTED 

Opcode not supported.

NRF_DFU_RES_CODE_INVALID_PARAMETER 

Missing or invalid parameter value.

NRF_DFU_RES_CODE_INSUFFICIENT_RESOURCES 

Not enough memory for the data object.

NRF_DFU_RES_CODE_INVALID_OBJECT 

Data object does not match the firmware and hardware requirements, the signature is missing, or parsing the command failed.

NRF_DFU_RES_CODE_UNSUPPORTED_TYPE 

Not a valid object type for a Create request.

NRF_DFU_RES_CODE_OPERATION_NOT_PERMITTED 

The state of the DFU process does not allow this operation.

NRF_DFU_RES_CODE_OPERATION_FAILED 

Operation failed.

NRF_DFU_RES_CODE_EXT_ERROR 

Extended error.

Function Documentation

uint32_t nrf_dfu_req_handler_init ( void  )

Function for initializing the request handling module.

This function initializes the flash with or without the SoftDevice, depending on the project configuration.

Return values
NRF_SUCCESSIf the operation was successful.
NRF_ERROR_INVALID_STATEIf the fstorage module could not be initiated or the SoftDevice could not set the event handler.
nrf_dfu_res_code_t nrf_dfu_req_handler_on_req ( void *  p_context,
nrf_dfu_req_t p_req,
nrf_dfu_res_t p_res 
)

Function type for handling a DFU request.

Parameters
[in,out]p_contextPointer to context-specific RAM required for running the command request. This value may be NULL if the command request does not require context-specific RAM.
[in,out]p_reqPointer to the structure holding the DFU request.
[in,out]p_resPointer to the structure holding the DFU response.
Return values
NRF_DFU_RES_CODE_SUCCESSIf the command request was executed successfully. Any other error code indicates that the request could not be handled.

Documentation feedback | Developer Zone | Subscribe | Updated