AusweisApp
Lade ...
Suche ...
Keine Treffer
RemoteDeviceModel.h
gehe zur Dokumentation dieser Datei
1
9#pragma once
10
11#include "GlobalStatus.h"
14
15#include <QAbstractListModel>
16#include <QList>
17#include <QMap>
18#include <QSharedPointer>
19#include <QSslCertificate>
20#include <QString>
21#include <QTimer>
22
23
24class test_RemoteDeviceModel;
25class test_RemoteDeviceFilterModel;
26
27
28namespace governikus
29{
30
32 : public QAbstractListModel
33{
34 Q_OBJECT
35 friend class ::test_RemoteDeviceModel;
36 friend class ::test_RemoteDeviceFilterModel;
37
38 private:
39 QMap<QString, RemoteServiceSettings::RemoteInfo> mPairedReaders;
40 QList<RemoteDeviceModelEntry> mAllRemoteReaders;
41 RemoteServiceSettings::RemoteInfo mLastPairedDevice;
42 QTimer mTimer;
43 bool mIsDetectingRemoteDevices;
44#if defined(Q_OS_IOS)
45 bool mRemoteDetectionWasRunning;
46#endif
47
48 [[nodiscard]] bool indexIsValid(const QModelIndex& pIndex) const;
49 [[nodiscard]] QString getStatus(const RemoteDeviceModelEntry& pRemoteDeviceModelEntry) const;
50 [[nodiscard]] QString getCurrentDeviceName(const QModelIndex& pIndex) const;
51 [[nodiscard]] QString constructDisplayDeviceName(const QModelIndex& pIndex) const;
52 void updatePairedReaders();
53 void updateUnpairedReaders();
54 void removeVanishedReaders();
55 [[nodiscard]] virtual QList<RemoteDeviceModelEntry> presentReaders() const;
56 bool addOrUpdateReader(const RemoteDeviceModelEntry& pModelEntry);
57
58 private Q_SLOTS:
59 void onApplicationStateChanged(bool pIsAppInForeground);
60 void onUpdateReaderList();
61
62 public Q_SLOTS:
64
65 public:
67 {
68 REMOTE_DEVICE_NAME = Qt::UserRole + 1,
78 };
79
80 explicit RemoteDeviceModel(QObject* pParent = nullptr);
81
82 [[nodiscard]] int rowCount(const QModelIndex& pParent = QModelIndex()) const override;
83 [[nodiscard]] QVariant data(const QModelIndex& pIndex, int pRole = Qt::DisplayRole) const override;
84 [[nodiscard]] QHash<int, QByteArray> roleNames() const override;
85
86 [[nodiscard]] QSharedPointer<IfdListEntry> getRemoteDeviceListEntry(const QModelIndex& pIndex) const;
87 [[nodiscard]] QSharedPointer<IfdListEntry> getRemoteDeviceListEntry(const QString& pDeviceId) const;
88 [[nodiscard]] bool isPaired(const QModelIndex& pIndex) const;
89 [[nodiscard]] bool isPairing(const QModelIndex& pIndex) const;
90 [[nodiscard]] bool isSupported(const QModelIndex& pIndex) const;
91 void forgetDevice(const QModelIndex& pIndex);
92 void forgetDevice(const QString& pDeviceId);
93 void setLastPairedReader(const QSslCertificate& pCert);
94
95 public Q_SLOTS:
96 void setDetectRemoteDevices(bool pNewStatus);
98 void onDeviceDisconnected(GlobalStatus::Code pCloseCode, const QString& pId);
99
100 Q_SIGNALS:
102};
103
104
105} // namespace governikus
Code
Definition GlobalStatus.h:28
Definition RemoteDeviceModelEntry.h:26
Definition RemoteDeviceModel.h:33
void forgetDevice(const QModelIndex &pIndex)
Definition RemoteDeviceModel.cpp:469
void onTranslationChanged()
Definition RemoteDeviceModel.cpp:463
SettingsRemoteRoles
Definition RemoteDeviceModel.h:67
@ IS_NETWORK_VISIBLE
Definition RemoteDeviceModel.h:72
@ LAST_CONNECTED
Definition RemoteDeviceModel.h:70
@ IS_SUPPORTED
Definition RemoteDeviceModel.h:73
@ DEVICE_ID
Definition RemoteDeviceModel.h:71
@ REMOTE_DEVICE_STATUS
Definition RemoteDeviceModel.h:69
@ IS_PAIRED
Definition RemoteDeviceModel.h:74
@ IS_PAIRING
Definition RemoteDeviceModel.h:75
@ LINK_QUALITY
Definition RemoteDeviceModel.h:76
@ IS_LAST_ADDED_DEVICE
Definition RemoteDeviceModel.h:77
@ REMOTE_DEVICE_NAME
Definition RemoteDeviceModel.h:68
QHash< int, QByteArray > roleNames() const override
Definition RemoteDeviceModel.cpp:41
bool isPairing(const QModelIndex &pIndex) const
Definition RemoteDeviceModel.cpp:363
bool isPaired(const QModelIndex &pIndex) const
Definition RemoteDeviceModel.cpp:352
void onDeviceDisconnected(GlobalStatus::Code pCloseCode, const QString &pId)
Definition RemoteDeviceModel.cpp:499
int rowCount(const QModelIndex &pParent=QModelIndex()) const override
Definition RemoteDeviceModel.cpp:269
void setLastPairedReader(const QSslCertificate &pCert)
Definition RemoteDeviceModel.cpp:491
void onKnownRemoteReadersChanged()
Definition RemoteDeviceModel.cpp:409
void setDetectRemoteDevices(bool pNewStatus)
Definition RemoteDeviceModel.cpp:385
QVariant data(const QModelIndex &pIndex, int pRole=Qt::DisplayRole) const override
Definition RemoteDeviceModel.cpp:275
bool isSupported(const QModelIndex &pIndex) const
Definition RemoteDeviceModel.cpp:374
QSharedPointer< IfdListEntry > getRemoteDeviceListEntry(const QModelIndex &pIndex) const
Definition RemoteDeviceModel.cpp:327
Definition RemoteServiceSettings.h:40
Implementation of GeneralAuthenticate response APDUs.
Definition CommandApdu.h:16