aliro_uwb_session.h
per-session public interface.
Overview
per-session public interface.
depends on cherry.h cherry_ccc.h · used by aliro_ranging.c aliro_uwb_internal.h aliro_uwb_msg.h aliro_uwb_msg_builder.h aliro_uwb_msg_parser.h aliro_uwb_session.c
API
Cstruct aliro_uwb_message
Framed Aliro BLE message with 4-byte header followed by TLV payload.
len- Number of valid bytes in @p data.
data- Message bytes (4-byte header followed by TLV attributes).
Cstruct aliro_uwb_session_event
Session event handed to the client, carrying status, error, or distance reports.
session- Opaque per-session context.
type- Event type (status, error, controller report, controlee report, or diagnostics).
cherry_event- Underlying Cherry event object.
data- Union holding the event payload: session status, error code and diagnostic context, controller distance and timestamp estimate, controlee distance and timestamp estimate, or diagnostic report snapshot.
Cenum aliro_uwb_session_event_type
Session event kinds (aliased to the CCC event types).
Ctypedef void (*aliro_uwb_session_cb_t)(struct aliro_uwb_session_event *event, void *user_data)
Session notification callback type.
Ctypedef void (*aliro_uwb_adapter_transmit_message_t)(struct aliro_uwb_message *message, struct aliro_uwb_session *session, void *user_data, bool timeout)
BLE transmit callback: sends an adapter-built message to the peer.
Fstruct aliro_uwb_session * aliro_uwb_session_create(struct aliro_uwb_adapter *aliro_ctx, uint32_t session_id, aliro_uwb_session_cb_t callback, aliro_uwb_adapter_transmit_message_t transmit, void *user_data)
Create a session in the CREATED state. No CCC session is started here. @param aliro_ctx Adapter supplying the Cherry context and reader configuration. @param session_id Session identifier carried in the ranging-service messages. @param callback Session event callback; must not be NULL. @param transmit Message transmit callback; must not be NULL. @param user_data Opaque pointer passed back to the callbacks. @return New session, or NULL on bad parameters or allocation failure.
Fvoid aliro_uwb_session_destroy(struct aliro_uwb_session *session)
Stop if needed and release a session.
Fvoid aliro_uwb_session_message_free(struct aliro_uwb_message *message)
Free a message produced by the adapter's transmit callback.
Fvoid aliro_uwb_session_event_free(struct aliro_uwb_session_event *event)
Free an event delivered to the session callback. @param event Event to free.
Fenum aliro_uwb_err aliro_uwb_session_set_ursk(struct aliro_uwb_session *session, const uint8_t *ursk)
Provide the 32-byte URSK for the session.
Fenum aliro_uwb_err aliro_uwb_session_set_protocol_version(struct aliro_uwb_session *session, uint16_t selected_protocol_version)
Record the selected BLE/UWB protocol version.
Fenum aliro_uwb_err aliro_uwb_session_init_setup(struct aliro_uwb_session *session)
Begin setup: build M1 and transmit it to the user device.
Fenum aliro_uwb_err aliro_uwb_session_set_time_offset(struct aliro_uwb_session *session, int64_t time_offset)
Set the time offset (microseconds) added to the negotiated UWB_Time0.
Fenum aliro_uwb_err aliro_uwb_session_message_handle(struct aliro_uwb_session *session, struct aliro_uwb_message *message)
Handle an incoming BLE message (M2/M4, suspend/resume, notifications).
Fenum aliro_uwb_err aliro_uwb_session_suspend(struct aliro_uwb_session *session)
Request a graceful suspend (builds and sends a suspend request).
Fenum aliro_uwb_err aliro_uwb_session_forced_suspend(struct aliro_uwb_session *session)
Suspend ranging immediately without waiting for a peer response.
Fenum aliro_uwb_err aliro_uwb_session_resume(struct aliro_uwb_session *session)
Build and send a resume request for a suspended Aliro UWB ranging session. @param session Aliro UWB session to resume. @return Aliro UWB error code indicating success or failure of the resume request.