nRF51 SDK - S110 SoftDevice
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
GATTS Application command request encoders and command response decoders

GATTS Application command request encoders and command response decoders. More...

Functions

uint32_t ble_gatts_value_get_req_enc (uint16_t handle, uint16_t offset, uint16_t const *const p_value_len, uint8_t const *const p_value, uint8_t *const p_buf, uint32_t *const p_buf_len)
 Encodes sd_ble_gatts_value_get command request. More...
 
uint32_t ble_gatts_value_get_rsp_dec (uint8_t const *const p_buf, uint32_t packet_len, uint8_t **const pp_value, uint16_t **const pp_value_len, uint32_t *const p_result_code)
 Decodes response to sd_ble_gatts_value_get command. More...
 
uint32_t ble_gatts_hvx_req_enc (uint16_t conn_handle, ble_gatts_hvx_params_t const *const p_hvx_params, uint8_t *const p_buf, uint32_t *const p_buf_len)
 Encodes sd_ble_gatts_hvx command request. More...
 
uint32_t ble_gatts_hvx_rsp_dec (uint8_t const *const p_buf, uint32_t packet_len, uint32_t *const p_result_code, uint16_t **const pp_bytes_written)
 Decodes response to sd_ble_gatts_hvx command. More...
 
uint32_t ble_gatts_characteristic_add_req_enc (uint16_t service_handle, ble_gatts_char_md_t const *const p_char_md, ble_gatts_attr_t const *const p_attr_char_value, ble_gatts_char_handles_t const *const p_handles, uint8_t *const p_buf, uint32_t *const p_buf_len)
 Encodes sd_ble_gatts_characteristic_add command request. More...
 
uint32_t ble_gatts_characteristic_add_rsp_dec (uint8_t const *const p_buf, uint32_t packet_len, uint16_t **const pp_handles, uint32_t *const p_result_code)
 Decodes response to sd_ble_gatts_characteristic_add command. More...
 
uint32_t ble_gatts_service_add_req_enc (uint8_t type, ble_uuid_t const *const p_uuid, uint16_t const *const p_conn_handle, uint8_t *const p_buf, uint32_t *const p_buf_len)
 Encodes sd_ble_gatts_service_add command request. More...
 
uint32_t ble_gatts_service_add_rsp_dec (uint8_t const *const p_buf, uint32_t packet_len, uint16_t *const p_conn_handle, uint32_t *const p_result_code)
 Decodes response to sd_ble_gatts_service_add command. More...
 
uint32_t ble_gatts_sys_attr_set_req_enc (uint16_t conn_handle, uint8_t const *const p_sys_attr_data, uint16_t sys_attr_data_len, uint8_t *const p_buf, uint32_t *const p_buf_len)
 Encodes sd_ble_gatts_sys_attr_set command request. More...
 
uint32_t ble_gatts_sys_attr_set_rsp_dec (uint8_t const *const p_buf, uint32_t packet_len, uint32_t *const p_result_code)
 Decodes response to sd_ble_gatts_sys_attr_set command. More...
 
uint32_t ble_gatts_value_set_req_enc (uint16_t handle, uint16_t offset, uint16_t *const p_value_len, uint8_t const *const p_value, uint8_t *const p_buf, uint32_t *const p_buf_len)
 Encodes sd_ble_gatts_value_set command request. More...
 
uint32_t ble_gatts_value_set_rsp_dec (uint8_t const *const p_buf, uint32_t packet_len, uint16_t *const p_value_len, uint32_t *const p_result_code)
 Decodes response to sd_ble_gatts_value_set command. More...
 
uint32_t ble_gatts_sys_attr_get_req_enc (uint16_t conn_handle, uint8_t const *const p_sys_attr_data, uint16_t const *const p_sys_attr_data_len, uint8_t *const p_buf, uint32_t *p_buf_len)
 Encodes sd_ble_gatts_sys_attr_get command request. More...
 
