AusweisApp2
IfdCard.h
gehe zur Dokumentation dieser Datei
1 
7 #pragma once
8 
9 #include "Card.h"
10 #include "IfdDispatcherClient.h"
11 #include "messages/IfdMessage.h"
12 
13 #include <QMutex>
14 #include <QSharedPointer>
15 #include <QString>
16 #include <QWaitCondition>
17 
18 
19 namespace governikus
20 {
21 
22 class IfdCard
23  : public Card
24 {
25  Q_OBJECT
26 
27  private:
28  bool mWaitingForAnswer;
29  QWaitCondition mWaitCondition;
30  QMutex mResponseAvailable;
31  QMutex mProcessResponse;
32 
33  IfdMessageType mExpectedAnswerType;
34  QJsonObject mResponse;
35  const QSharedPointer<IfdDispatcherClient> mDispatcher;
36  QString mReaderName;
37  QString mSlotHandle;
38  bool mConnected;
39  QString mProgressMessage;
40 
41  bool sendMessage(const QSharedPointer<const IfdMessage>& pMessage, IfdMessageType pExpectedAnswer, unsigned long pTimeout);
42 
43  private Q_SLOTS:
44  void onMessageReceived(IfdMessageType pMessageTpe, const QJsonObject& pJsonObject);
45  void onDispatcherClosed(GlobalStatus::Code pCloseCode, const QString& pId);
46 
47  Q_SIGNALS:
49 
50  public:
51  IfdCard(const QSharedPointer<IfdDispatcherClient>& pDispatcher, const QString& pReaderName);
52  ~IfdCard() override;
53 
54  CardReturnCode establishConnection() override;
55  CardReturnCode releaseConnection() override;
56  bool isConnected() const override;
57  void setProgressMessage(const QString& pMessage, int pProgress = -1) override;
58 
59  ResponseApduResult transmit(const CommandApdu& pCmd) override;
60 
61  EstablishPaceChannelOutput establishPaceChannel(PacePasswordId pPasswordId, int pPreferredPinLength, const QByteArray& pChat, const QByteArray& pCertificateDescription, quint8 pTimeoutSeconds = 60) override;
62 
63  ResponseApduResult setEidPin(quint8 pTimeoutSeconds) override;
64 };
65 
66 } // namespace governikus
Definition: Card.h:45
Definition: EstablishPaceChannelOutput.h:48
Code
Definition: GlobalStatus.h:26
Definition: IfdCard.h:24
EstablishPaceChannelOutput establishPaceChannel(PacePasswordId pPasswordId, int pPreferredPinLength, const QByteArray &pChat, const QByteArray &pCertificateDescription, quint8 pTimeoutSeconds=60) override
Establishes a PACE channel, i.e.
Definition: IfdCard.cpp:210
ResponseApduResult setEidPin(quint8 pTimeoutSeconds) override
Sets a new eID PIN, i.e.
Definition: IfdCard.cpp:245
IfdCard(const QSharedPointer< IfdDispatcherClient > &pDispatcher, const QString &pReaderName)
Definition: IfdCard.cpp:97
ResponseApduResult transmit(const CommandApdu &pCmd) override
Performs a transmit to the smart card.
Definition: IfdCard.cpp:183
bool isConnected() const override
Is the smart card connected, i.e.
Definition: IfdCard.cpp:171
void setProgressMessage(const QString &pMessage, int pProgress=-1) override
Sets the current workflow progress message.
Definition: IfdCard.cpp:177
CardReturnCode establishConnection() override
Establish a connection to the smart card.
Definition: IfdCard.cpp:124
~IfdCard() override
Definition: IfdCard.cpp:118
CardReturnCode releaseConnection() override
Destroys the previously established connection to the smart card.
Definition: IfdCard.cpp:148
Implementation of GeneralAuthenticate response APDUs.
Definition: CommandApdu.h:16
quint8
Definition: ResponseApdu.h:62
Definition: ResponseApdu.h:115