LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
chip.hpp
Go to the documentation of this file.
1
7#ifndef LOGICALACCESS_CHIP_HPP
8#define LOGICALACCESS_CHIP_HPP
9
10#include <memory>
11#include <vector>
14#include <logicalaccess/lla_core_api.hpp>
16
17namespace logicalaccess
18{
19#define CHIP_UNKNOWN "UNKNOWN"
20#define CHIP_GENERICTAG "GenericTag"
21
25typedef enum {
26 CPS_NO_POWER = 0x00,
27 CPS_UNKNOWN = 0x01,
29 CPS_POWER_HIGH = 0x03
31
36class LLA_CORE_API Chip : public IChip, public std::enable_shared_from_this<Chip>
37{
38 public:
42 Chip();
43
48 explicit Chip(std::string cardtype);
49
53 virtual ~Chip()
54 {
55 }
56
61 const std::string &getCardType() const override;
62
67 std::string getGenericCardType() const override;
68
73 virtual std::shared_ptr<LocationNode> getRootLocationNode();
74
79 std::shared_ptr<Commands> getCommands() const override
80 {
81 return d_commands;
82 }
83
88 void setCommands(std::shared_ptr<Commands> commands)
89 {
90 d_commands = commands;
91 }
92
98 {
99 return d_chipIdentifier;
100 }
101
106 virtual void setChipIdentifier(ByteVector identifier)
107 {
108 d_chipIdentifier = identifier;
109 }
110
116 {
117 return d_powerStatus;
118 }
119
125 {
126 d_powerStatus = powerStatus;
127 }
128
133 unsigned char getReceptionLevel() const
134 {
135 return d_receptionLevel;
136 }
137
142 void setReceptionLevel(unsigned char receptionLevel)
143 {
144 d_receptionLevel = receptionLevel;
145 }
146
151 virtual std::shared_ptr<AccessInfo> createAccessInfo() const;
152
157 virtual std::shared_ptr<Location> createLocation() const;
158
164 std::shared_ptr<CardService> getService(CardServiceType serviceType) override;
165
166 template<typename T>
167 std::shared_ptr<T> getService() {
168 return std::dynamic_pointer_cast<T>(getService(T::service_type_));
169 }
170
171 bool operator<(const Chip &chip) const
172 {
173 return d_receptionLevel < chip.getReceptionLevel();
174 }
175
176 protected:
180 std::string d_cardtype;
181
186
191
195 std::shared_ptr<Commands> d_commands;
196
200 unsigned char d_receptionLevel;
201};
202}
203
204#endif /* LOGICALACCESS_CHIP_H */
Card service.
The base chip class for all chip. Each chip have is own object and providers according to himself and...
Definition: chip.hpp:37
virtual void setChipIdentifier(ByteVector identifier)
Set the chip identifier.
Definition: chip.hpp:106
bool operator<(const Chip &chip) const
Definition: chip.hpp:171
void setReceptionLevel(unsigned char receptionLevel)
Set the chip reception level.
Definition: chip.hpp:142
virtual ~Chip()
Destructor.
Definition: chip.hpp:53
ByteVector d_chipIdentifier
The chip identifier.
Definition: chip.hpp:185
ChipPowerStatus getPowerStatus() const
Get the chip power status.
Definition: chip.hpp:115
std::shared_ptr< T > getService()
Definition: chip.hpp:167
ChipPowerStatus d_powerStatus
The chip power status. Most chip doesn't have his own power supply.
Definition: chip.hpp:190
void setCommands(std::shared_ptr< Commands > commands)
Set commands.
Definition: chip.hpp:88
std::shared_ptr< Commands > d_commands
Commands object.
Definition: chip.hpp:195
std::string d_cardtype
The card type of the profile.
Definition: chip.hpp:180
unsigned char getReceptionLevel() const
Get the chip reception level.
Definition: chip.hpp:133
void setPowerStatus(ChipPowerStatus powerStatus)
Set the chip power status.
Definition: chip.hpp:124
std::shared_ptr< Commands > getCommands() const override
Get the commands.
Definition: chip.hpp:79
ByteVector getChipIdentifier() const override
Get the chip identifier.
Definition: chip.hpp:97
unsigned char d_receptionLevel
The chip reception level.
Definition: chip.hpp:200
The base abstract chip class for all chip.
Definition: ichip.hpp:22
IChip descriptor.
std::vector< uint8_t > ByteVector
Definition: lla_fwd.hpp:80
Definition: asn1.hpp:9
ChipPowerStatus
The power status.
Definition: chip.hpp:25
@ CPS_POWER_LOW
Definition: chip.hpp:28
@ CPS_UNKNOWN
Definition: chip.hpp:27
@ CPS_NO_POWER
Definition: chip.hpp:26
@ CPS_POWER_HIGH
Definition: chip.hpp:29
CardServiceType
The card services.
Definition: cardservice.hpp:35