uint32_t ble_gatts_sys_attr_get_rsp_dec (uint8_t const *const p_buf, uint32_t packet_len, uint8_t *const p_sys_attr_data, uint16_t *const p_sys_attr_data_len, uint32_t *const p_result_code)
 Decodes response to sd_ble_gatts_sys_attr_get command. More...
 
uint32_t ble_gatts_descriptor_add_req_enc (uint16_t char_handle, ble_gatts_attr_t const *const p_attr, uint16_t *const p_handle, uint8_t *const p_buf, uint32_t *const p_buf_len)
 Encodes sd_ble_gatts_descriptor_add command request. More...
 
uint32_t ble_gatts_descriptor_add_rsp_dec (uint8_t const *const p_buf, uint32_t packet_len, uint16_t *const p_handle, uint32_t *const p_result_code)
 Decodes response to sd_ble_gatts_descriptor_add command. More...
 
uint32_t ble_gatts_include_add_req_enc (uint16_t service_handle, uint16_t inc_srvc_handle, uint16_t *const p_include_handle, uint8_t *const p_buf, uint32_t *const p_buf_len)
 Encodes sd_ble_gatts_include_add command request. More...
 
uint32_t ble_gatts_include_add_rsp_dec (uint8_t const *const p_buf, uint32_t packet_len, uint16_t *const p_include_handle, uint32_t *const p_result_code)
 Decodes response to sd_ble_gatts_include_add command. More...
 
uint32_t ble_gatts_rw_authorize_reply_req_enc (uint16_t conn_handle, ble_gatts_rw_authorize_reply_params_t const *const p_reply_params, uint8_t *const p_buf, uint32_t *const p_buf_len)
 Encodes sd_ble_gatts_rw_authorize_reply command request. More...
 
uint32_t ble_gatts_rw_authorize_reply_rsp_dec (uint8_t const *const p_buf, uint32_t packet_len, uint32_t *const p_result_code)
 Decodes response to sd_ble_gatts_rw_authorize_reply command. More...
 
uint32_t ble_gatts_service_changed_req_enc (uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint8_t *const p_buf, uint32_t *const p_buf_len)
 Encodes sd_ble_gatts_service_changed command request. More...
 
uint32_t ble_gatts_service_changed_rsp_dec (uint8_t const *const p_buf, uint32_t packet_len, uint32_t *const p_result_code)
 Decodes response to sd_ble_gatts_service_changed command. More...
 

Detailed Description

GATTS Application command request encoders and command response decoders.

Function Documentation

uint32_t ble_gatts_characteristic_add_req_enc ( uint16_t  service_handle,
ble_gatts_char_md_t const *const  p_char_md,
ble_gatts_attr_t const *const  p_attr_char_value,
ble_gatts_char_handles_t const *const  p_handles,
uint8_t *const  p_buf,
uint32_t *const  p_buf_len 
)

Encodes sd_ble_gatts_characteristic_add command request.

See Also
0xA2 - sd_ble_gatts_characteristic_add for packet format, ble_gatts_characteristic_add_rsp_dec for command response decoder.
Parameters
[in]service_handleHandle of the service where the characteristic is to be placed. If BLE_GATT_HANDLE_INVALID is used, it will be placed sequentially.
[in]p_char_mdPointer to a ble_gatts_char_md_t structure, characteristic metadata.
[in]p_attr_char_valuePointer to a ble_gatts_attr_t structure, corresponding to the characteristic value.
[in]p_handlesPointer to a ble_gatts_char_handles_t structure, where the assigned handles will be stored.
[in]p_bufPointer to buffer where encoded data command will be returned.
[in,out]p_buf_lenin: Size of p_buf buffer. out: Length of encoded command packet.
Note
p_handles will not be updated by the command request encoder. Updated values are set by ble_gatts_characteristic_add_rsp_dec.
Return values
NRF_SUCCESSEncoding success.
NRF_ERROR_NULLEncoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTHEncoding failure. Incorrect buffer length.
uint32_t ble_gatts_characteristic_add_rsp_dec ( uint8_t const *const  p_buf,
uint32_t  packet_len,
uint16_t **const  pp_handles,
uint32_t *const  p_result_code 
)

Decodes response to sd_ble_gatts_characteristic_add command.

