modules/woz_uwb/src/ccc/cherry_ccc_shim.c
asxeem/openaliro
Module

cherry_ccc_shim.c

cherry_ccc_* seam (Aliro responder) implemented over the lock-native…

modules/woz_uwb/src/ccc/cherry_ccc_shim.c22 documented symbols

Overview

cherry_ccc_* seam (Aliro responder) implemented over the lock-native FiRa MAC; maps each call onto woz_uwb_facade.

depends on woz_log.h cherry.h cherry_ccc.h cherry_session.h aliro_round_config.h woz_alloc.h woz_util.h woz_uwb_facade.h

API

Cstruct cherry

modules/woz_uwb/src/ccc/cherry_ccc_shim.c:27

Opaque Cherry context holder.

core_cb
Core callback (never invoked: no UCI).
user_data
Client data from cherry_create().

Cstruct cherry_session

modules/woz_uwb/src/ccc/cherry_ccc_shim.c:37

Base session object; first member of cherry_ccc_session for up-casting.

cb
CCC notification callback from create.
user_data
Client data (the aliro_uwb_session).

Cstruct cherry_ccc_session

modules/woz_uwb/src/ccc/cherry_ccc_shim.c:50

CCC ranging session bound to FiRa MAC.

base
MUST be first member for up-casting.
config
Borrowed pointer to adapter's negotiated params, valid until destroy.
ursk
Provisioned-STS root key (16 bytes).
have_ursk
True if URSK has been stashed via set_ursk.
state
Last emitted session state (INIT, IDLE, ACTIVE, or DEINIT).

Fstatic inline struct cherry_ccc_session *to_ccc(struct cherry_session *base)

modules/woz_uwb/src/ccc/cherry_ccc_shim.c:60

Up-cast a base session pointer (base is the first member).

called by cherry_session_destroy, cherry_session_start, cherry_session_stop

Fstatic void emit_status(struct cherry_ccc_session *s, enum cherry_ccc_session_state st)

modules/woz_uwb/src/ccc/cherry_ccc_shim.c:70

Allocate and dispatch a SESSION_STATUS event to the CCC callback.

s
CCC session.
st
State to report (INIT, IDLE, ACTIVE, or DEINIT).
called by cherry_session_destroy, cherry_session_start, cherry_session_stop

Fstatic void emit_error(struct cherry_ccc_session *s, enum cherry_err err)

modules/woz_uwb/src/ccc/cherry_ccc_shim.c:95

Allocate + dispatch a SESSION_ERROR event to the CCC callback.

called by cherry_session_start

Fstruct cherry *cherry_create(const char *device, cherry_core_cb_t core_cb, void *user_data)

modules/woz_uwb/src/ccc/cherry_ccc_shim.c:126

Allocate and initialize a Cherry context with the given core callback and user data.

device
Device parameter (unused).
core_cb
Core callback (never invoked).
user_data
User data to store in the context.
returns
Cherry context pointer, or null if allocation fails.

Fvoid cherry_destroy_sync(struct cherry *ctx)

modules/woz_uwb/src/ccc/cherry_ccc_shim.c:142

Deallocate a Cherry context; null input is safely ignored.

Fcherry_ccc_session_create_aliro_responder

modules/woz_uwb/src/ccc/cherry_ccc_shim.c:157

Allocate and initialize an Aliro responder CCC session.

ctx
Cherry context (unused).
callback
CCC notification callback.
user_data
User context to pass to callback.
config
Session configuration (channel, session ID, STS index, timing, slot geometry).
returns
Session pointer, or null if callback is null, config is null, or allocation fails.

Fstruct cherry_session *cherry_ccc_session_to_base(struct cherry_ccc_session *session)

modules/woz_uwb/src/ccc/cherry_ccc_shim.c:185

Cast a CCC session pointer to its embedded base session structure.

session
CCC session.
returns
Base session pointer, or null if session is null.

Fvoid *cherry_session_get_user_data(struct cherry_session *session)

modules/woz_uwb/src/ccc/cherry_ccc_shim.c:195

Retrieve the user data pointer stored in the base session.

session
Base session.
returns
User data pointer, or null if session is null.

Fvoid cherry_session_destroy(struct cherry_session *session)

modules/woz_uwb/src/ccc/cherry_ccc_shim.c:204

Stop the UWB radio, emit a DEINIT status event, and deallocate the session.

session
Base session; null or invalid input is safely ignored.
calls emit_status, to_ccc

Fenum cherry_err cherry_session_start(struct cherry_session *session)

