summaryrefslogtreecommitdiffstats
path: root/src/serialportinfo.h
blob: 02b93595088b11550df359adee61d16f8a37c876 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
    License...
*/

#ifndef SERIALPORTINFO_H
#define SERIALPORTINFO_H

#include <QtCore/qlist.h>
#include <QtCore/qscopedpointer.h>

#include "serialport-global.h"

QT_BEGIN_NAMESPACE_SERIALPORT

class SerialPort;
class SerialPortInfoPrivate;
class SerialInfoPrivateDeleter;

class Q_ADDON_SERIALPORT_EXPORT SerialPortInfo
{
    Q_DECLARE_PRIVATE(SerialPortInfo)
public:
    SerialPortInfo();
    SerialPortInfo(const SerialPortInfo &other);
    SerialPortInfo(const SerialPort &port);
    SerialPortInfo(const QString &name);
    ~SerialPortInfo();

    SerialPortInfo& operator=(const SerialPortInfo &other);
    void swap(SerialPortInfo &other);

    QString portName() const;
    QString systemLocation() const;
    QString description() const;
    QString manufacturer() const;

    bool isNull() const;
    bool isBusy() const;
    bool isValid() const;

    QList<qint32> standardRates() const;
    static QList<SerialPortInfo> availablePorts();

private:
    QScopedPointer<SerialPortInfoPrivate, SerialInfoPrivateDeleter> d_ptr;
};

inline bool SerialPortInfo::isNull() const
{ return !d_ptr; }

QT_END_NAMESPACE_SERIALPORT

#endif // SERIALPORTINFO_H