Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
GCAdapterBase Class Referenceabstract

Publicly visible API for the gridconnect-to-CAN bridge. More...

#include <GridConnectHub.hxx>

Inheritance diagram for GCAdapterBase:
GCAdapter

Public Member Functions

virtual bool shutdown ()=0
 Unregisters *this from the pipes.
 

Static Public Member Functions

static GCAdapterBaseCreateGridConnectAdapter (HubFlow *gc_side, CanHubFlow *can_side, bool double_bytes)
 This function connects an ASCII (GridConnect-format) CAN adapter to a binary CAN adapter, performing the necessary format conversions inbetween.
 
static GCAdapterBaseCreateGridConnectAdapter (HubFlow *gc_side_read, HubFlow *gc_side_write, CanHubFlow *can_side, bool double_bytes)
 Creates a gridconnect-CAN bridge with separate pipes for reading (parsing) from the GC side and writing (formatting) to the GC side.
 

Detailed Description

Publicly visible API for the gridconnect-to-CAN bridge.

This bridge links two Hubs, one typed string, the other typed CanHubData, by parsing/rendering the packets from the gridconnect protocol.

This public-facing API allows creating and managing the bridge as necessary for production code and unittests.

Definition at line 51 of file GridConnectHub.hxx.

Constructor & Destructor Documentation

◆ ~GCAdapterBase()

virtual GCAdapterBase::~GCAdapterBase ( )
inlinevirtual

Definition at line 54 of file GridConnectHub.hxx.

Member Function Documentation

◆ CreateGridConnectAdapter() [1/2]

GCAdapterBase * GCAdapterBase::CreateGridConnectAdapter ( HubFlow gc_side,
CanHubFlow can_side,
bool  double_bytes 
)
static

This function connects an ASCII (GridConnect-format) CAN adapter to a binary CAN adapter, performing the necessary format conversions inbetween.

Specifically, it takes two Hub flows as input, one carrying CAN frames in GridConnect protocol, and the other carrying CAN frames in the binary protocol.

Parameters
gc_sideis the Hub that has the ASCII GridConnect traffic.
can_sideis the Hub that has the binary CAN traffic.
double_bytesif true, any frame rendered into the GC protocol will have their characters doubled.
Returns
a pointer to the created object. It can be deleted, which will terminate the link and unregister the link members from both pipes.

Definition at line 357 of file GridConnectHub.cxx.

◆ CreateGridConnectAdapter() [2/2]

GCAdapterBase * GCAdapterBase::CreateGridConnectAdapter ( HubFlow gc_side_read,
HubFlow gc_side_write,
CanHubFlow can_side,
bool  double_bytes 
)
static

Creates a gridconnect-CAN bridge with separate pipes for reading (parsing) from the GC side and writing (formatting) to the GC side.

*‍/

Parameters
gc_side_readis the Hub that the GridConnect traffic is read from, to be converted and sent to binary.
gc_side_writeis the Hub that the coverted GridConnect traffic is written to.
can_sidethe hub (of type struct can_frame) that the binary IO is done via.
double_bytesif true, any frame rendered into the GC protocol will have their characters doubled.
Returns
a pointer to the created object. It can be deleted, which will terminate the link and unregister the link members from both pipes.

Definition at line 364 of file GridConnectHub.cxx.

◆ shutdown()

virtual bool GCAdapterBase::shutdown ( )
pure virtual

Unregisters *this from the pipes.

Returns
true if it is safe to destroy *this. It is OK to call this multiple times. It should be called on the executor of the CAN side service. *‍/

Implemented in GCAdapter.


The documentation for this class was generated from the following files: