AusweisApp2
MessageDispatcher.h
gehe zur Dokumentation dieser Datei
1 
7 #pragma once
8 
9 #include "context/AuthContext.h"
11 #include "messages/MsgContext.h"
12 #include "messages/MsgHandler.h"
13 
14 #include <QJsonDocument>
15 #include <QString>
16 
17 #include <functional>
18 #include <initializer_list>
19 
20 class test_Message;
21 
22 namespace governikus
23 {
24 
26 {
27  private:
28  friend class ::test_Message;
29 
30  MsgDispatcherContext mContext;
31 
32  MsgHandler createForStateChange(MsgType pStateType);
33  MsgHandler createForCommand(const QJsonObject& pObj);
34 
35  MsgHandler cancel();
36  MsgHandler accept();
37  MsgHandler interrupt();
38  MsgHandler handleCurrentState(MsgCmdType pCmdType, std::initializer_list<MsgType> pMsgType, const std::function<MsgHandler()>& pFunc) const;
39  MsgHandler handleInternalOnly(MsgCmdType pCmdType, const std::function<MsgHandler()>& pFunc) const;
40 
41  public:
42  class Msg final
43  {
44  friend class MessageDispatcher;
45  const MsgType mType;
46  const QByteArray mData;
47 
48  Msg(const MsgHandler& pHandler);
49 
50  public:
51  operator QByteArray() const;
52  operator MsgType() const;
53  };
54 
56 
57  QByteArray init(const QSharedPointer<WorkflowContext>& pWorkflowContext);
58  QByteArray finish();
59  void reset();
60  Msg processCommand(const QByteArray& pMsg);
61  QByteArray processStateChange(const QString& pState);
62 
63  [[nodiscard]] QByteArray createMsgReader(const ReaderInfo& pInfo) const;
64 };
65 
66 char* toString(const MessageDispatcher::Msg& pMsg);
67 
68 } // namespace governikus
Definition: MsgContext.h:64
QByteArray createMsgReader(const ReaderInfo &pInfo) const
Definition: MessageDispatcher.cpp:88
MessageDispatcher()
Definition: MessageDispatcher.cpp:54
Definition: MessageDispatcher.h:42
Definition: ReaderInfo.h:16
QByteArray processStateChange(const QString &pState)
Definition: MessageDispatcher.cpp:113
QByteArray init(const QSharedPointer< WorkflowContext > &pWorkflowContext)
Definition: MessageDispatcher.cpp:60
void reset()
Definition: MessageDispatcher.cpp:80
Implementation of ActivationContext for Intent based activation on Android systems.
Definition: ActivationContext.h:14
char * toString(const MessageDispatcher::Msg &pMsg)
Definition: MessageDispatcher.h:25
QByteArray finish()
Definition: MessageDispatcher.cpp:94
Msg processCommand(const QByteArray &pMsg)
Definition: MessageDispatcher.cpp:162
Definition: MsgHandler.h:16