See Also
0xA2 - sd_ble_gatts_characteristic_add for packet format, ble_gatts_characteristic_add_req_enc for command request encoder.
Parameters
[in]p_bufPointer to beginning of command response packet.
[in]packet_lenLength (in bytes) of response packet.
[out]pp_handlesPointer to pointer to location where handles should be decoded.
[out]p_result_codePointer to command result code decode location.
Return values
NRF_SUCCESSDecoding success.
NRF_ERROR_NULLDecoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTHDecoding failure. Incorrect buffer length.
NRF_ERROR_INVALID_DATADecoding failure. Decoded operation code does not match expected operation code.
uint32_t ble_gatts_descriptor_add_req_enc ( uint16_t  char_handle,
ble_gatts_attr_t const *const  p_attr,
uint16_t *const  p_handle,
uint8_t *const  p_buf,
uint32_t *const  p_buf_len 
)

Encodes sd_ble_gatts_descriptor_add command request.

See Also
0xA3 - sd_ble_gatts_descriptor_add for packet format, ble_gatts_descriptor_add_rsp_dec for command response decoder.
Parameters
[in]char_handleHandle of the characteristic where the description is to be placed. If BLE_GATT_HANDLE_INVALID is used, it will be placed sequentially.
[in]p_attr_mdPointer to a ble_gatts_attr_t structure, characteristic metadata.
[in]p_handlePointer to a ble_gatts_char_handles_t structure, where the assigned handles will be stored.
[in]p_bufPointer to buffer where encoded data command will be returned.
[in,out]p_buf_lenin: Size of p_buf buffer. out: Length of encoded command packet.
Return values
NRF_SUCCESSEncoding success.
NRF_ERROR_NULLEncoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTHEncoding failure. Incorrect buffer length.
uint32_t ble_gatts_descriptor_add_rsp_dec ( uint8_t const *const  p_buf,
uint32_t  packet_len,
uint16_t *const  p_handle,
uint32_t *const  p_result_code 
)

Decodes response to sd_ble_gatts_descriptor_add command.

See Also
0xA3 - sd_ble_gatts_descriptor_add for packet format, ble_gatts_descriptor_add_req_enc for command request encoder.
Parameters
[in]p_bufPointer to beginning of command response packet.
[in]packet_lenLength (in bytes) of response packet.
[out]p_handlePointer to bufer where descriptor handle will be returned.
[out]p_result_codePointer to command result code decode location.
Return values
NRF_SUCCESSDecoding success.
NRF_ERROR_NULLDecoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTHDecoding failure. Incorrect buffer length.
NRF_ERROR_INVALID_DATADecoding failure. Decoded operation code does not match expected operation code.
uint32_t ble_gatts_hvx_req_enc ( uint16_t  conn_handle,
ble_gatts_hvx_params_t const *const  p_hvx_params,
uint8_t *const  p_buf,
uint32_t *const  p_buf_len 
)

Encodes sd_ble_gatts_hvx command request.

See Also
0xA6 - sd_ble_gatts_hvx for packet format, ble_gatts_hvx_rsp_dec for command response decoder.
Parameters
[in]conn_handleConnection handle.
[in]p_hvx_paramsPointer to an HVx parameters structure to be encoded.
[in]p_bufPointer to buffer where encoded data command will be returned.
[in,out]p_buf_lenin: Size of p_buf buffer. out: Length of encoded command packet.
Note
p_hvx_params will not be updated by the command request encoder. Updated values are set by ble_gatts_hvx_rsp_dec.
Return values
NRF_SUCCESSEncoding success.
NRF_ERROR_NULLEncoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTHEncoding failure. Incorrect buffer length.
uint32_t ble_gatts_hvx_rsp_dec ( uint8_t const *const  p_buf,
uint32_t  packet_len,
uint32_t *const  p_result_code,
uint16_t **const  pp_bytes_written 
)

Decodes response to sd_ble_gatts_hvx command.

