nRF51 SDK
|
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. |
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 |
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. |