AusweisApp2
WorkflowContext.h
gehe zur Dokumentation dieser Datei
1 
7 #pragma once
8 
9 #include "CardConnection.h"
10 #include "ECardApiResult.h"
11 #include "GlobalStatus.h"
12 #include "ReaderInfo.h"
13 #include "SmartCardDefinitions.h"
14 
15 #include <QElapsedTimer>
16 #include <QSharedPointer>
17 #include <QString>
18 
19 namespace governikus
20 {
21 
23  : public QObject
24 {
25  Q_OBJECT
26 
27  private:
28  bool mStateApproved;
29  bool mWorkflowKilled;
30  QString mCurrentState;
31  QVector<ReaderManagerPlugInType> mReaderPlugInTypes;
32  QString mReaderName;
33  QSharedPointer<CardConnection> mCardConnection;
34  int mCardVanishedDuringPacePinCount;
35  QElapsedTimer mCardVanishedDuringPacePinTimer;
36  QString mCan;
37  QString mPin;
38  QString mPuk;
39  PacePasswordId mEstablishPaceChannelType;
40  QScopedPointer<EstablishPaceChannelOutput> mPaceOutputData;
41  ReaderInfo mExpectedReader;
42  CardReturnCode mLastPaceResult;
43  GlobalStatus mStatus;
44  ECardApiResult mStartPaosResult;
45  bool mErrorReportedToUser;
46  bool mPaceResultReportedToUser;
47  bool mWorkflowFinished;
48  bool mWorkflowCancelled;
49  bool mWorkflowCancelledInState;
50  bool mNextWorkflowPending;
51  bool mCurrentReaderHasEidCardButInsufficientApduLength;
52 
53  private Q_SLOTS:
54  void onWorkflowCancelled();
55 
56  Q_SIGNALS:
57  void fireStateApprovedChanged(bool pApproved);
58  void fireStateChanged(const QString& pNewState);
70 
72 
74 
75  public:
77  ~WorkflowContext() override;
78 
79  [[nodiscard]] bool isErrorReportedToUser() const;
80  void setErrorReportedToUser(bool pErrorReportedToUser = true);
81 
82  [[nodiscard]] bool isPaceResultReportedToUser() const;
83  void setPaceResultReportedToUser(bool pReported = true);
84 
85  void setStateApproved(bool pApproved = true);
86  [[nodiscard]] bool isStateApproved() const;
87 
88  void killWorkflow();
89  [[nodiscard]] bool isWorkflowKilled() const;
90 
91  [[nodiscard]] const QString& getCurrentState() const;
92  void setCurrentState(const QString& pNewState);
93 
94  [[nodiscard]] const QVector<ReaderManagerPlugInType>& getReaderPlugInTypes() const;
95  void setReaderPlugInTypes(const QVector<ReaderManagerPlugInType>& pReaderPlugInTypes);
96 
97  [[nodiscard]] const QString& getReaderName() const;
98  void setReaderName(const QString& pReaderName);
99 
100  [[nodiscard]] const QSharedPointer<CardConnection>& getCardConnection() const;
101  void setCardConnection(const QSharedPointer<CardConnection>& pCardConnection);
102  void resetCardConnection();
103 
104  [[nodiscard]] bool isNpaRepositioningRequired() const;
105  void setNpaPositionVerified();
106  void handleWrongNpaPosition();
107 
108  [[nodiscard]] const QString& getPuk() const;
109  void setPuk(const QString& pPuk);
110 
111  [[nodiscard]] const QString& getCan() const;
112  void setCan(const QString& pCan);
113 
114  [[nodiscard]] const QString& getPin() const;
115  void setPin(const QString& pPin);
116 
117  [[nodiscard]] PacePasswordId getEstablishPaceChannelType() const;
118  void setEstablishPaceChannelType(PacePasswordId pType);
119 
120  virtual void resetPacePasswords();
121 
122  [[nodiscard]] EstablishPaceChannelOutput* getPaceOutputData() const;
123  void setPaceOutputData(const EstablishPaceChannelOutput& pPaceOutputData);
124 
125  bool isPinBlocked();
126  [[nodiscard]] CardReturnCode getLastPaceResult() const;
127  void setLastPaceResult(CardReturnCode pLastPaceResult);
128  void resetLastPaceResult();
129 
130  void rememberReader();
131  [[nodiscard]] bool isExpectedReader() const;
132  [[nodiscard]] const ReaderInfo& getExpectedReader() const;
133 
134  [[nodiscard]] int getExpectedRetryCounter() const;
135  void setExpectedRetryCounter(int pExpectedRetryCounter);
136 
137  [[nodiscard]] const GlobalStatus& getStatus() const;
138  void setStatus(const GlobalStatus& pResult);
139 
140  [[nodiscard]] const ECardApiResult getStartPaosResult() const;
141  void setStartPaosResult(const ECardApiResult& pStartPaosResult);
142 
143  [[nodiscard]] bool isWorkflowFinished() const;
144  void setWorkflowFinished(bool pWorkflowFinished);
145 
146  [[nodiscard]] bool isWorkflowCancelled() const;
147  [[nodiscard]] bool isWorkflowCancelledInState() const;
149 
150  [[nodiscard]] virtual bool isCanAllowedMode() const;
151 
152  [[nodiscard]] bool hasNextWorkflowPending() const;
153  void setNextWorkflowPending(bool pNextWorkflowPending);
154 
155  [[nodiscard]] bool currentReaderHasEidCardButInsufficientApduLength() const;
157 };
158 
159 } // namespace governikus
governikus::WorkflowContext::rememberReader
void rememberReader()
Definition: WorkflowContext.cpp:343
governikus::UNKNOWN
UNKNOWN
Definition: SmartCardDefinitions.h:18
governikus::WorkflowContext::isWorkflowCancelled
bool isWorkflowCancelled() const
Definition: WorkflowContext.cpp:418
governikus::WorkflowContext::setPaceOutputData
void setPaceOutputData(const EstablishPaceChannelOutput &pPaceOutputData)
Definition: WorkflowContext.cpp:317
governikus::WorkflowContext::getPuk
const QString & getPuk() const
Definition: WorkflowContext.cpp:242
governikus::WorkflowContext::setExpectedRetryCounter
void setExpectedRetryCounter(int pExpectedRetryCounter)
Definition: WorkflowContext.cpp:374
ReaderManager.h
governikus::WorkflowContext::fireResultChanged
void fireResultChanged()
governikus::WorkflowContext::resetLastPaceResult
void resetLastPaceResult()
Definition: WorkflowContext.cpp:337
governikus::WorkflowContext::setLastPaceResult
void setLastPaceResult(CardReturnCode pLastPaceResult)
Definition: WorkflowContext.cpp:329
governikus::WorkflowContext::isErrorReportedToUser
bool isErrorReportedToUser() const
Definition: WorkflowContext.cpp:64
governikus::WorkflowContext::getPaceOutputData
EstablishPaceChannelOutput * getPaceOutputData() const
Definition: WorkflowContext.cpp:311
governikus::WorkflowContext::firePasswordTypeChanged
void firePasswordTypeChanged()
governikus::WorkflowContext::WorkflowContext
WorkflowContext()
Definition: WorkflowContext.cpp:20
governikus::WorkflowContext::setWorkflowCancelledInState
void setWorkflowCancelledInState()
Definition: WorkflowContext.cpp:430
governikus::WorkflowContext::setCurrentState
void setCurrentState(const QString &pNewState)
Definition: WorkflowContext.cpp:130
governikus::WorkflowContext::getPin
const QString & getPin() const
Definition: WorkflowContext.cpp:274
governikus::WorkflowContext::getExpectedRetryCounter
int getExpectedRetryCounter() const
Definition: WorkflowContext.cpp:368
governikus::WorkflowContext::resetCardConnection
void resetCardConnection()
Definition: WorkflowContext.cpp:190
governikus::WorkflowContext::setErrorReportedToUser
void setErrorReportedToUser(bool pErrorReportedToUser=true)
Definition: WorkflowContext.cpp:70
governikus::WorkflowContext::resetPacePasswords
virtual void resetPacePasswords()
Definition: WorkflowContext.cpp:303
governikus::ReaderInfo
Definition: ReaderInfo.h:17
governikus::WorkflowContext::isPinBlocked
bool isPinBlocked()
Definition: WorkflowContext.cpp:236
governikus::WorkflowContext::isWorkflowKilled
bool isWorkflowKilled() const
Definition: WorkflowContext.cpp:112
governikus::WorkflowContext::handleWrongNpaPosition
void handleWrongNpaPosition()
Definition: WorkflowContext.cpp:225
ReaderInfo.h
governikus::WorkflowContext::killWorkflow
void killWorkflow()
Definition: WorkflowContext.cpp:98
governikus::WorkflowContext::setStateApproved
void setStateApproved(bool pApproved=true)
Definition: WorkflowContext.cpp:88
governikus::WorkflowContext::getStartPaosResult
const ECardApiResult getStartPaosResult() const
Definition: WorkflowContext.cpp:394
governikus::WorkflowContext::isCanAllowedMode
virtual bool isCanAllowedMode() const
Definition: WorkflowContext.cpp:436
governikus::WorkflowContext::fireCardConnectionChanged
void fireCardConnectionChanged()
governikus::WorkflowContext::fireReaderPlugInTypesChanged
void fireReaderPlugInTypesChanged()
WorkflowContext.h
governikus::WorkflowContext::isPaceResultReportedToUser
bool isPaceResultReportedToUser() const
Definition: WorkflowContext.cpp:76
governikus::WorkflowContext::fireReaderNameChanged
void fireReaderNameChanged()
governikus::WorkflowContext::setCan
void setCan(const QString &pCan)
Definition: WorkflowContext.cpp:264
governikus::WorkflowContext::setReaderName
void setReaderName(const QString &pReaderName)
Definition: WorkflowContext.cpp:164
governikus::WorkflowContext::isNpaRepositioningRequired
bool isNpaRepositioningRequired() const
Definition: WorkflowContext.cpp:201
governikus::WorkflowContext::fireReaderInfoChanged
void fireReaderInfoChanged()
governikus::WorkflowContext::getCurrentState
const QString & getCurrentState() const
Definition: WorkflowContext.cpp:124
governikus::WorkflowContext::setPin
void setPin(const QString &pPin)
Definition: WorkflowContext.cpp:280
governikus::WorkflowContext::firePaceResultUpdated
void firePaceResultUpdated()
governikus::WorkflowContext::getReaderPlugInTypes
const QVector< ReaderManagerPlugInType > & getReaderPlugInTypes() const
Definition: WorkflowContext.cpp:142
governikus::WorkflowContext::setStatus
void setStatus(const GlobalStatus &pResult)
Definition: WorkflowContext.cpp:386
governikus::WorkflowContext::hasNextWorkflowPending
bool hasNextWorkflowPending() const
Definition: WorkflowContext.cpp:442
governikus::EstablishPaceChannelOutput
Definition: EstablishPaceChannelOutput.h:48
governikus::WorkflowContext::setNextWorkflowPending
void setNextWorkflowPending(bool pNextWorkflowPending)
Definition: WorkflowContext.cpp:448
governikus::ECardApiResult
Definition: ECardApiResult.h:25
governikus::WorkflowContext::isWorkflowCancelledInState
bool isWorkflowCancelledInState() const
Definition: WorkflowContext.cpp:424
GlobalStatus.h
governikus::WorkflowContext::fireStateApprovedChanged
void fireStateApprovedChanged(bool pApproved)
governikus::WorkflowContext::fireCanChanged
void fireCanChanged()
governikus
Implementation of ActivationContext for Intent based activation on Android systems.
Definition: ActivationContext.h:15
governikus::WorkflowContext::fireCanAllowedModeChanged
void fireCanAllowedModeChanged()
SmartCardDefinitions.h
governikus::WorkflowContext::setPuk
void setPuk(const QString &pPuk)
Definition: WorkflowContext.cpp:248
governikus::WorkflowContext::isWorkflowFinished
bool isWorkflowFinished() const
Definition: WorkflowContext.cpp:406
governikus::WorkflowContext::setCardConnection
void setCardConnection(const QSharedPointer< CardConnection > &pCardConnection)
Definition: WorkflowContext.cpp:180
governikus::WorkflowContext::setEstablishPaceChannelType
void setEstablishPaceChannelType(PacePasswordId pType)
Definition: WorkflowContext.cpp:296
governikus::CardInfo::setRetryCounter
void setRetryCounter(int pRetryCounter)
Definition: CardInfo.cpp:94
governikus::WorkflowContext::firePinChanged
void firePinChanged()
governikus::WorkflowContext
Definition: WorkflowContext.h:24
governikus::WorkflowContext::fireNextWorkflowPending
void fireNextWorkflowPending()
governikus::WorkflowContext::setNpaPositionVerified
void setNpaPositionVerified()
Definition: WorkflowContext.cpp:218
governikus::ReaderInfo::getCardInfo
CardInfo & getCardInfo()
Definition: ReaderInfo.h:41
governikus::WorkflowContext::getCardConnection
const QSharedPointer< CardConnection > & getCardConnection() const
Definition: WorkflowContext.cpp:174
governikus::WorkflowContext::fireCancelWorkflow
void fireCancelWorkflow()
governikus::WorkflowContext::setPaceResultReportedToUser
void setPaceResultReportedToUser(bool pReported=true)
Definition: WorkflowContext.cpp:82
governikus::WorkflowContext::getLastPaceResult
CardReturnCode getLastPaceResult() const
Definition: WorkflowContext.cpp:323
governikus::WorkflowContext::getCan
const QString & getCan() const
Definition: WorkflowContext.cpp:258
governikus::WorkflowContext::currentReaderHasEidCardButInsufficientApduLength
bool currentReaderHasEidCardButInsufficientApduLength() const
Definition: WorkflowContext.cpp:458
governikus::WorkflowContext::isStateApproved
bool isStateApproved() const
Definition: WorkflowContext.cpp:118
governikus::GlobalStatus
Definition: GlobalStatus.h:20
governikus::WorkflowContext::setReaderPlugInTypes
void setReaderPlugInTypes(const QVector< ReaderManagerPlugInType > &pReaderPlugInTypes)
Definition: WorkflowContext.cpp:148
governikus::ReaderInfo::getName
const QString & getName() const
Definition: ReaderInfo.h:107
ECardApiResult.h
governikus::WorkflowContext::firePukChanged
void firePukChanged()
governikus::WorkflowContext::getStatus
const GlobalStatus & getStatus() const
Definition: WorkflowContext.cpp:380
governikus::WorkflowContext::setCurrentReaderHasEidCardButInsufficientApduLength
void setCurrentReaderHasEidCardButInsufficientApduLength(bool pState)
Definition: WorkflowContext.cpp:464
governikus::WorkflowContext::getReaderName
const QString & getReaderName() const
Definition: WorkflowContext.cpp:158
governikus::WorkflowContext::isExpectedReader
bool isExpectedReader() const
Definition: WorkflowContext.cpp:356
governikus::WorkflowContext::setStartPaosResult
void setStartPaosResult(const ECardApiResult &pStartPaosResult)
Definition: WorkflowContext.cpp:400
governikus::WorkflowContext::getExpectedReader
const ReaderInfo & getExpectedReader() const
Definition: WorkflowContext.cpp:362
governikus::WorkflowContext::~WorkflowContext
~WorkflowContext() override
Definition: WorkflowContext.cpp:51
governikus::WorkflowContext::setWorkflowFinished
void setWorkflowFinished(bool pWorkflowFinished)
Definition: WorkflowContext.cpp:412
governikus::CardInfo::getRetryCounter
int getRetryCounter() const
Definition: CardInfo.cpp:88
governikus::GlobalStatus::Code::Card_Cancellation_By_User
@ Card_Cancellation_By_User
governikus::WorkflowContext::getEstablishPaceChannelType
PacePasswordId getEstablishPaceChannelType() const
Definition: WorkflowContext.cpp:290
governikus::WorkflowContext::fireStateChanged
void fireStateChanged(const QString &pNewState)
CardConnection.h