See Also
0xA6 - sd_ble_gatts_hvx for packet format, ble_gatts_hvx_req_enc for command request encoder.
Parameters
[in]p_bufPointer to beginning of command response packet.
[in]packet_lenLength (in bytes) of response packet.
[out]p_result_codeCommand result code.
[out]pp_bytes_writtenPointer to pointer to location where number of bytes is written.
Return values
NRF_SUCCESSDecoding success.
NRF_ERROR_NULLDecoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTHDecoding failure. Incorrect buffer length.
NRF_ERROR_INVALID_DATADecoding failure. Decoded operation code does not match expected operation code.
uint32_t ble_gatts_include_add_req_enc ( uint16_t  service_handle,
uint16_t  inc_srvc_handle,
uint16_t *const  p_include_handle,
uint8_t *const  p_buf,
uint32_t *const  p_buf_len 
)

Encodes sd_ble_gatts_include_add command request.

See Also
nrf51_include_add_encoding for packet format, ble_gatts_include_add_rsp_dec for command response decoder.
Parameters
[in]service_handleHandle of the service where the included service is to be placed.
[in]inc_srvc_handleHandle of the included service
[in]p_include_handlePointer to Pointer to a 16-bit word where the assigned handle will be stored.
[in]p_bufPointer to buffer where encoded data command will be returned.
[in,out]p_buf_lenin: Size of p_buf buffer. out: Length of encoded command packet.
Return values
NRF_SUCCESSEncoding success.
NRF_ERROR_NULLEncoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTHEncoding failure. Incorrect buffer length.
uint32_t ble_gatts_include_add_rsp_dec ( uint8_t const *const  p_buf,
uint32_t  packet_len,
uint16_t *const  p_include_handle,
uint32_t *const  p_result_code 
)

Decodes response to sd_ble_gatts_include_add command.

See Also
nrf51_include_add_encoding for packet format, ble_gatts_include_add_req_enc for command request encoder.
Parameters
[in]p_bufPointer to beginning of command response packet.
[in]packet_lenLength (in bytes) of response packet.
[out]p_include_handlePointer to a 16-bit word where the assigned handle will be stored.
[out]p_result_codePointer to command result code decode location.
Return values
NRF_SUCCESSDecoding success.
NRF_ERROR_NULLDecoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTHDecoding failure. Incorrect buffer length.
NRF_ERROR_INVALID_DATADecoding failure. Decoded operation code does not match expected operation code.
uint32_t ble_gatts_rw_authorize_reply_req_enc ( uint16_t  conn_handle,
ble_gatts_rw_authorize_reply_params_t const *const  p_reply_params,
uint8_t *const  p_buf,
uint32_t *const  p_buf_len 
)

Encodes sd_ble_gatts_rw_authorize_reply command request.

See Also
0xA8 - sd_ble_gatts_rw_authorize_reply for packet format, ble_gatts_rw_authorize_reply_rsp_dec for command response decoder.
Parameters
[in]conn_handleConnection handle.
[in]p_reply_paramsPointer to ble_gatts_rw_authorize_reply_params_t
[in]p_bufPointer to buffer where encoded data command will be returned.
[in,out]p_buf_lenin: Size of p_buf buffer. out: Length of encoded command packet.
Return values
NRF_SUCCESSEncoding success.
NRF_ERROR_NULLEncoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTHEncoding failure. Incorrect buffer length.
NRF_ERROR_INVALID_PARAMEncoding failure. Invalid param provided in p_reply_params.
uint32_t ble_gatts_rw_authorize_reply_rsp_dec ( uint8_t const *const  p_buf,
uint32_t  packet_len,
uint32_t *const  p_result_code 
)

Decodes response to sd_ble_gatts_rw_authorize_reply command.

See Also
0xA8 - sd_ble_gatts_rw_authorize_reply for packet format, ble_gatts_rw_authorize_reply_req_enc for command request encoder.
Parameters
[in]p_bufPointer to beginning of command response packet.
[in]packet_lenLength (in bytes) of response packet.
[out]p_result_codeCommand result code.
Return values
NRF_SUCCESSDecoding success.
NRF_ERROR_NULLDecoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTHDecoding failure. Incorrect buffer length.
NRF_ERROR_INVALID_DATADecoding failure. Decoded operation code does not match expected operation code.
uint32_t ble_gatts_service_add_req_enc ( uint8_t  type,
ble_uuid_t const *const  p_uuid,
uint16_t const *const  p_conn_handle,
uint8_t *const  p_buf,
uint32_t *const  p_buf_len 
)

