Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
GCAdapter Class Reference

Actual implementation for the gridconnect bridge between a string-typed Hub and a CAN-frame-typed Hub. More...

Inheritance diagram for GCAdapter:
GCAdapterBase

Classes

class  BinaryToGCMember
 HubPort (on a CAN-typed hub) that turns a binary CAN packet into a string-formatted CAN packet, and sends it off to the HubFlow (of type string). More...
 
class  GCToBinaryMember
 HubPort (on a string hub) that turns a gridconnect-formatted CAN packet into a binary CAN packet, and sends them off to the HubFlow (of CAN frame). More...
 

Public Member Functions

 GCAdapter (HubFlow *gc_side, CanHubFlow *can_side, bool double_bytes)
 Constructor.
 
 GCAdapter (HubFlow *gc_side_read, HubFlow *gc_side_write, CanHubFlow *can_side, bool double_bytes)
 Constructor.
 
void unregister ()
 
bool shutdown () OVERRIDE
 Unregisters *this from the pipes.
 

Private Attributes

GCToBinaryMember parser_
 PipeMember doing the parsing.
 
BinaryToGCMember formatter_
 PipeMember doing the formatting.
 
unsigned isRegistered_: 1
 1 if the flows are registered.
 

Additional Inherited Members

- Static Public Member Functions inherited from GCAdapterBase
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

Actual implementation for the gridconnect bridge between a string-typed Hub and a CAN-frame-typed Hub.

Definition at line 55 of file GridConnectHub.cxx.

Constructor & Destructor Documentation

◆ GCAdapter() [1/2]

GCAdapter::GCAdapter ( HubFlow gc_side,
CanHubFlow can_side,
bool  double_bytes 
)
inline

Constructor.

Parameters
gc_sideA hub of type string, the gridconnect side.
can_sideA hub of type struct can_frame, the binary side.
double_bytesif true, upon rendering data each byte will be doubled. This is an anciant workaround.

Definition at line 64 of file GridConnectHub.cxx.

◆ GCAdapter() [2/2]

GCAdapter::GCAdapter ( HubFlow gc_side_read,
HubFlow gc_side_write,
CanHubFlow can_side,
bool  double_bytes 
)
inline

Constructor.

Parameters
gc_side_readA hub of type string to read packets from. The read packets will be converted to binary and sent to can_side.
gc_side_writeA hub of type string to write incoming binary packets that were converted to
can_sideA hub of type struct can_frame, the binary side.
double_bytesif true, upon rendering data each byte will be doubled. This is an anciant workaround.

Definition at line 82 of file GridConnectHub.cxx.

◆ ~GCAdapter()

virtual GCAdapter::~GCAdapter ( )
inlinevirtual

Definition at line 92 of file GridConnectHub.cxx.

Member Function Documentation

◆ shutdown()

bool GCAdapter::shutdown ( )
inlinevirtual

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. *‍/

Implements GCAdapterBase.

Definition at line 109 of file GridConnectHub.cxx.

◆ unregister()

void GCAdapter::unregister ( )
inline
Todo:
(balazs.racz) This is incorrect if the 3-pipe constructor is used.

Definition at line 97 of file GridConnectHub.cxx.

Member Data Documentation

◆ formatter_

BinaryToGCMember GCAdapter::formatter_
private

PipeMember doing the formatting.

Definition at line 352 of file GridConnectHub.cxx.

◆ isRegistered_

unsigned GCAdapter::isRegistered_
private

1 if the flows are registered.

Definition at line 354 of file GridConnectHub.cxx.

◆ parser_

GCToBinaryMember GCAdapter::parser_
private

PipeMember doing the parsing.

Definition at line 350 of file GridConnectHub.cxx.


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