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

API for the Ranging Service (RAS). More...

Data Structures

struct  ras_ranging_header
 Ranging Header structure as defined in RAS Specification, Table 3.7. More...
 
struct  ras_subevent_header
 Subevent Header structure as defined in RAS Specification, Table 3.8. More...
 
struct  bt_ras_rd_buffer_cb
 RAS Ranging Data Buffer callback structure. More...
 
struct  ras_rd_buffer
 RAS Ranging Data buffer structure. More...
 

Macros

#define BT_UUID_RANGING_SERVICE_VAL   (0x185B)
 UUID of the Ranging Service.
 
#define BT_UUID_RAS_FEATURES_VAL   (0x2C14)
 UUID of the RAS Features Characteristic.
 
#define BT_UUID_RAS_REALTIME_RD_VAL   (0x2C15)
 UUID of the Real-time Ranging Data Characteristic.
 
#define BT_UUID_RAS_ONDEMAND_RD_VAL   (0x2C16)
 UUID of the On-demand Ranging Data Characteristic.
 
#define BT_UUID_RAS_CP_VAL   (0x2C17)
 UUID of the RAS Control Point Characteristic.
 
#define BT_UUID_RAS_RD_READY_VAL   (0x2C18)
 UUID of the Ranging Data Ready Characteristic.
 
#define BT_UUID_RAS_RD_OVERWRITTEN_VAL   (0x2C19)
 UUID of the Ranging Data Overwritten Characteristic.
 
#define BT_UUID_RANGING_SERVICE   BT_UUID_DECLARE_16(BT_UUID_RANGING_SERVICE_VAL)
 
#define BT_UUID_RAS_FEATURES   BT_UUID_DECLARE_16(BT_UUID_RAS_FEATURES_VAL)
 
#define BT_UUID_RAS_REALTIME_RD   BT_UUID_DECLARE_16(BT_UUID_RAS_REALTIME_RD_VAL)
 
#define BT_UUID_RAS_ONDEMAND_RD   BT_UUID_DECLARE_16(BT_UUID_RAS_ONDEMAND_RD_VAL)
 
#define BT_UUID_RAS_CP   BT_UUID_DECLARE_16(BT_UUID_RAS_CP_VAL)
 
#define BT_UUID_RAS_RD_READY   BT_UUID_DECLARE_16(BT_UUID_RAS_RD_READY_VAL)
 
#define BT_UUID_RAS_RD_OVERWRITTEN   BT_UUID_DECLARE_16(BT_UUID_RAS_RD_OVERWRITTEN_VAL)
 
#define BT_RAS_RANGING_HEADER_LEN   4
 
#define BT_RAS_SUBEVENT_HEADER_LEN   8
 
#define BT_RAS_STEP_MODE_LEN   1
 
#define BT_RAS_MAX_SUBEVENTS_PER_PROCEDURE   32
 
#define BT_RAS_MAX_STEPS_PER_PROCEDURE   256
 
#define BT_RAS_STEP_MODE_2_3_ANT_DEPENDENT_LEN(antenna_paths)
 
#define BT_RAS_STEP_MODE_0_MAX_LEN
 
#define BT_RAS_STEP_MODE_1_MAX_LEN   (sizeof(struct bt_hci_le_cs_step_data_mode_1))
 
#define BT_RAS_STEP_MODE_2_MAX_LEN
 
#define BT_RAS_STEP_MODE_3_MAX_LEN
 
#define BT_RAS_STEP_MODE_0_1_MAX_LEN   MAX(BT_RAS_STEP_MODE_0_MAX_LEN, BT_RAS_STEP_MODE_1_MAX_LEN)
 
#define BT_RAS_STEP_MODE_0_1_2_MAX_LEN   MAX(BT_RAS_STEP_MODE_0_1_MAX_LEN, BT_RAS_STEP_MODE_2_MAX_LEN)
 
#define BT_RAS_MAX_STEP_DATA_LEN   BT_RAS_STEP_MODE_0_1_2_MAX_LEN
 
#define BT_RAS_PROCEDURE_MEM
 

Typedefs

typedef void(* bt_ras_rreq_rd_ready_cb_t) (struct bt_conn *conn, uint16_t ranging_counter)
 Ranging data ready callback. Called when peer has ranging data available.
 
typedef void(* bt_ras_rreq_rd_overwritten_cb_t) (struct bt_conn *conn, uint16_t ranging_counter)
 Ranging data overwritten callback. Called when peer has overwritten previously available ranging data.
 
typedef void(* bt_ras_rreq_ranging_data_received_t) (struct bt_conn *conn, uint16_t ranging_counter, int err)
 Ranging data complete callback. Called when complete ranging data has been received from the peer.
 
typedef void(* bt_ras_rreq_features_read_cb_t) (struct bt_conn *conn, uint32_t feature_bits, int err)
 RAS features read callback.
 
typedef bool(* bt_ras_rreq_ranging_header_cb_t) (struct ras_ranging_header *ranging_header, void *user_data)
 Provide ranging header for the ranging data back to the user.
 
typedef bool(* bt_ras_rreq_subevent_header_cb_t) (struct ras_subevent_header *subevent_header, void *user_data)
 Provide subevent header for each subevent back to the user.
 
