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

Connection client that opens a character device (such as an usb-serial) and sets the termios attributes as appropriate for linux and mac on a serial-to-can or usb-to-can controller. More...

#include <ClientConnection.hxx>

Inheritance diagram for DeviceConnectionClient:
GCFdConnectionClient ConnectionClient

Public Member Functions

template<typename HubType >
 DeviceConnectionClient (const string &name, HubType *hub, const string &dev)
 Constructor.
 
- Public Member Functions inherited from GCFdConnectionClient
 GCFdConnectionClient (const string &name, CanHubFlow *hub)
 Constructor.
 
 GCFdConnectionClient (const string &name, ByteDirectHubInterface *direct_hub)
 Constructor.
 
bool ping () OVERRIDE
 Tests if the device is alive or encountered an error.
 
int fd () override
 

Private Member Functions

void try_connect () OVERRIDE
 Attempts to open the device.
 

Private Attributes

string dev_
 filename of device to open
 

Additional Inherited Members

- Protected Member Functions inherited from GCFdConnectionClient
void connection_complete (int fd)
 Callback from try_connect to donate the file descriptor.
 

Detailed Description

Connection client that opens a character device (such as an usb-serial) and sets the termios attributes as appropriate for linux and mac on a serial-to-can or usb-to-can controller.

Definition at line 161 of file ClientConnection.hxx.

Constructor & Destructor Documentation

◆ DeviceConnectionClient()

template<typename HubType >
DeviceConnectionClient::DeviceConnectionClient ( const string &  name,
HubType *  hub,
const string &  dev 
)
inline

Constructor.

Parameters
nameuser-readable name of this device
hubCAN packet hub or GC DirectHub to connect this device to
devfilename of the device node to open

Definition at line 170 of file ClientConnection.hxx.

◆ ~DeviceConnectionClient()

virtual DeviceConnectionClient::~DeviceConnectionClient ( )
inlinevirtual

Definition at line 177 of file ClientConnection.hxx.

Member Function Documentation

◆ try_connect()

void DeviceConnectionClient::try_connect ( )
inlineprivatevirtual

Attempts to open the device.

Implements GCFdConnectionClient.

Definition at line 183 of file ClientConnection.hxx.

Member Data Documentation

◆ dev_

string DeviceConnectionClient::dev_
private

filename of device to open

Definition at line 199 of file ClientConnection.hxx.


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