Connectivity command request decoders and command response encoders

nRF5 SDK v12.2.0

Connectivity command request decoders and command response encoders. More...

Functions

uint32_t ble_tx_packet_count_get_req_dec (uint8_t const *const p_buf, uint16_t packet_len, uint16_t *const p_conn_handle, uint8_t **const pp_count)
Decodes sd_ble_tx_packet_count_get command request. More...
uint32_t ble_tx_packet_count_get_rsp_enc (uint32_t return_code, uint8_t *const p_buf, uint32_t *const p_buf_len, uint8_t const *const p_count)
Encodes sd_ble_tx_packet_count_get command response. More...
uint32_t ble_event_enc ( ble_evt_t const *const p_event, uint32_t event_len, uint8_t *const p_buf, uint32_t *const p_buf_len)
Event encoding dispatcher. More...
uint32_t ble_version_get_req_dec (uint8_t const *const p_buf, uint16_t packet_len, ble_version_t **const pp_version)
Decodes sd_ble_version_get command request. More...
uint32_t ble_version_get_rsp_enc (uint32_t return_code, uint8_t *const p_buf, uint32_t *const p_buf_len, ble_version_t const *const p_version)
Encodes sd_ble_version_get command response. More...
uint32_t ble_opt_get_req_dec (uint8_t const *const p_buf, uint16_t packet_len, uint32_t *const p_opt_id, ble_opt_t **const pp_opt)
Decodes sd_ble_opt_get command request. More...
uint32_t ble_opt_get_rsp_enc (uint32_t return_code, uint8_t *const p_buf, uint32_t *const p_buf_len, uint32_t opt_id, ble_opt_t const *const p_opt)
Encodes sd_ble_opt_get command response. More...
uint32_t ble_opt_set_req_dec (uint8_t const *const p_buf, uint16_t packet_len, uint32_t *const p_opt_id, ble_opt_t **const pp_opt)
Decodes sd_ble_opt_set command request. More...
uint32_t ble_opt_set_rsp_enc (uint32_t return_code, uint8_t *const p_buf, uint32_t *const p_buf_len)
Encodes sd_ble_opt_set command response. More...
uint32_t ble_uuid_encode_req_dec (uint8_t const *const p_buf, uint16_t packet_len, ble_uuid_t **const pp_uuid, uint8_t **const pp_uuid_le_len, uint8_t **const pp_uuid_le)
Decodes sd_ble_uuid_encode command request. More...
uint32_t ble_uuid_encode_rsp_enc (uint32_t return_code, uint8_t *const p_buf, uint32_t *const p_buf_len, uint8_t uuid_le_len, uint8_t const *const p_uuid_le)
Encodes sd_ble_uuid_encode command response. More...
uint32_t ble_uuid_decode_req_dec (uint8_t const *const p_buf, uint32_t const packet_len, uint8_t *p_uuid_le_len, uint8_t **const pp_uuid_le, ble_uuid_t **const pp_uuid)
Decodes sd_ble_uuid_decode command request. More...
uint32_t ble_uuid_decode_rsp_enc (uint32_t return_code, uint8_t *const p_buf, uint32_t *const p_buf_len, ble_uuid_t const *const p_uuid)
Encodes sd_ble_uuid_decode command response. More...
uint32_t ble_uuid_vs_add_req_dec (uint8_t const *const p_buf, uint16_t packet_len, ble_uuid128_t **const pp_uuid, uint8_t **const pp_uuid_type)
Decodes sd_ble_uuid_vs_add command request. More...
uint32_t ble_uuid_vs_add_rsp_enc (uint32_t return_code, uint8_t *const p_buf, uint32_t *const p_buf_len, uint8_t const *const p_uuid_type)
Encodes sd_ble_uuid_vs_add command response. More...
uint32_t ble_enable_req_dec (uint8_t const *const p_buf, uint32_t packet_len, ble_enable_params_t **const pp_ble_enable_params)
Decodes sd_ble_enable command request. More...
uint32_t ble_enable_rsp_enc (uint32_t return_code, uint8_t *const p_buf, uint32_t *const p_buf_len)
Encodes sd_ble_enable command response. More...
uint32_t ble_opt_id_pre_dec (uint8_t const *const p_buf, uint16_t packet_len, uint32_t *const p_opt_id)
Pre-decodes opt_id of ble_opt_t for middleware. More...
uint32_t ble_user_mem_reply_req_dec (uint8_t const *const p_buf, uint32_t packet_len, uint16_t *const p_conn_handle, ble_user_mem_block_t **const pp_block)
Decodes sd_ble_user_mem_reply command request. More...
uint32_t ble_user_mem_reply_rsp_enc (uint32_t return_code, uint8_t *const p_buf, uint32_t *const p_buf_len)
Encodes sd_ble_user_mem_reply command response. More...

