openaliro
Aliro reader: UWB/CCC core and ESP32-S3/C5/C6 port
Loading...
Searching...
No Matches
cherry_ccc.h File Reference

— CCC/Aliro-session interface (seam the adapter drives). More...

#include <cherry/cherry.h>
#include <cherry/cherry_common.h>
#include <cherry/cherry_session.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
Include dependency graph for cherry_ccc.h:

Go to the source code of this file.

Data Structures

struct  cherry_ccc_capabilities
 Device CCC/Aliro capability set advertised to the peer. More...
 
struct  cherry_ccc_session_event_session_status
 Payload of a SESSION_STATUS event, giving the new session state and the reason for the change. More...
 
struct  cherry_ccc_session_event_error
 Payload of a SESSION_ERROR event, giving the error status that triggered it. More...
 
struct  cherry_ccc_event
 CCC notification delivered to the adapter. More...
 
struct  cherry_ccc_aliro_session_config
 Negotiated Aliro ranging params (filled in-place across M1-M4). More...
 

Macros

#define CHERRY_CCC_HOP_MODE_KEY_SIZE   4
 Length in bytes of the hopping-sequence key carried in M4.
 

Typedefs

typedef void(* cherry_ccc_cb_t) (struct cherry_ccc_event *event, void *user_data)
 CCC notification callback type.
 

Enumerations

enum  cherry_ccc_event_type
 CCC session event kinds.
 
enum  cherry_ccc_session_state
 Lifecycle state of a CCC session.
 
enum  cherry_ccc_state_change_reason
 Why a session changed state.
 
enum  cherry_ccc_hopping_mode
 Selected hopping mode.
 

Functions

struct cherry_ccc_sessioncherry_ccc_session_create_aliro_responder (struct cherry *ctx, cherry_ccc_cb_t callback, void *user_data, struct cherry_ccc_aliro_session_config *config)
 Create an Aliro responder session bound to config (NULL on error).
 
struct cherry_sessioncherry_ccc_session_to_base (struct cherry_ccc_session *session)
 Return the base session for a CCC session (the base is the first member).
 
static void * cherry_ccc_session_get_user_data (struct cherry_ccc_session *session)
 Fetch the CCC session's user_data via its base session.
 
void cherry_ccc_event_free (struct cherry_ccc_event *event)
 Release a CCC event and any heap payload it owns.
 
static void cherry_ccc_session_destroy (struct cherry_ccc_session *session)
 Destroy a CCC session (delegates to the base).
 
static enum cherry_err cherry_ccc_session_start (struct cherry_ccc_session *session)
 Start a CCC session (delegates to the base).
 
static enum cherry_err cherry_ccc_session_stop (struct cherry_ccc_session *session)
 Stop a CCC session (delegates to the base).
 
static enum cherry_err cherry_ccc_session_set_antennas (struct cherry_ccc_session *session, uint8_t tx_antenna_set, uint8_t rx_antenna_set)
 Select round-1 antennas for a CCC session (delegates to the base).
 
enum cherry_err cherry_ccc_session_set_ursk (struct cherry_ccc_session *session, const uint8_t *ursk)
 Provide the 32-byte URSK (host-provided STS root key).
 
enum cherry_err cherry_ccc_session_set_protocol_version (struct cherry_ccc_session *session, uint16_t selected_protocol_version)
 Record the selected BLE/UWB protocol version.
 
enum cherry_err cherry_ccc_session_set_round2_antennas (struct cherry_ccc_session *session, uint8_t tx_antenna_set, uint8_t rx_antenna_set)
 Select antennas for the Aliro second ranging round.
 
enum cherry_err cherry_ccc_session_set_sts_index (struct cherry_ccc_session *session, uint32_t sts_index)
 Set the starting STS index (resume path).
 
enum cherry_err cherry_ccc_session_set_initiation_time (struct cherry_ccc_session *session, uint64_t initiation_time_us)
 Set the ranging initiation time on the UWBS time base (resume path).
 
static enum cherry_err cherry_ccc_session_set_diagnostics (struct cherry_ccc_session *session, struct cherry_common_diag_cfg config)
 Enable/disable diagnostics for a CCC session (delegates to the base).
 

Detailed Description

— CCC/Aliro-session interface (seam the adapter drives).

Function Documentation

◆ cherry_ccc_event_free()

void cherry_ccc_event_free ( struct cherry_ccc_event event)

Release a CCC event and any heap payload it owns.

Parameters
eventEvent to free.

Release a CCC event and any heap payload it owns.

◆ cherry_ccc_session_create_aliro_responder()

struct cherry_ccc_session * cherry_ccc_session_create_aliro_responder ( struct cherry ctx,
cherry_ccc_cb_t  callback,
void *  user_data,
struct cherry_ccc_aliro_session_config config 
)

Create an Aliro responder session bound to config (NULL on error).

Create an Aliro responder session bound to config (NULL on error).

Parameters
ctxCherry context (unused).
callbackCCC notification callback.
user_dataUser context to pass to callback.
configSession configuration (channel, session ID, STS index, timing, slot geometry).
Returns
Session pointer, or null if callback is null, config is null, or allocation fails.