Encodes sd_ble_gatts_service_add command request.

See Also
0xA0 - sd_ble_gatts_service_add for packet format, ble_gatts_service_add_rsp_dec for command response decoder.
Parameters
[in]typeToggles between primary and secondary services, see BLE_GATTS_SRVC_TYPES.
[in]p_uuidPointer to service UUID.
[in]p_conn_handlePointer to a 16-bit word where the assigned handle will be stored.
[in]p_bufPointer to buffer where encoded data command will be returned.
[in,out]p_buf_lenin: Size of p_buf buffer. out: Length of encoded command packet.
Note
p_conn_handle will not be updated by the command request encoder. Updated values are set by ble_gatts_service_add_rsp_dec.
Return values
NRF_SUCCESSEncoding success.
NRF_ERROR_NULLEncoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTHEncoding failure. Incorrect buffer length.
uint32_t ble_gatts_service_add_rsp_dec ( uint8_t const *const  p_buf,
uint32_t  packet_len,
uint16_t *const  p_conn_handle,
uint32_t *const  p_result_code 
)

Decodes response to sd_ble_gatts_service_add command.

See Also
0xA0 - sd_ble_gatts_service_add for packet format, ble_gatts_service_add_req_enc for command request encoder.
Parameters
[in]p_bufPointer to beginning of command response packet.
[in]packet_lenLength (in bytes) of response packet.
[out]p_conn_handleConnection handle.
[out]p_result_codeCommand result code.
Return values
NRF_SUCCESSDecoding success.
NRF_ERROR_NULLDecoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTHDecoding failure. Incorrect buffer length.
NRF_ERROR_INVALID_DATADecoding failure. Decoded operation code does not match expected operation code.
uint32_t ble_gatts_service_changed_req_enc ( uint16_t  conn_handle,
uint16_t  start_handle,
uint16_t  end_handle,
uint8_t *const  p_buf,
uint32_t *const  p_buf_len 
)

Encodes sd_ble_gatts_service_changed command request.

See Also
nrf51_gatts_service_chhanged_encoding for packet format, ble_gatts_service_changed_rsp_dec for command response decoder.
Parameters
[in]conn_handleConnection handle.
[in]start_handleStart of affected attribute handle range.
[in]end_handleEnd of affected attribute handle range.
[in]p_bufPointer to buffer where encoded data command will be returned.
[in,out]p_buf_lenin: Size of p_buf buffer. out: Length of encoded command packet.
Return values
NRF_SUCCESSEncoding success.
NRF_ERROR_NULLEncoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTHEncoding failure. Incorrect buffer length.
NRF_ERROR_INVALID_PARAMEncoding failure. Invalid param provided in p_reply_params.
uint32_t ble_gatts_service_changed_rsp_dec ( uint8_t const *const  p_buf,
uint32_t  packet_len,
uint32_t *const  p_result_code 
)

Decodes response to sd_ble_gatts_service_changed command.

See Also
nrf51_gatts_service_changed_encoding for packet format, ble_gatts_service_changed_req_enc for command request encoder.
Parameters
[in]p_bufPointer to beginning of command response packet.
[in]packet_lenLength (in bytes) of response packet.
[out]p_result_codeCommand result code.
Return values
NRF_SUCCESSDecoding success.
NRF_ERROR_NULLDecoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTHDecoding failure. Incorrect buffer length.
NRF_ERROR_INVALID_DATADecoding failure. Decoded operation code does not match expected operation code.
uint32_t ble_gatts_sys_attr_get_req_enc ( uint16_t  conn_handle,
uint8_t const *const  p_sys_attr_data,
uint16_t const *const  p_sys_attr_data_len,
uint8_t *const  p_buf,
uint32_t *  p_buf_len 
)

