LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
binarydatafield.hpp
Go to the documentation of this file.
1
7#ifndef LOGICALACCESS_BINARYDATAFIELD_HPP
8#define LOGICALACCESS_BINARYDATAFIELD_HPP
9
11#include <logicalaccess/key.hpp>
12
13namespace logicalaccess
14{
15class LLA_CORE_API BinaryFieldValue : public Key
16{
17 public:
22
27 explicit BinaryFieldValue(const std::string &str);
28
34 explicit BinaryFieldValue(const ByteVector &buf);
35
36 virtual ~BinaryFieldValue() = default;
41 size_t getLength() const override
42 {
43 return d_buf.size();
44 }
45
50 const unsigned char *getData() const override
51 {
52 if (d_buf.size() != 0)
53 return &d_buf[0];
54 return nullptr;
55 }
56
61 unsigned char *getData() override
62 {
63 if (d_buf.size() != 0)
64 return &d_buf[0];
65 return nullptr;
66 }
67
72 void serialize(boost::property_tree::ptree &parentNode) override;
73
78 void unSerialize(boost::property_tree::ptree &node) override;
79
84 std::string getDefaultXmlNodeName() const override;
85
86 private:
91};
92
96class LLA_CORE_API BinaryDataField : public ValueDataField
97{
98 public:
103
107 virtual ~BinaryDataField();
108
113 DataFieldType getDFType() const override
114 {
115 return DFT_BINARY;
116 }
117
122 void setValue(ByteVector value);
123
128 ByteVector getValue() const;
129
134 void setPaddingChar(unsigned char padding);
135
140 unsigned char getPaddingChar() const;
141
148 BitsetStream getLinearData(const BitsetStream &) const override;
149
156 void setLinearData(const ByteVector &data) override;
157
163 bool checkSkeleton(std::shared_ptr<DataField> field) const override;
164
169 void serialize(boost::property_tree::ptree &parentNode) override;
170
175 void unSerialize(boost::property_tree::ptree &node) override;
176
181 std::string getDefaultXmlNodeName() const override;
182
183 protected:
185
186 unsigned char d_padding;
187};
188}
189
190#endif /* LOGICALACCESS_BINARYDATAFIELD_HPP */
A binary data field.
Definition: binarydatafield.hpp:97
DataFieldType getDFType() const override
Get the field type.
Definition: binarydatafield.hpp:113
BinaryFieldValue d_value
Definition: binarydatafield.hpp:184
unsigned char d_padding
Definition: binarydatafield.hpp:186
Definition: binarydatafield.hpp:16
unsigned char * getData() override
Get the key data.
Definition: binarydatafield.hpp:61
size_t getLength() const override
Get the field length.
Definition: binarydatafield.hpp:41
ByteVector d_buf
The key bytes;.
Definition: binarydatafield.hpp:90
const unsigned char * getData() const override
Get the key data.
Definition: binarydatafield.hpp:50
virtual ~BinaryFieldValue()=default
Definition: BitsetStream.hpp:15
A Key base class. The key object is used to describe key chip information used for authentication on ...
Definition: key.hpp:22
A value data field base class.
Definition: valuedatafield.hpp:20
std::vector< uint8_t > ByteVector
Definition: lla_fwd.hpp:80
Definition: asn1.hpp:9
DataFieldType
Definition: datafield.hpp:22
@ DFT_BINARY
Definition: datafield.hpp:26
Value data field.