Detailed Description

Connectivity command request decoders and command response encoders.

Function Documentation

uint32_t ble_enable_req_dec ( uint8_t const *const p_buf ,
uint32_t packet_len ,
ble_enable_params_t **const pp_ble_enable_params
)

Decodes sd_ble_enable command request.

See Also
ble_enable_rsp_enc for response encoding.
Parameters
[in] p_buf Pointer to beginning of command request packet.
[in] packet_len Length (in bytes) of response packet.
[out] pp_ble_enable_params Pointer to pointer to ble_enable_params_t . It will be set to NULL if p_ble_enable_params is not present in the packet.
Return values
NRF_SUCCESS Decoding success.
NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
uint32_t ble_enable_rsp_enc ( uint32_t return_code ,
uint8_t *const p_buf ,
uint32_t *const p_buf_len
)

Encodes sd_ble_enable command response.

See Also
ble_enable_req_dec for request decoding.
Parameters
[in] return_code Return code indicating if command was successful or not.
[out] p_buf Pointer to buffer where encoded data command response will be returned.
[in,out] p_buf_len in: size of p_buf buffer. out: Length of encoded command response packet.
Return values
NRF_SUCCESS Encoding success.
NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
uint32_t ble_event_enc ( ble_evt_t const *const p_event ,
uint32_t event_len ,
uint8_t *const p_buf ,
uint32_t *const p_buf_len
)

Event encoding dispatcher.

The event encoding dispatcher will route the event packet to the correct encoder which in turn encodes the contents of the event and updates the p_buf buffer.

Parameters
[in] p_event Pointer to the ble_evt_t buffer that shall be encoded.
[in] event_len Size (in bytes) of p_event buffer.
[out] p_buf Pointer to the beginning of a buffer for encoded event packet.
[in,out] p_buf_len in: Size (in bytes) of p_buf buffer. out: Length of encoded contents in p_buf .
Return values
NRF_SUCCESS Encoding success.
NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
NRF_ERROR_NOT_SUPPORTED Event encoder is not implemented.
uint32_t ble_opt_get_req_dec ( uint8_t const *const p_buf ,
uint16_t packet_len ,
uint32_t *const p_opt_id ,
ble_opt_t **const pp_opt
)

Decodes sd_ble_opt_get command request.

See Also
ble_opt_get_rsp_enc for response encoding.
Parameters
[in] p_buf Pointer to beginning of command request packet.
[in] packet_len Length (in bytes) of response packet.
[out] p_opt_id Pointer to pointer to ble_version_t address.
[out] pp_opt Pointer to pointer to ble_opt_t address.
Return values
NRF_SUCCESS Decoding success.
NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
uint32_t ble_opt_get_rsp_enc ( uint32_t return_code ,
uint8_t *const p_buf ,
uint32_t *const p_buf_len ,
uint32_t opt_id ,
ble_opt_t const *const p_opt
)

Encodes sd_ble_opt_get command response.

See Also
ble_opt_get_req_dec for request decoding.
Parameters
[in] return_code Return code indicating if command was successful or not.
[out] p_buf Pointer to buffer where encoded data command response will be returned.
[in,out] p_buf_len in: size of p_buf buffer. out: Length of encoded command response packet.
[in] opt_id identifies type of ble_opt_t union
[in] p_opt Pointer to ble_opt_t union.
Return values
NRF_SUCCESS Encoding success.
NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
uint32_t ble_opt_id_pre_dec ( uint8_t const *const p_buf ,
uint16_t packet_len ,
uint32_t *const p_opt_id
)

Pre-decodes opt_id of ble_opt_t for middleware.

Parameters
[out] p_buf Pointer to buffer where encoded data command response will be returned.
[in,out] packet_len in: size of p_buf buffer. out: Length of encoded command response packet.
[in,out] p_opt_id Pointer to opt_id which identifies type of ble_opt_t union.
Return values
NRF_SUCCESS Encoding success.
NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
uint32_t ble_opt_set_req_dec ( uint8_t const *const p_buf ,
uint16_t packet_len ,
uint32_t *const p_opt_id ,
ble_opt_t **const pp_opt
)

Decodes sd_ble_opt_set command request.

