OpenLcbCLib 1.0 Alpha
OpenSource C Library to create OpenLcb/Lcc Nodes
Loading...
Searching...
No Matches
can_login_statemachine.h File Reference

Dispatcher for the 10-state CAN alias allocation login sequence. More...

Go to the source code of this file.

Data Structures

struct  interface_can_login_state_machine_t
 Dependency-injection interface for the CAN login state machine. More...
 

Functions

void CanLoginStateMachine_initialize (const interface_can_login_state_machine_t *interface_can_login_state_machine)
 Registers the dependency-injection interface for this module.
 
void CanLoginStateMachine_run (can_statemachine_info_t *can_statemachine_info)
 Dispatches to the handler for the node's current run_state.
 

Detailed Description

Dispatcher for the 10-state CAN alias allocation login sequence.

Transitions through INIT -> GENERATE_SEED -> GENERATE_ALIAS -> CID7 -> CID6 -> CID5 -> CID4 -> WAIT_200ms -> RID -> AMD. State handlers are supplied via dependency injection.

Author
Jim Kueneman
Date
4 Mar 2026

Function Documentation

◆ CanLoginStateMachine_initialize()

void CanLoginStateMachine_initialize ( const interface_can_login_state_machine_t * interface_can_login_state_machine)
extern

Registers the dependency-injection interface for this module.

Parameters
interface_can_login_state_machinePointer to a populated interface_can_login_state_machine_t. Must remain valid for the lifetime of the application. All 10 function pointers must be non-NULL.
Warning
NOT thread-safe - call during single-threaded initialization only.
See also
CanLoginMessageHandler_initialize - initialize first
CanLoginStateMachine_run

Registers the dependency-injection interface for this module.

◆ CanLoginStateMachine_run()

void CanLoginStateMachine_run ( can_statemachine_info_t * can_statemachine_info)
extern

Dispatches to the handler for the node's current run_state.

Non-blocking - executes exactly one state handler per call and returns. Call repeatedly from the main loop until the node reaches permitted state.

Parameters
can_statemachine_infoState machine context (node + outgoing message buffer).
Warning
can_statemachine_info must not be NULL.
NOT thread-safe.
See also
CanLoginMessageHandler_state_init - entry point
CanLoginMessageHandler_state_load_amd - final state

Dispatches to the handler for the node's current run_state.

* @param can_statemachine_info State machine context (node + login frame buffer).
* 

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