Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
openlcb Namespace Reference

Classes

class  Acdi
 Renders an "<acdi>" tag in the CDI group. More...
 
class  AcdiRenderer
 Helper class for rendering the "<acdi>" tag. More...
 
class  AddAliasAllocator
 Create this object statically to add an alias allocator to an already statically allocated interface. More...
 
class  AddressedCanMessageWriteFlow
 The addressed write flow is responsible for sending addressed messages to the CANbus. More...
 
class  AliasAllocator
 This state flow is responsible for reserving node ID aliases. More...
 
class  AliasCache
 Cache of alias to node id mappings. More...
 
class  AliasConflictHandler
 This class listens for incoming CAN messages, and if it sees a local alias conflict, then takes the appropriate action: More...
 
struct  AliasInfo
 Information we know locally about an NMRAnet CAN alias. More...
 
class  AMEGlobalQueryHandler
 This class listens for Alias Mapping Enquiry frames with no destination node ID (aka global alias enquiries) and sends back as many frames as wel have local aliases mapped. More...
 
class  AMEQueryHandler
 This class listens for alias mapping enquiry frames targeted for local nodes, and replies with AMD frames. More...
 
class  AsyncDatagramTest
 Test base class for OpenLCB unittests that need a datagram handler. More...
 
class  AsyncIfTest
 Test fixture base class with helper methods for exercising the asynchronous interface code. More...
 
class  AsyncNodeTest
 Base class for test cases with one virtual node on a CANbus interface. More...
 
struct  AtomConfigDefs
 Configuration options for rendering CDI (atom) data elements. More...
 
class  AtomConfigOptions
 Configuration implementation class for CDI Atom elements (strings, events and numbers). More...
 
class  AtomConfigRenderer
 Helper class for rendering an atom data element into the cdi.xml. More...
 
class  BitEventConsumer
 Event handler for a single-bit consumer, e.g. More...
 
class  BitEventHandler
 Base class for single-bit producer and consumer objects. More...
 
class  BitEventInterface
 Represents a bit of state using two events. More...
 
class  BitEventPC
 Producer-Consumer event handler for a single bit represented by two event IDs. More...
 
class  BitEventProducer
 Event handler for a single-bit producer, e.g. More...
 
class  BitRangeEventP
 Producer event handler for a sequence of bits represented by a dense block of consecutive event IDs. More...
 
class  BitRangeEventPC
 Producer-Consumer event handler for a sequence of bits represented by a dense block of consecutive event IDs. More...
 
class  BitRangeNonAuthoritativeEventP
 Event producer for range of bits (event pairs) that is non-autoritative. More...
 
class  BLEAdvertisement
 OpenLCB BLE advertisement defintion. More...
 
class  BLEDefs
 Miscellaneous BLE definitions. More...
 
class  BLEGattClient
 Metadata for a BLE Gatt Client instance. More...
 
class  BLEGattClients
 Singleton container of all the BLE Gatt Clients. More...
 
class  BLEHubPort
 
class  BLEProtocolEngine
 Shared base class for protocol implementation on a per-BLE-connection basis. More...
 
class  BLEService
 OpenLCB BLE service definition. More...
 
class  BootloaderClient
 StateFlow performing the bootloading process. More...
 
class  BootloaderPort
 Proxy class for sending canbus traffic to the Bootloader HAL. More...
 
struct  BootloaderRequest
 Send a structure of this type to the BootloaderClient state flow to perform the bootloading process on one target node. More...
 
struct  BootloaderResponse
 This structure will be filled in by BootloaderClient when the bootloading operation is complete. More...
 
struct  BootloaderState
 Internal state of the bootloader stack. More...
 
class  BroadcastTime
 Implementation of Broadcast Time Protocol. More...
 
class  BroadcastTimeAlarm
 Basic alarm type that all other alarms are based off of. More...
 
class  BroadcastTimeAlarmDate
 Specialization of BroadcastTimeAlarm meant to expire at each date rollover. More...
 
class  BroadcastTimeAlarmMinute
 Specialization of BroadcastTimeAlarm meant to expire at each minute. More...
 
class  BroadcastTimeClient
 Implementation of a Broadcast Time Protocol client. More...
 
struct  BroadcastTimeDefs
 Static constants and helper functions for Broadcast Time Protocol. More...
 
class  BroadcastTimeServer
 Implementation of a Broadcast Time Protocol server. More...
 
class  BroadcastTimeServerAlarm
 Specialization of the BroacastTimeAlarm to expire on the necessary clock minutes that must be produced. More...
 
class  BroadcastTimeServerDateRolloverFinish
 State machine for sending the date rollover finish (year and date events) sequence. More...
 
struct  BroadcastTimeServerDateRolloverFinishInput
 Request structure used to send requests to the BroadcastTimeServerDateRolloverFinish object. More...
 
class  BroadcastTimeServerSet
 State machine for sending the clock set sequence. More...
 
struct  BroadcastTimeServerSetInput
 Request structure used to send requests to the BroadcastTimeServerSet object. More...
 
class  BroadcastTimeServerSync
 State machine for sending the clock sync sequence. More...
 
struct  BroadcastTimeServerSyncInput
 Request structure used to send requests to the BroadcastTimeServerSync object. More...
 
class  BroadcastTimeServerTime
 State machine for sending the clock time events. More...
 
struct  BroadcastTimeServerTimeInput
 Request structure used to send requests to the BroadcastTimeServerTime object. More...
 
class  BulkAliasAllocator
 Implementation of the BulkAliasAllocatorInterface to allocate many aliases at the same time. More...
 
struct  BulkAliasRequest
 Message type to request allocating many aliases for an interface. More...
 
class  ByteRangeEventC
 Consumer event handler for a sequence of bytes represented by a dense block of consecutive event IDs. More...
 
class  ByteRangeEventP
 TODO(balazs.racz): Add another class here, ByteRangeEventPC. More...
 
class  BytesConfigEntry
 Implementation class for internal data bytes configuration entries. More...
 
class  CallbackEventHandler
 Event handler implementation class that calls a user-specified std::function callback every time an event report message for the given event ID arrives. More...
 
class  CallbackNetworkInitializedBit
 Speciallization of NetworkInitializedBit that adds callback support when the state changes. More...
 
class  CanDatagramParser
 Frame handler that assembles incoming datagram fragments into a single datagram message. More...
 
class  CanDatagramService
 Implementation of the DatagramService with the CANbus-specific OpenLCB datagram protocol. More...
 
class  CanDatagramWriteFlow
 Datagram client implementation for CANbus-based datagram protocol. More...
 
struct  CanDefs
 Static values and helper functions for CAN-bus interfaces. More...
 
class  CanFrameStateFlow
 Base class for incoming CAN frame handlers. More...
 
class  CanMessageWriteFlow
 Implements the write-side conversion logic from generic messages to CAN frames. More...
 
class  CDIUtils
 
class  ClockBaseSequenceNumberGenerator
 Implementation of sequence number generator that uses the real clock. More...
 
struct  CollectData
 Helper class that acts as a data sink for a stream receiver. More...
 
class  ConfigEntryBase
 Base class for individual configuration entries. More...
 
class  ConfigReference
 Class representing a particular location in the configuration space. More...
 
class  ConfigUpdateFlow
 Implementation of the ConfigUpdateService: state flow issuing all the calls to the registered ConfigUpdateListener descendants. More...
 
class  ConfiguredConsumer
 OpenLCB Consumer class integrating a simple CDI-based configuration for two event IDs, and an output GPIO object that will be turned on or off depending on the incoming event notifications. More...
 
class  ConfiguredProducer
 OpenLCB Producer class integrating a simple CDI-based configuration for two event IDs, and an input GPIO object whose value will determine when to produce events. More...
 
class  ConfiguredPulseConsumer
 OpenLCB Consumer class integrating a simple CDI-based configuration for a single event IDs, and an output GPIO object that will be turned on for a short period of time when the incoming event notifications arrives. More...
 
struct  ConsistEntry
 Linked list entry for all registered consist clients for a given train node. More...
 
class  DatagramClient
 Use this class to send datagrams. More...
 
class  DatagramClientImpl
 Datagram client implementation for CANbus-based datagram protocol. More...
 
struct  DatagramDefs
 Static constants and functions related to the Datagram protocol. More...
 
class  DatagramService
 Transport-agnostic dispatcher of datagrams. More...
 
class  DccAccyConsumer
 Specialized (DCC protocol) implementation of a DCC accessory consumer. More...
 
class  DccAccyConsumerBase
 Base (generic protocol) implementation of a DCC accessory consumer. More...
 
class  DccAccyProducer
 DCC accessory address event producer for the Well-Known DCC Accessory range. More...
 
struct  DccAccyProducerCommands
 C++ Namespace for collecting all commands that can be sent to the DccAccyProducer flow. More...
 
struct  DccAccyProducerInput
 Request structure used to send requests to the DccAccyProducer class. More...
 
class  DccDebugDecodeFlow
 Debug flow for the DCC decoder driver. More...
 
class  DccExtAccyConsumer
 Specialized (DCC protocol) implementation of a DCC extended accessory consumer. More...
 
class  DccExtAccyConsumerBase
 Base (generic protocol) implementation of the DCC extended accessory consumer. More...
 
