nRF Connect SDK API 3.3.99
Loading...
Searching...
No Matches

◆ bt_fast_pair_fhn_pf_ble_cs_ranging_capability_encode()

int bt_fast_pair_fhn_pf_ble_cs_ranging_capability_encode ( const struct bt_fast_pair_fhn_pf_ble_cs_ranging_capability * capability_desc,
struct bt_fast_pair_fhn_pf_ranging_tech_payload * capability_payload )

#include <include/bluetooth/fast_pair/fhn/pf/ble_cs.h>

Encode a descriptor of the BLE CS ranging capability into a technology-specific payload.

This function encodes the bt_fast_pair_fhn_pf_ble_cs_ranging_capability descriptor into the technology-specific payload descriptor (bt_fast_pair_fhn_pf_ranging_tech_payload) that is used in the Ranging Capability Response message. The encoded payload descriptor can then be passed to the bt_fast_pair_fhn_pf_ranging_capability_response_send API.

The capability_payload parameter must have a pre-allocated bt_fast_pair_fhn_pf_ranging_tech_payload::data buffer with the bt_fast_pair_fhn_pf_ranging_tech_payload::data_len field set to the size of this buffer. The buffer size should be at least equal to the size of the bt_fast_pair_fhn_pf_ble_cs_ranging_capability descriptor.

On success, the function overwrites the bt_fast_pair_fhn_pf_ranging_tech_payload::data_len field with the actual encoded length of the capability bytes that were written to the bt_fast_pair_fhn_pf_ranging_tech_payload::data buffer. The function also sets the bt_fast_pair_fhn_pf_ranging_tech_payload::id field to BT_FAST_PAIR_FHN_PF_RANGING_TECH_ID_BLE_CS value.

This function can be called from any context.

Parameters
capability_descBLE CS ranging capability descriptor to encode.
capability_payloadTechnology-specific payload to write the encoded data into. The bt_fast_pair_fhn_pf_ranging_tech_payload::data buffer and bt_fast_pair_fhn_pf_ranging_tech_payload::data_len fields must describe the memory region that will be used to store the encoded capability bytes.
Returns
0 if the operation was successful. Otherwise, a (negative) error code is returned.