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

— reader-context lifecycle. More...

#include "aliro_uwb_internal.h"
#include <aliro_uwb_adapter/aliro_uwb_adapter.h>
#include <cherry/cherry_ccc.h>
#include "woz_alloc.h"
#include <string.h>
#include "woz_log.h"
Include dependency graph for aliro_uwb_adapter.c:

Functions

enum aliro_uwb_err cherry_err_to_aliro (enum cherry_err err)
 Map a CCC error code to its Aliro UWB equivalent, treating unknown errors as internal failures.
 
static enum aliro_uwb_err copy_capabilities (struct aliro_uwb_adapter *adapter, struct cherry_core_event_device_capabilities *caps)
 Deep-copy the device CCC capabilities into the adapter.
 
static bool reader_config_valid (const struct aliro_uwb_adapter_reader_config *config)
 Validate that a reader configuration offers at least one valid hopping sequence and respects configured bounds, returning false if invalid.
 
struct aliro_uwb_adapteraliro_uwb_adapter_create_reader (struct cherry *cherry_ctx, struct cherry_core_event_device_capabilities *caps, struct aliro_uwb_adapter_reader_config *config)
 Create a reader-mode adapter, copying the peer's CCC capabilities into it and resolving the minimum RAN multiplier against the reader's own configuration.
 
void aliro_uwb_adapter_set_diagnostics (struct aliro_uwb_adapter *aliro_ctx, struct cherry_common_diag_cfg config)
 Store a diagnostics configuration in the adapter for later application to CCC sessions, allocating storage if needed.
 
void aliro_uwb_adapter_destroy (struct aliro_uwb_adapter *aliro_ctx)
 Destroy an Aliro UWB adapter, freeing all associated CCC capabilities arrays and diagnostic configuration.
 

Detailed Description

— reader-context lifecycle.

Function Documentation

◆ aliro_uwb_adapter_create_reader()

struct aliro_uwb_adapter * aliro_uwb_adapter_create_reader ( struct cherry cherry_ctx,
struct cherry_core_event_device_capabilities caps,
struct aliro_uwb_adapter_reader_config config 
)

Create a reader-mode adapter, copying the peer's CCC capabilities into it and resolving the minimum RAN multiplier against the reader's own configuration.

Create a reader-mode adapter.

◆ aliro_uwb_adapter_destroy()

void aliro_uwb_adapter_destroy ( struct aliro_uwb_adapter aliro_ctx)

Destroy an Aliro UWB adapter, freeing all associated CCC capabilities arrays and diagnostic configuration.

Release an adapter context.

◆ aliro_uwb_adapter_set_diagnostics()

void aliro_uwb_adapter_set_diagnostics ( struct aliro_uwb_adapter aliro_ctx,
struct cherry_common_diag_cfg  config 
)

Store a diagnostics configuration in the adapter for later application to CCC sessions, allocating storage if needed.

Set the diagnostics configuration applied to new sessions.

◆ cherry_err_to_aliro()

enum aliro_uwb_err cherry_err_to_aliro ( enum cherry_err  err)

Map a CCC error code to its Aliro UWB equivalent, treating unknown errors as internal failures.

Parameters
errCCC error code to translate.
Returns
Corresponding enum aliro_uwb_err value, or ALIRO_UWB_ERR_INTERNAL if unrecognized.

◆ copy_capabilities()

static enum aliro_uwb_err copy_capabilities ( struct aliro_uwb_adapter adapter,
struct cherry_core_event_device_capabilities caps 
)
static

Deep-copy the device CCC capabilities into the adapter.

Parameters
adapterAdapter whose ccc_caps field receives the copied capabilities.
capsDevice capabilities event supplying the source CCC capabilities to copy.
Returns
ALIRO_UWB_ERR_NONE on success, or ALIRO_UWB_ERR_INTERNAL if the source capabilities are missing or allocation fails.

◆ reader_config_valid()

static bool reader_config_valid ( const struct aliro_uwb_adapter_reader_config config)
static

Validate that a reader configuration offers at least one valid hopping sequence and respects configured bounds, returning false if invalid.

Parameters
configReader configuration to validate.
Returns
true if the configuration's hopping count is within bounds and includes a default sequence, false otherwise.