aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/boot2qt/device-detection/qdbdevicetracker.h
blob: e7ebb8010a7a85a877e0a6e027a2256d2b654a99 (plain)
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
// Copyright (C) 2019 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#pragma once
#include <QObject>
#include <QMap>

namespace Qdb {
namespace Internal {

class QdbWatcher;

class QdbDeviceTracker : public QObject
{
    Q_OBJECT
public:
    QdbDeviceTracker(QObject *parent = nullptr);

    enum DeviceEventType
    {
        NewDevice,
        DisconnectedDevice
    };

    void start();
    void stop();

signals:
    void deviceEvent(DeviceEventType eventType, QMap<QString, QString> info);
    void trackerError(QString errorMessage);

private:
    void handleWatchMessage(const QJsonDocument &document);

    QdbWatcher *m_qdbWatcher = nullptr;
};

} // namespace Internal
} // namespace Qdb