-
Notifications
You must be signed in to change notification settings - Fork 1
/
cameradiscovery.h
54 lines (44 loc) · 1.35 KB
/
cameradiscovery.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef CAMERADISCOVERY_H
#define CAMERADISCOVERY_H
#include <QObject>
#include <QQmlEngine>
#include <QBluetoothDeviceDiscoveryAgent>
#include <QBluetoothDeviceInfo>
class CameraDiscovery : public QObject
{
Q_OBJECT
Q_PROPERTY(bool discovering READ discovering NOTIFY discoveringChanged FINAL)
Q_PROPERTY(int count READ count NOTIFY countChanged FINAL)
QML_ELEMENT
QML_SINGLETON
public:
explicit CameraDiscovery(QObject *parent = nullptr);
~CameraDiscovery();
int count() const;
public slots:
void stopDeviceDiscovery();
void startDeviceDiscovery();
QVariantList getDevices();
QString getDefaultDevice();
QBluetoothDeviceInfo *getBluetoothDevice(QString address);
signals:
void discoveryStart();
void discoveryStop(qsizetype devices);
void devicesUpdated();
void discoveringChanged();
void controllerErrorChanged();
void countChanged();
protected:
bool discovering();
private slots:
void addCameraDevice(const QBluetoothDeviceInfo&);
void deviceScanFinished();
void deviceScanError(QBluetoothDeviceDiscoveryAgent::Error);
private:
QBluetoothDeviceDiscoveryAgent *m_discoveryAgent;
QVariantList m_cameras;
QMap<QString, QBluetoothDeviceInfo *> m_devices;
bool m_discovering=false;
void clearDevices();
};
#endif // CAMERADISCOVERY_H