Encodes sd_ble_gatts_sys_attr_get command request.

See Also
0xAA - sd_ble_gatts_sys_attr_get for packet format, ble_gatts_sys_attr_get_rsp_dec for command response decoder.
Parameters
[in]conn_handleConnection handle of the connection.
[in]p_sys_attr_dataPointer to buffer where updated information about system attributes will be stored. Can be NULL to calculate required size.
[in]p_sys_attr_data_lenSize of p_sys_attr_data buffer if p_sys_attr_data is not NULL.
[in,out]p_bufPointer to buffer where encoded data command will be returned.
[in,out]p_buf_lenin: size of p_buf buffer. out: Length of encoded command packet.
Note
p_sys_attr_data and p_sys_attr_data_len will not be updated by the command request encoder. Updated values are set by ble_gatts_sys_attr_get_rsp_dec.
Return values
NRF_SUCCESSEncoding success.
NRF_ERROR_NULLEncoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTHEncoding failure. Incorrect buffer length.
uint32_t ble_gatts_sys_attr_get_rsp_dec ( uint8_t const *const  p_buf,
uint32_t  packet_len,
uint8_t *const  p_sys_attr_data,
uint16_t *const  p_sys_attr_data_len,
uint32_t *const  p_result_code 
)

Decodes response to sd_ble_gatts_sys_attr_get command.

See Also
0xAA - sd_ble_gatts_sys_attr_get for packet format, ble_gatts_sys_attr_get_req_enc for command request encoder.
Parameters
[in]p_bufPointer to beginning of command response packet.
[in]packet_lenLength (in bytes) of response packet.
[out]p_sys_attr_dataPointer to a buffer where updated information about system attributes will be stored.
[in,out]p_sys_attr_data_lenin: Size (in bytes) of p_sys_attr_data buffer. out: Length of decoded contents of p_sys_attr_data.
[out]p_result_codeCommand result code.
Return values
NRF_SUCCESSDecoding success.
NRF_ERROR_NULLDecoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTHDecoding failure. Incorrect buffer length.
NRF_ERROR_DATA_SIZELength of p_sys_attr_data is too small to hold decoded value from response.
NRF_ERROR_INVALID_DATADecoding failure. Decoded operation code does not match expected operation code.
uint32_t ble_gatts_sys_attr_set_req_enc ( uint16_t  conn_handle,
uint8_t const *const  p_sys_attr_data,
uint16_t  sys_attr_data_len,
uint8_t *const  p_buf,
uint32_t *const  p_buf_len 
)

Encodes sd_ble_gatts_sys_attr_set command request.

See Also
0xA9 - sd_ble_gatts_sys_attr_set for packet format, ble_gatts_sys_attr_set_rsp_dec for command response decoder.
Parameters
[in]conn_handleConnection handle.
[in]p_sys_attr_dataPointer to a buffer (at least sys_attr_data_len bytes long) containing the attribute value to write.
[in]sys_attr_data_lenLength (in bytes) of p_sys_attr_data.
[in]p_bufPointer to buffer where encoded data command will be returned.
[in,out]p_buf_lenin: Size of p_buf buffer. out: Length of encoded command packet.
Return values
NRF_SUCCESSEncoding success.
NRF_ERROR_NULLEncoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTHEncoding failure. Incorrect buffer length.
uint32_t ble_gatts_sys_attr_set_rsp_dec ( uint8_t const *const  p_buf,
uint32_t  packet_len,
uint32_t *const  p_result_code 
)

Decodes response to sd_ble_gatts_sys_attr_set command.

See Also
0xA9 - sd_ble_gatts_sys_attr_set for packet format, ble_gatts_sys_attr_set_req_enc for command request encoder.
Parameters
[in]p_bufPointer to beginning of command response packet.
[in]packet_lenLength (in bytes) of response packet.
[out]p_result_codeCommand result code.
Return values
NRF_SUCCESSDecoding success.
NRF_ERROR_NULLDecoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTHDecoding failure. Incorrect buffer length.
NRF_ERROR_INVALID_DATADecoding failure. Decoded operation code does not match expected operation code.
uint32_t ble_gatts_value_get_req_enc ( uint16_t  handle,
uint16_t  offset,
uint16_t const *const  p_value_len,
uint8_t const *const  p_value,
uint8_t *const  p_buf,
uint32_t *const  p_buf_len 
)

