nRF51 SDK - S110 SoftDevice
|
Frame format encoding of the sd_ble_gatts_service_add packet.
The parameters are encoded in the following order:
Length | Parameter | Value |
---|---|---|
1 byte | Operation Code | 0xA0, see BLE_GATTS_SVCS |
1 byte | Service Type | see GATT Server Service Types |
1 byte | UUID Present | 0x00 Field not present, 0x01 Field present |
3 bytes | UUID | see ble_uuid_t |
1 byte | Handle Present | 0x00 Field not present, 0x01 Field present |
As can also be seen inside Figure 1 the 3 bytes inside ble_uuid_t are encoded as:
Length | Parameter | Value |
---|---|---|
2 bytes | UUID | see ble_uuid_t::uuid |
1 byte | UUID Type | see ble_uuid_t::type |
In case of a successful command, i.e. 'nRF Error Code' = NRF_SUCCESS
nRF Error Code is followed by conditional data.
Frame format encoding of the sd_ble_gatts_service_add response packet:
Length | Parameter | Value |
---|---|---|
1 byte | Operation Code | 0xA0, see BLE_GATTS_SVCS |
4 bytes | nRF Error Code | see sd_ble_gatts_service_add |
2 bytes | Conditional: Handle Value | see sd_ble_gatts_service_add |
Frame format encoding of the sd_ble_gatts_include_add packet.
The parameters are encoded in the following order:
Length | Parameter | Value |
---|---|---|
1 byte | Operation Code | 0xA1, see BLE_GATTS_SVCS |
2 bytes | Service Handle | see sd_ble_gatts_include_add |
2 bytes | Include Service Handle | see sd_ble_gatts_include_add |
1 byte | Include Handle Present | 0x00 Field not present, 0x01 Field present |
In case of a successful command, i.e. 'nRF Error Code' = NRF_SUCCESS
nRF Error Code is followed by conditional data.
Frame format encoding of the sd_ble_gatts_include_add response packet:
Length | Parameter | Value |
---|---|---|
1 byte | Operation Code | 0xA1, see BLE_GATTS_SVCS |
4 bytes | nRF Error Code | see sd_ble_gatts_include_add |
2 bytes | Conditional: Handle Value | see sd_ble_gatts_include_add |
Frame format encoding of the sd_ble_gatts_characteristic_add packet.
The parameters are encoded in the following order:
Length | Parameter | Value |
---|---|---|
1 byte | Operation Code | 0xA2, see BLE_GATTS_SVCS |
2 bytes | Service Handle | Service handle |
1 byte | Metadata Present | 0x00 - Not Present, 0x01 - Present |
11..539 bytes | Conditional: Characteristic Metadata | see ble_gatts_char_md_t |
1 byte | Characteristic Attribute Present | 0x00 - Not Present, 0x01 - Present |
9..527 bytes | Conditional: Characteristic Attribute | see ble_gatts_attr_t |
1 byte | Handles Present | 0x00 - Not Present, 0x01 - Present on Application Chip |
Length | Parameter | Value |
---|---|---|
1 byte | Characteristic Properties | see ble_gatt_char_props_t |
1 byte | Characteristic Extended Properties | see ble_gatt_char_ext_props_t |
2 bytes | User Descriptor Maximum Size | see ble_gatts_char_md_t::char_user_desc_max_size |
2 bytes | User Descriptor Size | see ble_gatts_char_md_t::char_user_desc_size |
1 byte | User Descriptor Present | 0x00 - Not Present, 0x01 - Present |
0..512 bytes | User Descriptor | see ble_gatts_char_md_t::p_char_user_desc |
1 byte | Presentation Format Structure Present | 0x00 - Not Present, 0x01 - Present |
7 bytes | Presentation Format Structure | see ble_gatts_char_pf_t |
1 byte | Attribute Metadata User Description Present | 0x00 - Not Present, 0x01 - Present |
3 bytes | Attribute Metadata User Description | see ble_gatts_attr_md_t |
1 byte | Attribute metadata for the Client Characteristic Configuration Present | 0x00 - Not Present, 0x01 - Present |
3 bytes | Attribute metadata for the Client Characteristic Configuration | see ble_gatts_attr_md_t |
1 byte | Attribute metadata for the Server Characteristic Configuration Present | 0x00 - Not Present, 0x01 - Present |
3 bytes | Attribute metadata for the Server Characteristic Configuration Description | see ble_gatts_attr_md_t |
Length | Parameter | Value |
---|---|---|
bit 0 | broadcast | see ble_gatt_char_props_t::broadcast |
bit 1 | read | see ble_gatt_char_props_t::read |
bit 2 | write_wo_resp | see ble_gatt_char_props_t::write_wo_resp |
bit 3 | write | see ble_gatt_char_props_t::write |
bit 4 | notify | see ble_gatt_char_props_t::notify |
bit 5 | indicate | see ble_gatt_char_props_t::indicate |
bit 6 | auth_signed_wr | see ble_gatt_char_props_t::auth_signed_wr |
bit 7 | not used | not used |
Length | Parameter | Value |
---|---|---|
bit 0 | reliable_wr | see ble_gatt_char_ext_props_t::reliable_wr |
bit 1 | wr_aux | see ble_gatt_char_ext_props_t::wr_aux |
bit 2..7 | not used | not used |
Length | Parameter | Value |
---|---|---|
1 byte | format | see ble_gatts_char_pf_t::format |
1 byte | exponent | see ble_gatts_char_pf_t::exponent |
2 bytes | unit | see ble_gatts_char_pf_t::unit |
1 byte | name_space | see ble_gatts_char_pf_t::name_space |
2 bytes | desc | see ble_gatts_char_pf_t::desc |
For User Descriptor, CCCD, and SCCD descriptor the Metadata field is encoded in the following order:
Length | Parameter | Value |
---|---|---|
1 byte | read_perm | see ble_gatts_attr_md_t::read_perm |
1 byte | write_perm | see ble_gatts_attr_md_t::write_perm |
1 byte | Bit attributes | see ble_gatts_attr_md_t |
Read and write permissions are encoded in following order:
Length | Parameter | Value |
---|---|---|
bit 0..3 | sm | see ble_gap_conn_sec_mode_t::sm |
bit 4..7 | lv | see ble_gap_conn_sec_mode_t::lv |
Bit attributes are encoded in following order:
Length | Parameter | Value |
---|---|---|
bit 0 | vlen | see ble_gatts_attr_md_t::vlen |
bit 1..2 | vloc | see ble_gatts_attr_md_t::vloc |
bit 3 | rd_auth | see ble_gatts_attr_md_t::rd_auth |
bit 4 | wr_auth | see ble_gatts_attr_md_t::wr_auth |
bit 5..7 | not used | not used |
Note that ble_gatts_attr_t::init_len is relocated in the serialized structure in order to have length field preceeding data field.
Length | Parameter | Value |
---|---|---|
1 byte | UUID Present | 0x00 - Not Present, 0x01 - Present |
3 bytes | Conditional: UUID | see ble_gatts_attr_t::p_uuid |
1 byte | Attribute Metadata Present | 0x00 - Not Present, 0x01 - Present |
3 bytes | Conditional: Attribute Metadata | see ble_gatts_attr_t::p_attr_md |
2 bytes | Value offset | see ble_gatts_attr_t::init_offs |
2 bytes | Maximum Value Length | see ble_gatts_attr_t::max_len |
2 bytes | Value Length | see ble_gatts_attr_t::init_len |
1 byte | Attribute Data Present | 0x00 - Not Present, 0x01 - Present |
n bytes | Attribute Data | see ble_gatts_attr_t::p_value |
Length | Parameter | Value |
---|---|---|
2 bytes | UUID | see ble_uuid_t::uuid |
1 byte | Type | see ble_uuid_t::type |
Length | Parameter | Value |
---|---|---|
1 byte | read_perm | see ble_gatts_attr_md_t::read_perm |
1 byte | write_perm | see ble_gatts_attr_md_t::write_perm |
1 byte | Bit attributes | see ble_gatts_attr_md_t |
Read and write permissions are encoded in following order:
Length | Parameter | Value |
---|---|---|
bit 0..3 | sm | see ble_gap_conn_sec_mode_t::sm |
bit 4..7 | lv | see ble_gap_conn_sec_mode_t::lv |
Bit attributes are encoded in following order:
Length | Parameter | Value |
---|---|---|
bit 0 | vlen | see ble_gatts_attr_md_t::vlen |
bit 1..2 | vloc | see ble_gatts_attr_md_t::vloc |
bit 3 | rd_auth | see ble_gatts_attr_md_t::rd_auth |
bit 4 | wr_auth | see ble_gatts_attr_md_t::wr_auth |
bit 5..7 | not used | not used |
In case of a successful command, i.e. 'nRF Error Code' = NRF_SUCCESS
nRF Error Code is followed by conditional data.
Frame format encoding of the sd_ble_gatts_characteristic_add response packet:
Length | Parameter | Value |
---|---|---|
1 byte | Operation Code | 0xA2, see BLE_GATTS_SVCS |
4 bytes | nRF Error Code | see sd_ble_gatts_characteristic_add |
1 byte | Conditional: Handles Present | 0x00 - not present, 0x01 - Handles are present in the packet |
8 bytes | Conditional: Handles | see ble_gatts_char_handles_t |
ble_gatts_char_handles_t is encoded in following order:
Length | Parameter | Value |
---|---|---|
2 bytes | Value Handle | see ble_gatts_char_handles_t::value_handle |
2 bytes | User Desc Handle | see ble_gatts_char_handles_t::user_desc_handle |
2 bytes | CCCD Handle | see ble_gatts_char_handles_t::cccd_handle |
2 bytes | SCCD Handle | see ble_gatts_char_handles_t::sccd_handle |
Frame format encoding of the sd_ble_gatts_descriptor_add packet.
The parameters are encoded in the following order:
Length | Parameter | Value |
---|---|---|
1 byte | Operation Code | 0xA3, see BLE_GATTS_SVCS |
2 bytes | Characteristic Handle | Characteristic handle |
1 byte | Characteristic Attribute Present | 0x00 - Not Present, 0x01 - Present |
11..527 bytes | see ble_gatts_attr_t | Conditional: Characteristic Attribute |
1 byte | Handle Present | 0x00 - Not Present, 0x01 - Present on Application Chip |
In case of a successful command, i.e. 'nRF Error Code' = NRF_SUCCESS
nRF Error Code is followed by conditional data.
Frame format encoding of the sd_ble_gatts_descriptor_add response packet:
Length | Parameter | Value |
---|---|---|
1 byte | Operation Code | 0xA3, see BLE_GATTS_SVCS |
4 bytes | nRF Error Code | see sd_ble_gatts_descriptor_add |
2 bytes | Descriptor handle | Descriptor handle |
Frame format encoding of the sd_ble_gatts_value_set packet.
The parameters are encoded in the following order:
Length | Parameter | Value |
---|---|---|
1 byte | Operation Code | 0xA4, see BLE_GATTS_SVCS |
2 bytes | Attribute Handle | sd_ble_gatts_value_set |
2 bytes | Offset | sd_ble_gatts_value_set |
1 byte | Length Present | 0x00 - Not Present, 0x01 - Present |
2 bytes | Length | sd_ble_gatts_value_set |
1 byte | Attribute Value Present | 0x00 - Not Present, 0x01 - Present |
2 bytes | Attribute Value | sd_ble_gatts_value_set |
In case of a successful command, i.e. 'nRF Error Code' = NRF_SUCCESS
nRF Error Code is followed by conditional data.
Frame format encoding of the sd_ble_gatts_value_set response packet:
Length | Parameter | Value |
---|---|---|
1 byte | Operation Code | 0xA4, see BLE_GATTS_SVCS |
4 bytes | nRF Error Code | see sd_ble_gatts_value_set |
2 bytes | Conditional: Length of bytes written | see sd_ble_gatts_value_set |
Frame format encoding of the sd_ble_gatts_value_get packet.
The parameters are encoded in the following order:
Length | Parameter | Value |
---|---|---|
1 byte | Operation Code | 0xA5, see BLE_GATTS_SVCS |
2 bytes | Attribute Handle | sd_ble_gatts_value_get |
2 bytes | Offset | sd_ble_gatts_value_get |
1 byte | Length Present | 0x00 - Not Present, 0x01 - Present |
2 bytes | Conditional: Length | sd_ble_gatts_value_get |
1 byte | Value Present | 0x00 - Not Present, 0x01 - Present |
In case of a successful command, i.e. 'nRF Error Code' = NRF_SUCCESS
nRF Error Code is followed by conditional data.
Frame format encoding of the sd_ble_gatts_value_get response packet:
Length | Parameter | Value |
---|---|---|
1 byte | Operation Code | 0xA5, see BLE_GATTS_SVCS |
4 bytes | nRF Error Code | see sd_ble_gatts_value_get |
1 byte | Length Present | 0x00 - Not Present, 0x01 - Present |
2 bytes | Conditional:Value length in bytes | see sd_ble_gatts_value_get |
1 byte | Value Present | 0x00 - Not Present, 0x01 - Present |
n bytes | Conditional:Value | see sd_ble_gatts_value_get |
Frame format encoding of the sd_ble_gatts_hvx packet.
The parameters are encoded in the following order:
Length | Parameter | Value |
---|---|---|
1 byte | Operation Code | 0xA6, see BLE_GATTS_SVCS |
2 bytes | Connection Handle | sd_ble_gatts_hvx |
1 byte | HVX Parameters Present | 0x00 - Not Present, 0x01 - Present |
n bytes | Conditional:HVX Parameters | see sd_ble_gatts_hvx |
As shown in Figure 1, the data inside ble_gatts_hvx_params_t are encoded as:
Length | Parameter | Value |
---|---|---|
2 bytes | handle | see ble_gatts_hvx_params_t::handle |
1 byte | type | see ble_gatts_hvx_params_t::type |
2 bytes | offset | see ble_gatts_hvx_params_t::offset |
1 byte | Length Field Present | 0x00 - Not Present, 0x01 - Present |
2 bytes | Conditional: Length | see ble_gatts_hvx_params_t::p_len |
1 byte | Data Field Present | 0x00 - Not Present, 0x01 - Present |
n bytes | Conditional: Data | see ble_gatts_hvx_params_t::p_data |
In case of a successful command, i.e. 'nRF Error Code' = NRF_SUCCESS
nRF Error Code is followed by conditional data.
Frame format encoding of the sd_ble_gatts_hvx response packet:
Length | Parameter | Value |
---|---|---|
1 byte | Operation Code | 0xA6, see BLE_GATTS_SVCS |
4 bytes | nRF Error Code | see sd_ble_gatts_hvx |
1 byte | Number of Data Written Present | 0x00 - Not Present, 0x01 - Present |
2 bytes | Conditional: Number of Data written | see sd_ble_gatts_hvx |
Frame format encoding of the sd_ble_gatts_service_changed packet.
The parameters are encoded in the following order:
Length | Parameter | Value |
---|---|---|
1 byte | Operation Code | 0xA7, see BLE_GATTS_SVCS |
2 bytes | Connection Handle | see sd_ble_gatts_service_changed |
2 bytes | Start Handle | see sd_ble_gatts_service_changed |
2 bytes | End Handle | see sd_ble_gatts_service_changed |
Frame format encoding of the sd_ble_gatts_service_changed response packet.
Data for the response packet is encoded in the following order:
Length | Parameter | Value |
---|---|---|
1 byte | Operation Code | 0xA7, see BLE_GATTS_SVCS |
4 bytes | nRF Error Code | see sd_ble_gatts_service_changed |
Frame format encoding of the sd_ble_gatts_rw_authorize_reply packet.
The parameters are encoded in the following order:
Length | Parameter | Value |
---|---|---|
1 byte | Operation Code | 0xA8, see BLE_GATTS_SVCS |
2 bytes | Connection Handle | see sd_ble_gatts_rw_authorize_reply |
1 byte | RW Authorize Reply Params Present | 0x00 if System Attributes is a NULL pointer, 0x01 otherwise |
n bytes | Conditional: RW Authorize Reply Params | see sd_ble_gatts_rw_authorize_reply |
ble_gatts_rw_authorize_reply_params_t is encoded in following order:
Length | Parameter | Value |
---|---|---|
1 byte | Type | see ble_gatts_rw_authorize_reply_params_t::type |
n bytes | Read or Write Params | see ble_gatts_rw_authorize_reply_params_t::read or ble_gatts_rw_authorize_reply_params_t::write |
Read parameters (ble_gatts_read_authorize_params_t) are encoded in the following order (also presented in Figure 2):
Length | Parameter | Value |
---|---|---|
2 bytes | GATT Status | see ble_gatts_read_authorize_params_t::gatt_status |
1 byte | Update | see ble_gatts_read_authorize_params_t::update |
2 bytes | Offset | see ble_gatts_read_authorize_params_t::offset |
2 bytes | Len | see ble_gatts_read_authorize_params_t::len |
1 byte | Data Present | 0x00 if data is a NULL pointer, 0x01 otherwise |
n bytes | Data | see ble_gatts_read_authorize_params_t::p_data |
Write parameters (ble_gatts_write_authorize_params_t) are encoded in the following order (also presented in Figure 3):
Length | Parameter | Value |
---|---|---|
2 bytes | GATT Status | see GATT Status Codes |
Frame format encoding of the sd_ble_gatts_rw_authorize_reply response packet:
Length | Parameter | Value |
---|---|---|
1 byte | Operation Code | 0xA8, see BLE_GATTS_SVCS |
4 bytes | nRF Error Code | see sd_ble_gatts_rw_authorize_reply |
Frame format encoding of the sd_ble_gatts_sys_attr_set packet.
The parameters are encoded in the following order:
Length | Parameter | Value |
---|---|---|
1 byte | Operation Code | 0xA9, see BLE_GATTS_SVCS |
2 bytes | Connection Handle | Handle Value |
1 byte | System Attributes Present | 0x00 if System Attributes is a NULL pointer, 0x01 otherwise |
2 bytes | Conditional: Length of System Attributes Data | n - Number of bytes of System Attributes Data |
n bytes | Conditional: System Attributes Data | Data |
Frame format encoding of the sd_ble_gatts_sys_attr_set response packet:
Length | Parameter | Value |
---|---|---|
1 byte | Operation Code | 0xA9, see BLE_GATTS_SVCS |
4 bytes | nRF Error Code | see sd_ble_gatts_sys_attr_set |
Frame format encoding of the sd_ble_gatts_sys_attr_get packet.
The parameters are encoded in the following order:
Length | Parameter | Value |
---|---|---|
1 byte | Operation Code | 0xAA, see BLE_GATTS_SVCS |
2 bytes | Connection Handle | Handle Value |
1 byte | System Attribute Length Present | 0x00 if is a NULL pointer, 0x01 otherwise |
2 bytes | Conditional: System Attribute Length | see sd_ble_gatts_sys_attr_get |
1 byte | System Attribute Data Present | 0x00 if is a NULL pointer, 0x01 otherwise |
In case of a successful command, The response packet will encode the return value NRF_SUCCESS. If a valid pointer were provided in the function packet, i.e. 'System Attribute Present' = 0x01
, then the System Attributes from the BLE S110 SoftDevice will be encoded, and the length of the data will be encoded in the length field.
If a NULL pointer where provided in the function packet, i.e. 'System Attribute Present' = 0x00
, then the length of the System Attribute Data will be encoded, but no data will follow.
Frame format encoding of the sd_ble_gatts_sys_attr_get response packet:
Length | Parameter | Value |
---|---|---|
1 byte | Operation Code | 0xAA, see BLE_GATTS_SVCS |
4 bytes | nRF Error Code | see sd_ble_gatts_sys_attr_get |
2 bytes | Conditional: System Attribute Length | see sd_ble_gatts_sys_attr_get |
1 byte | Conditional: System Attribute Data Present | 0x00 if is a NULL pointer, 0x01 otherwise |
n bytes | Conditional: System Attribute Data | see sd_ble_gatts_sys_attr_get |