|
Open Model Railroad Network (OpenMRN)
|
Classes | |
| class | TcpPhysicalIf |
Public Member Functions | |
| SimpleTcpStackBase (const openlcb::NodeID node_id) | |
| void | add_tcp_port_select (int fd, Notifiable *on_error=nullptr) |
| Adds a new link to the TCP interface. | |
Public Member Functions inherited from openlcb::SimpleStackBase | |
| SimpleStackBase (std::function< std::unique_ptr< PhysicalIf >()> create_if_helper) | |
| Executor< EXECUTOR_PRIORITIES > * | executor () |
| Service * | service () |
| If * | iface () |
| DatagramService * | dg_service () |
| SimpleInfoFlow * | info_flow () |
| Accessor for clients that have their custom SNIP-like handler. | |
| virtual Node * | node ()=0 |
| MemoryConfigHandler * | memory_config_handler () |
| ConfigUpdateService * | config_service () |
| void | set_tx_activity_led (const Gpio *led, long long period=MSEC_TO_NSEC(33)) |
| Adds an activiy LED which will be flashed every time a message is sent from this node to the network. | |
| void | restart_stack () |
| Reinitializes the node. | |
| void | loop_executor (bool delay_start=false) |
| Donates the current thread to the executor. | |
| void | start_after_delay () |
| Call this function when you used delay_start upon starting the executor. | |
| void | start_executor_thread (const char *name, int priority, size_t stack_size, bool delay_start=false) |
| Instructs the executor to create a new thread and run in there. | |
| int | create_config_file_if_needed (const InternalConfigData &ofs, uint16_t expected_version, unsigned file_size) |
| Tries to open the config file; if not existant, the size too small, or the version number is mismatched, then creates a new file of the given size with all 0xFF bytes inside. | |
| int | check_version_and_factory_reset (const InternalConfigData &ofs, uint16_t expected_version, bool force=false) |
| Checks the version information in the EEPROM and performs a factory reset if incorrect or if force is set. | |
| void | send_event (uint64_t event_id) |
| Helper function to send an event report to the bus. | |
| void | send_message_to (Defs::MTI mti, NodeHandle dst, const string &payload=EMPTY_PAYLOAD) |
| Sends an addressed message to the bus. | |
| virtual uint64_t | get_pip () |
| Get the PIP response value. | |
Protected Member Functions | |
| void | start_iface (bool restart) override |
| Helper function for start_stack et al. | |
Protected Member Functions inherited from openlcb::SimpleStackBase | |
| void | start_stack (bool delay_start) |
| Call this function once after the actual IO ports are set up. | |
| virtual void | start_node ()=0 |
| Hook for clients to initialize the node-specific components. | |
| void | default_start_node () |
| Exports the memory config spaces that are typically used for a complex node. | |
Private Member Functions | |
| HubFlow * | tcp_hub () |
| This function is not safe to use. | |
| IfTcp * | if_tcp () |
| std::unique_ptr< PhysicalIf > | create_if (const openlcb::NodeID node_id) |
| Constructor helper function. | |
Additional Inherited Members | |
Static Public Member Functions inherited from openlcb::SimpleStackBase | |
| static void | factory_reset_all_events (const InternalConfigData &ofs, uint64_t node_id, int fd) |
| Overwrites all events in the eeprom with a brand new event ID. | |
| static void | set_event_offsets (const vector< uint16_t > *offsets) |
| Call this function at the beginning of appl_main, just before {} or { create_config_file_if_needed} if the list of event offsets are dyamically created instead of statically linked. | |
Static Public Attributes inherited from openlcb::SimpleStackBase | |
| static const unsigned | EXECUTOR_PRIORITIES = 5 |
Protected Attributes inherited from openlcb::SimpleStackBase | |
| Executor< EXECUTOR_PRIORITIES > | executor_ {NO_THREAD()} |
| This executor's threads will be handled. | |
| Service | service_ {&executor_} |
| Default service on the particular executor. | |
| std::unique_ptr< PhysicalIf > | ifaceHolder_ |
| Pointer to the polymorphic implementation of the OpenLCB If. | |
| If * | iface_ {ifaceHolder_->iface()} |
| The OpenLCB interface object. Owned by ifaceHolder_;. | |
| DatagramService * | datagramService_ {ifaceHolder_->datagram_service()} |
| The datagram service bound to the interface object. | |
| ConfigUpdateFlow | configUpdateFlow_ {iface()} |
| Calls the config listeners with the configuration FD. | |
| InitializeFlow | initFlow_ {&service_} |
| The initialization flow takes care for node startup duties. | |
| EventService | eventService_ {iface()} |
| Dispatches event protocol requests to the event handlers. | |
| SimpleInfoFlow | infoFlow_ {iface()} |
| General flow for simple info requests. | |
| MemoryConfigHandler | memoryConfigHandler_ |
| std::unique_ptr< HubFlow > | gcHub_ |
| All packets are forwarded to this hub in gridconnect format, if needed. | |
| std::unique_ptr< GCAdapterBase > | gcAdapter_ |
| Bridge between canHub_ and gcHub_. Lazily initialized. | |
| std::vector< std::unique_ptr< Destructable > > | additionalComponents_ |
| Stores and keeps ownership of optional components. | |
Definition at line 521 of file SimpleStack.hxx.
| openlcb::SimpleTcpStackBase::SimpleTcpStackBase | ( | const openlcb::NodeID | node_id | ) |
Definition at line 81 of file SimpleStack.cxx.
|
inline |
Adds a new link to the TCP interface.
It is OK to add more than one link, data between different links will be forwarded (without any filtering).
| fd | is the file descriptor (socket) representing the link. Must be select-capable. |
| on_error | will be invoked when the link is closed due to experiencing an error. |
Definition at line 533 of file SimpleStack.hxx.
|
private |
Constructor helper function.
Creates the specific objects needed for the TCP interface to function. Will be called exactly once by the constructor of the base class.
Definition at line 86 of file SimpleStack.cxx.
|
inlineprivate |
Definition at line 554 of file SimpleStack.hxx.
|
overrideprotectedvirtual |
Helper function for start_stack et al.
Implements openlcb::SimpleStackBase.
Definition at line 222 of file SimpleStack.cxx.
|
inlineprivate |
This function is not safe to use.
There is an expectation that only complete OpenLCB-TCP packets are submitted to this hub. Use the add_tcp_port_select() call instead.
Definition at line 548 of file SimpleStack.hxx.