OpenLcbCLib 1.0 Alpha
OpenSource C Library to create OpenLcb/Lcc Nodes
Loading...
Searching...
No Matches
protocol_event_transport.h
Go to the documentation of this file.
1
39/*
40 * NOTE: All Function for all Protocols expect that the incoming CAN messages have been
41 * blocked so there is not a race on the incoming message buffer.
42 */
43
44#ifndef __OPENLCB_PROTOCOL_EVENT_TRANSPORT__
45#define __OPENLCB_PROTOCOL_EVENT_TRANSPORT__
46
47#include <stdbool.h>
48#include <stdint.h>
49
50#include "openlcb_types.h"
51
53typedef struct
54{
55
57 void (*on_consumed_event_identified)(openlcb_node_t *openlcb_node, uint16_t index, event_id_t *event_id, event_status_enum status, event_payload_t *payload);
58
60 void (*on_consumed_event_pcer)(openlcb_node_t *openlcb_node, uint16_t index, event_id_t *event_id, event_payload_t *payload);
61
63 void (*on_consumer_range_identified)(openlcb_node_t *openlcb_node, event_id_t *event_id);
64
66 void (*on_consumer_identified_unknown)(openlcb_node_t *openlcb_node, event_id_t *event_id);
67
69 void (*on_consumer_identified_set)(openlcb_node_t *openlcb_node, event_id_t *event_id);
70
72 void (*on_consumer_identified_clear)(openlcb_node_t *openlcb_node, event_id_t *event_id);
73
75 void (*on_consumer_identified_reserved)(openlcb_node_t *openlcb_node, event_id_t *event_id);
76
78 void (*on_producer_range_identified)(openlcb_node_t *openlcb_node, event_id_t *event_id);
79
81 void (*on_producer_identified_unknown)(openlcb_node_t *openlcb_node, event_id_t *event_id);
82
84 void (*on_producer_identified_set)(openlcb_node_t *openlcb_node, event_id_t *event_id);
85
87 void (*on_producer_identified_clear)(openlcb_node_t *openlcb_node, event_id_t *event_id);
88
90 void (*on_producer_identified_reserved)(openlcb_node_t *openlcb_node, event_id_t *event_id);
91
93 void (*on_event_learn)(openlcb_node_t *openlcb_node, event_id_t *event_id);
94
96 void (*on_pc_event_report)(openlcb_node_t *openlcb_node, event_id_t *event_id);
97
99 void (*on_pc_event_report_with_payload)(openlcb_node_t *openlcb_node, event_id_t *event_id, uint16_t count, event_payload_t *payload);
100
102
103#ifdef __cplusplus
104extern "C"
105{
106#endif /* __cplusplus */
107
113 extern void ProtocolEventTransport_initialize(const interface_openlcb_protocol_event_transport_t *interface_openlcb_protocol_event_transport);
114
123
130
137
144
151
158
167
174
181
188
195
202
209
217
224
231
238
246 extern uint16_t ProtocolEventTransport_extract_consumer_event_status_mti(openlcb_node_t *openlcb_node, uint16_t event_index);
247
255 extern uint16_t ProtocolEventTransport_extract_producer_event_status_mti(openlcb_node_t *openlcb_node, uint16_t event_index);
256
257
258#ifdef __cplusplus
259}
260#endif /* __cplusplus */
261
262#endif /* __OPENLCB_PROTOCOL_EVENT_TRANSPORT__ */
Core type definitions, structures, and configuration constants for the OpenLCB library.
uint64_t event_id_t
64-bit Event ID.
Definition openlcb_types.h:340
event_status_enum
Event status for Producer/Consumer identification messages.
Definition openlcb_types.h:230
uint8_t event_payload_t[LEN_EVENT_PAYLOAD]
Event payload data buffer (LEN_EVENT_PAYLOAD bytes).
Definition openlcb_types.h:362
void ProtocolEventTransport_handle_consumer_identified_unknown(openlcb_statemachine_info_t *statemachine_info)
Forwards Consumer Identified Unknown to the app callback. No automatic response.
Definition protocol_event_transport.c:597
void ProtocolEventTransport_handle_pc_event_report(openlcb_statemachine_info_t *statemachine_info)
Forwards PC Event Report to the app callback. No automatic response.
Definition protocol_event_transport.c:1158
void ProtocolEventTransport_initialize(const interface_openlcb_protocol_event_transport_t *interface_openlcb_protocol_event_transport)
Stores the callback interface. Call once at startup.
Definition protocol_event_transport.c:73
void ProtocolEventTransport_handle_producer_identify(openlcb_statemachine_info_t *statemachine_info)
Responds with Producer Identified if this node produces the requested event.
Definition protocol_event_transport.c:758
void ProtocolEventTransport_handle_consumer_identified_clear(openlcb_statemachine_info_t *statemachine_info)
Forwards Consumer Identified Clear to the app callback. No automatic response.
Definition protocol_event_transport.c:673
void ProtocolEventTransport_handle_producer_identified_set(openlcb_statemachine_info_t *statemachine_info)
Forwards Producer Identified Set to the app callback. No automatic response.
Definition protocol_event_transport.c:908
void ProtocolEventTransport_handle_consumer_identified_set(openlcb_statemachine_info_t *statemachine_info)
Forwards Consumer Identified Set to the app callback. No automatic response.
Definition protocol_event_transport.c:635
void ProtocolEventTransport_handle_producer_identified_reserved(openlcb_statemachine_info_t *statemachine_info)
Forwards Producer Identified Reserved to the app callback. No automatic response.
Definition protocol_event_transport.c:989
void ProtocolEventTransport_handle_event_learn(openlcb_statemachine_info_t *statemachine_info)
Forwards Learn Event to the app callback. No automatic response.
Definition protocol_event_transport.c:1117
void ProtocolEventTransport_handle_events_identify_dest(openlcb_statemachine_info_t *statemachine_info)
Checks addressing then delegates to handle_events_identify for addressed variant.
Definition protocol_event_transport.c:1077
uint16_t ProtocolEventTransport_extract_producer_event_status_mti(openlcb_node_t *openlcb_node, uint16_t event_index)
Returns the Producer Identified MTI (Unknown/Set/Clear) for producers.list[event_index].
Definition protocol_event_transport.c:437
void ProtocolEventTransport_handle_consumer_identified_reserved(openlcb_statemachine_info_t *statemachine_info)
Forwards Consumer Identified Reserved to the app callback. No automatic response.
Definition protocol_event_transport.c:712
void ProtocolEventTransport_handle_pc_event_report_with_payload(openlcb_statemachine_info_t *statemachine_info)
Forwards PC Event Report with payload to the app callback. No automatic response.
Definition protocol_event_transport.c:1209
void ProtocolEventTransport_handle_consumer_range_identified(openlcb_statemachine_info_t *statemachine_info)
Forwards Consumer Range Identified to the app callback. No automatic response.
Definition protocol_event_transport.c:559
void ProtocolEventTransport_handle_producer_identified_unknown(openlcb_statemachine_info_t *statemachine_info)
Forwards Producer Identified Unknown to the app callback. No automatic response.
Definition protocol_event_transport.c:868
void ProtocolEventTransport_handle_events_identify(openlcb_statemachine_info_t *statemachine_info)
Enumerates all producer then consumer events, responding with Identified messages....
Definition protocol_event_transport.c:1039
void ProtocolEventTransport_handle_producer_range_identified(openlcb_statemachine_info_t *statemachine_info)
Forwards Producer Range Identified to the app callback. No automatic response.
Definition protocol_event_transport.c:830
uint16_t ProtocolEventTransport_extract_consumer_event_status_mti(openlcb_node_t *openlcb_node, uint16_t event_index)
Returns the Consumer Identified MTI (Unknown/Set/Clear) for consumers.list[event_index].
Definition protocol_event_transport.c:384
void ProtocolEventTransport_handle_consumer_identify(openlcb_statemachine_info_t *statemachine_info)
Responds with Consumer Identified if this node consumes the requested event.
Definition protocol_event_transport.c:489
void ProtocolEventTransport_handle_producer_identified_clear(openlcb_statemachine_info_t *statemachine_info)
Forwards Producer Identified Clear to the app callback. No automatic response.
Definition protocol_event_transport.c:948
Application callbacks for event transport notifications. All optional (NULL = ignored).
Definition protocol_event_transport.h:54
OpenLCB virtual node.
Definition openlcb_types.h:679
Complete context passed to protocol handler functions.
Definition openlcb_types.h:743

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