See Also
ble_opt_set_rsp_enc for response encoding.
Parameters
[in] p_buf Pointer to beginning of command request packet.
[in] packet_len Length (in bytes) of response packet.
[out] p_opt_id Pointer to ble_opt_t union type identifier.
[out] pp_opt Pointer to pointer to ble_opt_t union.
Return values
NRF_SUCCESS Decoding success.
NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
uint32_t ble_opt_set_rsp_enc ( uint32_t return_code ,
uint8_t *const p_buf ,
uint32_t *const p_buf_len
)

Encodes sd_ble_opt_set command response.

See Also
ble_opt_set_req_dec for request decoding.
Parameters
[in] return_code Return code indicating if command was successful or not.
[out] p_buf Pointer to buffer where encoded data command response will be returned.
[in,out] p_buf_len in: size of p_buf buffer. out: Length of encoded command response packet.
Return values
NRF_SUCCESS Encoding success.
NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
uint32_t ble_tx_packet_count_get_req_dec ( uint8_t const *const p_buf ,
uint16_t packet_len ,
uint16_t *const p_conn_handle ,
uint8_t **const pp_count
)

Decodes sd_ble_tx_packet_count_get command request.

See Also
ble_tx_packet_count_get_rsp_enc for response encoding.
Parameters
[in] p_buf Pointer to beginning of command request packet.
[in] packet_len Length (in bytes) of response packet.
[out] p_conn_handle Pointer to connection handle.
[out] pp_count Pointer to pointer to location for count.
Return values
NRF_SUCCESS Decoding success.
NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
uint32_t ble_tx_packet_count_get_rsp_enc ( uint32_t return_code ,
uint8_t *const p_buf ,
uint32_t *const p_buf_len ,
uint8_t const *const p_count
)

Encodes sd_ble_tx_packet_count_get command response.

See Also
ble_tx_packet_count_get_req_dec for request decoding.
Parameters
[in] return_code Return code indicating if command was successful or not.
[out] p_buf Pointer to buffer where encoded data command response will be returned.
[in,out] p_buf_len in: size of p_buf buffer. out: Length of encoded command response packet.
[in] p_count Pointer to count value.
Return values
NRF_SUCCESS Encoding success.
NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
uint32_t ble_user_mem_reply_req_dec ( uint8_t const *const p_buf ,
uint32_t packet_len ,
uint16_t *const p_conn_handle ,
ble_user_mem_block_t **const pp_block
)

Decodes sd_ble_user_mem_reply command request.

See Also
ble_user_mem_reply_rsp_enc for response encoding.
Parameters
[in] p_buf Pointer to beginning of command request packet.
[in] packet_len Length (in bytes) of response packet.
[in] p_conn_handle Pointer to Connection Handle.
[in,out] pp_block Pointer to pointer to ble_user_mem_block_t . It will be set to NULL if p_block is not present in the packet.
Return values
NRF_SUCCESS Decoding success.
NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
uint32_t ble_user_mem_reply_rsp_enc ( uint32_t return_code ,
uint8_t *const p_buf ,
uint32_t *const p_buf_len
)

Encodes sd_ble_user_mem_reply command response.

See Also
ble_user_mem_reply_req_dec for request decoding.
Parameters
[in] return_code Return code indicating if command was successful or not.
[out] p_buf Pointer to buffer where encoded data command response will be returned.
[in,out] p_buf_len in: size of p_buf buffer. out: Length of encoded command response packet.
Return values
NRF_SUCCESS Encoding success.
NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
uint32_t ble_uuid_decode_req_dec ( uint8_t const *const p_buf ,
uint32_t const packet_len ,
uint8_t * p_uuid_le_len ,
uint8_t **const pp_uuid_le ,
ble_uuid_t **const pp_uuid
)

Decodes sd_ble_uuid_decode command request.

See Also
ble_uuid_decode_rsp_enc for response encoding.
Parameters
[in] p_buf Pointer to beginning of command request packet.
[in] packet_len Length (in bytes) of response packet.
[out] p_uuid_le_len Pointer to the length of encoded UUID.
[out] pp_uuid_le Pointer to pointer to buffer where encoded UUID will be stored.
[out] pp_uuid Pointer to pointer to ble_uuid_t structure. It will be set to NULL if p_uuid is not present in the packet.
Return values
NRF_SUCCESS Decoding success.
NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
uint32_t ble_uuid_decode_rsp_enc ( uint32_t return_code ,
uint8_t *const p_buf ,
uint32_t *const p_buf_len ,
ble_uuid_t const *const p_uuid
)

Encodes sd_ble_uuid_decode command response.