typedef bool(* bt_ras_rreq_step_data_cb_t) (struct bt_le_cs_subevent_step *local_step, struct bt_le_cs_subevent_step *peer_step, void *user_data)
 Provide step data for each step back to the user.
 

Enumerations

enum  ras_feat { RAS_FEAT_REALTIME_RD = BIT(0) , RAS_FEAT_RETRIEVE_LOST_RD_SEG = BIT(1) , RAS_FEAT_ABORT_OP = BIT(2) , RAS_FEAT_FILTER_RD = BIT(3) }
 RAS Features as defined in RAS Specification, Table 3.3. More...
 

Functions

int bt_ras_rrsp_alloc (struct bt_conn *conn)
 Allocate Ranging Responder instance for connection.
 
void bt_ras_rrsp_free (struct bt_conn *conn)
 Free Ranging Responder instance for connection.
 
void bt_ras_rd_buffer_cb_register (struct bt_ras_rd_buffer_cb *cb)
 Register ranging data buffer callbacks.
 
bool bt_ras_rd_buffer_ready_check (struct bt_conn *conn, uint16_t ranging_counter)
 Check if a given ranging counter is available.
 
struct ras_rd_bufferbt_ras_rd_buffer_claim (struct bt_conn *conn, uint16_t ranging_counter)
 Claim a buffer with a given ranging counter.
 
int bt_ras_rd_buffer_release (struct ras_rd_buffer *buf)
 Release a claimed ranging data buffer.
 
int bt_ras_rd_buffer_bytes_pull (struct ras_rd_buffer *buf, uint8_t *out_buf, uint16_t max_data_len, uint16_t *read_cursor, bool *empty)
 Pull bytes from a ranging data buffer.
 
int bt_ras_rreq_alloc_and_assign_handles (struct bt_gatt_dm *dm, struct bt_conn *conn)
 Allocate a RREQ context and assign GATT handles. Takes a reference to the connection.
 
int bt_ras_rreq_subscription_change_cb_register (struct bt_conn *conn, bt_gatt_subscribe_func_t subscription_change_cb)
 Register a callback for GATT subscriptions and unsubscriptions attempted by the RREQ.
 
int bt_ras_rreq_cp_get_ranging_data (struct bt_conn *conn, struct net_buf_simple *ranging_data_out, uint16_t ranging_counter, bt_ras_rreq_ranging_data_received_t data_get_complete_cb)
 Get ranging data for given ranging counter.
 
void bt_ras_rreq_free (struct bt_conn *conn)
 Free RREQ context for connection. This will unsubscribe from any remaining subscriptions.
 
int bt_ras_rreq_cp_subscribe (struct bt_conn *conn)
 Subscribe to RAS-CP. Required to be called before bt_ras_rreq_cp_get_ranging_data.
 
int bt_ras_rreq_cp_unsubscribe (struct bt_conn *conn)
 Unsubscribe from RAS-CP.
 
int bt_ras_rreq_on_demand_rd_subscribe (struct bt_conn *conn)
 Subscribe to on-demand ranging data notifications. Required to be called before bt_ras_rreq_cp_get_ranging_data.
 
int bt_ras_rreq_on_demand_rd_unsubscribe (struct bt_conn *conn)
 Unsubscribe from on-demand ranging data notifications.
 
int bt_ras_rreq_rd_ready_subscribe (struct bt_conn *conn, bt_ras_rreq_rd_ready_cb_t cb)
 Subscribe to ranging data ready notifications. These notify when on-demand ranging data is available for a given CS procedure counter.
 
int bt_ras_rreq_rd_ready_unsubscribe (struct bt_conn *conn)
 Unsubscribe from ranging data ready notifications.
 
int bt_ras_rreq_rd_overwritten_subscribe (struct bt_conn *conn, bt_ras_rreq_rd_overwritten_cb_t cb)
 Subscribe to ranging data overwritten notifications. These notify when on-demand ranging data is no longer available for a given CS procedure counter.
 
int bt_ras_rreq_rd_overwritten_unsubscribe (struct bt_conn *conn)
 Unsubscribe from ranging data overwritten notifications.
 
int bt_ras_rreq_realtime_rd_subscribe (struct bt_conn *conn, struct net_buf_simple *ranging_data_out, bt_ras_rreq_ranging_data_received_t data_received_cb)
 Subscribe to real-time ranging data notifications.
 
int bt_ras_rreq_realtime_rd_unsubscribe (struct bt_conn *conn)
 Unsubscribe from real-time ranging data notifications.
 
int bt_ras_rreq_read_features (struct bt_conn *conn, bt_ras_rreq_features_read_cb_t cb)
 Read supported RAS features from peer.
 
void bt_ras_rreq_rd_subevent_data_parse (struct net_buf_simple *peer_ranging_data_buf, struct net_buf_simple *local_step_data_buf, enum bt_conn_le_cs_role cs_role, bt_ras_rreq_ranging_header_cb_t ranging_header_cb, bt_ras_rreq_subevent_header_cb_t subevent_header_cb, bt_ras_rreq_step_data_cb_t step_data_cb, void *user_data)
 Parse peer ranging data buffer and local step data buffer.
 
static uint16_t bt_ras_rreq_get_ranging_counter (uint16_t procedure_counter)
 Convert CS procedure counter to RAS ranging counter.
 

Detailed Description

API for the Ranging Service (RAS).