◆ cherry_ccc_session_destroy()

static void cherry_ccc_session_destroy ( struct cherry_ccc_session session)
inlinestatic

Destroy a CCC session (delegates to the base).

Destroy a CCC session, delegating to the base session.

Parameters
sessionCCC session to destroy.

◆ cherry_ccc_session_get_user_data()

static void * cherry_ccc_session_get_user_data ( struct cherry_ccc_session session)
inlinestatic

Fetch the CCC session's user_data via its base session.

Parameters
sessionCCC session to query.
Returns
The user_data pointer associated with the session's base.

◆ cherry_ccc_session_set_antennas()

static enum cherry_err cherry_ccc_session_set_antennas ( struct cherry_ccc_session session,
uint8_t  tx_antenna_set,
uint8_t  rx_antenna_set 
)
inlinestatic

Select round-1 antennas for a CCC session (delegates to the base).

Select round-1 antennas for a CCC session, delegating to the base session.

Parameters
sessionCCC session to configure.
tx_antenna_setAntenna set to use for transmission.
rx_antenna_setAntenna set to use for reception.
Returns
Error code from cherry_session_set_antennas.

◆ cherry_ccc_session_set_diagnostics()

static enum cherry_err cherry_ccc_session_set_diagnostics ( struct cherry_ccc_session session,
struct cherry_common_diag_cfg  config 
)
inlinestatic

Enable/disable diagnostics for a CCC session (delegates to the base).

Opaque CCC session being configured, defined by the shim.

◆ cherry_ccc_session_set_initiation_time()

enum cherry_err cherry_ccc_session_set_initiation_time ( struct cherry_ccc_session session,
uint64_t  initiation_time_us 
)

Set the ranging initiation time on the UWBS time base (resume path).

Set the ranging initiation time on the UWBS time base (resume path).

Parameters
sessionCCC session.
initiation_time_usInitiation timestamp in microseconds.
Returns
CHERRY_ERR_INVALID_PARAMETER if session or its config is null, otherwise CHERRY_ERR_NONE.

◆ cherry_ccc_session_set_protocol_version()

enum cherry_err cherry_ccc_session_set_protocol_version ( struct cherry_ccc_session session,
uint16_t  selected_protocol_version 
)

Record the selected BLE/UWB protocol version.

Record the selected BLE/UWB protocol version.

Parameters
sessionCCC session.
selected_protocol_versionProtocol version (ignored).
Returns
CHERRY_ERR_INVALID_PARAMETER if session is null, otherwise CHERRY_ERR_NONE.

◆ cherry_ccc_session_set_round2_antennas()

enum cherry_err cherry_ccc_session_set_round2_antennas ( struct cherry_ccc_session session,
uint8_t  tx_antenna_set,
uint8_t  rx_antenna_set 
)

Select antennas for the Aliro second ranging round.

Select antennas for the Aliro second ranging round.

Parameters
sessionCCC session.
tx_antenna_setTX antenna set (ignored).
rx_antenna_setRX antenna set (ignored).
Returns
CHERRY_ERR_INVALID_PARAMETER if session is null, otherwise CHERRY_ERR_NONE.

◆ cherry_ccc_session_set_sts_index()

enum cherry_err cherry_ccc_session_set_sts_index ( struct cherry_ccc_session session,
uint32_t  sts_index 
)

Set the starting STS index (resume path).

Set the starting STS index (resume path).

Parameters
sessionCCC session.
sts_indexSTS index value.
Returns
CHERRY_ERR_INVALID_PARAMETER if session or its config is null, otherwise CHERRY_ERR_NONE.

◆ cherry_ccc_session_set_ursk()

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

Provide the 32-byte URSK (host-provided STS root key).

Provide the 32-byte URSK (host-provided STS root key).

Parameters
sessionCCC session.
ursk16-byte Unique Responder Session Key.
Returns
CHERRY_ERR_INVALID_PARAMETER if session or ursk is null, otherwise CHERRY_ERR_NONE.

◆ cherry_ccc_session_start()

static enum cherry_err cherry_ccc_session_start ( struct cherry_ccc_session session)
inlinestatic

Start a CCC session (delegates to the base).

Start a CCC session, delegating to the base session.

Parameters
sessionCCC session to start.
Returns
Error code from cherry_session_start.

◆ cherry_ccc_session_stop()

static enum cherry_err cherry_ccc_session_stop ( struct cherry_ccc_session session)
inlinestatic

Stop a CCC session (delegates to the base).

Stop a CCC session, delegating to the base session.

Parameters
sessionCCC session to stop.
Returns
Error code from cherry_session_stop.

◆ cherry_ccc_session_to_base()

struct cherry_session * cherry_ccc_session_to_base ( struct cherry_ccc_session session)

Return the base session for a CCC session (the base is the first member).

Return the base session for a CCC session (the base is the first member).

Parameters
sessionCCC session.
Returns
Base session pointer, or null if session is null.