class  DccPacketDebugFlow
 Sends every incoming DCC packet as a custom OpenLCB message to the OpenLCB bus. More...
 
class  DefaultDatagramHandler
 Base class with utility functionality that implements some common functionality. More...
 
class  DefaultNode
 Trivial implementation of a virtual Node. More...
 
class  DefaultNodeRegistry
 
class  DefaultTrainNode
 Default implementation of a train node. More...
 
struct  Defs
 The generic interface for NMRAnet network interfaces. More...
 
class  DistributedBit
 Implementation of the BitEventInterface that has accessors to the desired and actual state, but does not perform callback on change. More...
 
class  EmptyGroup
 Defines an empty group with no members, but blocking a certain amount of space in the rendered configuration. More...
 
class  EmptyGroupConfigRenderer
 Helper class for rendering an empty group of a given size into the cdi.xml. More...
 
class  EntryMarker
 Helper class for partial template specialization. More...
 
class  EventCallerFlow
 Control flow that calls individual event handlers one at a time and waits until the done callback is invoked before calling the next event handler. More...
 
class  EventConfigEntry
 Implementation class for event ID configuration entries. More...
 
class  EventHandler
 Abstract base class for all event handlers. More...
 
struct  EventHandlerCall
 Arguments structure for the EventCallerFlow. More...
 
class  EventIdentifyGlobal
 Helper object for producing an Event Identify Global message. More...
 
class  EventIterator
 Abstract class for representing iteration through a container for event handlers. More...
 
class  EventIteratorFlow
 Flow to receive incoming messages of event protocol, and dispatch them to the registered event handler. More...
 
class  EventRegistry
 Global static object for registering event handlers. More...
 
class  EventRegistryEntry
 Structure used in registering event handlers. More...
 
struct  EventReport
 Shared notification structure that is assembled for each incoming event-related message, and passed around to all event handlers. More...
 
class  EventService
 Global Event Service. More...
 
class  FdToTcpParser
 This flow is listening to data from a TCP connection, segments the incoming data into TcpMessages based on the incoming size, and forwards packets containing the TCP message as string payload. More...
 
class  FileMemorySpace
 Memory space implementation that exports the contents of a file as a memory space. More...
 
struct  FirmwareUpgradeDefs
 Contains definitions from the Firmware Upgrade Standard. More...
 
class  FixedEventProducer
 Class that advertises an event ID to be produced. More...
 
class  FrameToAddressedMessageParser
 This class listens for incoming CAN frames of regular addressed OpenLCB messages destined for local nodes, then translates them in a generic way into a message, computing its MTI. More...
 
class  FrameToGlobalMessageParser
 This class listens for incoming CAN frames of regular unaddressed global OpenLCB messages, then translates it in a generic way into a message, computing its MTI. More...
 
class  FullContainerIterator
 EventIterator that produces every single entry in a given container (which can be any STL-compatible container with begin() and end() methods). More...
 
class  GcCanRoutingHub
 A hub flow that accepts string HUB ports sending CAN frames via the GridConnect protocol, performs routing decisions on the frames and sends out to the appropriate ports. More...
 
