CS Initiator#

Channel Sounding (CS) Initiator provides an instantiable initiator (central) logic that produce its own CS results and also collects CS results from CS Reflector (peripheral) devices. Once all initiator and reflector results collected correctly it is forwarded to the RTL lib that shall produce the high-level measurement values e.g. distance, likeliness of the current distance, etc.

Modules#

cs_result_t

cs_intermediate_result_t

cs_result_event_t

cs_result_data_t

state_machine_event_data_t

Enumerations#

enum
CS_PROCEDURE_ACTION_CONTINUE = 0u
CS_PROCEDURE_ACTION_TRIGGER_RESET
CS_PROCEDURE_ACTION_TRIGGER_START
CS_PROCEDURE_ACTION_TRIGGER_STOP
}
enum
INITIATOR_EVT_INIT_STARTED = 0U
INITIATOR_EVT_INIT_COMPLETED
INITIATOR_EVT_START_PROCEDURE
INITIATOR_EVT_PROCEDURE_ENABLE_STARTING
INITIATOR_EVT_PROCEDURE_ENABLE_COMPLETED
INITIATOR_EVT_PROCEDURE_DISABLE_COMPLETED
INITIATOR_EVT_CS_RESULT
INITIATOR_EVT_CS_RESULT_CONTINUE
INITIATOR_EVT_DELETE_INSTANCE
INITIATOR_EVT_ERROR
}

Typedefs#

typedef void(*
cs_error_cb_t)(uint8_t conn_handle, cs_error_event_t evt, sl_status_t sc)
typedef void(*
cs_result_cb_t)(const cs_result_t *result, const sl_rtl_cs_procedure *cs_procedure, const void *user_data)
typedef void(*
cs_intermediate_result_cb_t)(const cs_intermediate_result_t *result, const void *user_data)

Functions#

sl_status_t
cs_initiator_create(const uint8_t conn_handle, cs_initiator_config_t *initiator_config, const rtl_config_t *rtl_config, cs_result_cb_t result_cb, cs_intermediate_result_cb_t intermediate_result_cb, cs_error_cb_t error_cb, uint8_t *instance_id)
sl_status_t
cs_initiator_delete(const uint8_t conn_handle)
bool
cs_initiator_on_event(sl_bt_msg_t *evt)

Macros#

#define
#define
#define
CS_CUSTOM_CHANNEL_MAP { 0xFC, 0xFF, 0x7F, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F }
#define
#define
#define
CS_INITIATOR_DEFAULT_CS_TONE_ANTENNA_CONFIG_IDX_REQ CS_ANTENNA_CONFIG_INDEX_DUAL_ONLY
#define
CS_INITIATOR_DEFAULT_CHANNEL_SELECTION_TYPE sl_bt_cs_channel_selection_algorithm_3b
#define
CS_INITIATOR_DEFAULT_CH3C_SHAPE sl_bt_cs_ch3c_shape_hat
#define
CS_INITIATOR_DEFAULT_ALGO_MODE SL_RTL_CS_ALGO_MODE_REAL_TIME_BASIC
#define
CS_INITIATOR_DEFAULT_CHANNEL_MAP_PRESET CS_CHANNEL_MAP_PRESET_HIGH

Enumeration Documentation#

cs_procedure_action_t#

cs_procedure_action_t
Enumerator
CS_PROCEDURE_ACTION_CONTINUE
CS_PROCEDURE_ACTION_TRIGGER_RESET
CS_PROCEDURE_ACTION_TRIGGER_START
CS_PROCEDURE_ACTION_TRIGGER_STOP

Definition at line 109 of file common/cs_initiator/inc/cs_initiator.h

state_machine_event_t#

state_machine_event_t
Enumerator
INITIATOR_EVT_INIT_STARTED
INITIATOR_EVT_INIT_COMPLETED
INITIATOR_EVT_START_PROCEDURE
INITIATOR_EVT_PROCEDURE_ENABLE_STARTING
INITIATOR_EVT_PROCEDURE_ENABLE_COMPLETED
INITIATOR_EVT_PROCEDURE_DISABLE_COMPLETED
INITIATOR_EVT_CS_RESULT
INITIATOR_EVT_CS_RESULT_CONTINUE
INITIATOR_EVT_DELETE_INSTANCE
INITIATOR_EVT_ERROR

Definition at line 147 of file common/cs_initiator/inc/cs_initiator.h

Typedef Documentation#

cs_error_cb_t#

typedef void(* cs_error_cb_t) (uint8_t conn_handle, cs_error_event_t evt, sl_status_t sc) )(uint8_t conn_handle, cs_error_event_t evt, sl_status_t sc)
Parameters
[in]conn_handle

connection handle.

[in]evt

error event.

[in]sc

status code.

Initiator error callback type Called in case any CS initiator related error occurred.


Definition at line 79 of file common/cs_initiator/inc/cs_initiator.h

cs_result_cb_t#

typedef void(* cs_result_cb_t) (const cs_result_t *result, const sl_rtl_cs_procedure *cs_procedure, const void *user_data) )(const cs_result_t *result, const sl_rtl_cs_procedure *cs_procedure, const void *user_data)
Parameters
[in]result

