Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qbluetoothdevicewatcher_winrt_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QBLUETOOTHDEVICEWATCHER_WINRT_P_H
5#define QBLUETOOTHDEVICEWATCHER_WINRT_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/private/qglobal_p.h>
19#include <QtCore/QObject>
20
21#include <private/qbluetoothutils_winrt_p.h>
22
23#include <winrt/base.h>
24#include <QtCore/private/qfactorycacheregistration_p.h>
25#include <winrt/Windows.Devices.Enumeration.h>
26
28
30 public std::enable_shared_from_this<QBluetoothDeviceWatcherWinRT>
31{
33public:
34 QBluetoothDeviceWatcherWinRT(int id, winrt::hstring selector);
35 QBluetoothDeviceWatcherWinRT(int id, winrt::hstring selector,
36 winrt::Windows::Devices::Enumeration::DeviceInformationKind kind);
38
39 bool init();
40 void start();
41 void stop();
42
44 // The signals will be emitted from a separate thread,
45 // so we need to use Qt::QueuedConnection
46 void deviceAdded(winrt::hstring deviceId, int id);
47 void deviceRemoved(winrt::hstring deviceId, int id);
48 void deviceUpdated(winrt::hstring deviceId, int id);
50 void watcherStopped(int id);
51
52private:
53 void subscribeToEvents();
54 void unsubscribeFromEvents();
55 bool canStop() const;
56
57 const int m_id; // used to uniquely identify the wrapper
58 winrt::Windows::Devices::Enumeration::DeviceWatcher m_watcher = nullptr;
59
60 winrt::event_token m_addedToken;
61 winrt::event_token m_removedToken;
62 winrt::event_token m_updatedToken;
63 winrt::event_token m_enumerationToken;
64 winrt::event_token m_stoppedToken;
65};
66
68
69#endif // QBLUETOOTHDEVICEWATCHER_WINRT_P_H
void deviceAdded(winrt::hstring deviceId, int id)
void deviceUpdated(winrt::hstring deviceId, int id)
void deviceRemoved(winrt::hstring deviceId, int id)
QBluetoothDeviceWatcherWinRT(int id, winrt::hstring selector)
\inmodule QtCore
Definition qobject.h:103
Combined button and popup list for selecting options.
#define Q_OBJECT
#define signals
QFileSelector selector
[1]