summaryrefslogtreecommitdiff
path: root/include/serialportinfo.h
blob: b197d52fe6c6458cc44d6de80d2cecb97ccd7c93 (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
54
55
56
57
58
59
60
61
/*
    License...
*/

#ifndef SERIALPORTINFO_H
#define SERIALPORTINFO_H

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

#ifdef SERIALPORT_SHARED
#  ifdef SERIALPORT_BUILD
#    define SERIALPORT_EXPORT Q_DECL_EXPORT
#  else
#    define SERIALPORT_EXPORT Q_DECL_IMPORT
#  endif
#else
#  define SERIALPORT_EXPORT
#endif

QT_BEGIN_NAMESPACE

class SerialPort;
class SerialPortInfoPrivate;
class SerialInfoPrivateDeleter;

class 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

#endif // SERIALPORTINFO_H