AusweisApp2
BluetoothReaderManagerPlugIn.h
gehe zur Dokumentation dieser Datei
1 
7 #pragma once
8 
9 
10 #include "CyberJackWaveDevice.h"
11 #include "ReaderManagerPlugIn.h"
12 
13 #include <QBluetoothDeviceDiscoveryAgent>
14 
15 
16 namespace governikus
17 {
18 
19 class BluetoothReader;
20 class BluetoothReaderManagerPlugInPrivate;
21 
22 
24  : public ReaderManagerPlugIn
25 {
26  Q_PLUGIN_METADATA(IID "governikus.ReaderManagerPlugIn" FILE "metadata.json")
28  Q_DECLARE_PRIVATE(BluetoothReaderManagerPlugIn)
29  Q_OBJECT
30 
31  private:
33 
34  QBluetoothDeviceDiscoveryAgent mDeviceDiscoveryAgent;
35  QMap<QString, QSharedPointer<CyberJackWaveDevice>> mInitializingDevices;
36  QMap<QString, BluetoothReader*> mReaders;
37  QMap<QString, int> mPendingConnections;
38  QStringList mReadersDiscoveredInCurrentScan;
39  int mTimerIdDiscoverPairedDevices;
40 
41  void onRemoveReader(const QString& pDeviceId);
42  void timerEvent(QTimerEvent* event) override;
43  void setScanRunning(bool pScanRunning);
44  void onScanRunningChanged();
45 
46  QVector<QString> deviceIdsForReaderName(const QString& pReaderName);
47 
48  private Q_SLOTS:
49  void onDeviceInitialized(const QBluetoothDeviceInfo& pInfo);
50  void onDeviceDisconnected(const QBluetoothDeviceInfo& pInfo);
51  void onDeviceDiscovered(const QBluetoothDeviceInfo& pInfo);
52  void onDeviceDiscoveryFinished();
53  void onDeviceDiscoveryError(QBluetoothDeviceDiscoveryAgent::Error pError);
54  void onDeviceDiscoveryCanceled();
55  void setBluetoothStatus(bool pEnabled);
56  void onCardRemoved(const QString& pReaderName);
57  void onReaderConnected(const QString& pReaderName);
58  void onReaderConnectionFailed(const QString& pReaderName);
59 
60  public:
62  void init() override;
63  QList<Reader*> getReaders() const override;
64 
65  virtual void startScan(bool pAutoConnect) override;
66  virtual void stopScan(const QString& pError = QString()) override;
67 };
68 
69 } // namespace governikus
Definition: BluetoothReaderManagerPlugIn_p.h:16
Definition: BluetoothReaderManagerPlugIn.h:25
void init() override
Definition: BluetoothReaderManagerPlugIn.cpp:44
virtual void startScan(bool pAutoConnect) override
Definition: BluetoothReaderManagerPlugIn.cpp:68
BluetoothReaderManagerPlugIn()
Definition: BluetoothReaderManagerPlugIn.cpp:28
virtual void stopScan(const QString &pError=QString()) override
Definition: BluetoothReaderManagerPlugIn.cpp:105
QList< Reader * > getReaders() const override
Definition: BluetoothReaderManagerPlugIn.cpp:56
Definition: ReaderManagerPlugIn.h:23
Implementation of ActivationContext for Intent based activation on Android systems.
Definition: ActivationContext.h:15