LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
logicalaccess::DataTransport Class Referenceabstract

A data transport base class. It provide an abstraction layer between the host and readers. More...

#include <datatransport.hpp>

Inheritance diagram for logicalaccess::DataTransport:
logicalaccess::XmlSerializable logicalaccess::DummyDataTransport logicalaccess::LibUSBDataTransport logicalaccess::PCSCDataTransport logicalaccess::SerialPortDataTransport logicalaccess::TCPDataTransport logicalaccess::UDPDataTransport logicalaccess::YubikeyDataTransport logicalaccess::PCSCControlDataTransport logicalaccess::DeisterSerialPortDataTransport logicalaccess::ElatecSerialPortDataTransport logicalaccess::GunneboSerialPortDataTransport logicalaccess::OSDPSerialPortDataTransport logicalaccess::STidSTRSerialPortDataTransport

Public Member Functions

virtual ~DataTransport ()=default
 
virtual std::shared_ptr< ReaderUnitgetReaderUnit () const
 Get the reader unit.
 
virtual void setReaderUnit (std::weak_ptr< ReaderUnit > unit)
 Set the reader unit.
 
virtual std::string getTransportType () const =0
 Get the transport type of this instance.
 
virtual bool connect ()=0
 Connect to the transport layer.
 
virtual void disconnect ()=0
 Disconnect from the transport layer.
 
virtual bool isConnected ()=0
 
virtual std::string getName () const =0
 Get the data transport endpoint name.
 
virtual ByteVector sendCommand (const ByteVector &command, long int timeout=-1)
 Send a command to the reader.
 
virtual ByteVector getLastCommand ()
 Get the last command.
 
virtual ByteVector getLastResult ()
 Get the last command result.
 
- Public Member Functions inherited from logicalaccess::XmlSerializable
virtual ~XmlSerializable ()=default
 
virtual std::string serialize ()
 Serialize object to Xml Node string.
 
virtual std::string serializeWithHeaders ()
 Serialize object to Xml Node string, with xml headers.
 
virtual void serialize (boost::property_tree::ptree &parentNode)=0
 Serialize object to Xml Node.
 
virtual void serializeToFile (const std::string &filename)
 Serialize object to a Xml file.
 
virtual void unSerialize (boost::property_tree::ptree &node)=0
 UnSerialize object from a Xml Node.
 
virtual void unSerialize (const std::string &xmlstring, const std::string &rootNode)
 UnSerialize object from a Xml Node string.
 
virtual void unSerialize (std::istream &is, const std::string &rootNode)
 UnSerialize object from a Xml node.
 
virtual void unSerialize (boost::property_tree::ptree &node, const std::string &rootNode)
 UnSerialize object from a Xml node.
 
virtual void unSerializeFromFile (const std::string &filename)
 UnSerialize object from a Xml file.
 
virtual std::string getDefaultXmlNodeName () const =0
 Get the default Xml Node name for this object.
 

Protected Member Functions

virtual void send (const ByteVector &data)=0
 
virtual ByteVector receive (long int timeout)=0
 

Protected Attributes

std::weak_ptr< ReaderUnitd_ReaderUnit
 The reader unit.
 
ByteVector d_lastResult
 The last result.
 
ByteVector d_lastCommand
 The last command.
 

Additional Inherited Members

- Static Public Member Functions inherited from logicalaccess::XmlSerializable
static std::string removeXmlDeclaration (const std::string &xmlstring)
 Remove Xml declaration from a xml string.
 
static ByteVector formatHexString (std::string hexstr)
 Format hex string to hex string with space.
 
- Static Protected Member Functions inherited from logicalaccess::XmlSerializable
static unsigned long long atoull (const std::string &str)
 

Detailed Description

A data transport base class. It provide an abstraction layer between the host and readers.

Constructor & Destructor Documentation

◆ ~DataTransport()

virtual logicalaccess::DataTransport::~DataTransport ( )
virtualdefault

Member Function Documentation

◆ connect()

virtual bool logicalaccess::DataTransport::connect ( )
pure virtual

◆ disconnect()

virtual void logicalaccess::DataTransport::disconnect ( )
pure virtual

◆ getLastCommand()

virtual ByteVector logicalaccess::DataTransport::getLastCommand ( )
inlinevirtual

Get the last command.

Returns
The last command.

◆ getLastResult()

virtual ByteVector logicalaccess::DataTransport::getLastResult ( )
inlinevirtual

Get the last command result.

Returns
The last command result.

◆ getName()

virtual std::string logicalaccess::DataTransport::getName ( ) const
pure virtual

◆ getReaderUnit()

virtual std::shared_ptr< ReaderUnit > logicalaccess::DataTransport::getReaderUnit ( ) const
inlinevirtual

Get the reader unit.

Returns
The reader unit.

◆ getTransportType()

virtual std::string logicalaccess::DataTransport::getTransportType ( ) const
pure virtual

◆ isConnected()

virtual bool logicalaccess::DataTransport::isConnected ( )
pure virtual

◆ receive()

virtual ByteVector logicalaccess::DataTransport::receive ( long int  timeout)
protectedpure virtual

◆ send()

virtual void logicalaccess::DataTransport::send ( const ByteVector data)
protectedpure virtual

◆ sendCommand()

ByteVector logicalaccess::DataTransport::sendCommand ( const ByteVector command,
long int  timeout = -1 
)
virtual

Send a command to the reader.

Parameters
commandThe command buffer.
timeoutThe command timeout.
Returns
the result of the command.

◆ setReaderUnit()

virtual void logicalaccess::DataTransport::setReaderUnit ( std::weak_ptr< ReaderUnit unit)
inlinevirtual

Set the reader unit.

Parameters
unitThe reader unit.

Member Data Documentation

◆ d_lastCommand

ByteVector logicalaccess::DataTransport::d_lastCommand
protected

The last command.

◆ d_lastResult

ByteVector logicalaccess::DataTransport::d_lastResult
protected

The last result.

◆ d_ReaderUnit

std::weak_ptr<ReaderUnit> logicalaccess::DataTransport::d_ReaderUnit
protected

The reader unit.


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