OpenLcbCLib 1.0 Alpha
OpenSource C Library to create OpenLcb/Lcc Nodes
Loading...
Searching...
No Matches
openlcb_login_statemachine.h
Go to the documentation of this file.
1
39// This is a guard condition so that contents of this file are not included
40// more than once.
41#ifndef __OPENLCB_OPENLCB_LOGIN_STATEMACHINE__
42#define __OPENLCB_OPENLCB_LOGIN_STATEMACHINE__
43
44#include "openlcb_types.h"
45
48typedef struct {
49
51 bool (*send_openlcb_msg)(openlcb_msg_t *outgoing_msg);
52
54 openlcb_node_t *(*openlcb_node_get_first)(uint8_t key);
55
57 openlcb_node_t *(*openlcb_node_get_next)(uint8_t key);
58
60 void (*load_initialization_complete)(openlcb_login_statemachine_info_t *openlcb_statemachine_info);
61
63 void (*load_producer_events)(openlcb_login_statemachine_info_t *openlcb_statemachine_info);
64
66 void (*load_consumer_events)(openlcb_login_statemachine_info_t *openlcb_statemachine_info);
67
68 // ---- Internal function pointers (exposed for unit testing) ----
69
71 void (*process_login_statemachine)(openlcb_login_statemachine_info_t *statemachine_info);
72
74 bool (*handle_outgoing_openlcb_message)(void);
75
77 bool (*handle_try_reenumerate)(void);
78
80 bool (*handle_try_enumerate_first_node)(void);
81
83 bool (*handle_try_enumerate_next_node)(void);
84
85
87 bool (*on_login_complete)(openlcb_node_t *openlcb_node);
88
90
91
92#ifdef __cplusplus
93extern "C" {
94#endif /* __cplusplus */
95
102 extern void OpenLcbLoginStateMachine_initialize(const interface_openlcb_login_state_machine_t *interface_openlcb_login_state_machine);
103
110 extern void OpenLcbLoginMainStatemachine_run(void);
111
117 extern void OpenLcbLoginStateMachine_process(openlcb_login_statemachine_info_t *openlcb_statemachine_info);
118
121
124
127
130
133
134#ifdef __cplusplus
135}
136#endif /* __cplusplus */
137
138#endif /* __OPENLCB_OPENLCB_LOGIN_STATEMACHINE__ */
void OpenLcbLoginStateMachine_process(openlcb_login_statemachine_info_t *openlcb_statemachine_info)
Dispatches to the handler matching node->run_state. Exposed for unit testing.
Definition openlcb_login_statemachine.c:138
bool OpenLcbLoginStatemachine_handle_outgoing_openlcb_message(void)
Tries to send the pending message; returns true if one was pending. Exposed for unit testing.
Definition openlcb_login_statemachine.c:194
bool OpenLcbLoginStatemachine_handle_try_enumerate_next_node(void)
Advances to the next node needing login. Exposed for unit testing.
Definition openlcb_login_statemachine.c:284
void OpenLcbLoginStateMachine_initialize(const interface_openlcb_login_state_machine_t *interface_openlcb_login_state_machine)
Stores the callback interface. Call once at startup after OpenLcbLoginMessageHandler_initialize().
Definition openlcb_login_statemachine.c:108
bool OpenLcbLoginStatemachine_handle_try_reenumerate(void)
Re-enters the state processor if the enumerate flag is set. Exposed for unit testing.
Definition openlcb_login_statemachine.c:222
void OpenLcbLoginMainStatemachine_run(void)
Runs one non-blocking step of login processing. Call from main loop.
Definition openlcb_login_statemachine.c:320
bool OpenLcbLoginStatemachine_handle_try_enumerate_first_node(void)
Starts enumeration from the first node if none is active. Exposed for unit testing.
Definition openlcb_login_statemachine.c:247
openlcb_login_statemachine_info_t * OpenLcbLoginStatemachine_get_statemachine_info(void)
Returns pointer to internal static state machine info. For unit testing only — do not modify.
Definition openlcb_login_statemachine.c:353
Core type definitions, structures, and configuration constants for the OpenLCB library.
Callback interface for the login state machine. All pointers are REQUIRED unless noted....
Definition openlcb_login_statemachine.h:48
Login state machine context.
Definition openlcb_types.h:771
Core OpenLCB message structure.
Definition openlcb_types.h:480
OpenLCB virtual node.
Definition openlcb_types.h:679

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