AusweisApp2
 Alle Klassen Namensbereiche Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Propertys Freundbeziehungen Makrodefinitionen
CyberJackWaveDevice.h
gehe zur Dokumentation dieser Datei
1 
7 #pragma once
8 
9 
10 #include <QBluetoothDeviceInfo>
11 #include <QLowEnergyCharacteristic>
12 #include <QLowEnergyController>
13 #include <QLowEnergyService>
14 
15 
16 namespace governikus
17 {
18 
20  : public QObject
21 {
22  Q_OBJECT
23 
24  private:
25  /*
26  * This is the maximum number of bytes arriving in one incoming response block
27  */
28  static int INPUT_BLOCK_SIZE;
29 
30  /*
31  * This is the maximum number of bytes to send in one outgoing request block
32  */
33  static int OUTPUT_BLOCK_SIZE;
34 
35  /*
36  * This is the service UUID of the LE service providing the "SIM Access Profile"
37  */
38  static QBluetoothUuid SAP_SERVICE_UUID;
39 
40  /*
41  * This is the characteristic UUID of the SAP service for outgoing requests
42  */
43  static QBluetoothUuid WRITE_CHARACTERISTIC_UUID;
44 
45  /*
46  * This is the characteristic UUID of the SAP service for incoming responses
47  */
48  static QBluetoothUuid READ_CHARACTERISTIC_UUID;
49 
50  /*
51  * This is the characteristic UUID of the SAP service for status indications
52  */
53  static QBluetoothUuid STATUS_CHARACTERISTIC_UUID;
54 
55  QBluetoothDeviceInfo mDeviceInfo;
56  QLowEnergyController mLeController;
57  QScopedPointer<QLowEnergyService> mSapService;
58  QLowEnergyCharacteristic mStatusCharacteristic, mReadCharacteristic, mWriteCharacteristic;
59 
60  QLowEnergyService::WriteMode determineWriteMode(int pBlockIndex);
61 
62  private Q_SLOTS:
63  void onConnectedDevice();
64  void onDisconnectedDevice();
65  void onDeviceError(QLowEnergyController::Error pError);
66  void onDeviceStateChanged(QLowEnergyController::ControllerState pState);
67  void onServiceDiscoveryFinished();
68  void onServiceStateChanged(QLowEnergyService::ServiceState pState);
69  void onServiceError(QLowEnergyService::ServiceError pError);
70  void onCharacteristicChanged(const QLowEnergyCharacteristic& pCharacteristic, const QByteArray& pNewValue);
71 
72  public:
73  CyberJackWaveDevice(const QBluetoothDeviceInfo& pDeviceInfo);
75 
76  QString getName() const;
77  void setDeviceInfo(const QBluetoothDeviceInfo& pInfo);
78 
79  bool isValid() const;
80 
81  bool write(const QByteArray& pValue);
82 
83  public Q_SLOTS:
87  void initialize();
88 
92  void disconnectFromDevice();
93 
94  Q_SIGNALS:
95  void fireInitialized(const QBluetoothDeviceInfo& pInfo);
96  void fireDisconnected(const QBluetoothDeviceInfo& pInfo);
97  void fireError(QLowEnergyController::Error pError);
98  void fireReadCharacteristicChanged(const QByteArray& pValue);
99  void fireStatusCharacteristicChanged(const QByteArray& pValue);
100 };
101 
102 } /* namespace governikus */
void fireStatusCharacteristicChanged(const QByteArray &pValue)
void fireInitialized(const QBluetoothDeviceInfo &pInfo)
bool write(const QByteArray &pValue)
Definition: CyberJackWaveDevice.cpp:210
CyberJackWaveDevice(const QBluetoothDeviceInfo &pDeviceInfo)
Definition: CyberJackWaveDevice.cpp:26
void fireError(QLowEnergyController::Error pError)
~CyberJackWaveDevice()
Definition: CyberJackWaveDevice.cpp:43
void fireReadCharacteristicChanged(const QByteArray &pValue)
void fireDisconnected(const QBluetoothDeviceInfo &pInfo)
bool isValid() const
Definition: CyberJackWaveDevice.cpp:53
QString getName() const
Definition: CyberJackWaveDevice.cpp:59
void setDeviceInfo(const QBluetoothDeviceInfo &pInfo)
Definition: CyberJackWaveDevice.cpp:65
Definition: CyberJackWaveDevice.h:19
void initialize()
Connect to the device and initialize.
Definition: CyberJackWaveDevice.cpp:71
void disconnectFromDevice()
Disconnect from the device.
Definition: CyberJackWaveDevice.cpp:198