See Also
ble_uuid_decode_req_dec for request decoding.
Parameters
[in] return_code Return code indicating if command was successful or not.
[out] p_buf Pointer to buffer where encoded data command response will be returned.
[in,out] p_buf_len in: size of p_buf buffer. out: Length of encoded command response packet.
[in] p_uuid Pointer to the buffer with encoded UUID.
Return values
NRF_SUCCESS Encoding success.
NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
uint32_t ble_uuid_encode_req_dec ( uint8_t const *const p_buf ,
uint16_t packet_len ,
ble_uuid_t **const pp_uuid ,
uint8_t **const pp_uuid_le_len ,
uint8_t **const pp_uuid_le
)

Decodes sd_ble_uuid_encode command request.

See Also
ble_uuid_encode_rsp_enc for response encoding.
Parameters
[in] p_buf Pointer to beginning of command request packet.
[in] packet_len Length (in bytes) of response packet.
[out] pp_uuid Pointer to pointer to ble_uuid_t structure.
[out] pp_uuid_le_len Pointer to pointer to the length of encoded UUID.
[out] pp_uuid_le Pointer to pointer to buffer where encoded UUID will be stored.
Return values
NRF_SUCCESS Decoding success.
NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
uint32_t ble_uuid_encode_rsp_enc ( uint32_t return_code ,
uint8_t *const p_buf ,
uint32_t *const p_buf_len ,
uint8_t uuid_le_len ,
uint8_t const *const p_uuid_le
)

Encodes sd_ble_uuid_encode command response.

See Also
ble_uuid_encode_req_dec for request decoding.
Parameters
[in] return_code Return code indicating if command was successful or not.
[out] p_buf Pointer to buffer where encoded data command response will be returned.
[in,out] p_buf_len in: size of p_buf buffer. out: Length of encoded command response packet.
[in] uuid_le_len Length of the encoded UUID.
[in] p_uuid_le Pointer to the buffer with encoded UUID.
Return values
NRF_SUCCESS Encoding success.
NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
uint32_t ble_uuid_vs_add_req_dec ( uint8_t const *const p_buf ,
uint16_t packet_len ,
ble_uuid128_t **const pp_uuid ,
uint8_t **const pp_uuid_type
)

Decodes sd_ble_uuid_vs_add command request.

See Also
ble_uuid_vs_add_rsp_enc for response encoding.
Parameters
[in] p_buf Pointer to beginning of command request packet.
[in] packet_len Length (in bytes) of response packet.
[out] pp_uuid Pointer to pointer to UUID. It will be set to NULL if p_uuid is not present in the packet.
[out] pp_uuid_type Pointer to pointer to UUID type. It will be set to NULL if p_uuid_type is not present in the packet.
Return values
NRF_SUCCESS Decoding success.
NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
uint32_t ble_uuid_vs_add_rsp_enc ( uint32_t return_code ,
uint8_t *const p_buf ,
uint32_t *const p_buf_len ,
uint8_t const *const p_uuid_type
)

Encodes sd_ble_uuid_vs_add command response.

See Also
ble_uuid_vs_add_req_dec for request decoding.
Parameters
[in] return_code Return code indicating if command was successful or not.
[out] p_buf Pointer to buffer where encoded data command response will be returned.
[in,out] p_buf_len in: size of p_buf buffer. out: Length of encoded command response packet.
[in] p_uuid_type Pointer to the UUID type.
Return values
NRF_SUCCESS Encoding success.
NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
uint32_t ble_version_get_req_dec ( uint8_t const *const p_buf ,
uint16_t packet_len ,
ble_version_t **const pp_version
)

Decodes sd_ble_version_get command request.

See Also
ble_version_get_rsp_enc for response encoding.
Parameters
[in] p_buf Pointer to beginning of command request packet.
[in] packet_len Length (in bytes) of response packet.
[out] pp_version Pointer to pointer to ble_version_t address.
Return values
NRF_SUCCESS Decoding success.
NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
uint32_t ble_version_get_rsp_enc ( uint32_t return_code ,
uint8_t *const p_buf ,
uint32_t *const p_buf_len ,
ble_version_t const *const p_version
)

Encodes sd_ble_version_get command response.

See Also
ble_version_get_req_dec for request decoding.
Parameters
[in] return_code Return code indicating if command was successful or not.
[out] p_buf Pointer to buffer where encoded data command response will be returned.
[in,out] p_buf_len in: size of p_buf buffer. out: Length of encoded command response packet.
[in] p_version Pointer to ble_version_t address.
Return values
NRF_SUCCESS Encoding success.
NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.