deCONZ C++ API v2.6.1
Loading...
Searching...
No Matches
device_enumerator.h
1#ifndef DEVICE_ENUMERATOR_H
2#define DEVICE_ENUMERATOR_H
3
4/*
5 * Copyright (c) 2012-2023 dresden elektronik ingenieurtechnik gmbh.
6 * All rights reserved.
7 *
8 * The software in this package is published under the terms of the BSD
9 * style license a copy of which has been included with this distribution in
10 * the LICENSE.txt file.
11 *
12 */
13
14#include <QObject>
15#include <QString>
16#include <vector>
17#include "deconz/declspec.h"
18
19namespace deCONZ
20{
21
25{
26 DeviceEntry() :
27 failedConnects(0),
28 idVendor(0),
29 idProduct(0)
30 {
31
32 }
33 bool operator==(const DeviceEntry &other) const
34 {
35 return path == other.path
36 && friendlyName == other.friendlyName
37 && idVendor == other.idVendor
38 && idProduct == other.idProduct
39 && serialNumber == other.serialNumber;
40 }
41 QString friendlyName;
42 QString path;
43 QString serialNumber;
44 int failedConnects;
45 quint16 idVendor;
46 quint16 idProduct;
47};
48
49DECONZ_DLLSPEC QString DEV_StableDevicePath(const QString &path);
50DECONZ_DLLSPEC QString DEV_ResolvedDevicePath(const QString &path);
51
53
59class DECONZ_DLLSPEC DeviceEnumerator : public QObject
60{
61 Q_OBJECT
62
63public:
64 DeviceEnumerator() = delete;
65 explicit DeviceEnumerator(QObject *parent);
67 static DeviceEnumerator *instance();
68 bool listSerialPorts();
69 const std::vector<DeviceEntry> &getList() const;
70
71private:
72 Q_DECLARE_PRIVATE_D(d_ptr2, DeviceEnumerator)
73 DeviceEnumeratorPrivate *d_ptr2 = nullptr;
74};
75
76} // namespace deCONZ
77
78#endif // DEVICE_ENUMERATOR_H
Definition device_enumerator.cpp:82
Lists all devices which are available for serial communication.
Definition device_enumerator.h:60
The deCONZ namespace.
Definition aps.cpp:19
Descriptor of a device.
Definition device_enumerator.h:25