pointer to the result structure.

[in]cs_procedure

procedure data that the result was calculated from.

[in]user_data

pointer to additional user data.

Initiator result callback type Called in case a CS procedure extracted successfully and based on the extracted data a distance measurement by the RTL library has been successfully performed.


Definition at line 91 of file common/cs_initiator/inc/cs_initiator.h

cs_intermediate_result_cb_t#

typedef void(* cs_intermediate_result_cb_t) (const cs_intermediate_result_t *result, const void *user_data) )(const cs_intermediate_result_t *result, const void *user_data)
Parameters
[in]result

pointer to the intermediate result structure.

[in]user_data

pointer to additional user data.

Initiator intermediate result callback type Called only in case the static object tracking mode is active. That means not in every CS procedure the CS initiator gets a distance measurement. When the measurement is still in progress at the end of a successfully extracted CS procedure this callback will be called instead of the result callback.


Definition at line 106 of file common/cs_initiator/inc/cs_initiator.h

Function Documentation#

cs_initiator_create#

sl_status_t cs_initiator_create (const uint8_t conn_handle, cs_initiator_config_t * initiator_config, const rtl_config_t * rtl_config, cs_result_cb_t result_cb, cs_intermediate_result_cb_t intermediate_result_cb, cs_error_cb_t error_cb, uint8_t * instance_id)
Parameters
[in]conn_handle

connection handle

[in]initiator_config

pointer to the initiator config

[in]rtl_config

pointer to the RTL library config

[in]result_cb

callback for result

[in]intermediate_result_cb

callback for intermediate result

[in]error_cb

callback for error

[out]instance_id

RTL library instance ID (optional)

Create CS Initiator instance for the given connection handle. Returns

  • status of the operation.


Definition at line 175 of file common/cs_initiator/inc/cs_initiator.h

cs_initiator_init#

void cs_initiator_init (void )
Parameters
N/A

Create and configure initiator instances.


Definition at line 186 of file common/cs_initiator/inc/cs_initiator.h

cs_initiator_delete#

sl_status_t cs_initiator_delete (const uint8_t conn_handle)
Parameters
[in]conn_handle

connection handle

Delete CS Initiator instance associated with the given connection handle. Returns

  • status of the operation.


Definition at line 194 of file common/cs_initiator/inc/cs_initiator.h

cs_initiator_deinit#

void cs_initiator_deinit (void )
Parameters
N/A

Deinitialization function of CS Initiator component.


Definition at line 199 of file common/cs_initiator/inc/cs_initiator.h

cs_initiator_on_event#

bool cs_initiator_on_event (sl_bt_msg_t * evt)
Parameters
[in]evt

Event coming from the Bluetooth stack.

Bluetooth stack event handler of the initiator events. Returns

  • true to send the event to the host in NCP case.


Definition at line 209 of file common/cs_initiator/inc/cs_initiator.h

Macro Definition Documentation#

CS_INITIATOR_MAX_CONNECTIONS#

#define CS_INITIATOR_MAX_CONNECTIONS
Value:
(1)

Definition at line 49 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_MAX_SUBEVENT_PER_PROC#

#define CS_INITIATOR_MAX_SUBEVENT_PER_PROC
Value:
(6)

Definition at line 55 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_MAX_STEP_DATA_LEN#

#define CS_INITIATOR_MAX_STEP_DATA_LEN
Value:
(2048)

Definition at line 61 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_LOG#

#define CS_INITIATOR_LOG
Value:
(1)

Definition at line 68 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_LOG_PREFIX#

#define CS_INITIATOR_LOG_PREFIX
Value:
"[Initiator]"

Definition at line 74 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_RTL_LOG#

#define CS_INITIATOR_RTL_LOG
Value:
(1)

Definition at line 82 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_CS_EVENT_BUF_SIZE#

#define CS_INITIATOR_CS_EVENT_BUF_SIZE
Value:
(16)

Definition at line 89 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_MIN_PROCEDURE_INTERVAL#

#define CS_INITIATOR_DEFAULT_MIN_PROCEDURE_INTERVAL
Value:
(30)

Definition at line 96 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_MAX_PROCEDURE_INTERVAL#

#define CS_INITIATOR_DEFAULT_MAX_PROCEDURE_INTERVAL
Value:
(30)

Definition at line 103 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_ANTENNA_OFFSET#

#define CS_INITIATOR_ANTENNA_OFFSET
Value:
0

Definition at line 111 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_ERROR_TIMEOUT_MS#

#define CS_INITIATOR_ERROR_TIMEOUT_MS
Value:
3000

Definition at line 119 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_PROCEDURE_TIMEOUT_MS#

#define CS_INITIATOR_PROCEDURE_TIMEOUT_MS
Value:
3000

Definition at line 126 of file common/cs_initiator/config/cs_initiator_config.h

CS_CUSTOM_CHANNEL_MAP#

