OpenCPN Partial API docs
Loading...
Searching...
No Matches
AbstractCommDriver Class Referenceabstract

Common interface for all drivers. More...

#include <comm_driver.h>

Inheritance diagram for AbstractCommDriver:
CommDriverN0183 CommDriverN2K CommDriverSignalK FileCommDriver CommDriverN0183Net CommDriverN0183Serial CommDriverN2KSerial CommDriverN2KSocketCAN CommDriverSignalKNet CommDriverN2KSocketCanImpl

Public Member Functions

virtual bool SendMessage (std::shared_ptr< const NavMsg > msg, std::shared_ptr< const NavAddr > addr)=0
 
virtual void Activate ()=0
 Register driver in the driver Registry. More...
 
virtual void SetListener (DriverListener &l)
 Set the entity which will receive incoming data. More...
 
virtual std::pair< CommStatus, std::string > Clone ()
 Create a new virtual interface using a new instance of this driver. More...
 
std::string Key () const
 
virtual std::unordered_map< std::string, std::string > GetAttributes () const
 

Public Attributes

const NavAddr::Bus bus
 
const std::string iface
 Physical device for 0183, else a unique string. More...
 
std::unordered_map< std::string, std::string > attributes
 

Protected Member Functions

 AbstractCommDriver (NavAddr::Bus b)
 
 AbstractCommDriver (NavAddr::Bus b, const std::string &s)
 

Detailed Description

Common interface for all drivers.


Definition at line 57 of file comm_driver.h.

Constructor & Destructor Documentation

◆ AbstractCommDriver() [1/3]

AbstractCommDriver::AbstractCommDriver ( )
inline

Definition at line 60 of file comm_driver.h.

◆ AbstractCommDriver() [2/3]

AbstractCommDriver::AbstractCommDriver ( NavAddr::Bus  b)
inlineprotected

Definition at line 97 of file comm_driver.h.

◆ AbstractCommDriver() [3/3]

AbstractCommDriver::AbstractCommDriver ( NavAddr::Bus  b,
const std::string &  s 
)
inlineprotected

Definition at line 100 of file comm_driver.h.

Member Function Documentation

◆ Activate()

virtual void AbstractCommDriver::Activate ( )
pure virtual

◆ Clone()

virtual std::pair< CommStatus, std::string > AbstractCommDriver::Clone ( )
inlinevirtual

Create a new virtual interface using a new instance of this driver.

A successful return guarantees that the new driver is registered in the device registry and activated.

Returns
<CommStatus::ok, interface> on success else <error_code, message>.

Definition at line 81 of file comm_driver.h.

◆ GetAttributes()

virtual std::unordered_map< std::string, std::string > AbstractCommDriver::GetAttributes ( ) const
inlinevirtual

Definition at line 92 of file comm_driver.h.

◆ Key()

std::string AbstractCommDriver::Key ( ) const
inline

Definition at line 86 of file comm_driver.h.

◆ SetListener()

virtual void AbstractCommDriver::SetListener ( DriverListener l)
inlinevirtual

Set the entity which will receive incoming data.

By default, such data is ignored

Reimplemented in CommDriverN0183, CommDriverN2K, CommDriverN2KSerial, CommDriverN2KSocketCAN, and CommDriverSignalK.

Definition at line 72 of file comm_driver.h.

Member Data Documentation

◆ attributes

std::unordered_map<std::string, std::string> AbstractCommDriver::attributes

Definition at line 94 of file comm_driver.h.

◆ bus

const NavAddr::Bus AbstractCommDriver::bus

Definition at line 88 of file comm_driver.h.

◆ iface

const std::string AbstractCommDriver::iface

Physical device for 0183, else a unique string.

Definition at line 89 of file comm_driver.h.


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