LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
osdpserialportdatatransport.hpp
Go to the documentation of this file.
1
7#ifndef OSDPSERIALPORTDATATRANSPORT_HPP
8#define OSDPSERIALPORTDATATRANSPORT_HPP
9
10#include <boost/filesystem.hpp>
11#include <boost/property_tree/ptree.hpp>
12#include <boost/property_tree/xml_parser.hpp>
13
16
17#include <string>
18#include <vector>
19
20namespace logicalaccess
21{
22class LLA_READERS_OSDP_API OSDPSerialPortDataTransport : public SerialPortDataTransport
23{
24 public:
25 explicit OSDPSerialPortDataTransport(const std::string &portname = "")
26 : SerialPortDataTransport(portname)
27 {
28 }
29
30 void setSerialPort(std::shared_ptr<SerialPortXml> port) override
31 {
32 d_port = port;
33 d_port->getSerialPort()->setCircularBufferParser(new OSDPBufferParser());
34 }
35
40 std::string getTransportType() const override
41 {
42 return "OSDPSerialPort";
43 }
44
49 void serialize(boost::property_tree::ptree &parentNode) override
50 {
51 boost::property_tree::ptree node;
52 SerialPortDataTransport::serialize(node);
53 parentNode.add_child(getDefaultXmlNodeName(), node);
54 }
55
60 void unSerialize(boost::property_tree::ptree &node) override
61 {
62 SerialPortDataTransport::unSerialize(
63 node.get_child(SerialPortDataTransport::getDefaultXmlNodeName()));
64 d_port->getSerialPort()->setCircularBufferParser(new OSDPBufferParser());
65 }
66
71 std::string getDefaultXmlNodeName() const override
72 {
73 return "OSDPDataTransport";
74 }
75};
76}
77
78#endif /* OSDPSERIALPORTDATATRANSPORT_HPP */
Definition: osdpbufferparser.hpp:18
Definition: osdpserialportdatatransport.hpp:23
void serialize(boost::property_tree::ptree &parentNode) override
Serialize the current object to XML.
Definition: osdpserialportdatatransport.hpp:49
std::string getTransportType() const override
Get the transport type of this instance.
Definition: osdpserialportdatatransport.hpp:40
std::string getDefaultXmlNodeName() const override
Get the default Xml Node name for this object.
Definition: osdpserialportdatatransport.hpp:71
void unSerialize(boost::property_tree::ptree &node) override
UnSerialize a XML node to the current object.
Definition: osdpserialportdatatransport.hpp:60
OSDPSerialPortDataTransport(const std::string &portname="")
Definition: osdpserialportdatatransport.hpp:25
void setSerialPort(std::shared_ptr< SerialPortXml > port) override
Definition: osdpserialportdatatransport.hpp:30
A serial port data transport class.
Definition: serialportdatatransport.hpp:21
Definition: asn1.hpp:9
OSDP Buffer Parser.
Serial port data transport for reader/card commands.