modules/woz_uwb/src/ccc/cherry_ccc_shim.c:227

Start an Aliro UWB session by building a RangingConfiguration byte array from session config, calling woz_uwb_start_aliro, and emitting IDLE then ACTIVE status events.

session
Base session.
returns
CHERRY_ERR_INVALID_PARAMETER if session or config is null; CHERRY_ERR_SESSION_CONFIG if URSK is not set; CHERRY_ERR_SESSION_INIT if UWB start fails; otherwise CHERRY_ERR_NONE.
calls emit_error, emit_status, to_ccc

Fenum cherry_err cherry_session_stop(struct cherry_session *session)

modules/woz_uwb/src/ccc/cherry_ccc_shim.c:308

Stop the UWB radio and emit an IDLE status event.

session
Base session.
returns
CHERRY_ERR_INVALID_PARAMETER if session is null or invalid, otherwise CHERRY_ERR_NONE.
calls emit_status, to_ccc

Fenum cherry_err cherry_ccc_session_set_ursk(struct cherry_ccc_session *session, const uint8_t *ursk)

modules/woz_uwb/src/ccc/cherry_ccc_shim.c:328

Copy the URSK into the session and mark it as present.

session
CCC session.
ursk
16-byte Unique Responder Session Key.
returns
CHERRY_ERR_INVALID_PARAMETER if session or ursk is null, otherwise CHERRY_ERR_NONE.

Fenum cherry_err cherry_ccc_session_set_protocol_version(struct cherry_ccc_session *session, uint16_t selected_protocol_version)

modules/woz_uwb/src/ccc/cherry_ccc_shim.c:344

Validate that the session exists; selected protocol version is accepted but ignored.

session
CCC session.
selected_protocol_version
Protocol version (ignored).
returns
CHERRY_ERR_INVALID_PARAMETER if session is null, otherwise CHERRY_ERR_NONE.

Fenum cherry_err cherry_ccc_session_set_sts_index(struct cherry_ccc_session *session, uint32_t sts_index)

modules/woz_uwb/src/ccc/cherry_ccc_shim.c:357

Store the STS index on the session config.

session
CCC session.
sts_index
STS index value.
returns
CHERRY_ERR_INVALID_PARAMETER if session or its config is null, otherwise CHERRY_ERR_NONE.

Fenum cherry_err cherry_ccc_session_set_initiation_time(struct cherry_ccc_session *session, uint64_t initiation_time_us)

modules/woz_uwb/src/ccc/cherry_ccc_shim.c:373

Store the UWB initiation timestamp in microseconds on the session config.

session
CCC session.
initiation_time_us
Initiation timestamp in microseconds.
returns
CHERRY_ERR_INVALID_PARAMETER if session or its config is null, otherwise CHERRY_ERR_NONE.

Fenum cherry_err cherry_ccc_session_set_round2_antennas(struct cherry_ccc_session *session, uint8_t tx_antenna_set, uint8_t rx_antenna_set)

modules/woz_uwb/src/ccc/cherry_ccc_shim.c:391

Validate that the session exists; TX and RX antenna set parameters are accepted but ignored.

session
CCC session.
tx_antenna_set
TX antenna set (ignored).
rx_antenna_set
RX antenna set (ignored).
returns
CHERRY_ERR_INVALID_PARAMETER if session is null, otherwise CHERRY_ERR_NONE.

Fenum cherry_err cherry_session_set_antennas(struct cherry_session *session, uint8_t tx_antenna_set, uint8_t rx_antenna_set)

modules/woz_uwb/src/ccc/cherry_ccc_shim.c:408

Validate that the session exists; TX and RX antenna set parameters are accepted but ignored.

session
Base session.
tx_antenna_set
TX antenna set (ignored).
rx_antenna_set
RX antenna set (ignored).
returns
CHERRY_ERR_INVALID_PARAMETER if session is null, otherwise CHERRY_ERR_NONE.

Fenum cherry_err cherry_session_set_diagnostics(struct cherry_session *session, struct cherry_common_diag_cfg config, bool controlee_only)

modules/woz_uwb/src/ccc/cherry_ccc_shim.c:420

Validate that the session exists; the diagnostics settings are accepted but ignored.

returns
CHERRY_ERR_INVALID_PARAMETER if session is null, otherwise CHERRY_ERR_NONE.

Fvoid cherry_ccc_event_free(struct cherry_ccc_event *event)

modules/woz_uwb/src/ccc/cherry_ccc_shim.c:434

Free a CCC event and its payload; null input is safely ignored.