LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
datatransport.hpp
Go to the documentation of this file.
1
7#ifndef LOGICALACCESS_DATATRANSPORT_HPP
8#define LOGICALACCESS_DATATRANSPORT_HPP
9
12
13#include <vector>
14
15namespace logicalaccess
16{
21class LLA_CORE_API DataTransport : public XmlSerializable
22{
23 public:
24 virtual ~DataTransport() = default;
25
30 virtual std::shared_ptr<ReaderUnit> getReaderUnit() const
31 {
32 return d_ReaderUnit.lock();
33 }
34
39 virtual void setReaderUnit(std::weak_ptr<ReaderUnit> unit)
40 {
41 d_ReaderUnit = unit;
42 }
43
48 virtual std::string getTransportType() const = 0;
49
54 virtual bool connect() = 0;
55
59 virtual void disconnect() = 0;
60
65 virtual bool isConnected() = 0;
66
71 virtual std::string getName() const = 0;
72
79 virtual ByteVector sendCommand(const ByteVector &command, long int timeout = -1);
80
86 {
87 return d_lastCommand;
88 }
89
95 {
96 return d_lastResult;
97 }
98
99 protected:
100 virtual void send(const ByteVector &data) = 0;
101
102 virtual ByteVector receive(long int timeout) = 0;
103
107 std::weak_ptr<ReaderUnit> d_ReaderUnit;
108
113
118};
119}
120
121#endif /* LOGICALACCESS_DATATRANSPORT_HPP */
A data transport base class. It provide an abstraction layer between the host and readers.
Definition: datatransport.hpp:22
virtual ~DataTransport()=default
virtual bool connect()=0
Connect to the transport layer.
virtual void disconnect()=0
Disconnect from the transport layer.
virtual std::shared_ptr< ReaderUnit > getReaderUnit() const
Get the reader unit.
Definition: datatransport.hpp:30
virtual std::string getName() const =0
Get the data transport endpoint name.
virtual ByteVector getLastCommand()
Get the last command.
Definition: datatransport.hpp:85
virtual ByteVector receive(long int timeout)=0
virtual ByteVector getLastResult()
Get the last command result.
Definition: datatransport.hpp:94
std::weak_ptr< ReaderUnit > d_ReaderUnit
The reader unit.
Definition: datatransport.hpp:107
virtual void setReaderUnit(std::weak_ptr< ReaderUnit > unit)
Set the reader unit.
Definition: datatransport.hpp:39
virtual void send(const ByteVector &data)=0
ByteVector d_lastResult
The last result.
Definition: datatransport.hpp:112
virtual std::string getTransportType() const =0
Get the transport type of this instance.
ByteVector d_lastCommand
The last command.
Definition: datatransport.hpp:117
virtual bool isConnected()=0
A Xml Serializable base class. Add Xml serialization to a class.
Definition: xmlserializable.hpp:54
std::vector< uint8_t > ByteVector
Definition: lla_fwd.hpp:80
Definition: asn1.hpp:9
Reader provider.