1 | // Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com> |
---|---|
2 | // Copyright (C) 2012 Laszlo Papp <lpapp@kde.org> |
3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
4 | |
5 | #ifndef QSERIALPORTINFO_H |
6 | #define QSERIALPORTINFO_H |
7 | |
8 | #include <QtCore/qlist.h> |
9 | #include <QtCore/qscopedpointer.h> |
10 | |
11 | #include <QtSerialPort/qserialportglobal.h> |
12 | |
13 | QT_BEGIN_NAMESPACE |
14 | |
15 | class QSerialPort; |
16 | class QSerialPortInfoPrivate; |
17 | |
18 | class Q_SERIALPORT_EXPORT QSerialPortInfo |
19 | { |
20 | Q_DECLARE_PRIVATE(QSerialPortInfo) |
21 | public: |
22 | QSerialPortInfo(); |
23 | explicit QSerialPortInfo(const QSerialPort &port); |
24 | explicit QSerialPortInfo(const QString &name); |
25 | QSerialPortInfo(const QSerialPortInfo &other); |
26 | ~QSerialPortInfo(); |
27 | |
28 | QSerialPortInfo& operator=(const QSerialPortInfo &other); |
29 | void swap(QSerialPortInfo &other); |
30 | |
31 | QString portName() const; |
32 | QString systemLocation() const; |
33 | QString description() const; |
34 | QString manufacturer() const; |
35 | QString serialNumber() const; |
36 | |
37 | quint16 vendorIdentifier() const; |
38 | quint16 productIdentifier() const; |
39 | |
40 | bool hasVendorIdentifier() const; |
41 | bool hasProductIdentifier() const; |
42 | |
43 | bool isNull() const; |
44 | |
45 | static QList<qint32> standardBaudRates(); |
46 | static QList<QSerialPortInfo> availablePorts(); |
47 | |
48 | private: |
49 | QSerialPortInfo(const QSerialPortInfoPrivate &dd); |
50 | friend QList<QSerialPortInfo> availablePortsByUdev(bool &ok); |
51 | friend QList<QSerialPortInfo> availablePortsBySysfs(bool &ok); |
52 | friend QList<QSerialPortInfo> availablePortsByFiltersOfDevices(bool &ok); |
53 | std::unique_ptr<QSerialPortInfoPrivate> d_ptr; |
54 | }; |
55 | |
56 | inline bool QSerialPortInfo::isNull() const |
57 | { return !d_ptr; } |
58 | |
59 | QT_END_NAMESPACE |
60 | |
61 | #endif // QSERIALPORTINFO_H |
62 |