AusweisApp2
Lade ...
Suche ...
Keine Treffer
ReaderInfo.h
gehe zur Dokumentation dieser Datei
1
5#pragma once
6
7#include "CardInfo.h"
11
12#include <QString>
13#include <QVariant>
14
15namespace governikus
16{
18{
19 friend class Reader;
20
21 private:
22 ReaderManagerPlugInType mPlugInType;
23 QString mName;
24 bool mBasicReader;
25 CardInfo mCardInfo;
26 int mMaxApduLength;
27 CardType mShelvedCard;
28
29 public:
30 explicit ReaderInfo(const QString& pName = QString(),
31 ReaderManagerPlugInType pPlugInType = ReaderManagerPlugInType::UNKNOWN,
32 const CardInfo& pCardInfo = CardInfo(CardType::NONE));
33
35
36
37 [[nodiscard]] ReaderManagerPlugInType getPlugInType() const
38 {
39 return mPlugInType;
40 }
41
42
43 [[nodiscard]] bool isValid() const
44 {
45 return mPlugInType != ReaderManagerPlugInType::UNKNOWN;
46 }
47
48
50 {
51 mPlugInType = ReaderManagerPlugInType::UNKNOWN;
52 mCardInfo = CardInfo(CardType::NONE);
53 }
54
55
56 [[nodiscard]] CardInfo& getCardInfo()
57 {
58 return mCardInfo;
59 }
60
61
62 [[nodiscard]] const CardInfo& getCardInfo() const
63 {
64 return mCardInfo;
65 }
66
67
68 [[nodiscard]] CardType getCardType() const
69 {
70 return mCardInfo.getCardType();
71 }
72
73
74 [[nodiscard]] QString getCardTypeString() const
75 {
76 return mCardInfo.getCardTypeString();
77 }
78
79
80 [[nodiscard]] bool hasCard() const
81 {
82 return mCardInfo.getCardType() != CardType::NONE;
83 }
84
85
86 [[nodiscard]] bool hasEid() const
87 {
88 return QVector<CardType>({CardType::EID_CARD, CardType::SMART_EID}).contains(mCardInfo.getCardType());
89 }
90
91
92 [[nodiscard]] int getRetryCounter() const
93 {
94 return mCardInfo.getRetryCounter();
95 }
96
97
98 [[nodiscard]] bool isRetryCounterDetermined() const
99 {
100 return mCardInfo.isRetryCounterDetermined();
101 }
102
103
104 [[nodiscard]] bool isPinDeactivated() const
105 {
106 return mCardInfo.isPinDeactivated();
107 }
108
109
110 [[nodiscard]] bool isPukInoperative() const
111 {
112 return mCardInfo.isPukInoperative();
113 }
114
115
116 [[nodiscard]] bool isPhysicalCard() const
117 {
118 const auto& cardType = mCardInfo.getCardType();
119 return cardType == CardType::EID_CARD;
120 }
121
122
123 [[nodiscard]] bool isSoftwareSmartEid() const
124 {
125 return mCardInfo.getMobileEidType() == MobileEidType::HW_KEYSTORE;
126 }
127
128
129 [[nodiscard]] bool wasShelved() const
130 {
131 return mShelvedCard != CardType::NONE;
132 }
133
134
136 {
137 mShelvedCard = mCardInfo.getCardType();
138 mCardInfo.setCardType(CardType::NONE);
139 }
140
141
142 [[nodiscard]] bool isInsertable() const;
143
144
146 {
147 mCardInfo.setCardType(mShelvedCard);
148 }
149
150
151 void setCardInfo(const CardInfo& pCardInfo)
152 {
153 mCardInfo = pCardInfo;
154 }
155
156
157 [[nodiscard]] const QString& getName() const
158 {
159 return mName;
160 }
161
162
163 void setBasicReader(bool pIsBasicReader)
164 {
165 mBasicReader = pIsBasicReader;
166 }
167
168
169 [[nodiscard]] bool isBasicReader() const
170 {
171 return mBasicReader;
172 }
173
174
175 void setMaxApduLength(int pMaxApduLength)
176 {
177 mMaxApduLength = pMaxApduLength;
178 }
179
180
181 [[nodiscard]] int getMaxApduLength() const
182 {
183 return mMaxApduLength;
184 }
185
186
187 [[nodiscard]] bool insufficientApduLength() const
188 {
189 return mMaxApduLength >= 0 && mMaxApduLength < 500;
190 }
191
192
193};
194
195} // namespace governikus
Holds smart card information.
Definition: CardInfo.h:32
void setCardType(CardType pCardType)
Definition: CardInfo.cpp:43
MobileEidType getMobileEidType() const
Definition: CardInfo.cpp:134
QString getCardTypeString() const
Definition: CardInfo.cpp:55
bool isPukInoperative() const
The PUK is inoperative.
Definition: CardInfo.cpp:110
bool isPinDeactivated() const
The eID function has not been activated by the competent authority.
Definition: CardInfo.cpp:104
int getRetryCounter() const
Definition: CardInfo.cpp:86
CardType getCardType() const
Definition: CardInfo.cpp:49
bool isRetryCounterDetermined() const
Definition: CardInfo.cpp:98
Definition: ReaderConfigurationInfo.h:21
Definition: ReaderInfo.h:18
void insertCard()
Definition: ReaderInfo.h:145
void setCardInfo(const CardInfo &pCardInfo)
Definition: ReaderInfo.h:151
bool isBasicReader() const
Definition: ReaderInfo.h:169
ReaderManagerPlugInType getPlugInType() const
Definition: ReaderInfo.h:37
void setMaxApduLength(int pMaxApduLength)
Definition: ReaderInfo.h:175
ReaderInfo(const QString &pName=QString(), ReaderManagerPlugInType pPlugInType=ReaderManagerPlugInType::UNKNOWN, const CardInfo &pCardInfo=CardInfo(CardType::NONE))
bool wasShelved() const
Definition: ReaderInfo.h:129
CardInfo & getCardInfo()
Definition: ReaderInfo.h:56
bool isPhysicalCard() const
Definition: ReaderInfo.h:116
bool insufficientApduLength() const
Definition: ReaderInfo.h:187
const CardInfo & getCardInfo() const
Definition: ReaderInfo.h:62
bool isRetryCounterDetermined() const
Definition: ReaderInfo.h:98
bool hasEid() const
Definition: ReaderInfo.h:86
bool isInsertable() const
Definition: ReaderInfo.cpp:50
void shelveCard()
Definition: ReaderInfo.h:135
ReaderConfigurationInfo getReaderConfigurationInfo() const
Definition: ReaderInfo.cpp:38
CardType getCardType() const
Definition: ReaderInfo.h:68
int getMaxApduLength() const
Definition: ReaderInfo.h:181
bool isPinDeactivated() const
Definition: ReaderInfo.h:104
bool isValid() const
Definition: ReaderInfo.h:43
const QString & getName() const
Definition: ReaderInfo.h:157
void invalidate()
Definition: ReaderInfo.h:49
int getRetryCounter() const
Definition: ReaderInfo.h:92
bool isPukInoperative() const
Definition: ReaderInfo.h:110
bool hasCard() const
Definition: ReaderInfo.h:80
bool isSoftwareSmartEid() const
Definition: ReaderInfo.h:123
QString getCardTypeString() const
Definition: ReaderInfo.h:74
void setBasicReader(bool pIsBasicReader)
Definition: ReaderInfo.h:163
Definition: Reader.h:19
Implementation of GeneralAuthenticate response APDUs.
Definition: CommandApdu.h:16