OpenLcbCLib 1.0 Alpha
OpenSource C Library to create OpenLcb/Lcc Nodes
Loading...
Searching...
No Matches
interface_can_main_statemachine_t Struct Reference

Dependency-injection interface for the CAN main state machine. More...

Data Fields

void(* lock_shared_resources )(void)
 REQUIRED. Disable interrupts / acquire mutex. Typical: application lock function.
 
void(* unlock_shared_resources )(void)
 REQUIRED. Re-enable interrupts / release mutex. Typical: application unlock function.
 
bool(* send_can_message )(can_msg_t *msg)
 REQUIRED. Transmit a pre-built CAN frame. Typical: CanTxStatemachine_send_can_message.
 
openlcb_node_t *(* openlcb_node_get_first )(uint8_t key)
 REQUIRED. Return the first allocated node (start of enumeration). Typical: OpenLcbNode_get_first.
 
openlcb_node_t *(* openlcb_node_get_next )(uint8_t key)
 REQUIRED. Return the next node in the enumeration sequence. Typical: OpenLcbNode_get_next.
 
openlcb_node_t *(* openlcb_node_find_by_alias )(uint16_t alias)
 REQUIRED. Find a node by its 12-bit CAN alias. Typical: OpenLcbNode_find_by_alias.
 
void(* login_statemachine_run )(can_statemachine_info_t *can_statemachine_info)
 REQUIRED. Advance the login state machine one step. Typical: CanLoginStateMachine_run.
 
alias_mapping_info_t *(* alias_mapping_get_alias_mapping_info )(void)
 REQUIRED. Return pointer to the alias mapping table. Typical: AliasMappings_get_alias_mapping_info.
 
void(* alias_mapping_unregister )(uint16_t alias)
 REQUIRED. Remove an alias from the mapping table. Typical: AliasMappings_unregister.
 
uint8_t(* get_current_tick )(void)
 REQUIRED. Return the current value of the global 100ms tick counter. Typical: OpenLcb_get_global_100ms_tick.
 
bool(* handle_duplicate_aliases )(void)
 REQUIRED. Scan and resolve all duplicate aliases. Typical: CanMainStatemachine_handle_duplicate_aliases.
 
bool(* handle_outgoing_can_message )(void)
 REQUIRED. Pop and transmit one outgoing CAN message. Typical: CanMainStatemachine_handle_outgoing_can_message.
 
bool(* handle_login_outgoing_can_message )(void)
 REQUIRED. Transmit a pending login frame (CID/RID/AMD). Typical: CanMainStatemachine_handle_login_outgoing_can_message.
 
bool(* handle_try_enumerate_first_node )(void)
 REQUIRED. Start enumeration and process the first node. Typical: CanMainStatemachine_handle_try_enumerate_first_node.
 
bool(* handle_try_enumerate_next_node )(void)
 REQUIRED. Continue enumeration to the next node. Typical: CanMainStatemachine_handle_try_enumerate_next_node.
 
bool(* handle_listener_verification )(void)
 OPTIONAL. Probe one listener alias for staleness. NULL if unused. Typical: CanMainStatemachine_handle_listener_verification.
 

Detailed Description

Dependency-injection interface for the CAN main state machine.

All pointers are REQUIRED (must not be NULL). Each call to CanMainStateMachine_run() processes one operation in priority order: duplicate aliases → outgoing CAN message → login message → first node → next node.

See also
CanMainStatemachine_initialize

Field Documentation

◆ lock_shared_resources

void(* lock_shared_resources) (void)

REQUIRED. Disable interrupts / acquire mutex. Typical: application lock function.

◆ unlock_shared_resources

void(* unlock_shared_resources) (void)

REQUIRED. Re-enable interrupts / release mutex. Typical: application unlock function.

◆ send_can_message

bool(* send_can_message) (can_msg_t *msg)

REQUIRED. Transmit a pre-built CAN frame. Typical: CanTxStatemachine_send_can_message.

◆ openlcb_node_get_first

openlcb_node_t *(* openlcb_node_get_first) (uint8_t key)

REQUIRED. Return the first allocated node (start of enumeration). Typical: OpenLcbNode_get_first.

◆ openlcb_node_get_next

openlcb_node_t *(* openlcb_node_get_next) (uint8_t key)

REQUIRED. Return the next node in the enumeration sequence. Typical: OpenLcbNode_get_next.

◆ openlcb_node_find_by_alias

openlcb_node_t *(* openlcb_node_find_by_alias) (uint16_t alias)

REQUIRED. Find a node by its 12-bit CAN alias. Typical: OpenLcbNode_find_by_alias.

◆ login_statemachine_run

void(* login_statemachine_run) (can_statemachine_info_t *can_statemachine_info)

REQUIRED. Advance the login state machine one step. Typical: CanLoginStateMachine_run.

◆ alias_mapping_get_alias_mapping_info

alias_mapping_info_t *(* alias_mapping_get_alias_mapping_info) (void)

REQUIRED. Return pointer to the alias mapping table. Typical: AliasMappings_get_alias_mapping_info.

◆ alias_mapping_unregister

void(* alias_mapping_unregister) (uint16_t alias)

REQUIRED. Remove an alias from the mapping table. Typical: AliasMappings_unregister.

◆ get_current_tick

uint8_t(* get_current_tick) (void)

REQUIRED. Return the current value of the global 100ms tick counter. Typical: OpenLcb_get_global_100ms_tick.

◆ handle_duplicate_aliases

bool(* handle_duplicate_aliases) (void)

REQUIRED. Scan and resolve all duplicate aliases. Typical: CanMainStatemachine_handle_duplicate_aliases.

◆ handle_outgoing_can_message

bool(* handle_outgoing_can_message) (void)

REQUIRED. Pop and transmit one outgoing CAN message. Typical: CanMainStatemachine_handle_outgoing_can_message.

◆ handle_login_outgoing_can_message

bool(* handle_login_outgoing_can_message) (void)

REQUIRED. Transmit a pending login frame (CID/RID/AMD). Typical: CanMainStatemachine_handle_login_outgoing_can_message.

◆ handle_try_enumerate_first_node

bool(* handle_try_enumerate_first_node) (void)

REQUIRED. Start enumeration and process the first node. Typical: CanMainStatemachine_handle_try_enumerate_first_node.

◆ handle_try_enumerate_next_node

bool(* handle_try_enumerate_next_node) (void)

REQUIRED. Continue enumeration to the next node. Typical: CanMainStatemachine_handle_try_enumerate_next_node.

◆ handle_listener_verification

bool(* handle_listener_verification) (void)

OPTIONAL. Probe one listener alias for staleness. NULL if unused. Typical: CanMainStatemachine_handle_listener_verification.


The documentation for this struct was generated from the following file:

Copyright (c) 2026 Jim Kueneman all rights reserved. See the License