OpenLcbCLib 1.0 Alpha
OpenSource C Library to create OpenLcb/Lcc Nodes
Loading...
Searching...
No Matches
can_login_message_handler.h
Go to the documentation of this file.
1
33#ifndef __DRIVERS_CANBUS_CAN_LOGIN_MESSAGE_HANDLER__
34#define __DRIVERS_CANBUS_CAN_LOGIN_MESSAGE_HANDLER__
35
36#include <stdbool.h>
37#include <stdint.h>
38
39#include "can_types.h"
40
49typedef struct {
50
52 alias_mapping_t *(*alias_mapping_register)(uint16_t alias, node_id_t node_id);
53
55 alias_mapping_t *(*alias_mapping_find_mapping_by_alias)(uint16_t alias);
56
58 void (*on_alias_change)(uint16_t alias, node_id_t node_id);
59
61
62
63#ifdef __cplusplus
64extern "C" {
65#endif /* __cplusplus */
66
78
84 extern void CanLoginMessageHandler_state_init(can_statemachine_info_t *can_statemachine_info);
85
94
101
107 extern void CanLoginMessageHandler_state_load_cid07(can_statemachine_info_t *can_statemachine_info);
108
114 extern void CanLoginMessageHandler_state_load_cid06(can_statemachine_info_t *can_statemachine_info);
115
121 extern void CanLoginMessageHandler_state_load_cid05(can_statemachine_info_t *can_statemachine_info);
122
128 extern void CanLoginMessageHandler_state_load_cid04(can_statemachine_info_t *can_statemachine_info);
129
140 extern void CanLoginMessageHandler_state_wait_200ms(can_statemachine_info_t *can_statemachine_info);
141
147 extern void CanLoginMessageHandler_state_load_rid(can_statemachine_info_t *can_statemachine_info);
148
159 extern void CanLoginMessageHandler_state_load_amd(can_statemachine_info_t *can_statemachine_info);
160
161#ifdef __cplusplus
162}
163#endif /* __cplusplus */
164
165#endif /* __DRIVERS_CANBUS_CAN_LOGIN_MESSAGE_HANDLER__ */
void CanLoginMessageHandler_state_load_cid06(can_statemachine_info_t *can_statemachine_info)
State 5: Loads a CID6 frame (Node ID bits 35-24) into the outgoing buffer.
Definition can_login_message_handler.c:179
void CanLoginMessageHandler_state_init(can_statemachine_info_t *can_statemachine_info)
State 1: Sets node seed to its Node ID, then jumps to GENERATE_ALIAS.
Definition can_login_message_handler.c:128
void CanLoginMessageHandler_state_wait_200ms(can_statemachine_info_t *can_statemachine_info)
State 8: Waits until timerticks > 2, then transitions to LOAD_RESERVE_ID.
Definition can_login_message_handler.c:213
void CanLoginMessageHandler_state_load_rid(can_statemachine_info_t *can_statemachine_info)
State 9: Loads an RID frame to claim the alias, then transitions to LOAD_AMD.
Definition can_login_message_handler.c:227
void CanLoginMessageHandler_state_load_cid05(can_statemachine_info_t *can_statemachine_info)
State 6: Loads a CID5 frame (Node ID bits 23-12) into the outgoing buffer.
Definition can_login_message_handler.c:190
void CanLoginMessageHandler_state_generate_seed(can_statemachine_info_t *can_statemachine_info)
State 2: Generates a new seed via LFSR, then transitions to GENERATE_ALIAS.
Definition can_login_message_handler.c:136
void CanLoginMessageHandler_initialize(const interface_can_login_message_handler_t *interface)
Registers the dependency-injection interface for this module.
Definition can_login_message_handler.c:59
void CanLoginMessageHandler_state_load_amd(can_statemachine_info_t *can_statemachine_info)
State 10: Loads an AMD frame with the full Node ID, marks the node permitted, and updates the alias m...
Definition can_login_message_handler.c:238
void CanLoginMessageHandler_state_load_cid04(can_statemachine_info_t *can_statemachine_info)
State 7: Loads a CID4 frame (Node ID bits 11-0) and resets the 200 ms timer.
Definition can_login_message_handler.c:201
void CanLoginMessageHandler_state_generate_alias(can_statemachine_info_t *can_statemachine_info)
State 3: Derives a 12-bit alias from the seed, registers it, then transitions to LOAD_CID07.
Definition can_login_message_handler.c:144
void CanLoginMessageHandler_state_load_cid07(can_statemachine_info_t *can_statemachine_info)
State 4: Loads a CID7 frame (Node ID bits 47-36) into the outgoing buffer.
Definition can_login_message_handler.c:168
Type definitions and constants for the CAN transport layer.
uint64_t node_id_t
48-bit Node ID stored in a 64-bit type (upper 16 bits unused).
Definition openlcb_types.h:359
Definition can_types.h:173
Definition can_types.h:155
Dependency-injection interface for the CAN login message handler.
Definition can_login_message_handler.h:49

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