AusweisApp2
Lade ...
Suche ...
Keine Treffer
RemoteServiceModel.h
gehe zur Dokumentation dieser Datei
1
7#pragma once
8
10#include "Env.h"
11#include "ReaderManager.h"
12#include "RemoteDeviceModel.h"
13#include "WorkflowModel.h"
14
15#include <QObject>
16#include <QQmlEngine>
17
18namespace governikus
19{
20
22 : public WorkflowModel
23{
24 Q_OBJECT
25 friend class Env;
26
27 Q_PROPERTY(bool running READ isRunning NOTIFY fireIsRunningChanged)
28 Q_PROPERTY(bool isStarting READ isStarting NOTIFY fireIsStartingChanged)
29 Q_PROPERTY(bool runnable READ isRunnable NOTIFY fireEnvironmentChanged)
30 Q_PROPERTY(bool canEnableNfc READ isCanEnableNfc NOTIFY fireEnvironmentChanged)
31 Q_PROPERTY(QString errorMessage READ getErrorMessage NOTIFY fireEnvironmentChanged)
32 Q_PROPERTY(bool isPairing READ isPairing NOTIFY firePskChanged)
33 Q_PROPERTY(QByteArray psk READ getPsk NOTIFY firePskChanged)
35 Q_PROPERTY(QString connectionInfo READ getConnectionInfo NOTIFY fireConnectionInfoChanged)
38 Q_PROPERTY(RemoteDeviceModel * knownDevices READ getKnownDevices CONSTANT)
39 Q_PROPERTY(RemoteDeviceModel * combinedDevices READ getCombinedDevices CONSTANT)
44 Q_PROPERTY(bool requiresLocalNetworkPermission MEMBER mRequiresLocalNetworkPermission CONSTANT)
45
46 private:
47 QSharedPointer<RemoteServiceContext> mContext;
48 bool mRunnable;
49 bool mIsStarting;
50 bool mCanEnableNfc;
51 bool mPairingRequested;
52 bool mRequestTransportPin;
53 QString mErrorMessage;
54 QByteArray mPsk;
55 RemoteDeviceModel mAvailableRemoteDevices;
56 RemoteDeviceModel mKnownDevices;
57 RemoteDeviceModel mCombinedDevices;
58 QString mConnectionInfo;
59 QString mConnectedServerDeviceNames;
60 QSharedPointer<RemoteDeviceListEntry> mRememberedServerEntry;
61 const bool mRequiresLocalNetworkPermission;
62
64 ~RemoteServiceModel() override = default;
65
66 void onEnvironmentChanged();
67 QString getErrorMessage(bool pNfcPluginAvailable, bool pNfcPluginEnabled, bool pWifiEnabled) const;
68
69 void setStarting(bool pStarting);
70
71 private Q_SLOTS:
72 void onEstablishConnectionDone(const QSharedPointer<RemoteDeviceListEntry>& pEntry, const GlobalStatus& pStatus);
73 void onConnectionInfoChanged(bool pConnected);
74 void onCardConnectionEstablished(const QSharedPointer<CardConnection>& pConnection);
75 void onConnectedDevicesChanged();
76 void onEstablishPaceChannelUpdated();
77
78 public:
79 bool isRunning() const;
80 Q_INVOKABLE void setRunning(bool pState, bool pEnablePairing = false);
81 bool isStarting() const;
82
86 void setDetectRemoteDevices(bool pNewStatus);
87 bool detectRemoteDevices() const;
88 Q_INVOKABLE bool rememberServer(const QString& pDeviceId);
89 Q_INVOKABLE void connectToRememberedServer(const QString& pServerPsk);
90
91 void resetRemoteServiceContext(const QSharedPointer<RemoteServiceContext>& pContext = QSharedPointer<RemoteServiceContext>());
92 void setPairing(bool pEnabled);
93 bool isPairing();
94 bool isConnectedToPairedDevice() const;
95 bool enableTransportPinLink() const;
96 bool isRequestTransportPin() const;
97 bool isRunnable() const;
98 bool isCanEnableNfc() const;
99 QString getErrorMessage() const;
100 QByteArray getPsk() const;
101 QString getConnectionInfo() const;
102 QString getConnectedServerDeviceNames() const;
103 bool getRemoteReaderVisible() const;
104
105 Q_INVOKABLE bool pinPadModeOn() const;
106 Q_INVOKABLE QString getPasswordType() const;
107 Q_INVOKABLE void forgetDevice(const QString& pId);
108 Q_INVOKABLE void cancelPasswordRequest();
109 Q_INVOKABLE void changePinLength();
110
111 Q_SIGNALS:
116 void firePskChanged(const QByteArray& pPsk);
120 void firePairingFailed(const QString& pDeviceName, const QString& pErrorMessage);
121 void firePairingSuccess(const QString& pDeviceName);
127};
128
129
130} // namespace governikus
Definition: Env.h:44
Definition: GlobalStatus.h:20
Definition: RemoteDeviceModel.h:63
Definition: RemoteServiceModel.h:23
QByteArray psk
Definition: RemoteServiceModel.h:33
Q_INVOKABLE void connectToRememberedServer(const QString &pServerPsk)
Definition: RemoteServiceModel.cpp:196
Q_INVOKABLE void changePinLength()
Definition: RemoteServiceModel.cpp:442
bool running
Definition: RemoteServiceModel.h:27
bool remoteReaderVisible
Definition: RemoteServiceModel.h:43
void setDetectRemoteDevices(bool pNewStatus)
Definition: RemoteServiceModel.cpp:170
bool connectedToPairedDevice
Definition: RemoteServiceModel.h:34
bool isRunnable() const
Definition: RemoteServiceModel.cpp:333
void resetRemoteServiceContext(const QSharedPointer< RemoteServiceContext > &pContext=QSharedPointer< RemoteServiceContext >())
Definition: RemoteServiceModel.cpp:253
void firePairingFailed(const QString &pDeviceName, const QString &pErrorMessage)
Q_INVOKABLE void forgetDevice(const QString &pId)
Definition: RemoteServiceModel.cpp:427
bool canEnableNfc
Definition: RemoteServiceModel.h:30
QString connectionInfo
Definition: RemoteServiceModel.h:35
QString getErrorMessage() const
Definition: RemoteServiceModel.cpp:345
Q_INVOKABLE QString getPasswordType() const
Definition: RemoteServiceModel.cpp:381
Q_INVOKABLE bool pinPadModeOn() const
Definition: RemoteServiceModel.cpp:375
RemoteDeviceModel * getCombinedDevices()
Definition: RemoteServiceModel.cpp:164
RemoteDeviceModel * knownDevices
Definition: RemoteServiceModel.h:38
bool isConnectedToPairedDevice() const
Definition: RemoteServiceModel.cpp:310
QString connectedServerDeviceNames
Definition: RemoteServiceModel.h:36
RemoteDeviceModel * getAvailableRemoteDevices()
Definition: RemoteServiceModel.cpp:152
RemoteDeviceModel * availableRemoteDevices
Definition: RemoteServiceModel.h:37
bool runnable
Definition: RemoteServiceModel.h:29
void firePskChanged(const QByteArray &pPsk)
QString getConnectionInfo() const
Definition: RemoteServiceModel.cpp:357
bool getRemoteReaderVisible() const
Definition: RemoteServiceModel.cpp:369
bool isStarting
Definition: RemoteServiceModel.h:28
Q_INVOKABLE bool rememberServer(const QString &pDeviceId)
Definition: RemoteServiceModel.cpp:209
void firePairingSuccess(const QString &pDeviceName)
RemoteDeviceModel * combinedDevices
Definition: RemoteServiceModel.h:39
QString getConnectedServerDeviceNames() const
Definition: RemoteServiceModel.cpp:363
bool requiresLocalNetworkPermission
Definition: RemoteServiceModel.h:44
bool isRequestTransportPin() const
Definition: RemoteServiceModel.cpp:327
Q_INVOKABLE void cancelPasswordRequest()
Definition: RemoteServiceModel.cpp:433
bool requestTransportPin
Definition: RemoteServiceModel.h:42
QByteArray getPsk() const
Definition: RemoteServiceModel.cpp:351
bool isPairing
Definition: RemoteServiceModel.h:32
bool detectRemoteDevices
Definition: RemoteServiceModel.h:40
QString errorMessage
Definition: RemoteServiceModel.h:31
bool isCanEnableNfc() const
Definition: RemoteServiceModel.cpp:339
RemoteDeviceModel * getKnownDevices()
Definition: RemoteServiceModel.cpp:158
Q_INVOKABLE void setRunning(bool pState, bool pEnablePairing=false)
Definition: RemoteServiceModel.cpp:110
void setPairing(bool pEnabled)
Definition: RemoteServiceModel.cpp:290
bool enableTransportPinLink
Definition: RemoteServiceModel.h:41
bool isRunning() const
Definition: RemoteServiceModel.cpp:104
Definition: WorkflowModel.h:23
Implementation of ActivationContext for Intent based activation on Android systems.
Definition: ActivationContext.h:15