|
Open Model Railroad Network (OpenMRN)
|
Implementation class that adds a device to a CAN hub with dynamic translation of the packets to/from GridConnect format. More...
Public Member Functions | |
| GcHubPort (CanHubFlow *can_hub, int fd, Notifiable *on_exit, bool use_select) | |
| Constructor. | |
| void | notify () OVERRIDE |
| Callback in case the connection is closed due to error. | |
| void | run () OVERRIDE |
| Entry point. | |
Public Member Functions inherited from Executable | |
| void | test_deletion () |
| virtual void | alloc_result (QMember *item) |
| Return the result of an alloc_async() from a memory Pool. | |
Public Member Functions inherited from QMember | |
| void | init () |
| Initiailize a QMember, in place of a public placement construction. | |
Public Attributes | |
| HubFlow | gcHub_ |
| This hub sees the character-based representation of the packets. | |
| std::unique_ptr< GCAdapterBase > | bridge_ |
| Translates packets between the can-hub of the device and the char-hub of this port. | |
| std::unique_ptr< FdHubPortInterface > | gcWrite_ |
| Reads the characters from the char-hub and sends them to the fd. | |
| Notifiable * | onExit_ |
| If not null, this notifiable will be called when the device is closed. | |
Additional Inherited Members | |
Protected Member Functions inherited from QMember | |
| QMember () | |
| Constructor. | |
| ~QMember () | |
| Destructor. | |
Protected Attributes inherited from QMember | |
| QMember * | next |
| pointer to the next member in the queue | |
Implementation class that adds a device to a CAN hub with dynamic translation of the packets to/from GridConnect format.
Sends a notification to the application level when there is an error on the device and the connection is closed.
Definition at line 441 of file GridConnectHub.cxx.
|
inline |
Constructor.
| can_hub | Parent (binary) hub flow. |
| fd | device descriptor of open channel (device or socket) |
| on_exit | Notifiable that will be called when the descriptor experiences an error (typically upon device closed or connection lost). |
| use_select | true if fd can be used with select, false if threads are needed. |
Definition at line 451 of file GridConnectHub.cxx.
|
inlinevirtual |
Definition at line 468 of file GridConnectHub.cxx.
|
inlinevirtual |
Callback in case the connection is closed due to error.
Reimplemented from Executable.
Definition at line 494 of file GridConnectHub.cxx.
|
inlinevirtual |
Entry point.
This funciton will be called when *this gets scheduled on the CPU.
Implements Executable.
Definition at line 503 of file GridConnectHub.cxx.
| std::unique_ptr<GCAdapterBase> GcHubPort::bridge_ |
Translates packets between the can-hub of the device and the char-hub of this port.
Destruction requirement: Call shutdown() on the can-side executor (and yield) until it returns true.
Definition at line 484 of file GridConnectHub.cxx.
| HubFlow GcHubPort::gcHub_ |
This hub sees the character-based representation of the packets.
The members of it are: the bridge and the physical device (fd).
Destruction requirement: HubFlow should be empty. This means after the disconnection of the bridge (write side) and the FdHubport (read side) we need to wait for the executor until this flow drains.
Definition at line 478 of file GridConnectHub.cxx.
| std::unique_ptr<FdHubPortInterface> GcHubPort::gcWrite_ |
Reads the characters from the char-hub and sends them to the fd.
Similarly, listens to the fd and sends the read charcters to the char-hub.
Definition at line 488 of file GridConnectHub.cxx.
| Notifiable* GcHubPort::onExit_ |
If not null, this notifiable will be called when the device is closed.
Definition at line 491 of file GridConnectHub.cxx.