Encodes sd_ble_gatts_value_get command request.

See Also
nrf51_value_get_encoding for packet format, ble_gatts_value_get_rsp_dec for command response decoder.
Parameters
[in]handleAttribute handle.
[in]offsetOffset in bytes to read from.
[in]p_valuePointer to buffer where the requested value will be stored. Can be NULL to calculate required size.
[in]p_value_lenSize of p_value buffer if p_value is not NULL.
[in]p_bufPointer to buffer where encoded data command will be returned.
[in,out]p_buf_lenin: Size of p_buf buffer. out: Length of encoded command packet.
Note
p_data_len and p_data will not be updated by the command request encoder. Updated values are set by ble_gatts_value_get_rsp_dec.
Return values
NRF_SUCCESSEncoding success.
NRF_ERROR_NULLEncoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTHEncoding failure. Incorrect buffer length.
uint32_t ble_gatts_value_get_rsp_dec ( uint8_t const *const  p_buf,
uint32_t  packet_len,
uint8_t **const  pp_value,
uint16_t **const  pp_value_len,
uint32_t *const  p_result_code 
)

Decodes response to sd_ble_gatts_value_get command.

See Also
nrf51_value_get_encoding for packet format, ble_gatts_value_get_req_enc for command request encoder.
Parameters
[in]p_bufPointer to beginning of command response packet.
[in]packet_lenLength (in bytes) of response packet.
[out]pp_valuePointer to pointera buffer where the requested value will be stored.
[in,out]pp_value_lenin: Size (in bytes) of p_value buffer. out: Length of decoded contents of p_value.
[out]p_result_codeCommand result code.
Return values
NRF_SUCCESSDecoding success.
NRF_ERROR_NULLDecoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTHDecoding failure. Incorrect buffer length.
NRF_ERROR_DATA_SIZELength of p_value is too small to hold decoded value from response.
uint32_t ble_gatts_value_set_req_enc ( uint16_t  handle,
uint16_t  offset,
uint16_t *const  p_value_len,
uint8_t const *const  p_value,
uint8_t *const  p_buf,
uint32_t *const  p_buf_len 
)

Encodes sd_ble_gatts_value_set command request.

See Also
0xA4 - sd_ble_gatts_value_set for packet format, ble_gatts_value_set_rsp_dec for command response decoder.
Parameters
[in]handleAttribute handle.
[in]offsetOffset (in bytes) to write from.
[in]p_value_lenPointer to length (in bytes) of p_value.
[in]p_valuePointer to a buffer (at least value_len bytes long) containing the attribute value to write.
[in]p_bufPointer to buffer where encoded data command will be returned.
[in,out]p_buf_lenin: Size of p_buf buffer. out: Length of encoded command packet.
Return values
NRF_SUCCESSEncoding success.
NRF_ERROR_NULLEncoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTHEncoding failure. Incorrect buffer length.
uint32_t ble_gatts_value_set_rsp_dec ( uint8_t const *const  p_buf,
uint32_t  packet_len,
uint16_t *const  p_value_len,
uint32_t *const  p_result_code 
)

Decodes response to sd_ble_gatts_value_set command.

See Also
0xA4 - sd_ble_gatts_value_set for packet format, ble_gatts_value_set_req_enc for command request encoder.
Parameters
[in]p_bufPointer to beginning of command response packet.
[in]packet_lenLength (in bytes) of response packet.
[out]p_value_lenLength (in bytes) written.
[out]p_result_codeCommand result code.
Return values
NRF_SUCCESSDecoding success.
NRF_ERROR_NULLDecoding failure. NULL pointer supplied.
NRF_ERROR_INVALID_LENGTHDecoding failure. Incorrect buffer length.
NRF_ERROR_INVALID_DATADecoding failure. Decoded operation code does not match expected operation code.