#define CS_CUSTOM_CHANNEL_MAP
Value:
{ 0xFC, 0xFF, 0x7F, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F }

Definition at line 130 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_CS_MODE#

#define CS_INITIATOR_DEFAULT_CS_MODE
Value:
2

Definition at line 135 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_MIN_CONNECTION_INTERVAL#

#define CS_INITIATOR_DEFAULT_MIN_CONNECTION_INTERVAL
Value:
6

Definition at line 139 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_MAX_CONNECTION_INTERVAL#

#define CS_INITIATOR_DEFAULT_MAX_CONNECTION_INTERVAL
Value:
6

Definition at line 143 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_MAX_PROCEDURE_COUNT#

#define CS_INITIATOR_DEFAULT_MAX_PROCEDURE_COUNT
Value:
1

Definition at line 149 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_CONN_PHY#

#define CS_INITIATOR_DEFAULT_CONN_PHY
Value:
sl_bt_gap_phy_2m

Definition at line 155 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_CS_SYNC_PHY#

#define CS_INITIATOR_DEFAULT_CS_SYNC_PHY
Value:
sl_bt_gap_phy_1m

Definition at line 161 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_MODE0_STEPS#

#define CS_INITIATOR_DEFAULT_MODE0_STEPS
Value:
3

Definition at line 166 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_CS_TONE_ANTENNA_CONFIG_IDX_REQ#

#define CS_INITIATOR_DEFAULT_CS_TONE_ANTENNA_CONFIG_IDX_REQ
Value:
CS_ANTENNA_CONFIG_INDEX_DUAL_ONLY

Definition at line 183 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_CS_SYNC_ANTENNA_REQ#

#define CS_INITIATOR_DEFAULT_CS_SYNC_ANTENNA_REQ
Value:
CS_SYNC_SWITCHING

Definition at line 191 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_PREFERRED_PEER_ANTENNA#

#define CS_INITIATOR_DEFAULT_PREFERRED_PEER_ANTENNA
Value:
1

Definition at line 197 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_MAX_TX_POWER#

#define CS_INITIATOR_DEFAULT_MAX_TX_POWER
Value:
20

Definition at line 201 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_CREATE_CONTEXT#

#define CS_INITIATOR_DEFAULT_CREATE_CONTEXT
Value:
1

Definition at line 209 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_RSSI_REF_TX_POWER#

#define CS_INITIATOR_DEFAULT_RSSI_REF_TX_POWER
Value:
-40.0F

Definition at line 214 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_CONNECTION_PERIPHERAL_LATENCY#

#define CS_INITIATOR_DEFAULT_CONNECTION_PERIPHERAL_LATENCY
Value:
0

Definition at line 220 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_TIMEOUT#

#define CS_INITIATOR_DEFAULT_TIMEOUT
Value:
200

Definition at line 224 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_MIN_CE_LENGTH#

#define CS_INITIATOR_DEFAULT_MIN_CE_LENGTH
Value:
0

Definition at line 229 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_MAX_CE_LENGTH#

#define CS_INITIATOR_DEFAULT_MAX_CE_LENGTH
Value:
65535

Definition at line 234 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_CHANNEL_SELECTION_TYPE#

#define CS_INITIATOR_DEFAULT_CHANNEL_SELECTION_TYPE
Value:
sl_bt_cs_channel_selection_algorithm_3b

Definition at line 241 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_CH3C_SHAPE#

#define CS_INITIATOR_DEFAULT_CH3C_SHAPE
Value:
sl_bt_cs_ch3c_shape_hat

Definition at line 247 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_ALGO_MODE#

#define CS_INITIATOR_DEFAULT_ALGO_MODE
Value:
SL_RTL_CS_ALGO_MODE_REAL_TIME_BASIC

Definition at line 253 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_CHANNEL_MAP_PRESET#

#define CS_INITIATOR_DEFAULT_CHANNEL_MAP_PRESET
Value:
CS_CHANNEL_MAP_PRESET_HIGH

Definition at line 261 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_CH3C_JUMP#

#define CS_INITIATOR_DEFAULT_CH3C_JUMP
Value:
2

Definition at line 270 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_MAX_PROCEDURE_DURATION#

#define CS_INITIATOR_DEFAULT_MAX_PROCEDURE_DURATION
Value:
65535

Definition at line 276 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_TX_PWR_DELTA#

#define CS_INITIATOR_DEFAULT_TX_PWR_DELTA
Value:
0

Definition at line 280 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_CONFIG_ID#

#define CS_INITIATOR_DEFAULT_CONFIG_ID
Value:
1

Definition at line 285 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_MIN_SUBEVENT_LEN#

#define CS_INITIATOR_DEFAULT_MIN_SUBEVENT_LEN
Value:
1250

Definition at line 290 of file common/cs_initiator/config/cs_initiator_config.h

CS_INITIATOR_DEFAULT_MAX_SUBEVENT_LEN#

#define CS_INITIATOR_DEFAULT_MAX_SUBEVENT_LEN
Value:
3999999

Definition at line 295 of file common/cs_initiator/config/cs_initiator_config.h