nRF51 SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
0xA6 - sd_ble_gatts_hvx

Function packet format

Frame format encoding of the sd_ble_gatts_hvx packet.

Operation Code = 0xA6 (166) for sd_ble_gatts_hvx, see BLE_GATTS_SVCS.

The parameters provided as input to sd_ble_gatts_hvx are encoded in the following order:

- 1 byte: Operation Code, Value = 0xA6 (166)
- 2 bytes:Connection Handle
- 1 byte:HVX Parameters Present
0x00 if p_hvx_params is a NULL pointer
0x01 otherwise
- 7 ... n bytes:ble_gatts_hvx_params_t Conditional: HVX Parameters


As shown in Figure 1, the data inside ble_gatts_hvx_params_t are encoded as:

- 2 bytes:ble_gatts_hvx_params_t::handle Characteristic Value Handle
- 1 byte: ble_gatts_hvx_params_t::type Indication or Notification, see GATT Handle Value operations
- 2 bytes:ble_gatts_hvx_params_t::offset Offset Value
- 1 byte:Data Length Field Present
0x00 if p_len is a NULL pointer
0x01 otherwise
- 2 bytes:ble_gatts_hvx_params_t::p_len Conditional: Length of Data
- 1 byte:Data Present
0x00 if p_ is a NULL pointer
0x01 otherwise
- 0 ... n bytes:ble_gatts_hvx_params_t::p_data Conditional: Data Content
The number 'n' of bytes encoded in the packet is defined in the Data Length field.


hvx_packet.png
Figure 1: Packet format for sd_ble_gatts_hvx function.


Response packet format

Frame format encoding of the sd_ble_gatts_hvx response packet.

In case of an error, the following data is encoded:

- 1 byte:Operation Code, Value = 0xA6 (166)
- 4 byte:nRF Error Code


default_error_response_packet.png
Figure 2: Packet format for sd_ble_gatts_hvx error response.

In case of a successful command, i.e. 'nRF Error Code' = NRF_SUCCESS, the following data is encoded:

- 1 byte:Operation Code, Value = 0xA6 (166)
- 4 bytes:nRF Error Code
- 2 bytes:Number of Data written, if 'nRF Error Code' is NRF_SUCCESS
Otherwise nothing is encoded.


hvx_resp_packet.png
Figure 3: Packet format sd_ble_gatts_hvx response packet.