struct  GenMessage
 This class is used in the dispatching of incoming or outgoing NMRAnet messages to the message handlers at the protocol-agnostic level (i.e. More...
 
class  GlobalCanMessageWriteFlow
 This write flow inherits all the business logic from the parent, just maintains a separate allocation queue. More...
 
class  GPIOBit
 Simple implementation of the BitEventInterface for going through GPIO ports. More...
 
class  GroupBase
 Base class for all CDI Group structures (including segment, and the whole CDI entry). More...
 
class  GroupBaseEntry
 Constexpr base class for all group like structures. More...
 
struct  GroupConfigDefs
 Configuration options for the CDI group element, as well as representing and distinguishing alternate uses of the BEGIN_GROUP/EXTEND_GROUP/END_GROUP syntax, such as for the toplevel CDI node and for representing segments. More...
 
class  GroupConfigOptions
 Implementation class for the condifuration options of a CDI group element. More...
 
class  GroupConfigRenderer
 Helper class for rendering the cdi.xml of groups, segments and the toplevel CDI node. More...
 
class  Identification
 Add this entry to the beginning of the CDI group to render an "<identification>" tag at the beginning of the output cdi.xml. More...
 
struct  IdentificationConfigDefs
 Configuration options for rendering CDI (identification) data elements. More...
 
class  IdentificationConfigOptions
 Configuration implementation options for rendering CDI (identification) data elements. More...
 
class  IdentificationRenderer
 Helper class for rendering the "<identification>" tag. More...
 
struct  IdStreamType
 unused. More...
 
class  If
 Abstract class representing an OpenLCB Interface. More...
 
class  IfCan
 Implementation of the OpenLCB interface abstraction for the CAN-bus interface standard. More...
 
class  IfTcp
 Network interface class for a character stream link that speaks the (point-to-point) TcpTransfer protocol. More...
 
struct  IncomingDatagram
 Message structure for incoming datagram handlers. More...
 
class  IncomingMessageStateFlow
 Base class for incoming message handler flows. More...
 
class  InitializeFlow
 Performs upon-startup initialization of virtual nodes. More...
 
struct  InitializeRequest
 Request to send to instruct InitializeFlow to perform the initialization function of a single virtual node. More...
 
class  InlineEventIteratorFlow
 Flow to receive incoming messages of event protocol, and dispatch them to the registered event handler. More...
 
class  LatencyTestConsumer
 This event consumer works together with the hub_test application in order to detect the response latency of a node. More...
 
class  LocalIf
 
class  LocalMessageFilter
 Component that drops incoming addressed messages that are not destined for a local node. More...
 
class  LoggingTrain
 Test train implementation that just logs every action to the info log. More...
 
class  MemoryBit
 Simple implementation of a BitEventInterface when the true state ofthe variable is mapped in memory (e.g. More...
 
class  MemoryConfigClient
 
struct  MemoryConfigClientRequest
 
class  MemoryConfigClientWithStream
 
struct  MemoryConfigDefs
 Static constants and helper functions related to the Memory Configuration Protocol. More...
 
class  MemoryConfigHandler
 Implementation of the Memory Access Configuration Protocol for OpenLCB. More...
 
class  MemoryConfigHandlerBase
 
class  MemoryConfigStreamHandler
 Handler for the stream read/write commands in the memory config protocol (server side). More...
 
class  MemorySpace
 Abstract base class for the address spaces exported via the Memory Config Protocol. More...
 
class  MemorySpaceStreamReadFlow
 This is a self-owned flow which reads an memory space into a stream. More...
 
class  MockEventHandler
 Test handler for receiving incoming event related messages via the EventService. More...
 
class  MockHubPort
 
class  MockMessageHandler
 Test handler for receiving incoming openlcb Message objects from a bus. More...
 
class  MockSNIPUserFile
 Helper class for mock implementations. More...
 
class  MockTrain
 Test helper class for TrainImpl using GoogleMock. More...
 
class  MultiConfiguredConsumer
 Version of the ConfiguredConsumer class that can handle many GPIO pins with two events each. More...
 
class  MultiConfiguredPC
 
class  MultiTcpIfTest
 
class  NetworkInitializedBit
 A network-initialized bit is a tri-state bit implementation that starts up in the UNKNOWN state until either a local state set or a remote state set occurs. More...
 
class  NetworkState
 OpenLCB implementation of a binary network state. More...
 
class  Node
 Base class for NMRAnet nodes conforming to the asynchronous interface. More...
 
class  NodeBrowser
 This class helps establishing a list of all (live) nodes on the network. More...
 
struct  NodeCanonicalizeRequest
 Request object for the NodeIdLookupFlow. More...
 
struct  NodeHandle
 Container of both a NodeID and NodeAlias. More...
 
class  NodeIdLookupFlow
 Child flow to be used in parents that need translation from node alias to node id. More...
 
class  NodeRegistry
 
class  NoopGroupEntry
 Empty group entry that can be used for structuring the CDI configs. More...
 
struct  NumericConfigDefs
 Declarations for the options for numeric CDI entries. More...
 
class  NumericConfigEntry
 Implementation class for numeric configuration entries, templated by the integer type. More...
 
class  NumericConfigOptions
 Definitions for the options for numeric CDI entries. More...
 
class  NumericConfigRenderer
 Helper class for rendering a numeric data element into the cdi.xml. More...
 
class  PIPClient
 State flow to request PIP information from a remote node on the OpenLCB network. More...
 
class  PolledProducer
 Producer class for GPIO bits. More...
 
class  Polling
 Abstract base class for components that need repeated execution (with a specified frequency, i.e. More...
 
class  ProtocolIdentificationHandler
 An instance of this class will add Protocol Identification Protocol to an NMRAnet Node. More...
 
class  ProxyEventHandler
 A proxy event handler has a single helper function that gets every event handler call with an indication of which call it is. More...
 
class  RailcomToOpenLCBDebugProxy
 This flow proxies all incoming railcom traffic to the openlcb bus in non-standard messages. More...
 
class  ReadOnlyMemoryBlock
 Memory space implementation that exports a some memory-mapped data as a read-only memory space. More...
 
class  ReadWriteMemoryBlock
 Memory space implementation that exports a some memory-mapped data as a read-write memory space. More...
 
class  RefreshLoop
 State flow that calls a set of Polling objects at a regular interval. More...
 
class  ReinitAllNodes
 StateFlow that iterates through all local nodes and sends out node initialization complete for each of them. More...
 
class  RemoteAliasCacheUpdater
 This class listens for alias mapping frames and updates the remote alias cache with the incoming information. More...
 
class  RepeatedGroup
 Defines a repeated group of a given type and a given number of repeats. More...
 
class  ROFileMemorySpace
 Memory space implementation that exports the contents of a file as a memory space. More...
 
struct  RoutableMessage
 ============ WARNING ============= This code is not used currently. More...
 
class  RoutingLogic
 Routing table for gateways and routers in OpenLCB. More...
 
class  SequenceNumberGenerator
 Virtual clock interface. More...
 
class  ServoConsumer
 Basically a specialized ConfiguredConsumer. More...
 
class  SimpleCanStack
 Helper class for bringing up all components needed for a typical OpenLCB node. More...
 
class  SimpleCanStackBase
 SimpleStack with a CAN-bus based interface and IO functions for CAN-bus. More...
 
class  SimpleEventHandler
 SimpleEventHandler ignores all non-essential callbacks. More...
 
struct  SimpleInfoDescriptor
 This structure defines how to piece together a reply to a Simple Info request, sich as SNIP. More...
 
class  SimpleInfoFlow
 StateFlow for sending out medium-sized data payloads like the Simple Node Ident Info protocol. More...
 
struct  SimpleInfoResponse
 Use a Buffer<SimpleInfoResponse> to send a SNIP response to a particular destination host. More...
 
struct  SimpleNodeDynamicValues
 Structure representing the layout of the memory space for Simple Node Identification user-editable data. More...
 
struct  SimpleNodeStaticValues
 Structure representing the layout of the memory space for Simple Node Identification manufacturer-specified data. More...
 
class  SimpleStackBase
 
class  SimpleTcpStack
 
class  SimpleTcpStackBase
 
class  SimpleTrainCanStack
 CAN-based stack with TrainNode. More...
 
class  SNIPClient
 
struct  SNIPClientRequest
 Buffer contents for invoking the SNIP client. More...
 
struct  SnipDecodedData
 Holds the data we decoded from a SNIP response. More...
 
class  SNIPHandler
 Handler for the Simple Node Information Protocol requests. More...
 
class  Stream
 Base service for OpenLCB streaming protocol. More...
 
struct  StreamDefs
 Static constants and helper functions for the OpenLCB streaming protocol. More...
 
class  StreamReceiverCan
 
struct  StreamReceiveRequest
 
class  StreamReceiverInterface
 
class  StreamRendererCan
 
class  StreamSender
 
class  StreamSenderCan
 Helper class for sending stream data to a CAN interface. More...
 
class  StreamTestBase
 
class  StreamTransport
 Collects the objects needed to support streams on an OpenLCB interface. More...
 
class  StreamTransportCan
 CAN-specific implementation of the stream transport interface. More...
 
class  StringConfigEntry
 Implementation class for string configuration entries. More...
 
class  TcpClientDefaultParams
 This structure shows what parameters are configurable in the TcpClientConfig CDI group definition. More...
 
class  TcpDatagramService
 Implementation of the DatagramService on TCP transfer. More...
 
class  TcpDefs
 Static class for constants and utilities related to the TCP transport protocol. More...
 
class  TcpIfTest
 
struct  TcpMessage
 This is not used at the moment, as TCP packet routing is not supported yet. More...
 
class  TcpNodeTest
 
class  TcpRecvFlow
 Simple stateless translator for incoming TCP messages from binary format into the structured format. More...
 
class  TcpSendFlow
 This flow renders outgoing OpenLCB messages to their TCP stream representation. More...
 
class  ToplevelEntryBase
 Base class for all entries that can appear in the MainCdi group. More...
 
class  TractionCvSpace
 Memory Space implementation for a CV (configuration variable) access on a Railcom-enabled command station. More...
 
struct  TractionDefs
 Static constants and helper functions for the Traciton protocol family. More...
 
class  TractionProxyService
 Implements the unapproved Traction Proxy Protocol for dynamic allocation of train nodes. More...
 
class  TractionResponseHandler
 This class helps waiting for traction responses. More...
 
class  TractionTest
 Test fixture base for traction tests. More...
 
class  TractionThrottle
 Interface for a single throttle for running a train node. More...
 
class  TractionThrottleBase
 
struct  TractionThrottleCommands
 C++ Namespace for collecting all commands that can be sent to the TractionThrottle flow. More...
 
struct  TractionThrottleInput
 Request structure used to send requests to the TractionThrottle class. More...
 
class  TractionThrottleInterface
 
class  TrainImpl
 Abstract base class for train implementations. More...
 
class  TrainNode
 Virtual node class for an OpenLCB train protocol node. More...
 
class  TrainNodeForProxy
 Train node class with a an OpenLCB Node ID from the DCC pool. Used for command stations. More...
 
class  TrainNodeWithConsist
 Intermediate class which is still abstract, but adds implementation for the consist management functions. More...
 
class  TrainNodeWithId
 Train node class with a fixed OpenLCB Node ID. More...
 
class  TrainService
 Collection of control flows necessary for implementing the Traction Protocol. More...
 
class  TreeEventHandlers
 EventRegistry implementation that keeps event handlers in a SortedListMap and filters the event handler calls based on the registered event handler arguments (id/mask). More...
 
class  TwoNodeDatagramTest
 Test base class for OpenLCB unittests that simulate two physical or virtual nodes talking to each other with the canbus protocol. More...
 
class  UnhandledAddressedMessageHandler
 Message handler that is registered as a fallback handler in the interface's message dispatcher. More...
 
class  VectorEventHandlers
 EventRegistry implementation that keeps all event handlers in a vector and forwards every single call to each event handler. More...
 
class  Velocity
 This class provides a mechanism for working with velocity in different forms. More...
 
class  VerifyNodeIdHandler
 This handler handles VerifyNodeId messages (both addressed and global) on the interface level. More...
 
class  VirtualMemorySpace
 Implementation of a memory space where the values are not stored in a contiguous storage area but are read and written via callbacks. More...
 
class  WriteFlowBase
 Implementation of the hardware-independent parts of the write flows. More...
 
class  WriteHelper
 A statically allocated buffer for sending one message to the OpenLCB bus. More...
 

Typedefs

using BLEProtocolEnginePtr = std::unique_ptr< BLEProtocolEngine, BLEProtocolEngine::Deleter >
 
using BulkAliasAllocatorInterface = FlowInterface< Buffer< BulkAliasRequest > >
 
typedef std::function< void(unsigned)> EventOffsetCallback
 Function declaration that will be called with all event offsets that exist in the configuration space.
 
using Uint8ConfigEntry = NumericConfigEntry< uint8_t >
 Unsigned numeric config entry with 1 byte width.
 
using Uint16ConfigEntry = NumericConfigEntry< uint16_t >
 Unsigned numeric config entry with 2 bytes width.
 
using Uint32ConfigEntry = NumericConfigEntry< uint32_t >
 Unsigned numeric config entry with 4 bytes width.
 
using Uint64ConfigEntry = NumericConfigEntry< uint64_t >
 Unsigned numeric config entry with 8 bytes width.
 
using Int8ConfigEntry = NumericConfigEntry< int8_t >
 Signed numeric config entry with 1 byte width.
 
using Int16ConfigEntry = NumericConfigEntry< int16_t >
 Signed numeric config entry with 2 bytes width.
 
using Int32ConfigEntry = NumericConfigEntry< int32_t >
 Signed numeric config entry with 4 bytes width.
 
using Int64ConfigEntry = NumericConfigEntry< int64_t >
 Signed numeric config entry with 8 bytes width.
 
typedef Payload DatagramPayload
 Contents of a Datagram message.
 
typedef FlowInterface< Buffer< IncomingDatagram > > DatagramHandler
 Base class for datagram handlers.
 
typedef StateFlow< Buffer< IncomingDatagram >, QList< 1 > > DatagramHandlerFlow
 Derive datagram handlers that are stateflows from this base class.
 
typedef uint64_t NodeID
 48-bit NMRAnet Node ID type
 
typedef uint16_t NodeAlias
 Alias to a 48-bit NMRAnet Node ID type.
 
typedef string Payload
 Container that carries the data bytes in an NMRAnet message.
 
typedef uint64_t EventId
 
typedef void(EventHandler::* EventHandlerFunction) (const EventRegistryEntry &registry_entry, EventReport *event, BarrierNotifiable *done)
 
typedef FlowInterface< Buffer< GenMessage > > MessageHandler
 Interface class for all handlers that can be registered in the dispatcher to receive incoming NMRAnet messages.
 
typedef StateFlow< Buffer< GenMessage >, QList< 4 > > MessageStateFlowBase
 Message handlers that are implemented as state flows should derive from this class.
 
using TcpHubDeviceSelect = HubDeviceSelect< HubFlow, FdToTcpParser >
 
typedef StateFlow< Buffer< InitializeRequest >, QList< 1 > > InitializeFlowBase
 
typedef StateFlow< Buffer< SimpleInfoResponse >, QList< 1 > > SimpleInfoFlowBase
 Base class for the SimpleInfoFlow.
 
typedef Velocity SpeedType
 Represents an OpenLCB speed value with accessors to convert to and from various formats.
 

Enumerations

enum  InitState {
  PICK_ALIAS = 0 , SEND_CID_7 , SEND_CID_6 , SEND_CID_5 ,
  SEND_CID_4 , WAIT_RID , SEND_RID , SEND_AMD ,
  SEND_NMRANET_INIT , INITIALIZED
}
 State machine states for initializing the bootloader node. More...
 
enum class  EventState { VALID = 0 , INVALID = 1 , RESERVED = 2 , UNKNOWN = 3 }
 Allowed states of producers and consumers. More...
 
enum  TestingEnum { FOR_TESTING }
 
enum class  ActionConfig : uint8_t { DOUTPUT = 0 , DINPUT = 1 }
 

Functions

void seed_alias_allocator (AliasAllocator *aliases, Pool *pool, int n)
 Helper function to instruct the async alias allocator to pre-allocate N aliases.
 
static NodeAlias resolve_notresponding (NodeAlias stored)
 This code removes the unique bits in the stored node alias in case this is a NOT_RESPONDING entry.
 
void debug_print_entry (void *, NodeID id, NodeAlias alias)
 
void debug_print_cache (AliasCache *c)
 
char * strptime (const char *, const char *, struct tm *)
 
std::unique_ptr< BulkAliasAllocatorInterfacecreate_bulk_alias_allocator (IfCan *can_if)
 Creates a bulk alias allocator.
 
 CDI_GROUP (UserInfoSegment, Segment(MemoryConfigDefs::SPACE_ACDI_USR), Offset(1))
 Configuration description for a segment containing the ACDI user-modifiable data.
 
 CDI_GROUP_ENTRY (name, StringConfigEntry< 63 >, Name("User Name"), Description("This name will appear in network browsers for this device."))
 User name entry.
 
 CDI_GROUP_ENTRY (description, StringConfigEntry< 64 >, Name("User Description"), Description("This description will appear in network browsers for " "this device."))
 User description entry.
 
 CDI_GROUP_END ()
 Signals termination of the group.
 
 CDI_GROUP (InternalConfigData, Name("Internal data"), Description("Do not change these settings."))
 Configuration description for internal configuration variables.
 
 CDI_GROUP_ENTRY (version, Uint16ConfigEntry, Name("Version"))
 Used to detect firmwares that have their config layout set in incompatible ways.
 
 CDI_GROUP_ENTRY (next_event, Uint16ConfigEntry, Name("Next event ID"))
 Last two bytes ofthe next available event ID that can be assigned in a factory reset to the producers/consumers.
 
 CDI_GROUP (ConsumerConfig)
 CDI Configuration for a ConfiguredConsumer.
 
 CDI_GROUP_ENTRY (description, StringConfigEntry< 8 >, Name("Description"), Description("User name of this output."))
 Allows the user to assign a name for this output.
 
 CDI_GROUP_ENTRY (event_on, EventConfigEntry, Name("Event On"), Description("Receiving this event ID will turn the output on."))
 Specifies the event ID to set the output to ON.
 
 CDI_GROUP_ENTRY (event_off, EventConfigEntry, Name("Event Off"), Description("Receiving this event ID will turn the output off."))
 Specifies the event ID to set the output to OFF.
 
 CDI_GROUP (PulseConsumerConfig)
 CDI Configuration for a ConfiguredPulseConsumer.
 
 CDI_GROUP_ENTRY (description, StringConfigEntry< 16 >, Name("Description"), Description("User name of this output."))
 Allows the user to assign a name for this output.
 
 CDI_GROUP_ENTRY (event, EventConfigEntry, Name("Event"), Description("Receiving this event ID will generate a pulse on the output."))
 Specifies the event ID to trigger the output pulse.
 
 CDI_GROUP_ENTRY (duration, Uint8ConfigEntry, Default(3), Name("Pulse duration"), Description("Length of the pulse to output (unit of 30 msec)."))
 Allows the user to configure the output pulse length.
 
 CDI_GROUP (ProducerConfig)
 CDI Configuration for a ConfiguredProducer.
 
 CDI_GROUP_ENTRY (description, StringConfigEntry< 15 >, Name("Description"), Description("User name of this input."))
 Allows the user to assign a name for this input.
 
 CDI_GROUP_ENTRY (debounce, Uint8ConfigEntry, Name("Debounce parameter"), Default(3), Description("Amount of time to wait for the input to stabilize before " "producing the event. Unit is 30 msec of time. Usually a value " "of 2-3 works well in a non-noisy environment. In high noise " "(train wheels for example) a setting between 8 -- 15 makes " "for a slower response time but a more stable " "signal.\nFormally, the parameter tells how many times of " "tries, each 30 msec apart, the input must have the same value " "in order for that value to be accepted and the event " "transition produced."), Default(3))
 Configures the debounce parameter.
 
 CDI_GROUP_ENTRY (event_on, EventConfigEntry, Name("Event On"), Description("This event will be produced when the input goes to HIGH."))
 This event will be produced when the input goes to HIGH.
 
 CDI_GROUP_ENTRY (event_off, EventConfigEntry, Name("Event Off"), Description("This event will be produced when the input goes to LOW."))
 This event will be produced when the input goes to LOW.
 
void ignore_fn ()
 
template<class LocalParams >
 CDI_GROUP (TcpManualAddress)
 
 CDI_GROUP_ENTRY (ip_address, StringConfigEntry< 32 >, Name(LocalParams::IP_ADDRESS_NAME), Description(LocalParams::IP_ADDRESS_DESCR))
 
 CDI_GROUP_ENTRY (port, Uint16ConfigEntry, Name(LocalParams::PORT_NAME), Description(LocalParams::PORT_DESCR), Min(1), Max(65535), Default(LocalParams::DEFAULT_PORT))
 
template<class LocalParams >
 CDI_GROUP (TcpAutoAddress)
 
 CDI_GROUP_ENTRY (service_name, StringConfigEntry< 48 >, Name(LocalParams::SERVICE_NAME), Description(LocalParams::SERVICE_DESCR))
 
 CDI_GROUP_ENTRY (host_name, StringConfigEntry< 48 >, Name(LocalParams::HOST_NAME), Description(LocalParams::HOST_DESCR))
 
template<class LocalParams >
 CDI_GROUP (TcpClientConfig)
 
 CDI_GROUP_ENTRY (search_mode, Uint8ConfigEntry, Name(LocalParams::SEARCH_MODE_NAME), Description(LocalParams::SEARCH_MODE_DESCR), Min(0), Max(3), Default(0), MapValues(LocalParams::SEARCH_MODE_MAP))
 
 CDI_GROUP_ENTRY (manual_address, TcpManualAddress< LocalParams >, Name(LocalParams::MANUAL_ADDRESS_NAME), Description(LocalParams::MANUAL_ADDRESS_DESCR))
 
 CDI_GROUP_ENTRY (auto_address, TcpAutoAddress< LocalParams >, Name(LocalParams::AUTO_ADDRESS_NAME), Description(LocalParams::AUTO_ADDRESS_DESCR))
 
 CDI_GROUP_ENTRY (reconnect, Uint8ConfigEntry, Name(LocalParams::RECONNECT_NAME), Description(LocalParams::RECONNECT_DESCR), Min(0), Max(1), Default(LocalParams::RECONNECT_DEFAULT), MapValues(LocalParams::RECONNECT_MAP))
 
 CDI_GROUP_ENTRY (last_address, TcpManualAddress< LocalParams >, Hidden(true))
 Internal storage for the last working address.
 
string node_id_to_buffer (NodeID id)
 Convenience function to render a 48-bit NMRAnet node ID into a new buffer.
 
void node_id_to_data (NodeID id, void *data)
 Convenience function to render a 48-bit NMRAnet node ID into an existing buffer.
 
NodeID buffer_to_node_id (const string &buf)
 Converts a 6-byte-long buffer to a node ID.
 
NodeID data_to_node_id (const void *d)
 Converts 6 bytes of big-endian data to a node ID.
 
Payload eventid_to_buffer (uint64_t eventid)
 Converts an Event ID to a Payload suitable to be sent as an event report.
 
uint64_t data_to_eventid (const void *data)
 Takes 8 bytes (big-endian) from *data, and returns the event id they represent.
 
string error_to_buffer (uint16_t error_code, uint16_t mti)
 Formats a payload for response of error response messages such as OPtioanl Interaction Rejected or Terminate Due To Error.
 
string error_to_buffer (uint16_t error_code)
 Formats a payload for response of error response messages such as Datagram Rejected.
 
void error_to_data (uint16_t error_code, void *data)
 Writes an error code into a payload object at a given pointer.
 
uint16_t data_to_error (const void *data)
 Parses an error code from a payload object at a given pointer.
 
void append_error_to_buffer (uint16_t error_code, Payload *p)
 Appends an error to the end of an existing buffer.
 
void buffer_to_error (const Payload &payload, uint16_t *error_code, uint16_t *mti, string *error_message)
 Parses the payload of an Optional Interaction Rejected or Terminate Due To Error message.
 
Payload error_payload (uint16_t error_code, Defs::MTI incoming_mti)
 Generates the payload for an OIR or TDE message.
 
unsigned node_high (NodeID id)
 
unsigned node_low (NodeID id)
 
ExecutableTEST_CreateCanDatagramParser (IfCan *if_can)
 Creates a CAN datagram parser flow. Exposed for testing only.
 
EventState invert_event_state (EventState state)
 Returns the inverted event state, switching valid and invalid, but not changing unknown and reserved.
 
EventState to_event_state (bool state)
 Returns the inverted event state, switching valid and invalid, but not changing unknown and reserved.
 
Defs::MTI operator+ (const Defs::MTI &value, EventState state)
 Allows of setting the producer/consumer identified MTI with the event state to set the low bits.
 
Defs::MTI operator++ (Defs::MTI &value, int)
 Operator overload for post increment.
 
Defs::MTIoperator++ (Defs::MTI &value)
 Operator overload for pre increment.
 
Defs::MTI operator-- (Defs::MTI &value, int)
 Operator overload for post decrement.
 
Defs::MTIoperator-- (Defs::MTI &value)
 Operator overload for pre decrement.
 
NodeID NetworkToNodeID (const uint8_t *data)
 Takes six bytes (big-endian) from *data, and returns the node ID they represent.
 
void NodeIDToNetwork (const NodeID id, uint8_t *dst)
 Takes a node id from.
 
uint64_t NetworkToEventID (const void *data)
 Takes 8 bytes (big-endian) from *data, and returns the event id they represent.
 
void EventIDToNetwork (const uint64_t event_id, void *dst)
 Takes an event id from id, and copies it network-endian into *data.
 
string EventIDToPayload (const uint64_t event_id)
 Takes an event ID and returns a network encoding of it in a payload buffer.
 
uint64_t EncodeRange (uint64_t begin, unsigned size)
 Creates a single encoded event range from the beginning of the range and the number fo events to cover.
 
void DecodeRange (EventReport *r)
 
void send_event (Node *src_node, uint64_t event_id)
 Helper function to send an event report to the bus.
 
template<typename... Args>
void send_message (Node *src_node, Defs::MTI mti, Args &&...args)
 Sends an OpenLCB message to the bus.
 
 CDI_GROUP (PCLineConfig)
 
 CDI_GROUP_ENTRY (description, StringConfigEntry< 20 >, Name("Description"), Description("User name of this line."))
 Allows the user to assign a name for this output.
 
 CDI_GROUP_ENTRY (event_on, EventConfigEntry, Name("Event On"), Description("This event ID will turn the output on / be produced when the " "input goes on."))
 Specifies the event ID to set the output to ON.
 
 CDI_GROUP_ENTRY (event_off, EventConfigEntry, Name("Event Off"), Description("This event ID will turn the output off / be produced when the " "input goes off."))
 Specifies the event ID to set the output to OFF.
 
 CDI_GROUP (PCConfig)
 CDI Configuration for a ConfiguredConsumer.
 
 CDI_GROUP_ENTRY (action, Uint8ConfigEntry, Default(1), MapValues(PC_ACTION_MAP), Name("Configuration"))
 
 CDI_GROUP_ENTRY (debounce, Uint8ConfigEntry, Name("Debounce parameter"), Default(3), Description("Used for inputs only. Amount of time to wait for the input to " "stabilize before " "producing the event. Unit is 30 msec of time. Usually a value " "of 2-3 works well in a non-noisy environment. In high noise " "(train wheels for example) a setting between 8 -- 15 makes " "for a slower response time but a more stable " "signal.\nFormally, the parameter tells how many times of " "tries, each 30 msec apart, the input must have the same value " "in order for that value to be accepted and the event " "transition produced."), Default(3))
 Configures the debounce parameter.
 
 CDI_GROUP_ENTRY (unused, EmptyGroup< 1 >)
 
 CDI_GROUP_ENTRY (pc, PCLineConfig)
 
void StartInitializationFlow (Node *node)
 Helper function that sends a local virtual node to the static InitializeFlow.
 
uint8_t event_range_to_bit_count (EventId *event)
 Decodes an event range, encoded according to the Event Transport protocol specification.
 
 CDI_GROUP (ServoConsumerConfig)
 
 CDI_GROUP_ENTRY (event_rotate_min, EventConfigEntry, Name("Minimum Rotation Event ID"), Description("Receiving this event ID will rotate the servo to its mimimum " "configured point."))
 
 CDI_GROUP_ENTRY (event_rotate_max, EventConfigEntry, Name("Maximum Rotation Event ID"), Description("Receiving this event ID will rotate the servo to its maximum " "configured point."))
 
 CDI_GROUP_ENTRY (servo_min_percent, Int16ConfigEntry, Default(0), Min(-99), Max(200), Name("Servo Minimum Stop Point Percentage"), Description("Low-end " SERVO_DESCRIPTION_SUFFIX))
 
 CDI_GROUP_ENTRY (servo_max_percent, Int16ConfigEntry, Default(100), Min(-99), Max(200), Name("Servo Maximum Stop Point Percentage"), Description("High-end " SERVO_DESCRIPTION_SUFFIX))
 
void init_snip_user_file (int fd, const char *user_name, const char *user_description)
 Helper function for test nodes.
 
static size_t find_string_at (const openlcb::Payload &payload, size_t start_pos, string *output)
 
void decode_snip_response (const openlcb::Payload &payload, SnipDecodedData *output)
 Takes an NMRANet SNIP repsonse message paylaod and splits it up into individual fields of the response structure.
 
 CDI_GROUP (TractionShortCvSpace, Segment(openlcb::MemoryConfigDefs::SPACE_DCC_CV), Offset(0x7F000000), Name("CV access"), Description("Individual CVs can be read and modified for Railcom-enabled locomotives using POM commands. Write the CV number variable first, then write or read the CV value variable."))
 CDI group that can be used with the TractionCvSpace class to enable CV access via MemoryConfig protocol.
 
 CDI_GROUP_ENTRY (number, Uint32ConfigEntry, Name("CV number"))
 Which CV number to read/write.
 
 CDI_GROUP_ENTRY (value, Uint8ConfigEntry, Name("CV value"))
 Value of the given CV.
 
 CDI_GROUP_ENTRY (verify_value, Uint8ConfigEntry, Name("Verify CV value"), Description("Write this value first to send out programming track verify " "commands"))
 Verify value.
 
 CDI_GROUP_ENTRY (verify_result, Uint8ConfigEntry, Name("Verify CV result"), Description("Refresh this line to verify CV value. Return 0=no ack, 1=ack."))
 
SpeedType fp16_to_speed (const void *fp16)
 Parses a SpeedType value from an unaligned memory address, typically from the input buffer.
 
void speed_to_fp16 (SpeedType speed, void *fp16)
 Renders a SpeedType value to an unaligned memory address, typically to the output buffer.
 
Nodeallocate_train_node (uint8_t system, uint8_t addr_hi, uint8_t addr_lo, TrainService *traction_service)
 
Velocity nan_to_speed ()
 
 MATCHER_P (IsBufferValue, id, "")
 GoogleMock matcher on a Payload being equal to a given 64-bit value in network byte order.
 
 MATCHER_P (IsBufferValueString, expected, "")
 GoogleMock matcher on a Payload being equal to a given string (C or C++ style).
 
 MATCHER_P (IsBufferNodeValue, id, "")
 GoogleMock matcher on a Payload being equal to a given 48-bit value in network byte order (typically a Node ID).
 
 MATCHER_P (IsBufferNodeValueString, id, "")
 GoogleMock matcher on a Payload being equal to a given 6-byte string.
 
string get_payload_data (size_t length)
 Generates some deterministic data to send via streams.
 

Variables

size_t g_alias_test_conflicts = 0
 Counts the number of aliases that were given up because a conflict has arisen during the allocation.
 
BootloaderState state_
 Global state variables.
 
uint8_t g_write_buffer [WRITE_BUFFER_SIZE]
 Write buffer; the OpenLCB protocol engine collects the incoming bytes into this buffer and repeatedly flushes to flash.
 
int g_bootloader_timeout_sec = 3
 How long to wait for a write datagram's response in the bootloader client.
 
const SimpleNodeStaticValues SNIP_STATIC_DATA
 This static data will be exported as the first block of SNIP.
 
const char *const CONFIG_FILENAME = nullptr
 This symbol must be defined by the application to tell which file to open for the configuration listener.
 
const size_t CONFIG_FILE_SIZE = 0
 This symbol must be defined by the application.
 
string EMPTY_PAYLOAD
 A global class / variable for empty or not-yet-initialized payloads.
 
long long DATAGRAM_RESPONSE_TIMEOUT_NSEC = SEC_TO_NSEC(3)
 Defines how long the datagram client flow should wait for the datagram ack/nack response message.
 
Pool *const g_incoming_datagram_allocator
 Allocator to be used for Buffer<IncomingDatagram> objects.
 
DccPacketDebugFlow g_packet_debug_flow
 Global reference to the packet debug flow.
 
static const NodeAlias NOT_RESPONDING = 0xF000
 Guard value put into the the internal node alias maps when a node ID could not be translated to a valid alias.
 
size_t g_alias_use_conflicts = 0
 Counts the number of alias conflicts that we see for aliases that we already reserved.
 
long long ADDRESSED_MESSAGE_LOOKUP_TIMEOUT_NSEC = SEC_TO_NSEC(1)
 Specifies how long to wait for a response to an alias mapping enquiry message when trying to send an addressed message to a destination.
 
static constexpr unsigned FACTORY_RESET_REBOOT_DELAY_MSEC = 500
 
static const char PC_ACTION_MAP []
 
long long PIP_CLIENT_TIMEOUT_NSEC = SEC_TO_NSEC(4)
 Specifies how long to wait for a PIP request to get a response.
 
const char *const SNIP_DYNAMIC_FILENAME
 The SNIP dynamic data will be read from this file.
 
const uint16_t CDI_EVENT_OFFSETS []
 Contains an array describing each position in the Configuration space that is occupied by an Event ID from a producer or consumer.
 
const uint16_t * cdi_event_offsets_ptr = CDI_EVENT_OFFSETS
 
const char CDI_DATA []
 This symbol contains the embedded text of the CDI xml file.
 
static constexpr long long SNIP_CLIENT_TIMEOUT_NSEC = MSEC_TO_NSEC(2000)
 Specifies how long to wait for a SNIP request to get a response.
 
static const NodeID TEST_NODE_ID = 0x02010d000003ULL
 
static constexpr uint8_t LOCAL_STREAM_ID = 0x3a
 
static constexpr uint8_t SRC_STREAM_ID = 0xa7
 

Detailed Description

Todo:
(balazs.racz) remove this dep
Todo:
need to find an alternative for reboot() for MacOS

Typedef Documentation

◆ BLEProtocolEnginePtr

using openlcb::BLEProtocolEnginePtr = typedef std::unique_ptr<BLEProtocolEngine, BLEProtocolEngine::Deleter>

Definition at line 55 of file BLEDefs.hxx.

◆ BulkAliasAllocatorInterface

◆ DatagramHandler

Base class for datagram handlers.

The datagram handler needs to listen to the incoming queue for arriving datagrams. It is okay to derive a datagram handler from DatagramHandlerFlow as well (they are compatible).

Definition at line 73 of file Datagram.hxx.

◆ DatagramHandlerFlow

Derive datagram handlers that are stateflows from this base class.

Definition at line 75 of file Datagram.hxx.

◆ DatagramPayload

Contents of a Datagram message.

Definition at line 51 of file Datagram.hxx.

◆ EventHandlerFunction

typedef void(EventHandler::* openlcb::EventHandlerFunction) (const EventRegistryEntry &registry_entry, EventReport *event, BarrierNotifiable *done)

Definition at line 241 of file EventHandler.hxx.

◆ EventId

typedef uint64_t openlcb::EventId

Definition at line 48 of file EventHandler.hxx.

◆ EventOffsetCallback

typedef std::function<void(unsigned)> openlcb::EventOffsetCallback

Function declaration that will be called with all event offsets that exist in the configuration space.

Definition at line 85 of file ConfigEntry.hxx.

◆ InitializeFlowBase

◆ Int16ConfigEntry

Signed numeric config entry with 2 bytes width.

Definition at line 333 of file ConfigEntry.hxx.

◆ Int32ConfigEntry

Signed numeric config entry with 4 bytes width.

Definition at line 335 of file ConfigEntry.hxx.

◆ Int64ConfigEntry

Signed numeric config entry with 8 bytes width.

Definition at line 337 of file ConfigEntry.hxx.

◆ Int8ConfigEntry

Signed numeric config entry with 1 byte width.

Definition at line 331 of file ConfigEntry.hxx.

◆ MessageHandler

Interface class for all handlers that can be registered in the dispatcher to receive incoming NMRAnet messages.

Definition at line 177 of file If.hxx.

◆ MessageStateFlowBase

Message handlers that are implemented as state flows should derive from this class.

Definition at line 395 of file If.hxx.

◆ NodeAlias

typedef uint16_t openlcb::NodeAlias

Alias to a 48-bit NMRAnet Node ID type.

Definition at line 48 of file openlcb/Defs.hxx.

◆ NodeID

typedef uint64_t openlcb::NodeID

48-bit NMRAnet Node ID type

Definition at line 45 of file openlcb/Defs.hxx.

◆ Payload

typedef string openlcb::Payload

Container that carries the data bytes in an NMRAnet message.

Definition at line 51 of file openlcb/Defs.hxx.

◆ SimpleInfoFlowBase

Base class for the SimpleInfoFlow.

Definition at line 109 of file SimpleInfoProtocol.hxx.

◆ SpeedType

Represents an OpenLCB speed value with accessors to convert to and from various formats.

Definition at line 52 of file TractionDefs.hxx.

◆ TcpHubDeviceSelect

Definition at line 582 of file IfTcpImpl.hxx.

◆ Uint16ConfigEntry

Unsigned numeric config entry with 2 bytes width.

Definition at line 324 of file ConfigEntry.hxx.

◆ Uint32ConfigEntry

Unsigned numeric config entry with 4 bytes width.

Definition at line 326 of file ConfigEntry.hxx.

◆ Uint64ConfigEntry

Unsigned numeric config entry with 8 bytes width.

Definition at line 328 of file ConfigEntry.hxx.

◆ Uint8ConfigEntry

Unsigned numeric config entry with 1 byte width.

Definition at line 322 of file ConfigEntry.hxx.

Enumeration Type Documentation

◆ ActionConfig

enum class openlcb::ActionConfig : uint8_t
strong

Definition at line 73 of file MultiConfiguredPC.hxx.

◆ EventState

enum class openlcb::EventState
strong

Allowed states of producers and consumers.

Definition at line 86 of file openlcb/Defs.hxx.

◆ InitState

State machine states for initializing the bootloader node.

Represents what the next outgoing packet should be.

Definition at line 63 of file Bootloader.hxx.

◆ TestingEnum

enum openlcb::TestingEnum

Definition at line 57 of file EventHandler.hxx.

Function Documentation

◆ allocate_train_node()

Node * openlcb::allocate_train_node ( uint8_t  system,
uint8_t  addr_hi,
uint8_t  addr_lo,
TrainService traction_service 
)
Todo:
(balazs.racz) this is a kludgy interface but allows the linux traction proxy implementation to override and create test trains.

@TODO(balazs.racz) take into account the speed step setting.

@TODO(balazs.racz) take into account the speed step setting.

Definition at line 51 of file TractionProxy.cxx.

◆ append_error_to_buffer()

void openlcb::append_error_to_buffer ( uint16_t  error_code,
Payload p 
)
extern

Appends an error to the end of an existing buffer.

Definition at line 106 of file If.cxx.

◆ buffer_to_error()

void openlcb::buffer_to_error ( const Payload payload,
uint16_t *  error_code,
uint16_t *  mti,
string *  error_message 
)
extern

Parses the payload of an Optional Interaction Rejected or Terminate Due To Error message.

Parameters
payloadis the contents of the incoming addressed message.
error_codewill hold the 2-byte error code, or ERROR_PERMANENT if not specified
mtiwill hold the MTI value, or 0 if not specified
error_messagewill hold all remaining bytes that came with the error message.

Definition at line 112 of file If.cxx.

◆ buffer_to_node_id()

NodeID openlcb::buffer_to_node_id ( const string &  buf)
extern

Converts a 6-byte-long buffer to a node ID.

Parameters
bufis a buffer that has to have exactly 6 bytes used, filled with a big-endian node id.
Returns
the node id (in host endian).

Definition at line 66 of file If.cxx.

◆ CDI_GROUP() [1/2]

openlcb::CDI_GROUP ( InternalConfigData  ,
Name("Internal data")  ,
Description("Do not change these settings.")   
)

Configuration description for internal configuration variables.

This should preferably not be user-visible in the CDI, but the space has to be reserved in the configuration EEPROM.

◆ CDI_GROUP() [2/2]

openlcb::CDI_GROUP ( UserInfoSegment  ,
Segment(MemoryConfigDefs::SPACE_ACDI_USR ,
Offset(1)   
)

Configuration description for a segment containing the ACDI user-modifiable data.

The implementation refers to the ACDI-userdata space number and does not depend on where the actual data is located.

◆ CDI_GROUP_ENTRY()

openlcb::CDI_GROUP_ENTRY ( last_address  ,
TcpManualAddress< LocalParams >  ,
Hidden(true)   
)

Internal storage for the last working address.

If the IP address field is clear, there is no last known good address.

◆ create_bulk_alias_allocator()

std::unique_ptr< BulkAliasAllocatorInterface > openlcb::create_bulk_alias_allocator ( IfCan can_if)

Creates a bulk alias allocator.

Parameters
can_ifthe interface to bind it to.

Definition at line 280 of file BulkAliasAllocator.cxx.

◆ data_to_error()

uint16_t openlcb::data_to_error ( const void *  data)
extern

Parses an error code from a payload object at a given pointer.

Definition at line 84 of file If.cxx.

◆ data_to_eventid()

uint64_t openlcb::data_to_eventid ( const void *  data)
inline

Takes 8 bytes (big-endian) from *data, and returns the event id they represent.

Definition at line 81 of file Convert.hxx.

◆ data_to_node_id()

NodeID openlcb::data_to_node_id ( const void *  d)
extern

Converts 6 bytes of big-endian data to a node ID.

Parameters
dis a pointer to at least 6 valid bytes.
Returns
the node ID represented by the first 6 bytes of d.

Definition at line 59 of file If.cxx.

◆ debug_print_cache()

void openlcb::debug_print_cache ( AliasCache c)

Definition at line 287 of file AliasCache.cxx.

◆ debug_print_entry()

void openlcb::debug_print_entry ( void *  ,
NodeID  id,
NodeAlias  alias 
)

Definition at line 282 of file AliasCache.cxx.

◆ decode_snip_response()

void openlcb::decode_snip_response ( const openlcb::Payload payload,
SnipDecodedData output 
)

Takes an NMRANet SNIP repsonse message paylaod and splits it up into individual fields of the response structure.

Parameters
payloadreceived message payload
outputwill be filled with the individual fields.

Definition at line 84 of file SimpleNodeInfo.cxx.

◆ DecodeRange()

void openlcb::DecodeRange ( EventReport r)

Definition at line 117 of file EventService.cxx.

◆ EncodeRange()

uint64_t openlcb::EncodeRange ( uint64_t  begin,
unsigned  size 
)

Creates a single encoded event range from the beginning of the range and the number fo events to cover.

There is no restriction on begin and size (e.g. need ot be power-of-two aligned etc.), the range will be expanded so long as it covers begin + size - 1.

Definition at line 240 of file EventHandlerTemplates.cxx.

◆ error_payload()

Payload openlcb::error_payload ( uint16_t  error_code,
Defs::MTI  incoming_mti 
)
extern

Generates the payload for an OIR or TDE message.

Parameters
error_codethe 16-bit ErrorCodes value.
incoming_mtithe MTI of the message that this error should refer to.

Definition at line 135 of file If.cxx.

◆ error_to_buffer() [1/2]

string openlcb::error_to_buffer ( uint16_t  error_code)
extern

Formats a payload for response of error response messages such as Datagram Rejected.

Definition at line 99 of file If.cxx.

◆ error_to_buffer() [2/2]

string openlcb::error_to_buffer ( uint16_t  error_code,
uint16_t  mti 
)
extern

Formats a payload for response of error response messages such as OPtioanl Interaction Rejected or Terminate Due To Error.

Definition at line 90 of file If.cxx.

◆ error_to_data()

void openlcb::error_to_data ( uint16_t  error_code,
void *  data 
)
extern

Writes an error code into a payload object at a given pointer.

Definition at line 78 of file If.cxx.

◆ event_range_to_bit_count()

uint8_t openlcb::event_range_to_bit_count ( EventId *  event)

Decodes an event range, encoded according to the Event Transport protocol specification.

Parameters
eventis a pointer to the variable holding the event range. This value will be modified to hold only the base value of the event, without the mask bits.
Returns
the number of mask bits that were there, in the range of 1..64.

Definition at line 49 of file RoutingLogic.cxx.

◆ eventid_to_buffer()

Payload openlcb::eventid_to_buffer ( uint64_t  eventid)
extern

Converts an Event ID to a Payload suitable to be sent as an event report.

Definition at line 72 of file If.cxx.

◆ EventIDToNetwork()

void openlcb::EventIDToNetwork ( const uint64_t  event_id,
void *  dst 
)
inline

Takes an event id from id, and copies it network-endian into *data.

Definition at line 67 of file EndianHelper.hxx.

◆ EventIDToPayload()

string openlcb::EventIDToPayload ( const uint64_t  event_id)
inline

Takes an event ID and returns a network encoding of it in a payload buffer.

Definition at line 74 of file EndianHelper.hxx.

◆ find_string_at()

static size_t openlcb::find_string_at ( const openlcb::Payload payload,
size_t  start_pos,
string *  output 
)
static

Definition at line 70 of file SimpleNodeInfo.cxx.

◆ fp16_to_speed()

SpeedType openlcb::fp16_to_speed ( const void *  fp16)

Parses a SpeedType value from an unaligned memory address, typically from the input buffer.

Definition at line 42 of file TractionDefs.cxx.

◆ get_payload_data()

string openlcb::get_payload_data ( size_t  length)

Generates some deterministic data to send via streams.

Definition at line 11 of file async_stream_test_helper.hxx.

◆ init_snip_user_file()

void openlcb::init_snip_user_file ( int  fd,
const char *  user_name,
const char *  user_description 
)

Helper function for test nodes.

Fills a file with the given SNIP user values.

Definition at line 46 of file SimpleNodeInfo.cxx.

◆ invert_event_state()

EventState openlcb::invert_event_state ( EventState  state)
inline

Returns the inverted event state, switching valid and invalid, but not changing unknown and reserved.

Definition at line 330 of file openlcb/Defs.hxx.

◆ MATCHER_P() [1/4]

openlcb::MATCHER_P ( IsBufferNodeValue  ,
id  ,
""   
)
protected

GoogleMock matcher on a Payload being equal to a given 48-bit value in network byte order (typically a Node ID).

Definition at line 552 of file async_if_test_helper.hxx.

◆ MATCHER_P() [2/4]

openlcb::MATCHER_P ( IsBufferNodeValueString  ,
id  ,
""   
)
protected

GoogleMock matcher on a Payload being equal to a given 6-byte string.

Definition at line 575 of file async_if_test_helper.hxx.

◆ MATCHER_P() [3/4]

openlcb::MATCHER_P ( IsBufferValue  ,
id  ,
""   
)
protected

GoogleMock matcher on a Payload being equal to a given 64-bit value in network byte order.

(Typically an event id.)

Definition at line 532 of file async_if_test_helper.hxx.

◆ MATCHER_P() [4/4]

openlcb::MATCHER_P ( IsBufferValueString  ,
expected  ,
""   
)
protected

GoogleMock matcher on a Payload being equal to a given string (C or C++ style).

Definition at line 544 of file async_if_test_helper.hxx.

◆ nan_to_speed()

Velocity openlcb::nan_to_speed ( )
inline
Returns
NAN as speed.

Definition at line 491 of file Velocity.hxx.

◆ NetworkToEventID()

uint64_t openlcb::NetworkToEventID ( const void *  data)
inline

Takes 8 bytes (big-endian) from *data, and returns the event id they represent.

Definition at line 60 of file EndianHelper.hxx.

◆ NetworkToNodeID()

NodeID openlcb::NetworkToNodeID ( const uint8_t *  data)
inline

Takes six bytes (big-endian) from *data, and returns the node ID they represent.

Definition at line 45 of file EndianHelper.hxx.

◆ node_high()

unsigned openlcb::node_high ( NodeID  id)
inline
Returns
the high 4 bytes of a node ID.
Parameters
idis the node ID.

Definition at line 127 of file Convert.hxx.

◆ node_id_to_buffer()

string openlcb::node_id_to_buffer ( NodeID  id)
extern

Convenience function to render a 48-bit NMRAnet node ID into a new buffer.

Parameters
idis the 48-bit ID to render.
Returns
a new buffer (from the main pool) with 6 bytes of used space, a big-endian representation of the node ID.

Definition at line 45 of file If.cxx.

◆ node_id_to_data()

void openlcb::node_id_to_data ( NodeID  id,
void *  data 
)
extern

Convenience function to render a 48-bit NMRAnet node ID into an existing buffer.

Parameters
idis the 48-bit ID to render.
datais the memory space to write the rendered ID into. There must be at least 6 bytes available at this address.

Definition at line 52 of file If.cxx.

◆ node_low()

unsigned openlcb::node_low ( NodeID  id)
inline
Returns
the low 4 bytes of a node ID.
Parameters
idis the node ID.

Definition at line 132 of file Convert.hxx.

◆ NodeIDToNetwork()

void openlcb::NodeIDToNetwork ( const NodeID  id,
uint8_t *  dst 
)
inline

Takes a node id from.

Parameters
id,andcopies 6 bytes network-endian into *dst.

Definition at line 53 of file EndianHelper.hxx.

◆ operator+()

Defs::MTI openlcb::operator+ ( const Defs::MTI value,
EventState  state 
)
inline

Allows of setting the producer/consumer identified MTI with the event state to set the low bits.

Definition at line 352 of file openlcb/Defs.hxx.

◆ operator++() [1/2]

Defs::MTI & openlcb::operator++ ( Defs::MTI value)
inline

Operator overload for pre increment.

Definition at line 368 of file openlcb/Defs.hxx.

◆ operator++() [2/2]

Defs::MTI openlcb::operator++ ( Defs::MTI value,
int   
)
inline

Operator overload for post increment.

Definition at line 360 of file openlcb/Defs.hxx.

◆ operator--() [1/2]

Defs::MTI & openlcb::operator-- ( Defs::MTI value)
inline

Operator overload for pre decrement.

Definition at line 383 of file openlcb/Defs.hxx.

◆ operator--() [2/2]

Defs::MTI openlcb::operator-- ( Defs::MTI value,
int   
)
inline

Operator overload for post decrement.

Definition at line 375 of file openlcb/Defs.hxx.

◆ resolve_notresponding()

static NodeAlias openlcb::resolve_notresponding ( NodeAlias  stored)
static

This code removes the unique bits in the stored node alias in case this is a NOT_RESPONDING entry.

Parameters
storedalias in the metadata storage
Returns
the alias if it's valid or NOT_RESPONDING ifthis is a sentinel

Definition at line 54 of file AliasCache.cxx.

◆ seed_alias_allocator()

void openlcb::seed_alias_allocator ( AliasAllocator aliases,
Pool pool,
int  n 
)

Helper function to instruct the async alias allocator to pre-allocate N aliases.

Parameters
aliasesis the async alias allocator to use.
poolis the pool from where we take the buffers for the aliases.
nis how many aliases we pre-allocate.

Definition at line 73 of file AliasAllocator.cxx.

◆ send_event()

void openlcb::send_event ( Node src_node,
uint64_t  event_id 
)

Helper function to send an event report to the bus.

Performs synchronous (dynamic) memory allocation so use it sparingly and when there is sufficient amount of RAM available.

Parameters
event_idis the event to send off.

Definition at line 143 of file If.cxx.

◆ send_message()

template<typename... Args>
void openlcb::send_message ( Node src_node,
Defs::MTI  mti,
Args &&...  args 
)

Sends an OpenLCB message to the bus.

Performs synchronous (dynamic) memory allocation so use it sparingly and when there is sufficient amount of RAM available.

Parameters
src_nodeA local virtual node from which to send the message.
mtimessage type indicator
argseither a Payload to send a global message, or a NodeHandle dst and a Payload to send an addressed message.

Definition at line 426 of file If.hxx.

◆ speed_to_fp16()

void openlcb::speed_to_fp16 ( SpeedType  speed,
void *  fp16 
)

Renders a SpeedType value to an unaligned memory address, typically to the output buffer.

Parameters
speedis the speed to write
fp16is an unaligned two-byte location to write the float16 value to.

Definition at line 55 of file TractionDefs.cxx.

◆ StartInitializationFlow()

void openlcb::StartInitializationFlow ( Node node)
extern

Helper function that sends a local virtual node to the static InitializeFlow.

Definition at line 44 of file NodeInitializeFlow.cxx.

◆ TEST_CreateCanDatagramParser()

Executable * openlcb::TEST_CreateCanDatagramParser ( IfCan if_can)

Creates a CAN datagram parser flow. Exposed for testing only.

Definition at line 360 of file DatagramCan.cxx.

◆ to_event_state()

EventState openlcb::to_event_state ( bool  state)
inline

Returns the inverted event state, switching valid and invalid, but not changing unknown and reserved.

Definition at line 345 of file openlcb/Defs.hxx.

Variable Documentation

◆ ADDRESSED_MESSAGE_LOOKUP_TIMEOUT_NSEC

long long openlcb::ADDRESSED_MESSAGE_LOOKUP_TIMEOUT_NSEC = SEC_TO_NSEC(1)

Specifies how long to wait for a response to an alias mapping enquiry message when trying to send an addressed message to a destination.

The final timeout will be twice this time, because after the first timeout a global message for verify node id request will also be sent out.

This value is writable for unittesting purposes. We might consider moving it to flash with a weak definition instead.

Definition at line 57 of file IfCan.cxx.

◆ CDI_EVENT_OFFSETS

const uint16_t openlcb::CDI_EVENT_OFFSETS[]
extern

Contains an array describing each position in the Configuration space that is occupied by an Event ID from a producer or consumer.

These Event IDs will be reset to increasing event numbers upon factory reset. The array is exported by the cdi compilation mechanism (in CompileCdiMain.cxx) and defined by cdi.o for the linker.

◆ cdi_event_offsets_ptr

const uint16_t* openlcb::cdi_event_offsets_ptr = CDI_EVENT_OFFSETS

Definition at line 387 of file SimpleStack.cxx.

◆ CONFIG_FILE_SIZE

const size_t openlcb::CONFIG_FILE_SIZE = 0
extern

This symbol must be defined by the application.

It defines the size of the config (or eeprom) file in bytes.

Definition at line 83 of file SimpleStack.hxx.

◆ CONFIG_FILENAME

const char *const openlcb::CONFIG_FILENAME = nullptr
extern

This symbol must be defined by the application to tell which file to open for the configuration listener.

Definition at line 80 of file SimpleStack.hxx.

◆ DATAGRAM_RESPONSE_TIMEOUT_NSEC

long long openlcb::DATAGRAM_RESPONSE_TIMEOUT_NSEC = SEC_TO_NSEC(3)

Defines how long the datagram client flow should wait for the datagram ack/nack response message.

Defines how long to wait for a Datagram_OK / Datagram_Rejected message.

Definition at line 42 of file Datagram.cxx.

◆ EMPTY_PAYLOAD

string openlcb::EMPTY_PAYLOAD

A global class / variable for empty or not-yet-initialized payloads.

Definition at line 152 of file If.cxx.

◆ FACTORY_RESET_REBOOT_DELAY_MSEC

constexpr unsigned openlcb::FACTORY_RESET_REBOOT_DELAY_MSEC = 500
staticconstexpr

Definition at line 75 of file MemoryConfig.cxx.

◆ g_alias_test_conflicts

size_t openlcb::g_alias_test_conflicts = 0

Counts the number of aliases that were given up because a conflict has arisen during the allocation.

Definition at line 42 of file AliasAllocator.cxx.

◆ g_alias_use_conflicts

size_t openlcb::g_alias_use_conflicts = 0

Counts the number of alias conflicts that we see for aliases that we already reserved.

Definition at line 47 of file IfCan.cxx.

◆ g_bootloader_timeout_sec

int openlcb::g_bootloader_timeout_sec = 3

How long to wait for a write datagram's response in the bootloader client.

Definition at line 89 of file BootloaderClient.hxx.

◆ g_incoming_datagram_allocator

Pool *const openlcb::g_incoming_datagram_allocator
Initial value:
=
Pool * init_main_buffer_pool()
Initializes the main buffer pool.
Definition Buffer.cxx:40

Allocator to be used for Buffer<IncomingDatagram> objects.

Definition at line 454 of file SimpleStack.cxx.

◆ g_write_buffer

uint8_t openlcb::g_write_buffer[WRITE_BUFFER_SIZE]

Write buffer; the OpenLCB protocol engine collects the incoming bytes into this buffer and repeatedly flushes to flash.

Definition at line 147 of file Bootloader.hxx.

◆ LOCAL_STREAM_ID

constexpr uint8_t openlcb::LOCAL_STREAM_ID = 0x3a
staticconstexpr

Definition at line 7 of file async_stream_test_helper.hxx.

◆ NOT_RESPONDING

const NodeAlias openlcb::NOT_RESPONDING = 0xF000
static

Guard value put into the the internal node alias maps when a node ID could not be translated to a valid alias.

Definition at line 55 of file openlcb/Defs.hxx.

◆ PC_ACTION_MAP

const char openlcb::PC_ACTION_MAP[]
static
Initial value:
=
"<relation><property>0</property><value>Output</value></relation>"
"<relation><property>1</property><value>Input</value></relation>"

Definition at line 50 of file MultiConfiguredPC.hxx.

◆ PIP_CLIENT_TIMEOUT_NSEC

long long openlcb::PIP_CLIENT_TIMEOUT_NSEC = SEC_TO_NSEC(4)

Specifies how long to wait for a PIP request to get a response.

Writable for unittesting purposes. Defaults to 4 seconds.

Definition at line 39 of file PIPClient.cxx.

◆ SNIP_CLIENT_TIMEOUT_NSEC

constexpr long long openlcb::SNIP_CLIENT_TIMEOUT_NSEC = MSEC_TO_NSEC(2000)
staticconstexpr

Specifies how long to wait for a SNIP request to get a response.

Writable for unittesting purposes.

Definition at line 79 of file SNIPClient.hxx.

◆ SNIP_DYNAMIC_FILENAME

const char* const openlcb::SNIP_DYNAMIC_FILENAME
extern

The SNIP dynamic data will be read from this file.

It should be 128 bytes long, and include the version number of "2" at the beginning.

◆ SNIP_STATIC_DATA

const SimpleNodeStaticValues openlcb::SNIP_STATIC_DATA
extern
Initial value:
= {
4, "OpenMRN", "Undefined model", "Undefined HW version", "0.9"}

This static data will be exported as the first block of SNIP.

The version field must contain "4".

Definition at line 43 of file SimpleNodeInfo.cxx.

◆ SRC_STREAM_ID

constexpr uint8_t openlcb::SRC_STREAM_ID = 0xa7
staticconstexpr

Definition at line 8 of file async_stream_test_helper.hxx.

◆ state_

BootloaderState openlcb::state_

Global state variables.

Definition at line 129 of file Bootloader.hxx.

◆ TEST_NODE_ID

const NodeID openlcb::TEST_NODE_ID = 0x02010d000003ULL
staticprotected

Definition at line 317 of file async_if_test_helper.hxx.