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

Broadcast Time Protocol message handler. More...

Go to the source code of this file.

Data Structures

struct  interface_openlcb_protocol_broadcast_time_handler_t
 Application callbacks for broadcast time events. More...
 

Functions

void ProtocolBroadcastTime_initialize (const interface_openlcb_protocol_broadcast_time_handler_t *interface_openlcb_protocol_broadcast_time_handler)
 Initializes the Broadcast Time Protocol handler.
 
void ProtocolBroadcastTime_handle_time_event (openlcb_statemachine_info_t *statemachine_info, event_id_t event_id)
 Handles incoming broadcast time events.
 

Detailed Description

Broadcast Time Protocol message handler.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Handles incoming broadcast time Event IDs from the network. Decodes time/date/year/rate/command data and updates the singleton clock state in openlcb_application_broadcast_time module.

Called from the main statemachine when a broadcast time event is detected. Only processes events for node index 0 (broadcast time events are global).

Author
Jim Kueneman
Date
28 Feb 2026
See also
openlcb_application_broadcast_time.h - Singleton clock state and API
openlcb_utilities.h - Event ID encoding/decoding functions

Function Documentation

◆ ProtocolBroadcastTime_initialize()

void ProtocolBroadcastTime_initialize ( const interface_openlcb_protocol_broadcast_time_handler_t * interface_openlcb_protocol_broadcast_time_handler)
extern

Initializes the Broadcast Time Protocol handler.

Parameters
interface_openlcb_protocol_broadcast_time_handlerPointer to interface_openlcb_protocol_broadcast_time_handler_t (must remain valid for application lifetime).

Initializes the Broadcast Time Protocol handler.

* @param interface_openlcb_protocol_broadcast_time_handler  Populated callback table.
* 

◆ ProtocolBroadcastTime_handle_time_event()

void ProtocolBroadcastTime_handle_time_event ( openlcb_statemachine_info_t * statemachine_info,
event_id_t event_id )
extern

Handles incoming broadcast time events.

Decodes the Event ID and updates the singleton clock state. Only processes if the node has index == 0 and a matching clock is registered in the application broadcast time module.

Parameters
statemachine_infoPointer to openlcb_statemachine_info_t context.
event_idFull 64-bit event_id_t containing encoded time data.

Decodes the event type, looks up the matching clock, and dispatches to the appropriate sub-handler.

* @param statemachine_info  Pointer to openlcb_statemachine_info_t context.
* @param event_id           Full 64-bit event_id_t containing encoded time data.
* 

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