summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf2
-rw-r--r--LGPL_EXCEPTION.txt2
-rw-r--r--LICENSE.GPLv24
-rw-r--r--LICENSE.LGPLv214
-rw-r--r--LICENSE.LGPLv34
-rw-r--r--examples/serialport/blockingmaster/blockingmaster.pro6
-rw-r--r--examples/serialport/blockingmaster/dialog.cpp12
-rw-r--r--examples/serialport/blockingmaster/dialog.h12
-rw-r--r--examples/serialport/blockingmaster/main.cpp12
-rw-r--r--examples/serialport/blockingmaster/masterthread.cpp12
-rw-r--r--examples/serialport/blockingmaster/masterthread.h12
-rw-r--r--examples/serialport/blockingslave/blockingslave.pro6
-rw-r--r--examples/serialport/blockingslave/dialog.cpp12
-rw-r--r--examples/serialport/blockingslave/dialog.h12
-rw-r--r--examples/serialport/blockingslave/main.cpp12
-rw-r--r--examples/serialport/blockingslave/slavethread.cpp12
-rw-r--r--examples/serialport/blockingslave/slavethread.h12
-rw-r--r--examples/serialport/cenumerator/cenumerator.pro7
-rw-r--r--examples/serialport/cenumerator/main.cpp12
-rw-r--r--examples/serialport/creaderasync/creaderasync.pro7
-rw-r--r--examples/serialport/creaderasync/main.cpp12
-rw-r--r--examples/serialport/creaderasync/serialportreader.cpp12
-rw-r--r--examples/serialport/creaderasync/serialportreader.h12
-rw-r--r--examples/serialport/creadersync/creadersync.pro7
-rw-r--r--examples/serialport/creadersync/main.cpp12
-rw-r--r--examples/serialport/cwriterasync/cwriterasync.pro7
-rw-r--r--examples/serialport/cwriterasync/main.cpp12
-rw-r--r--examples/serialport/cwriterasync/serialportwriter.cpp12
-rw-r--r--examples/serialport/cwriterasync/serialportwriter.h12
-rw-r--r--examples/serialport/cwritersync/cwritersync.pro7
-rw-r--r--examples/serialport/cwritersync/main.cpp12
-rw-r--r--examples/serialport/doc/blockingmaster.qdoc12
-rw-r--r--examples/serialport/doc/blockingslave.qdoc12
-rw-r--r--examples/serialport/doc/cenumerator.qdoc12
-rw-r--r--examples/serialport/doc/creaderasync.qdoc12
-rw-r--r--examples/serialport/doc/creadersync.qdoc12
-rw-r--r--examples/serialport/doc/cwriterasync.qdoc12
-rw-r--r--examples/serialport/doc/cwritersync.qdoc12
-rw-r--r--examples/serialport/doc/enumerator.qdoc12
-rw-r--r--examples/serialport/doc/terminal.qdoc12
-rw-r--r--examples/serialport/enumerator/enumerator.pro6
-rw-r--r--examples/serialport/enumerator/main.cpp12
-rw-r--r--examples/serialport/master/dialog.cpp12
-rw-r--r--examples/serialport/master/dialog.h12
-rw-r--r--examples/serialport/master/main.cpp12
-rw-r--r--examples/serialport/serialport.pro6
-rw-r--r--examples/serialport/slave/dialog.cpp12
-rw-r--r--examples/serialport/slave/dialog.h12
-rw-r--r--examples/serialport/slave/main.cpp12
-rw-r--r--examples/serialport/slave/slavethread.cpp12
-rw-r--r--examples/serialport/slave/slavethread.h12
-rw-r--r--examples/serialport/terminal/console.cpp12
-rw-r--r--examples/serialport/terminal/console.h12
-rw-r--r--examples/serialport/terminal/main.cpp12
-rw-r--r--examples/serialport/terminal/mainwindow.cpp12
-rw-r--r--examples/serialport/terminal/mainwindow.h12
-rw-r--r--examples/serialport/terminal/settingsdialog.cpp12
-rw-r--r--examples/serialport/terminal/settingsdialog.h12
-rw-r--r--examples/serialport/terminal/terminal.pro6
-rw-r--r--qtserialport.pro18
-rw-r--r--src/serialport/doc/src/index.qdoc10
-rw-r--r--src/serialport/doc/src/qtserialport-examples.qdoc12
-rw-r--r--src/serialport/doc/src/qtserialport-module.qdoc10
-rw-r--r--src/serialport/qserialport.cpp137
-rw-r--r--src/serialport/qserialport.h38
-rw-r--r--src/serialport/qserialport_p.h236
-rw-r--r--src/serialport/qserialport_symbian.cpp556
-rw-r--r--src/serialport/qserialport_symbian_p.h117
-rw-r--r--src/serialport/qserialport_unix.cpp82
-rw-r--r--src/serialport/qserialport_unix_p.h188
-rw-r--r--src/serialport/qserialport_win.cpp275
-rw-r--r--src/serialport/qserialport_win_p.h150
-rw-r--r--src/serialport/qserialport_wince.cpp46
-rw-r--r--src/serialport/qserialport_wince_p.h130
-rw-r--r--src/serialport/qserialportglobal.h29
-rw-r--r--src/serialport/qserialportinfo.cpp12
-rw-r--r--src/serialport/qserialportinfo.h12
-rw-r--r--src/serialport/qserialportinfo_mac.cpp35
-rw-r--r--src/serialport/qserialportinfo_p.h12
-rw-r--r--src/serialport/qserialportinfo_symbian.cpp234
-rw-r--r--src/serialport/qserialportinfo_unix.cpp32
-rw-r--r--src/serialport/qserialportinfo_win.cpp28
-rw-r--r--src/serialport/qserialportinfo_wince.cpp14
-rw-r--r--src/serialport/qt4support/include/QtCore/qlockfile.h79
-rw-r--r--src/serialport/qt4support/include/QtCore/qwineventnotifier.h79
-rw-r--r--src/serialport/qt4support/include/private/qcore_mac_p.h140
-rw-r--r--src/serialport/qt4support/include/private/qcore_unix_p.h116
-rw-r--r--src/serialport/qt4support/include/private/qlockfile_p.h96
-rw-r--r--src/serialport/qt4support/include/private/qringbuffer_p.h311
-rw-r--r--src/serialport/qt4support/install-helper.pri52
-rw-r--r--src/serialport/qt4support/serialport.prf27
-rw-r--r--src/serialport/qt4support/src/qlockfile.cpp344
-rw-r--r--src/serialport/qt4support/src/qlockfile_unix.cpp191
-rw-r--r--src/serialport/qtudev_p.h18
-rw-r--r--src/serialport/serialport-lib.pri51
-rw-r--r--src/serialport/serialport.pro19
-rw-r--r--tests/auto/qserialport/qserialport.pro6
-rw-r--r--tests/auto/qserialport/tst_qserialport.cpp92
-rw-r--r--tests/auto/qserialportinfo/tst_qserialportinfo.cpp38
-rw-r--r--tests/auto/qserialportinfoprivate/tst_qserialportinfoprivate.cpp42
-rw-r--r--tests/manual/qserialport/qserialport.pro6
-rw-r--r--tests/manual/qserialport/tst_qserialport.cpp16
-rw-r--r--tests/manual/qserialportinfo/qserialportinfo.pro6
-rw-r--r--tests/manual/qserialportinfo/tst_qserialportinfo.cpp12
104 files changed, 1009 insertions, 3754 deletions
diff --git a/.qmake.conf b/.qmake.conf
index f34c358..a98bcf6 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -1,3 +1,3 @@
load(qt_build_config)
-MODULE_VERSION = 5.4.3
+MODULE_VERSION = 5.5.0
diff --git a/LGPL_EXCEPTION.txt b/LGPL_EXCEPTION.txt
index add80b9..bd94b55 100644
--- a/LGPL_EXCEPTION.txt
+++ b/LGPL_EXCEPTION.txt
@@ -1,4 +1,4 @@
-Digia Qt LGPL Exception version 1.1
+The Qt Company Qt LGPL Exception version 1.1
As an additional permission to the GNU Lesser General Public License version
2.1, the object code form of a "work that uses the Library" may incorporate
diff --git a/LICENSE.GPLv2 b/LICENSE.GPLv2
index 194c39c..6dbb032 100644
--- a/LICENSE.GPLv2
+++ b/LICENSE.GPLv2
@@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
- The Qt Toolkit is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
- Contact: http://www.qt-project.org/legal
+ The Qt Toolkit is Copyright (C) 2015 The Qt Company Ltd.
+ Contact: http://www.qt.io/licensing/
You may use, distribute and copy the Qt GUI Toolkit under the terms of
GNU General Public License version 2, which is displayed below.
diff --git a/LICENSE.LGPLv21 b/LICENSE.LGPLv21
index 341aa9e..6e18461 100644
--- a/LICENSE.LGPLv21
+++ b/LICENSE.LGPLv21
@@ -1,7 +1,7 @@
GNU LESSER GENERAL PUBLIC LICENSE
- The Qt Toolkit is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
- Contact: http://www.qt-project.org/legal
+ The Qt Toolkit is Copyright (C) 2015 The Qt Company Ltd.
+ Contact: http://www.qt.io/licensing/
You may use, distribute and copy the Qt GUI Toolkit under the terms of
GNU Lesser General Public License version 2.1, which is displayed below.
diff --git a/LICENSE.LGPLv3 b/LICENSE.LGPLv3
index aed671a..8fbb743 100644
--- a/LICENSE.LGPLv3
+++ b/LICENSE.LGPLv3
@@ -1,7 +1,7 @@
GNU LESSER GENERAL PUBLIC LICENSE
- The Qt Toolkit is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
- Contact: http://www.qt-project.org/legal
+ The Qt Toolkit is Copyright (C) 2015 The Qt Company Ltd.
+ Contact: http://www.qt.io/licensing/
You may use, distribute and copy the Qt GUI Toolkit under the terms of
GNU Lesser General Public License version 3, which is displayed below.
diff --git a/examples/serialport/blockingmaster/blockingmaster.pro b/examples/serialport/blockingmaster/blockingmaster.pro
index 5f21cdb..8f3e0a1 100644
--- a/examples/serialport/blockingmaster/blockingmaster.pro
+++ b/examples/serialport/blockingmaster/blockingmaster.pro
@@ -1,8 +1,4 @@
-greaterThan(QT_MAJOR_VERSION, 4) {
- QT += widgets serialport
-} else {
- include($$QTSERIALPORT_PROJECT_ROOT/src/serialport/qt4support/serialport.prf)
-}
+QT += widgets serialport
TARGET = blockingmaster
TEMPLATE = app
diff --git a/examples/serialport/blockingmaster/dialog.cpp b/examples/serialport/blockingmaster/dialog.cpp
index 146f8ae..6355429 100644
--- a/examples/serialport/blockingmaster/dialog.cpp
+++ b/examples/serialport/blockingmaster/dialog.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/blockingmaster/dialog.h b/examples/serialport/blockingmaster/dialog.h
index 36a74f7..a77aef1 100644
--- a/examples/serialport/blockingmaster/dialog.h
+++ b/examples/serialport/blockingmaster/dialog.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/blockingmaster/main.cpp b/examples/serialport/blockingmaster/main.cpp
index 4bb6a4f..9553b42 100644
--- a/examples/serialport/blockingmaster/main.cpp
+++ b/examples/serialport/blockingmaster/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/blockingmaster/masterthread.cpp b/examples/serialport/blockingmaster/masterthread.cpp
index abaf2b5..33a1896 100644
--- a/examples/serialport/blockingmaster/masterthread.cpp
+++ b/examples/serialport/blockingmaster/masterthread.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/blockingmaster/masterthread.h b/examples/serialport/blockingmaster/masterthread.h
index 956d5fe..a4249b0 100644
--- a/examples/serialport/blockingmaster/masterthread.h
+++ b/examples/serialport/blockingmaster/masterthread.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/blockingslave/blockingslave.pro b/examples/serialport/blockingslave/blockingslave.pro
index 5a5fb78..2477b52 100644
--- a/examples/serialport/blockingslave/blockingslave.pro
+++ b/examples/serialport/blockingslave/blockingslave.pro
@@ -1,8 +1,4 @@
-greaterThan(QT_MAJOR_VERSION, 4) {
- QT += widgets serialport
-} else {
- include($$QTSERIALPORT_PROJECT_ROOT/src/serialport/qt4support/serialport.prf)
-}
+QT += widgets serialport
TARGET = blockingslave
TEMPLATE = app
diff --git a/examples/serialport/blockingslave/dialog.cpp b/examples/serialport/blockingslave/dialog.cpp
index 730c7e4..9933e05 100644
--- a/examples/serialport/blockingslave/dialog.cpp
+++ b/examples/serialport/blockingslave/dialog.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/blockingslave/dialog.h b/examples/serialport/blockingslave/dialog.h
index 2f8a632..e9e796a 100644
--- a/examples/serialport/blockingslave/dialog.h
+++ b/examples/serialport/blockingslave/dialog.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/blockingslave/main.cpp b/examples/serialport/blockingslave/main.cpp
index 4bb6a4f..9553b42 100644
--- a/examples/serialport/blockingslave/main.cpp
+++ b/examples/serialport/blockingslave/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/blockingslave/slavethread.cpp b/examples/serialport/blockingslave/slavethread.cpp
index 2b132f5..78fe647 100644
--- a/examples/serialport/blockingslave/slavethread.cpp
+++ b/examples/serialport/blockingslave/slavethread.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/blockingslave/slavethread.h b/examples/serialport/blockingslave/slavethread.h
index eeb2d3a..9d1affd 100644
--- a/examples/serialport/blockingslave/slavethread.h
+++ b/examples/serialport/blockingslave/slavethread.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/cenumerator/cenumerator.pro b/examples/serialport/cenumerator/cenumerator.pro
index 7f87034..f5494fd 100644
--- a/examples/serialport/cenumerator/cenumerator.pro
+++ b/examples/serialport/cenumerator/cenumerator.pro
@@ -1,10 +1,5 @@
QT = core
-
-greaterThan(QT_MAJOR_VERSION, 4) {
- QT += serialport
-} else {
- include($$QTSERIALPORT_PROJECT_ROOT/src/serialport/qt4support/serialport.prf)
-}
+QT += serialport
CONFIG += console
CONFIG -= app_bundle
diff --git a/examples/serialport/cenumerator/main.cpp b/examples/serialport/cenumerator/main.cpp
index 523de10..b1792d5 100644
--- a/examples/serialport/cenumerator/main.cpp
+++ b/examples/serialport/cenumerator/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/creaderasync/creaderasync.pro b/examples/serialport/creaderasync/creaderasync.pro
index 27b17dc..3565dc9 100644
--- a/examples/serialport/creaderasync/creaderasync.pro
+++ b/examples/serialport/creaderasync/creaderasync.pro
@@ -1,10 +1,5 @@
QT = core
-
-greaterThan(QT_MAJOR_VERSION, 4) {
- QT += serialport
-} else {
- include($$QTSERIALPORT_PROJECT_ROOT/src/serialport/qt4support/serialport.prf)
-}
+QT += serialport
CONFIG += console
CONFIG -= app_bundle
diff --git a/examples/serialport/creaderasync/main.cpp b/examples/serialport/creaderasync/main.cpp
index c75ba2c..1dbc6a5 100644
--- a/examples/serialport/creaderasync/main.cpp
+++ b/examples/serialport/creaderasync/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/creaderasync/serialportreader.cpp b/examples/serialport/creaderasync/serialportreader.cpp
index 26e831d..815ff8c 100644
--- a/examples/serialport/creaderasync/serialportreader.cpp
+++ b/examples/serialport/creaderasync/serialportreader.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/creaderasync/serialportreader.h b/examples/serialport/creaderasync/serialportreader.h
index 185cdb7..c7bcf57 100644
--- a/examples/serialport/creaderasync/serialportreader.h
+++ b/examples/serialport/creaderasync/serialportreader.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/creadersync/creadersync.pro b/examples/serialport/creadersync/creadersync.pro
index 3e9a199..ee9eaf2 100644
--- a/examples/serialport/creadersync/creadersync.pro
+++ b/examples/serialport/creadersync/creadersync.pro
@@ -1,10 +1,5 @@
QT = core
-
-greaterThan(QT_MAJOR_VERSION, 4) {
- QT += serialport
-} else {
- include($$QTSERIALPORT_PROJECT_ROOT/src/serialport/qt4support/serialport.prf)
-}
+QT += serialport
CONFIG += console
CONFIG -= app_bundle
diff --git a/examples/serialport/creadersync/main.cpp b/examples/serialport/creadersync/main.cpp
index fba0162..9b4f206 100644
--- a/examples/serialport/creadersync/main.cpp
+++ b/examples/serialport/creadersync/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/cwriterasync/cwriterasync.pro b/examples/serialport/cwriterasync/cwriterasync.pro
index 8a64ceb..0945f1d 100644
--- a/examples/serialport/cwriterasync/cwriterasync.pro
+++ b/examples/serialport/cwriterasync/cwriterasync.pro
@@ -1,10 +1,5 @@
QT = core
-
-greaterThan(QT_MAJOR_VERSION, 4) {
- QT += serialport
-} else {
- include($$QTSERIALPORT_PROJECT_ROOT/src/serialport/qt4support/serialport.prf)
-}
+QT += serialport
CONFIG += console
CONFIG -= app_bundle
diff --git a/examples/serialport/cwriterasync/main.cpp b/examples/serialport/cwriterasync/main.cpp
index 4aa2999..dce65a1 100644
--- a/examples/serialport/cwriterasync/main.cpp
+++ b/examples/serialport/cwriterasync/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/cwriterasync/serialportwriter.cpp b/examples/serialport/cwriterasync/serialportwriter.cpp
index 2d5c2c5..b50b353 100644
--- a/examples/serialport/cwriterasync/serialportwriter.cpp
+++ b/examples/serialport/cwriterasync/serialportwriter.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/cwriterasync/serialportwriter.h b/examples/serialport/cwriterasync/serialportwriter.h
index fcd845d..b53ac39 100644
--- a/examples/serialport/cwriterasync/serialportwriter.h
+++ b/examples/serialport/cwriterasync/serialportwriter.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/cwritersync/cwritersync.pro b/examples/serialport/cwritersync/cwritersync.pro
index 14cba72..08f50a2 100644
--- a/examples/serialport/cwritersync/cwritersync.pro
+++ b/examples/serialport/cwritersync/cwritersync.pro
@@ -1,10 +1,5 @@
QT = core
-
-greaterThan(QT_MAJOR_VERSION, 4) {
- QT += serialport
-} else {
- include($$QTSERIALPORT_PROJECT_ROOT/src/serialport/qt4support/serialport.prf)
-}
+QT += serialport
CONFIG += console
CONFIG -= app_bundle
diff --git a/examples/serialport/cwritersync/main.cpp b/examples/serialport/cwritersync/main.cpp
index 6b300cc..76e4c0f 100644
--- a/examples/serialport/cwritersync/main.cpp
+++ b/examples/serialport/cwritersync/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/doc/blockingmaster.qdoc b/examples/serialport/doc/blockingmaster.qdoc
index 0aa0c3f..9e50f3b 100644
--- a/examples/serialport/doc/blockingmaster.qdoc
+++ b/examples/serialport/doc/blockingmaster.qdoc
@@ -2,8 +2,8 @@
**
** Copyright (C) 2011 - 2012 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2012 - 2013 Laszlo Papp <lpapp@kde.org>
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -12,15 +12,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/examples/serialport/doc/blockingslave.qdoc b/examples/serialport/doc/blockingslave.qdoc
index a2e3a6b..cdcfe6b 100644
--- a/examples/serialport/doc/blockingslave.qdoc
+++ b/examples/serialport/doc/blockingslave.qdoc
@@ -1,8 +1,8 @@
/****************************************************************************
**
** Copyright (C) 2011 - 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,15 +11,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/examples/serialport/doc/cenumerator.qdoc b/examples/serialport/doc/cenumerator.qdoc
index 6774eed..67057ac 100644
--- a/examples/serialport/doc/cenumerator.qdoc
+++ b/examples/serialport/doc/cenumerator.qdoc
@@ -1,8 +1,8 @@
/****************************************************************************
**
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,15 +11,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/examples/serialport/doc/creaderasync.qdoc b/examples/serialport/doc/creaderasync.qdoc
index ff5e9c6..5a96725 100644
--- a/examples/serialport/doc/creaderasync.qdoc
+++ b/examples/serialport/doc/creaderasync.qdoc
@@ -1,8 +1,8 @@
/****************************************************************************
**
** Copyright (C) 2013 Laszlo Papp <lpapp@kde.org>
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,15 +11,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/examples/serialport/doc/creadersync.qdoc b/examples/serialport/doc/creadersync.qdoc
index 6c3f4a8..09f96a4 100644
--- a/examples/serialport/doc/creadersync.qdoc
+++ b/examples/serialport/doc/creadersync.qdoc
@@ -1,8 +1,8 @@
/****************************************************************************
**
** Copyright (C) 2013 Laszlo Papp <lpapp@kde.org>
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,15 +11,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/examples/serialport/doc/cwriterasync.qdoc b/examples/serialport/doc/cwriterasync.qdoc
index b10f2aa..dab014c 100644
--- a/examples/serialport/doc/cwriterasync.qdoc
+++ b/examples/serialport/doc/cwriterasync.qdoc
@@ -1,8 +1,8 @@
/****************************************************************************
**
** Copyright (C) 2013 Laszlo Papp <lpapp@kde.org>
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,15 +11,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/examples/serialport/doc/cwritersync.qdoc b/examples/serialport/doc/cwritersync.qdoc
index 03086e0..875154f 100644
--- a/examples/serialport/doc/cwritersync.qdoc
+++ b/examples/serialport/doc/cwritersync.qdoc
@@ -1,8 +1,8 @@
/****************************************************************************
**
** Copyright (C) 2013 Laszlo Papp <lpapp@kde.org>
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,15 +11,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/examples/serialport/doc/enumerator.qdoc b/examples/serialport/doc/enumerator.qdoc
index 326fdb4..2c8eb6a 100644
--- a/examples/serialport/doc/enumerator.qdoc
+++ b/examples/serialport/doc/enumerator.qdoc
@@ -1,8 +1,8 @@
/****************************************************************************
**
** Copyright (C) 2011 - 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,15 +11,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/examples/serialport/doc/terminal.qdoc b/examples/serialport/doc/terminal.qdoc
index 423d610..16f12fe 100644
--- a/examples/serialport/doc/terminal.qdoc
+++ b/examples/serialport/doc/terminal.qdoc
@@ -1,8 +1,8 @@
/****************************************************************************
**
** Copyright (C) 2011 - 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,15 +11,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/examples/serialport/enumerator/enumerator.pro b/examples/serialport/enumerator/enumerator.pro
index 21233a8..9819fd7 100644
--- a/examples/serialport/enumerator/enumerator.pro
+++ b/examples/serialport/enumerator/enumerator.pro
@@ -1,8 +1,4 @@
-greaterThan(QT_MAJOR_VERSION, 4) {
- QT += widgets serialport
-} else {
- include($$QTSERIALPORT_PROJECT_ROOT/src/serialport/qt4support/serialport.prf)
-}
+QT += widgets serialport
TARGET = enumerator
TEMPLATE = app
diff --git a/examples/serialport/enumerator/main.cpp b/examples/serialport/enumerator/main.cpp
index 40bc67a..41bfddd 100644
--- a/examples/serialport/enumerator/main.cpp
+++ b/examples/serialport/enumerator/main.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -11,9 +11,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -24,8 +24,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/master/dialog.cpp b/examples/serialport/master/dialog.cpp
index 9e35b27..c292b66 100644
--- a/examples/serialport/master/dialog.cpp
+++ b/examples/serialport/master/dialog.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/master/dialog.h b/examples/serialport/master/dialog.h
index f282d99..9f63009 100644
--- a/examples/serialport/master/dialog.h
+++ b/examples/serialport/master/dialog.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/master/main.cpp b/examples/serialport/master/main.cpp
index 4bb6a4f..9553b42 100644
--- a/examples/serialport/master/main.cpp
+++ b/examples/serialport/master/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/serialport.pro b/examples/serialport/serialport.pro
index ba8d167..c0e77df 100644
--- a/examples/serialport/serialport.pro
+++ b/examples/serialport/serialport.pro
@@ -1,8 +1,4 @@
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS = cenumerator creaderasync creadersync cwriterasync cwritersync
-greaterThan(QT_MAJOR_VERSION, 4) {
- !isEmpty(QT.widgets.name):SUBDIRS += enumerator terminal blockingmaster blockingslave
-} else {
- SUBDIRS += enumerator terminal blockingmaster blockingslave master slave
-}
+!isEmpty(QT.widgets.name):SUBDIRS += enumerator terminal blockingmaster blockingslave
diff --git a/examples/serialport/slave/dialog.cpp b/examples/serialport/slave/dialog.cpp
index 7ae52c1..34118de 100644
--- a/examples/serialport/slave/dialog.cpp
+++ b/examples/serialport/slave/dialog.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/slave/dialog.h b/examples/serialport/slave/dialog.h
index 9524940..8c38c6d 100644
--- a/examples/serialport/slave/dialog.h
+++ b/examples/serialport/slave/dialog.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/slave/main.cpp b/examples/serialport/slave/main.cpp
index 4bb6a4f..9553b42 100644
--- a/examples/serialport/slave/main.cpp
+++ b/examples/serialport/slave/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/slave/slavethread.cpp b/examples/serialport/slave/slavethread.cpp
index 5290373..c0300de 100644
--- a/examples/serialport/slave/slavethread.cpp
+++ b/examples/serialport/slave/slavethread.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/slave/slavethread.h b/examples/serialport/slave/slavethread.h
index a56a7d8..b371593 100644
--- a/examples/serialport/slave/slavethread.h
+++ b/examples/serialport/slave/slavethread.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/terminal/console.cpp b/examples/serialport/terminal/console.cpp
index ad1e78e..114bfbf 100644
--- a/examples/serialport/terminal/console.cpp
+++ b/examples/serialport/terminal/console.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -11,9 +11,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -24,8 +24,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/terminal/console.h b/examples/serialport/terminal/console.h
index 98268aa..bf35e58 100644
--- a/examples/serialport/terminal/console.h
+++ b/examples/serialport/terminal/console.h
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -11,9 +11,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -24,8 +24,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/terminal/main.cpp b/examples/serialport/terminal/main.cpp
index e77efe7..79036b0 100644
--- a/examples/serialport/terminal/main.cpp
+++ b/examples/serialport/terminal/main.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -11,9 +11,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -24,8 +24,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/terminal/mainwindow.cpp b/examples/serialport/terminal/mainwindow.cpp
index 2cb52a1..9a98456 100644
--- a/examples/serialport/terminal/mainwindow.cpp
+++ b/examples/serialport/terminal/mainwindow.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -11,9 +11,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -24,8 +24,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/terminal/mainwindow.h b/examples/serialport/terminal/mainwindow.h
index 1f15dbe..51524e1 100644
--- a/examples/serialport/terminal/mainwindow.h
+++ b/examples/serialport/terminal/mainwindow.h
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -11,9 +11,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -24,8 +24,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/terminal/settingsdialog.cpp b/examples/serialport/terminal/settingsdialog.cpp
index 7df3c35..900d2fe 100644
--- a/examples/serialport/terminal/settingsdialog.cpp
+++ b/examples/serialport/terminal/settingsdialog.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -11,9 +11,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -24,8 +24,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/terminal/settingsdialog.h b/examples/serialport/terminal/settingsdialog.h
index d6c9d5e..5dbe82b 100644
--- a/examples/serialport/terminal/settingsdialog.h
+++ b/examples/serialport/terminal/settingsdialog.h
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -11,9 +11,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -24,8 +24,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/examples/serialport/terminal/terminal.pro b/examples/serialport/terminal/terminal.pro
index 0a5b545..1e45e55 100644
--- a/examples/serialport/terminal/terminal.pro
+++ b/examples/serialport/terminal/terminal.pro
@@ -1,8 +1,4 @@
-greaterThan(QT_MAJOR_VERSION, 4) {
- QT += widgets serialport
-} else {
- include($$QTSERIALPORT_PROJECT_ROOT/src/serialport/qt4support/serialport.prf)
-}
+QT += widgets serialport
TARGET = terminal
TEMPLATE = app
diff --git a/qtserialport.pro b/qtserialport.pro
index 3220d2f..b3ebb8b 100644
--- a/qtserialport.pro
+++ b/qtserialport.pro
@@ -1,14 +1,8 @@
-requires(!winrt)
-
lessThan(QT_MAJOR_VERSION, 5) {
- TEMPLATE = subdirs
- SUBDIRS = src examples tests
- CONFIG += ordered
-
- !infile($$OUT_PWD/.qmake.cache, QTSERIALPORT_PROJECT_ROOT) {
- system("echo QTSERIALPORT_PROJECT_ROOT = $$PWD >> $$OUT_PWD/.qmake.cache")
- system("echo QTSERIALPORT_BUILD_ROOT = $$OUT_PWD >> $$OUT_PWD/.qmake.cache")
- }
-} else {
- load(qt_parts)
+ message("Cannot build current QtSerialPort sources with Qt version $${QT_VERSION}.")
+ error("Use at least Qt 5.0.0 or try to download QtSerialPort for Qt4.")
}
+
+requires(!winrt)
+
+load(qt_parts)
diff --git a/src/serialport/doc/src/index.qdoc b/src/serialport/doc/src/index.qdoc
index 9021089..be1c0dd 100644
--- a/src/serialport/doc/src/index.qdoc
+++ b/src/serialport/doc/src/index.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2011 - 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/serialport/doc/src/qtserialport-examples.qdoc b/src/serialport/doc/src/qtserialport-examples.qdoc
index 51858b9..1a04cfa 100644
--- a/src/serialport/doc/src/qtserialport-examples.qdoc
+++ b/src/serialport/doc/src/qtserialport-examples.qdoc
@@ -2,8 +2,8 @@
**
** Copyright (C) 2011-2012 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -12,15 +12,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/serialport/doc/src/qtserialport-module.qdoc b/src/serialport/doc/src/qtserialport-module.qdoc
index 9a2b89a..20452e5 100644
--- a/src/serialport/doc/src/qtserialport-module.qdoc
+++ b/src/serialport/doc/src/qtserialport-module.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2011 - 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/serialport/qserialport.cpp b/src/serialport/qserialport.cpp
index 0e60036..e9c6922 100644
--- a/src/serialport/qserialport.cpp
+++ b/src/serialport/qserialport.cpp
@@ -4,7 +4,7 @@
** Copyright (C) 2011 Sergey Belyashov <Sergey.Belyashov@gmail.com>
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
** Copyright (C) 2012 Andre Hartmann <aha_1980@gmx.de>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -13,9 +13,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -26,8 +26,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -38,30 +38,15 @@
#include "qserialportinfo.h"
#include "qserialportinfo_p.h"
-#ifdef Q_OS_WINCE
-#include "qserialport_wince_p.h"
-#elif defined (Q_OS_WIN)
-#include "qserialport_win_p.h"
-#elif defined (Q_OS_SYMBIAN)
-#include "qserialport_symbian_p.h"
-#elif defined (Q_OS_UNIX)
-#include "qserialport_unix_p.h"
-#else
-#error Unsupported OS
-#endif
-
-#ifndef SERIALPORT_BUFFERSIZE
-# define SERIALPORT_BUFFERSIZE 16384
-#endif
+#include "qserialport_p.h"
#include <QtCore/qdebug.h>
QT_BEGIN_NAMESPACE
-QSerialPortPrivateData::QSerialPortPrivateData(QSerialPort *q)
+QSerialPortPrivate::QSerialPortPrivate()
: readBufferMaxSize(0)
- , readBuffer(SERIALPORT_BUFFERSIZE)
- , writeBuffer(SERIALPORT_BUFFERSIZE)
+ , writeBuffer(InitialBufferSize)
, error(QSerialPort::NoError)
, inputBaudRate(9600)
, outputBaudRate(9600)
@@ -73,11 +58,38 @@ QSerialPortPrivateData::QSerialPortPrivateData(QSerialPort *q)
#if QT_DEPRECATED_SINCE(5,3)
, settingsRestoredOnClose(true)
#endif
- , q_ptr(q)
+ , isBreakEnabled(false)
+#if defined(Q_OS_WINCE)
+ , handle(INVALID_HANDLE_VALUE)
+ , parityErrorOccurred(false)
+ , eventNotifier(0)
+#elif defined(Q_OS_WIN32)
+ , handle(INVALID_HANDLE_VALUE)
+ , parityErrorOccurred(false)
+ , readChunkBuffer(ReadChunkSize, 0)
+ , writeStarted(false)
+ , readStarted(false)
+ , notifier(0)
+ , startAsyncWriteTimer(0)
+ , originalEventMask(0)
+ , triggeredEventMask(0)
+ , actualBytesToWrite(0)
+#elif defined(Q_OS_UNIX)
+ , descriptor(-1)
+ , readNotifier(0)
+ , writeNotifier(0)
+ , readPortNotifierCalled(false)
+ , readPortNotifierState(false)
+ , readPortNotifierStateSet(false)
+ , emittedReadyRead(false)
+ , emittedBytesWritten(false)
+ , pendingBytesWritten(0)
+ , writeSequenceStarted(false)
+#endif
{
}
-int QSerialPortPrivateData::timeoutValue(int msecs, int elapsed)
+int QSerialPortPrivate::timeoutValue(int msecs, int elapsed)
{
if (msecs == -1)
return msecs;
@@ -383,9 +395,10 @@ int QSerialPortPrivateData::timeoutValue(int msecs, int elapsed)
Constructs a new serial port object with the given \a parent.
*/
QSerialPort::QSerialPort(QObject *parent)
- : QIODevice(parent)
- , d_ptr(new QSerialPortPrivate(this))
-{}
+ : QIODevice(*new QSerialPortPrivate, parent)
+ , d_dummy(0)
+{
+}
/*!
Constructs a new serial port object with the given \a parent
@@ -394,8 +407,8 @@ QSerialPort::QSerialPort(QObject *parent)
The name should have a specific format; see the setPort() method.
*/
QSerialPort::QSerialPort(const QString &name, QObject *parent)
- : QIODevice(parent)
- , d_ptr(new QSerialPortPrivate(this))
+ : QIODevice(*new QSerialPortPrivate, parent)
+ , d_dummy(0)
{
setPortName(name);
}
@@ -406,8 +419,8 @@ QSerialPort::QSerialPort(const QString &name, QObject *parent)
\a serialPortInfo.
*/
QSerialPort::QSerialPort(const QSerialPortInfo &serialPortInfo, QObject *parent)
- : QIODevice(parent)
- , d_ptr(new QSerialPortPrivate(this))
+ : QIODevice(*new QSerialPortPrivate, parent)
+ , d_dummy(0)
{
setPort(serialPortInfo);
}
@@ -420,7 +433,6 @@ QSerialPort::~QSerialPort()
/**/
if (isOpen())
close();
- delete d_ptr;
}
/*!
@@ -466,10 +478,6 @@ void QSerialPort::setPort(const QSerialPortInfo &serialPortInfo)
\li Removes the suffix ":" from the system location
and returns the remainder of the string.
\row
- \li Symbian
- \li Returns the system location as it is,
- as it is equivalent to the port name.
- \row
\li Unix, BSD
\li Removes the prefix "/dev/" from the system location
and returns the remainder of the string.
@@ -550,6 +558,7 @@ void QSerialPort::close()
QIODevice::close();
d->close();
+ d->isBreakEnabled = false;
}
/*!
@@ -606,10 +615,9 @@ bool QSerialPort::settingsRestoredOnClose() const
after that the opening of the port succeeds.
\warning Setting the AllDirections flag is only supported on
- the Windows, Windows CE, and Symbian platforms.
+ the Windows, Windows CE platforms.
- \warning Returns equal baud rate in any direction on Windows, Windows CE, and
- Symbian.
+ \warning Returns equal baud rate in any direction on Windows, Windows CE.
The default value is Baud9600, i.e. 9600 bits per second.
*/
@@ -1009,7 +1017,7 @@ bool QSerialPort::clear(Directions directions)
}
if (directions & Input)
- d->readBuffer.clear();
+ d->buffer.clear();
if (directions & Output)
d->writeBuffer.clear();
return d->clear(directions);
@@ -1040,7 +1048,7 @@ bool QSerialPort::clear(Directions directions)
bool QSerialPort::atEnd() const
{
Q_D(const QSerialPort);
- return QIODevice::atEnd() && (!isOpen() || (d->readBuffer.size() == 0));
+ return QIODevice::atEnd() && (!isOpen() || (d->buffer.size() == 0));
}
/*!
@@ -1188,8 +1196,7 @@ bool QSerialPort::isSequential() const
*/
qint64 QSerialPort::bytesAvailable() const
{
- Q_D(const QSerialPort);
- return d->readBuffer.size() + QIODevice::bytesAvailable();
+ return QIODevice::bytesAvailable();
}
/*!
@@ -1217,9 +1224,7 @@ qint64 QSerialPort::bytesToWrite() const
*/
bool QSerialPort::canReadLine() const
{
- Q_D(const QSerialPort);
- const bool hasLine = (d->readBuffer.size() > 0) && d->readBuffer.canReadLine();
- return hasLine || QIODevice::canReadLine();
+ return QIODevice::canReadLine();
}
/*!
@@ -1292,15 +1297,20 @@ bool QSerialPort::sendBreak(int duration)
}
/*!
- Controls the signal break, depending on the flag \a set.
- If successful, returns true; otherwise returns false.
-
- If \a set is true then enables the break transmission; otherwise disables.
+ \property QSerialPort::breakEnabled
+ \since 5.5
+ \brief the state of the transmission line in break
- \note The serial port has to be open before trying to set break enabled;
- otherwise returns false and sets the NotOpenError error code.
+ Returns true on success, false otherwise.
+ If the flag is true then the transmission line is in break state;
+ otherwise is in non-break state.
- \sa sendBreak()
+ \note The serial port has to be open before trying to set or get this
+ property; otherwise returns false and sets the NotOpenError error code.
+ This is a bit unusual as opposed to the regular Qt property settings of
+ a class. However, this is a special use case since the property is set
+ through the interaction with the kernel and hardware. Hence, the two
+ scenarios cannot be completely compared to each other.
*/
bool QSerialPort::setBreakEnabled(bool set)
{
@@ -1312,7 +1322,20 @@ bool QSerialPort::setBreakEnabled(bool set)
return false;
}
- return d->setBreakEnabled(set);
+ if (d->setBreakEnabled(set)) {
+ if (d->isBreakEnabled != set) {
+ d->isBreakEnabled = set;
+ emit breakEnabledChanged(d->isBreakEnabled);
+ }
+ return true;
+ }
+ return false;
+}
+
+bool QSerialPort::isBreakEnabled() const
+{
+ Q_D(const QSerialPort);
+ return d->isBreakEnabled;
}
/*!
@@ -1347,7 +1370,7 @@ void QSerialPort::setError(QSerialPort::SerialPortError serialPortError, const Q
d->error = serialPortError;
- if (errorString.isNull())
+ if (errorString.isNull() && (serialPortError != QSerialPort::NoError))
setErrorString(qt_error_string(-1));
else
setErrorString(errorString);
diff --git a/src/serialport/qserialport.h b/src/serialport/qserialport.h
index fa681ad..cbf489d 100644
--- a/src/serialport/qserialport.h
+++ b/src/serialport/qserialport.h
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2013 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -11,9 +11,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -24,8 +24,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -63,6 +63,7 @@ class Q_SERIALPORT_EXPORT QSerialPort : public QIODevice
#if QT_DEPRECATED_SINCE(5, 3)
Q_PROPERTY(bool settingsRestoredOnClose READ settingsRestoredOnClose WRITE setSettingsRestoredOnClose NOTIFY settingsRestoredOnCloseChanged)
#endif
+ Q_PROPERTY(bool breakEnabled READ isBreakEnabled WRITE setBreakEnabled NOTIFY breakEnabledChanged)
Q_ENUMS(BaudRate DataBits Parity StopBits FlowControl DataErrorPolicy SerialPortError)
Q_FLAGS(Directions PinoutSignals)
@@ -141,7 +142,7 @@ public:
Q_DECLARE_FLAGS(PinoutSignals, PinoutSignal)
#if QT_DEPRECATED_SINCE(5, 2)
-#if defined _MSC_VER
+#if defined(_MSC_VER)
#pragma deprecated(UnknownBaud)
#pragma deprecated(UnknownDataBits)
#pragma deprecated(UnknownParity)
@@ -244,8 +245,11 @@ public:
bool waitForReadyRead(int msecs) Q_DECL_OVERRIDE;
bool waitForBytesWritten(int msecs) Q_DECL_OVERRIDE;
- bool sendBreak(int duration = 0);
+#if QT_DEPRECATED_SINCE(5, 5)
+ QT_DEPRECATED bool sendBreak(int duration = 0);
+#endif
bool setBreakEnabled(bool set = true);
+ bool isBreakEnabled() const;
Handle handle() const;
@@ -255,11 +259,16 @@ Q_SIGNALS:
void parityChanged(QSerialPort::Parity parity);
void stopBitsChanged(QSerialPort::StopBits stopBits);
void flowControlChanged(QSerialPort::FlowControl flowControl);
- void dataErrorPolicyChanged(QSerialPort::DataErrorPolicy policy);
+#if QT_DEPRECATED_SINCE(5, 2)
+ QT_DEPRECATED void dataErrorPolicyChanged(QSerialPort::DataErrorPolicy policy);
+#endif
void dataTerminalReadyChanged(bool set);
void requestToSendChanged(bool set);
void error(QSerialPort::SerialPortError serialPortError);
- void settingsRestoredOnCloseChanged(bool restore);
+#if QT_DEPRECATED_SINCE(5, 3)
+ QT_DEPRECATED void settingsRestoredOnCloseChanged(bool restore);
+#endif
+ void breakEnabledChanged(bool set);
protected:
qint64 readData(char *data, qint64 maxSize) Q_DECL_OVERRIDE;
@@ -269,15 +278,14 @@ protected:
private:
void setError(QSerialPort::SerialPortError error, const QString &errorString = QString());
- QSerialPortPrivate * const d_ptr;
+ // ### Qt6: remove me.
+ QSerialPortPrivate * const d_dummy;
Q_DISABLE_COPY(QSerialPort)
-#if defined (Q_OS_WIN32)
- Q_PRIVATE_SLOT(d_func(), bool _q_completeAsyncCommunication())
- Q_PRIVATE_SLOT(d_func(), bool _q_completeAsyncRead())
- Q_PRIVATE_SLOT(d_func(), bool _q_completeAsyncWrite())
+#if defined(Q_OS_WIN32)
Q_PRIVATE_SLOT(d_func(), bool _q_startAsyncWrite())
+ Q_PRIVATE_SLOT(d_func(), void _q_notified(quint32, quint32, OVERLAPPED*))
#endif
};
diff --git a/src/serialport/qserialport_p.h b/src/serialport/qserialport_p.h
index 578d8a9..ad8d9d0 100644
--- a/src/serialport/qserialport_p.h
+++ b/src/serialport/qserialport_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2011-2012 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2011 Sergey Belyashov <Sergey.Belyashov@gmail.com>
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -12,9 +12,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -25,8 +25,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -50,21 +50,116 @@
#include "qserialport.h"
#include <private/qringbuffer_p.h>
+#include <private/qiodevice_p.h>
+
+#if defined(Q_OS_WINCE)
+# include <QtCore/qmutex.h>
+# include <qt_windows.h>
+#elif defined(Q_OS_WIN32)
+# include <qt_windows.h>
+#elif defined(Q_OS_UNIX)
+# include <QtCore/qlockfile.h>
+# include <QtCore/qscopedpointer.h>
+# include <QtCore/qfileinfo.h>
+# include <QtCore/qstringlist.h>
+# include <limits.h>
+# include <termios.h>
+# ifdef Q_OS_ANDROID
+struct serial_struct {
+ int type;
+ int line;
+ unsigned int port;
+ int irq;
+ int flags;
+ int xmit_fifo_size;
+ int custom_divisor;
+ int baud_base;
+ unsigned short close_delay;
+ char io_type;
+ char reserved_char[1];
+ int hub6;
+ unsigned short closing_wait;
+ unsigned short closing_wait2;
+ unsigned char *iomem_base;
+ unsigned short iomem_reg_shift;
+ unsigned int port_high;
+ unsigned long iomap_base;
+};
+# define ASYNC_SPD_CUST 0x0030
+# define ASYNC_SPD_MASK 0x1030
+# define PORT_UNKNOWN 0
+# elif defined(Q_OS_LINUX)
+# include <linux/serial.h>
+# endif
+#else
+# error Unsupported OS
+#endif
QT_BEGIN_NAMESPACE
-class QSerialPortPrivateData
+class QThread;
+class QWinOverlappedIoNotifier;
+class QTimer;
+class QSocketNotifier;
+
+#if defined(Q_OS_UNIX)
+QString serialPortLockFilePath(const QString &portName);
+#endif
+
+class QSerialPortPrivate : public QIODevicePrivate
{
+ Q_DECLARE_PUBLIC(QSerialPort)
public:
enum IoConstants {
- ReadChunkSize = 512
+ ReadChunkSize = 512,
+ InitialBufferSize = 16384
};
- QSerialPortPrivateData(QSerialPort *q);
- int timeoutValue(int msecs, int elapsed);
+ QSerialPortPrivate();
+
+ static int timeoutValue(int msecs, int elapsed);
+
+ bool open(QIODevice::OpenMode mode);
+ void close();
+
+ QSerialPort::PinoutSignals pinoutSignals();
+
+ bool setDataTerminalReady(bool set);
+ bool setRequestToSend(bool set);
+
+ bool flush();
+ bool clear(QSerialPort::Directions directions);
+
+ bool sendBreak(int duration);
+ bool setBreakEnabled(bool set);
+
+ qint64 readData(char *data, qint64 maxSize);
+
+ bool waitForReadyRead(int msec);
+ bool waitForBytesWritten(int msec);
+
+ bool setBaudRate();
+ bool setBaudRate(qint32 baudRate, QSerialPort::Directions directions);
+ bool setDataBits(QSerialPort::DataBits dataBits);
+ bool setParity(QSerialPort::Parity parity);
+ bool setStopBits(QSerialPort::StopBits stopBits);
+ bool setFlowControl(QSerialPort::FlowControl flowControl);
+ bool setDataErrorPolicy(QSerialPort::DataErrorPolicy policy);
+
+ QSerialPort::SerialPortError decodeSystemError(int systemErrorCode = -1) const;
+
+ qint64 bytesToWrite() const;
+ qint64 writeData(const char *data, qint64 maxSize);
+
+ static QString portNameToSystemLocation(const QString &port);
+ static QString portNameFromSystemLocation(const QString &location);
+
+ static qint32 baudRateFromSetting(qint32 setting);
+ static qint32 settingFromBaudRate(qint32 baudRate);
+
+ static QList<qint32> standardBaudRates();
qint64 readBufferMaxSize;
- QRingBuffer readBuffer;
QRingBuffer writeBuffer;
QSerialPort::SerialPortError error;
QString systemLocation;
@@ -76,7 +171,124 @@ public:
QSerialPort::FlowControl flowControl;
QSerialPort::DataErrorPolicy policy;
bool settingsRestoredOnClose;
- QSerialPort * const q_ptr;
+ bool isBreakEnabled;
+
+#if defined(Q_OS_WINCE)
+
+ bool initialize(DWORD eventMask);
+ bool updateDcb();
+ bool updateCommTimeouts();
+
+ bool waitForReadOrWrite(bool *selectForRead, bool *selectForWrite,
+ bool checkRead, bool checkWrite,
+ int msecs);
+ void processIoErrors(bool error);
+
+ bool notifyRead();
+ bool notifyWrite();
+
+ DCB currentDcb;
+ DCB restoredDcb;
+ COMMTIMEOUTS currentCommTimeouts;
+ COMMTIMEOUTS restoredCommTimeouts;
+ HANDLE handle;
+ bool parityErrorOccurred;
+
+ QThread *eventNotifier;
+ QMutex settingsChangeMutex;
+
+#elif defined(Q_OS_WIN32)
+
+ bool initialize();
+ bool updateDcb();
+ bool updateCommTimeouts();
+ qint64 overlappedResult(OVERLAPPED *overlapped);
+ void handleLineStatusErrors();
+ OVERLAPPED *waitForNotified(int msecs);
+
+ bool completeAsyncCommunication(qint64 bytesTransferred);
+ bool completeAsyncRead(qint64 bytesTransferred);
+ bool completeAsyncWrite(qint64 bytesTransferred);
+
+ bool startAsyncCommunication();
+ bool startAsyncRead();
+ bool _q_startAsyncWrite();
+ void _q_notified(DWORD numberOfBytes, DWORD errorCode, OVERLAPPED *overlapped);
+
+ bool emulateErrorPolicy();
+ void emitReadyRead();
+
+ DCB currentDcb;
+ DCB restoredDcb;
+ COMMTIMEOUTS currentCommTimeouts;
+ COMMTIMEOUTS restoredCommTimeouts;
+ HANDLE handle;
+ bool parityErrorOccurred;
+ QByteArray readChunkBuffer;
+ bool writeStarted;
+ bool readStarted;
+ QWinOverlappedIoNotifier *notifier;
+ QTimer *startAsyncWriteTimer;
+ OVERLAPPED communicationOverlapped;
+ OVERLAPPED readCompletionOverlapped;
+ OVERLAPPED writeCompletionOverlapped;
+ DWORD originalEventMask;
+ DWORD triggeredEventMask;
+ qint64 actualBytesToWrite;
+
+#elif defined(Q_OS_UNIX)
+
+ bool initialize(QIODevice::OpenMode mode);
+ bool updateTermios();
+
+ QSerialPort::SerialPortError setBaudRate_helper(qint32 baudRate,
+ QSerialPort::Directions directions);
+ QSerialPort::SerialPortError setCustomBaudRate(qint32 baudRate,
+ QSerialPort::Directions directions);
+ QSerialPort::SerialPortError setStandardBaudRate(qint32 baudRate,
+ QSerialPort::Directions directions);
+
+ bool isReadNotificationEnabled() const;
+ void setReadNotificationEnabled(bool enable);
+ bool isWriteNotificationEnabled() const;
+ void setWriteNotificationEnabled(bool enable);
+
+ bool waitForReadOrWrite(bool *selectForRead, bool *selectForWrite,
+ bool checkRead, bool checkWrite,
+ int msecs);
+
+ qint64 readFromPort(char *data, qint64 maxSize);
+ qint64 writeToPort(const char *data, qint64 maxSize);
+
+#ifndef CMSPAR
+ qint64 writePerChar(const char *data, qint64 maxSize);
+#endif
+ qint64 readPerChar(char *data, qint64 maxSize);
+
+ bool readNotification();
+ bool startAsyncWrite();
+ bool completeAsyncWrite();
+
+ struct termios currentTermios;
+ struct termios restoredTermios;
+ int descriptor;
+
+ QSocketNotifier *readNotifier;
+ QSocketNotifier *writeNotifier;
+
+ bool readPortNotifierCalled;
+ bool readPortNotifierState;
+ bool readPortNotifierStateSet;
+
+ bool emittedReadyRead;
+ bool emittedBytesWritten;
+
+ qint64 pendingBytesWritten;
+ bool writeSequenceStarted;
+
+ QScopedPointer<QLockFile> lockFileScopedPointer;
+
+#endif
};
QT_END_NAMESPACE
diff --git a/src/serialport/qserialport_symbian.cpp b/src/serialport/qserialport_symbian.cpp
deleted file mode 100644
index ec7e96d..0000000
--- a/src/serialport/qserialport_symbian.cpp
+++ /dev/null
@@ -1,556 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtSerialPort module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qserialport_symbian_p.h"
-
-#include <QtCore/qmap.h>
-
-#include <e32base.h>
-//#include <e32test.h>
-#include <f32file.h>
-
-QT_BEGIN_NAMESPACE
-
-// Physical device driver.
-#ifdef __WINS__
-_LIT(KPddName, "ECDRV");
-#else // defined (__EPOC32__)
-_LIT(KPddName, "EUART");
-#endif
-
-// Logical device driver.
-_LIT(KLddName,"ECOMM");
-
-// Modules names.
-_LIT(KRS232ModuleName, "ECUART");
-_LIT(KBluetoothModuleName, "BTCOMM");
-_LIT(KInfraRedModuleName, "IRCOMM");
-_LIT(KACMModuleName, "ECACM");
-
-// Return false on error load.
-static bool loadDevices()
-{
- TInt r = KErrNone;
-#ifdef __WINS__
- RFs fileServer;
- r = User::LeaveIfError(fileServer.Connect());
- if (r != KErrNone)
- return false;
- fileServer.Close ();
-#endif
-
- r = User::LoadPhysicalDevice(KPddName);
- if (r != KErrNone && r != KErrAlreadyExists)
- return false; //User::Leave(r);
-
- r = User::LoadLogicalDevice(KLddName);
- if (r != KErrNone && r != KErrAlreadyExists)
- return false; //User::Leave(r);
-
-#ifndef __WINS__
- r = StartC32();
- if (r != KErrNone && r != KErrAlreadyExists)
- return false; //User::Leave(r);
-#endif
-
- return true;
-}
-
-QSerialPortPrivate::QSerialPortPrivate(QSerialPort *q)
- : QSerialPortPrivateData(q)
- , errnum(KErrNone)
-{
-}
-
-bool QSerialPortPrivate::open(QIODevice::OpenMode mode)
-{
- Q_Q(QSerialPort);
-
- // FIXME: Maybe need added check an ReadWrite open mode?
- Q_UNUSED(mode)
-
- if (!loadDevices()) {
- q->setError(QSerialPort::UnknownError);
- return false;
- }
-
- RCommServ server;
- errnum = server.Connect();
- if (errnum != KErrNone) {
- q->setError(decodeSystemError());
- return false;
- }
-
- if (systemLocation.contains("BTCOMM"))
- errnum = server.LoadCommModule(KBluetoothModuleName);
- else if (systemLocation.contains("IRCOMM"))
- errnum = server.LoadCommModule(KInfraRedModuleName);
- else if (systemLocation.contains("ACM"))
- errnum = server.LoadCommModule(KACMModuleName);
- else
- errnum = server.LoadCommModule(KRS232ModuleName);
-
- if (errnum != KErrNone) {
- q->setError(decodeSystemError());
- return false;
- }
-
- // In Symbian OS port opening only in R/W mode?
- TPtrC portName(static_cast<const TUint16*>(systemLocation.utf16()), systemLocation.length());
- errnum = descriptor.Open(server, portName, ECommExclusive);
-
- if (errnum != KErrNone) {
- q->setError(decodeSystemError());
- return false;
- }
-
- // Save current port settings.
- errnum = descriptor.Config(restoredSettings);
- if (errnum != KErrNone) {
- q->setError(decodeSystemError());
- return false;
- }
-
- return true;
-}
-
-void QSerialPortPrivate::close()
-{
- if (settingsRestoredOnClose)
- descriptor.SetConfig(restoredSettings);
- descriptor.Close();
-}
-
-QSerialPort::PinoutSignals QSerialPortPrivate::pinoutSignals()
-{
- QSerialPort::PinoutSignals ret = QSerialPort::NoSignal;
-
- TUint signalMask = 0;
- descriptor.Signals(signalMask);
-
- if (signalMask & KSignalCTS)
- ret |= QSerialPort::ClearToSendSignal;
- if (signalMask & KSignalDSR)
- ret |= QSerialPort::DataSetReadySignal;
- if (signalMask & KSignalDCD)
- ret |= QSerialPort::DataCarrierDetectSignal;
- if (signalMask & KSignalRNG)
- ret |= QSerialPort::RingIndicatorSignal;
- if (signalMask & KSignalRTS)
- ret |= QSerialPort::RequestToSendSignal;
- if (signalMask & KSignalDTR)
- ret |= QSerialPort::DataTerminalReadySignal;
-
- //if (signalMask & KSignalBreak)
- // ret |=
- return ret;
-}
-
-bool QSerialPortPrivate::setDataTerminalReady(bool set)
-{
- TInt r;
- if (set)
- r = descriptor.SetSignalsToMark(KSignalDTR);
- else
- r = descriptor.SetSignalsToSpace(KSignalDTR);
-
- return r == KErrNone;
-}
-
-bool QSerialPortPrivate::setRequestToSend(bool set)
-{
- TInt r;
- if (set)
- r = descriptor.SetSignalsToMark(KSignalRTS);
- else
- r = descriptor.SetSignalsToSpace(KSignalRTS);
-
- return r == KErrNone;
-}
-
-bool QSerialPortPrivate::flush()
-{
- // TODO: Implement me
- return false;
-}
-
-bool QSerialPortPrivate::clear(QSerialPort::Directions directions)
-{
- TUint flags = 0;
- if (directions & QSerialPort::Input)
- flags |= KCommResetRx;
- if (directions & QSerialPort::Output)
- flags |= KCommResetTx;
- TInt r = descriptor.ResetBuffers(flags);
- return r == KErrNone;
-}
-
-bool QSerialPortPrivate::sendBreak(int duration)
-{
- TRequestStatus status;
- descriptor.Break(status, TTimeIntervalMicroSeconds32(duration * 1000));
- return false;
-}
-
-bool QSerialPortPrivate::setBreakEnabled(bool set)
-{
- // TODO: Implement me
- return false;
-}
-
-void QSerialPortPrivate::startWriting()
-{
- // TODO: Implement me
-}
-
-bool QSerialPortPrivate::waitForReadyRead(int msec)
-{
- // TODO: Implement me
- return false;
-}
-
-bool QSerialPortPrivate::waitForBytesWritten(int msec)
-{
- // TODO: Implement me
- return false;
-}
-
-bool QSerialPortPrivate::setBaudRate()
-{
- return setBaudRate(inputBaudRate, QSerialPort::AllDirections);
-}
-
-bool QSerialPortPrivate::setBaudRate(qint32 baudRate, QSerialPort::Directions directions)
-{
- Q_Q(QSerialPort);
-
- if (directions != QSerialPort::AllDirections) {
- q->setError(QSerialPort::UnsupportedOperationError);
- return false;
- }
-
- baudRate = settingFromBaudRate(baudRate);
- if (baudRate)
- currentSettings().iRate = static_cast<TBps>(baudRate);
- else {
- q->setError(QSerialPort::UnsupportedOperationError);
- return false;
- }
-
- return updateCommConfig();
-}
-
-bool QSerialPortPrivate::setDataBits(QSerialPort::DataBits dataBits)
-{
- switch (dataBits) {
- case QSerialPort::Data5:
- currentSettings().iDataBits = EData5;
- break;
- case QSerialPort::Data6:
- currentSettings().iDataBits = EData6;
- break;
- case QSerialPort::Data7:
- currentSettings().iDataBits = EData7;
- break;
- case QSerialPort::Data8:
- currentSettings().iDataBits = EData8;
- break;
- default:
- currentSettings().iDataBits = EData8;
- break;
- }
-
- return updateCommConfig();
-}
-
-bool QSerialPortPrivate::setParity(QSerialPort::Parity parity)
-{
- switch (parity) {
- case QSerialPort::NoParity:
- currentSettings().iParity = EParityNone;
- break;
- case QSerialPort::EvenParity:
- currentSettings().iParity = EParityEven;
- break;
- case QSerialPort::OddParity:
- currentSettings().iParity = EParityOdd;
- break;
- case QSerialPort::MarkParity:
- currentSettings().iParity = EParityMark;
- break;
- case QSerialPort::SpaceParity:
- currentSettings().iParity = EParitySpace;
- break;
- default:
- currentSettings().iParity = EParityNone;
- break;
- }
-
- return updateCommConfig();
-}
-
-bool QSerialPortPrivate::setStopBits(QSerialPort::StopBits stopBits)
-{
- switch (stopBits) {
- case QSerialPort::OneStop:
- currentSettings().iStopBits = EStop1;
- break;
- case QSerialPort::TwoStop:
- currentSettings().iStopBits = EStop2;
- break;
- default:
- currentSettings().iStopBits = EStop1;
- break;
- }
-
- return updateCommConfig();
-}
-
-bool QSerialPortPrivate::setFlowControl(QSerialPort::FlowControl flowControl)
-{
- switch (flowControl) {
- case QSerialPort::NoFlowControl:
- currentSettings().iHandshake = KConfigFailDSR;
- break;
- case QSerialPort::HardwareControl:
- currentSettings().iHandshake = KConfigObeyCTS | KConfigFreeRTS;
- break;
- case QSerialPort::SoftwareControl:
- currentSettings().iHandshake = KConfigObeyXoff | KConfigSendXoff;
- break;
- default:
- currentSettings().iHandshake = KConfigFailDSR;
- break;
- }
-
- return updateCommConfig();
-}
-
-bool QSerialPortPrivate::setDataErrorPolicy(QSerialPort::DataErrorPolicy policy)
-{
- // TODO: Implement me
- return false;
-}
-
-bool QSerialPortPrivate::notifyRead()
-{
- // TODO: Implement me
- return false;
-}
-
-bool QSerialPortPrivate::notifyWrite()
-{
- // TODO: Implement me
- return false;
-}
-
-bool QSerialPortPrivate::updateCommConfig()
-{
- Q_Q(QSerialPort);
-
- if (descriptor.SetConfig(currentSettings) != KErrNone) {
- q->setError(QSerialPort::UnsupportedOperationError);
- return false;
- }
- return true;
-}
-
-QSerialPort::SerialPortError QSerialPortPrivate::decodeSystemError() const
-{
- QSerialPort::SerialPortError error;
- switch (errnum) {
- case KErrPermissionDenied:
- error = QSerialPort::DeviceNotFoundError;
- break;
- case KErrLocked:
- error = QSerialPort::PermissionError;
- break;
- case KErrAccessDenied:
- error = QSerialPort::PermissionError;
- break;
- default:
- error = QSerialPort::UnknownError;
- break;
- }
- return error;
-}
-
-bool QSerialPortPrivate::waitForReadOrWrite(bool *selectForRead, bool *selectForWrite,
- bool checkRead, bool checkWrite,
- int msecs, bool *timedOut)
-{
-
- // FIXME: I'm not sure in implementation this method.
- // Someone needs to check and correct.
-
- TRequestStatus timerStatus;
- TRequestStatus readStatus;
- TRequestStatus writeStatus;
-
- if (msecs > 0) {
- if (!selectTimer.Handle()) {
- if (selectTimer.CreateLocal() != KErrNone)
- return false;
- }
- selectTimer.HighRes(timerStatus, msecs * 1000);
- }
-
- if (checkRead)
- descriptor.NotifyDataAvailable(readStatus);
-
- if (checkWrite)
- descriptor.NotifyOutputEmpty(writeStatus);
-
- enum { STATUSES_COUNT = 3 };
- TRequestStatus *statuses[STATUSES_COUNT];
- TInt num = 0;
- statuses[num++] = &timerStatus;
- statuses[num++] = &readStatus;
- statuses[num++] = &writeStatus;
-
- User::WaitForNRequest(statuses, num);
-
- bool result = false;
-
- // By timeout?
- if (timerStatus != KRequestPending) {
- Q_ASSERT(selectForRead);
- *selectForRead = false;
- Q_ASSERT(selectForWrite);
- *selectForWrite = false;
- } else {
- selectTimer.Cancel();
- User::WaitForRequest(timerStatus);
-
- // By read?
- if (readStatus != KRequestPending) {
- Q_ASSERT(selectForRead);
- *selectForRead = true;
- }
-
- // By write?
- if (writeStatus != KRequestPending) {
- Q_ASSERT(selectForWrite);
- *selectForWrite = true;
- }
-
- if (checkRead)
- descriptor.NotifyDataAvailableCancel();
- if (checkWrite)
- descriptor.NotifyOutputEmptyCancel();
-
- result = true;
- }
- return result;
-}
-
-QString QSerialPortPrivate::portNameToSystemLocation(const QString &port)
-{
- // Port name is equval to port systemLocation.
- return port;
-}
-
-QString QSerialPortPrivate::portNameFromSystemLocation(const QString &location)
-{
- // Port name is equval to port systemLocation.
- return location;
-}
-
-typedef QMap<qint32, qint32> BaudRateMap;
-
-// This table contains correspondences standard pairs values of
-// baud rates that are defined in files
-// - d32comm.h for Symbian^3
-// - d32public.h for Symbian SR1
-
-static const BaudRateMap createStandardBaudRateMap()
-{
- BaudRateMap baudRateMap;
-
- baudRateMap.insert(50, EBps50)
- baudRateMap.insert(75, EBps75)
- baudRateMap.insert(110, EBps110)
- baudRateMap.insert(134, EBps134)
- baudRateMap.insert(150, EBps150)
- baudRateMap.insert(300, EBps300)
- baudRateMap.insert(600, EBps600)
- baudRateMap.insert(1200, EBps1200)
- baudRateMap.insert(1800, EBps1800)
- baudRateMap.insert(2000, EBps2000)
- baudRateMap.insert(2400, EBps2400)
- baudRateMap.insert(3600, EBps3600)
- baudRateMap.insert(4800, EBps4800)
- baudRateMap.insert(7200, EBps7200)
- baudRateMap.insert(9600, EBps9600)
- baudRateMap.insert(19200, EBps19200)
- baudRateMap.insert(38400, EBps38400)
- baudRateMap.insert(57600, EBps57600)
- baudRateMap.insert(115200, EBps115200)
- baudRateMap.insert(230400, EBps230400)
- baudRateMap.insert(460800, EBps460800)
- baudRateMap.insert(576000, EBps576000)
- baudRateMap.insert(921600, EBps921600)
- baudRateMap.insert(1152000, EBps1152000)
- // << baudRateMap.insert(1843200, EBps1843200) only for Symbian SR1
- baudRateMap.insert(4000000, EBps4000000);
-
- return baudRateMap;
-}
-
-static const BaudRateMap& standardBaudRateMap()
-{
- static const BaudRateMap baudRateMap = createStandardBaudRateMap();
- return baudRateMap;
-}
-
-qint32 QSerialPortPrivate::baudRateFromSetting(qint32 setting)
-{
- return standardBaudRateMap().key(setting);
-}
-
-qint32 QSerialPortPrivate::settingFromBaudRate(qint32 baudRate)
-{
- return standardBaudRateMap().value(baudRate);
-}
-
-QList<qint32> QSerialPortPrivate::standardBaudRates()
-{
- return standardBaudRateMap().keys();
-}
-
-QSerialPort::Handle QSerialPort::handle() const
-{
- return -1;
-}
-
-QT_END_NAMESPACE
diff --git a/src/serialport/qserialport_symbian_p.h b/src/serialport/qserialport_symbian_p.h
deleted file mode 100644
index 2c52d1c..0000000
--- a/src/serialport/qserialport_symbian_p.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtSerialPort module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSERIALPORT_SYMBIAN_P_H
-#define QSERIALPORT_SYMBIAN_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qserialport_p.h"
-
-#include <c32comm.h>
-
-QT_BEGIN_NAMESPACE
-
-class QSerialPortPrivate : public QSerialPortPrivateData
-{
- Q_DECLARE_PUBLIC(QSerialPort)
-
-public:
- QSerialPortPrivate(QSerialPort *q);
-
- bool open(QIODevice::OpenMode mode);
- void close();
-
- QSerialPort::PinoutSignals pinoutSignals();
-
- bool setDataTerminalReady(bool set);
- bool setRequestToSend(bool set);
-
- bool flush();
- bool clear(QSerialPort::Directions directions);
-
- bool sendBreak(int duration);
- bool setBreakEnabled(bool set);
-
- void startWriting();
-
- bool waitForReadyRead(int msec);
- bool waitForBytesWritten(int msec);
-
- bool setBaudRate();
- bool setBaudRate(qint32 baudRate, QSerialPort::Directions directions);
- bool setDataBits(QSerialPort::DataBits dataBits);
- bool setParity(QSerialPort::Parity parity);
- bool setStopBits(QSerialPort::StopBits stopBits);
- bool setFlowControl(QSerialPort::FlowControl flowControl);
- bool setDataErrorPolicy(QSerialPort::DataErrorPolicy policy);
-
- bool notifyRead();
- bool notifyWrite();
-
- static QString portNameToSystemLocation(const QString &port);
- static QString portNameFromSystemLocation(const QString &location);
-
- static qint32 baudRateFromSetting(qint32 setting);
- static qint32 settingFromBaudRate(qint32 baudRate);
-
- static QList<qint32> standardBaudRates();
-
- TCommConfig currentSettings;
- TCommConfig restoredSettings;
- RComm descriptor;
- mutable RTimer selectTimer;
- TInt errnum;
-
-private:
- bool updateCommConfig();
-
- QSerialPort::SerialPortError decodeSystemError() const;
-
- bool waitForReadOrWrite(bool *selectForRead, bool *selectForWrite,
- bool checkRead, bool checkWrite,
- int msecs, bool *timedOut);
-};
-
-QT_END_NAMESPACE
-
-#endif // QSERIALPORT_SYMBIAN_P_H
diff --git a/src/serialport/qserialport_unix.cpp b/src/serialport/qserialport_unix.cpp
index cda73b2..1f90a18 100644
--- a/src/serialport/qserialport_unix.cpp
+++ b/src/serialport/qserialport_unix.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
** Copyright (C) 2012 Andre Hartmann <aha_1980@gmx.de>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -12,9 +12,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -25,15 +25,15 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "qserialport_unix_p.h"
+#include "qserialport_p.h"
#include "qserialportinfo_p.h"
#include <errno.h>
@@ -43,7 +43,7 @@
#include <unistd.h>
#ifdef Q_OS_MAC
-#if defined (MAC_OS_X_VERSION_10_4) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4)
+#if defined(MAC_OS_X_VERSION_10_4) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4)
#include <IOKit/serial/ioss.h>
#endif
#endif
@@ -58,6 +58,10 @@
#include <QtCore/qsocketnotifier.h>
#include <QtCore/qmap.h>
+#ifdef Q_OS_MAC
+#include <QtCore/qstandardpaths.h>
+#endif
+
QT_BEGIN_NAMESPACE
QString serialPortLockFilePath(const QString &portName)
@@ -68,6 +72,9 @@ QString serialPortLockFilePath(const QString &portName)
<< QStringLiteral("/var/spool/locks")
<< QStringLiteral("/var/spool/uucp")
<< QStringLiteral("/tmp")
+ << QStringLiteral("/var/tmp")
+ << QStringLiteral("/var/lock/lockdev")
+ << QStringLiteral("/run/lock")
#ifdef Q_OS_ANDROID
<< QStringLiteral("/data/local/tmp")
#endif
@@ -75,7 +82,7 @@ QString serialPortLockFilePath(const QString &portName)
QString fileName = portName;
fileName.replace(QLatin1Char('/'), QLatin1Char('_'));
- fileName.prepend(QStringLiteral("/LCK.."));
+ fileName.prepend(QLatin1String("/LCK.."));
QString lockFilePath;
@@ -91,6 +98,13 @@ QString serialPortLockFilePath(const QString &portName)
}
}
+#ifdef Q_OS_MAC
+ // This is the workaround to specify a temporary directory
+ // on OSX when running the App Sandbox feature.
+ if (lockFilePath.isEmpty())
+ lockFilePath = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
+#endif
+
if (lockFilePath.isEmpty()) {
qWarning("The following directories are not readable or writable for detaling with lock files\n");
foreach (const QString &lockDirectoryPath, lockDirectoryPaths)
@@ -145,18 +159,6 @@ private:
#include "qserialport_unix.moc"
-QSerialPortPrivate::QSerialPortPrivate(QSerialPort *q)
- : QSerialPortPrivateData(q)
- , descriptor(-1)
- , readNotifier(Q_NULLPTR)
- , writeNotifier(Q_NULLPTR)
- , emittedReadyRead(false)
- , emittedBytesWritten(false)
- , pendingBytesWritten(0)
- , writeSequenceStarted(false)
-{
-}
-
bool QSerialPortPrivate::open(QIODevice::OpenMode mode)
{
Q_Q(QSerialPort);
@@ -283,14 +285,14 @@ QSerialPort::PinoutSignals QSerialPortPrivate::pinoutSignals()
#ifdef TIOCM_CAR
if (arg & TIOCM_CAR)
ret |= QSerialPort::DataCarrierDetectSignal;
-#elif defined TIOCM_CD
+#elif defined(TIOCM_CD)
if (arg & TIOCM_CD)
ret |= QSerialPort::DataCarrierDetectSignal;
#endif
#ifdef TIOCM_RNG
if (arg & TIOCM_RNG)
ret |= QSerialPort::RingIndicatorSignal;
-#elif defined TIOCM_RI
+#elif defined(TIOCM_RI)
if (arg & TIOCM_RI)
ret |= QSerialPort::RingIndicatorSignal;
#endif
@@ -372,7 +374,7 @@ bool QSerialPortPrivate::setBreakEnabled(bool set)
qint64 QSerialPortPrivate::readData(char *data, qint64 maxSize)
{
- return readBuffer.read(data, maxSize);
+ return buffer.read(data, maxSize);
}
bool QSerialPortPrivate::waitForReadyRead(int msecs)
@@ -451,6 +453,8 @@ QSerialPortPrivate::setStandardBaudRate(qint32 baudRate, QSerialPort::Directions
{
struct serial_struct currentSerialInfo;
+ ::memset(&currentSerialInfo, 0, sizeof(currentSerialInfo));
+
if ((::ioctl(descriptor, TIOCGSERIAL, &currentSerialInfo) != -1)
&& (currentSerialInfo.flags & ASYNC_SPD_CUST)) {
currentSerialInfo.flags &= ~ASYNC_SPD_CUST;
@@ -481,6 +485,8 @@ QSerialPortPrivate::setCustomBaudRate(qint32 baudRate, QSerialPort::Directions d
struct serial_struct currentSerialInfo;
+ ::memset(&currentSerialInfo, 0, sizeof(currentSerialInfo));
+
if (::ioctl(descriptor, TIOCGSERIAL, &currentSerialInfo) == -1)
return decodeSystemError();
@@ -511,7 +517,7 @@ QSerialPortPrivate::setCustomBaudRate(qint32 baudRate, QSerialPort::Directions d
{
Q_UNUSED(directions);
-#if defined (MAC_OS_X_VERSION_10_4) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4)
+#if defined(MAC_OS_X_VERSION_10_4) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4)
if (::ioctl(descriptor, IOSSIOSPEED, &baudRate) == -1)
return decodeSystemError();
@@ -521,7 +527,7 @@ QSerialPortPrivate::setCustomBaudRate(qint32 baudRate, QSerialPort::Directions d
return QSerialPort::UnsupportedOperationError;
}
-#elif defined (Q_OS_QNX)
+#elif defined(Q_OS_QNX)
QSerialPort::SerialPortError
QSerialPortPrivate::setCustomBaudRate(qint32 baudRate, QSerialPort::Directions directions)
@@ -705,11 +711,11 @@ bool QSerialPortPrivate::readNotification()
Q_Q(QSerialPort);
// Always buffered, read data from the port into the read buffer
- qint64 newBytes = readBuffer.size();
+ qint64 newBytes = buffer.size();
qint64 bytesToRead = policy == QSerialPort::IgnorePolicy ? ReadChunkSize : 1;
- if (readBufferMaxSize && bytesToRead > (readBufferMaxSize - readBuffer.size())) {
- bytesToRead = readBufferMaxSize - readBuffer.size();
+ if (readBufferMaxSize && bytesToRead > (readBufferMaxSize - buffer.size())) {
+ bytesToRead = readBufferMaxSize - buffer.size();
if (bytesToRead == 0) {
// Buffer is full. User must read data from the buffer
// before we can read more from the port.
@@ -717,7 +723,7 @@ bool QSerialPortPrivate::readNotification()
}
}
- char *ptr = readBuffer.reserve(bytesToRead);
+ char *ptr = buffer.reserve(bytesToRead);
const qint64 readBytes = readFromPort(ptr, bytesToRead);
if (readBytes <= 0) {
@@ -727,16 +733,16 @@ bool QSerialPortPrivate::readNotification()
else
setReadNotificationEnabled(false);
q->setError(error);
- readBuffer.chop(bytesToRead);
+ buffer.chop(bytesToRead);
return false;
}
- readBuffer.chop(bytesToRead - qMax(readBytes, qint64(0)));
+ buffer.chop(bytesToRead - qMax(readBytes, qint64(0)));
- newBytes = readBuffer.size() - newBytes;
+ newBytes = buffer.size() - newBytes;
// If read buffer is full, disable the read port notifier.
- if (readBufferMaxSize && readBuffer.size() == readBufferMaxSize)
+ if (readBufferMaxSize && buffer.size() == readBufferMaxSize)
setReadNotificationEnabled(false);
// only emit readyRead() when not recursing, and only if there is data available
@@ -864,8 +870,10 @@ bool QSerialPortPrivate::updateTermios()
return true;
}
-QSerialPort::SerialPortError QSerialPortPrivate::decodeSystemError() const
+QSerialPort::SerialPortError QSerialPortPrivate::decodeSystemError(int systemErrorCode) const
{
+ Q_UNUSED(systemErrorCode);
+
QSerialPort::SerialPortError error;
switch (errno) {
case ENODEV:
@@ -998,7 +1006,7 @@ bool QSerialPortPrivate::waitForReadOrWrite(bool *selectForRead, bool *selectFor
qint64 QSerialPortPrivate::readFromPort(char *data, qint64 maxSize)
{
qint64 bytesRead = 0;
-#if defined (CMSPAR)
+#if defined(CMSPAR)
if (parity == QSerialPort::NoParity
|| policy != QSerialPort::StopReceivingPolicy) {
#else
@@ -1016,7 +1024,7 @@ qint64 QSerialPortPrivate::readFromPort(char *data, qint64 maxSize)
qint64 QSerialPortPrivate::writeToPort(const char *data, qint64 maxSize)
{
qint64 bytesWritten = 0;
-#if defined (CMSPAR)
+#if defined(CMSPAR)
bytesWritten = qt_safe_write(descriptor, data, maxSize);
#else
if (parity != QSerialPort::MarkParity
diff --git a/src/serialport/qserialport_unix_p.h b/src/serialport/qserialport_unix_p.h
deleted file mode 100644
index 6b0e699..0000000
--- a/src/serialport/qserialport_unix_p.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtSerialPort module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSERIALPORT_UNIX_P_H
-#define QSERIALPORT_UNIX_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qserialport_p.h"
-
-#include <QtCore/qlockfile.h>
-#include <QtCore/qscopedpointer.h>
-#include <QtCore/qfileinfo.h>
-#include <QtCore/qstringlist.h>
-
-#include <limits.h>
-#include <termios.h>
-#ifndef Q_OS_ANDROID
-#ifdef Q_OS_LINUX
-# include <linux/serial.h>
-#endif
-#else
-struct serial_struct {
- int type;
- int line;
- unsigned int port;
- int irq;
- int flags;
- int xmit_fifo_size;
- int custom_divisor;
- int baud_base;
- unsigned short close_delay;
- char io_type;
- char reserved_char[1];
- int hub6;
- unsigned short closing_wait;
- unsigned short closing_wait2;
- unsigned char *iomem_base;
- unsigned short iomem_reg_shift;
- unsigned int port_high;
- unsigned long iomap_base;
-};
-#define ASYNC_SPD_CUST 0x0030
-#define ASYNC_SPD_MASK 0x1030
-#define PORT_UNKNOWN 0
-#endif
-
-QT_BEGIN_NAMESPACE
-
-QString serialPortLockFilePath(const QString &portName);
-
-class QSocketNotifier;
-
-class QSerialPortPrivate : public QSerialPortPrivateData
-{
- Q_DECLARE_PUBLIC(QSerialPort)
-
-public:
- QSerialPortPrivate(QSerialPort *q);
-
- bool open(QIODevice::OpenMode mode);
- void close();
-
- QSerialPort::PinoutSignals pinoutSignals();
-
- bool setDataTerminalReady(bool set);
- bool setRequestToSend(bool set);
-
- bool flush();
- bool clear(QSerialPort::Directions directions);
-
- bool sendBreak(int duration);
- bool setBreakEnabled(bool set);
-
- qint64 readData(char *data, qint64 maxSize);
-
- bool waitForReadyRead(int msecs);
- bool waitForBytesWritten(int msecs);
-
- bool setBaudRate();
- bool setBaudRate(qint32 baudRate, QSerialPort::Directions directions);
- bool setDataBits(QSerialPort::DataBits dataBits);
- bool setParity(QSerialPort::Parity parity);
- bool setStopBits(QSerialPort::StopBits stopBits);
- bool setFlowControl(QSerialPort::FlowControl flowControl);
- bool setDataErrorPolicy(QSerialPort::DataErrorPolicy policy);
-
- bool readNotification();
- bool startAsyncWrite();
- bool completeAsyncWrite();
-
- qint64 bytesToWrite() const;
- qint64 writeData(const char *data, qint64 maxSize);
-
- static qint32 baudRateFromSetting(qint32 setting);
- static qint32 settingFromBaudRate(qint32 baudRate);
-
- static QList<qint32> standardBaudRates();
-
- struct termios currentTermios;
- struct termios restoredTermios;
- int descriptor;
-
- QSocketNotifier *readNotifier;
- QSocketNotifier *writeNotifier;
-
- bool emittedReadyRead;
- bool emittedBytesWritten;
-
- qint64 pendingBytesWritten;
- bool writeSequenceStarted;
-
- QScopedPointer<QLockFile> lockFileScopedPointer;
-
-private:
- bool initialize(QIODevice::OpenMode mode);
- bool updateTermios();
-
- QSerialPort::SerialPortError setBaudRate_helper(qint32 baudRate,
- QSerialPort::Directions directions);
- QSerialPort::SerialPortError setCustomBaudRate(qint32 baudRate,
- QSerialPort::Directions directions);
- QSerialPort::SerialPortError setStandardBaudRate(qint32 baudRate,
- QSerialPort::Directions directions);
- QSerialPort::SerialPortError decodeSystemError() const;
-
- bool isReadNotificationEnabled() const;
- void setReadNotificationEnabled(bool enable);
- bool isWriteNotificationEnabled() const;
- void setWriteNotificationEnabled(bool enable);
-
- bool waitForReadOrWrite(bool *selectForRead, bool *selectForWrite,
- bool checkRead, bool checkWrite,
- int msecs);
-
- qint64 readFromPort(char *data, qint64 maxSize);
- qint64 writeToPort(const char *data, qint64 maxSize);
-
-#ifndef CMSPAR
- qint64 writePerChar(const char *data, qint64 maxSize);
-#endif
- qint64 readPerChar(char *data, qint64 maxSize);
-
-};
-
-QT_END_NAMESPACE
-
-#endif // QSERIALPORT_UNIX_P_H
diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp
index 466a8d2..b3d5c9d 100644
--- a/src/serialport/qserialport_win.cpp
+++ b/src/serialport/qserialport_win.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
** Copyright (C) 2012 Andre Hartmann <aha_1980@gmx.de>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -12,9 +12,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -25,21 +25,21 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "qserialport_win_p.h"
+#include "qserialport_p.h"
#include <QtCore/qcoreevent.h>
#include <QtCore/qelapsedtimer.h>
#include <QtCore/qvector.h>
#include <QtCore/qtimer.h>
-#include <QtCore/qwineventnotifier.h>
+#include <private/qwinoverlappedionotifier_p.h>
#include <algorithm>
#ifndef CTL_CODE
@@ -75,68 +75,6 @@
QT_BEGIN_NAMESPACE
-static void initializeOverlappedStructure(OVERLAPPED &overlapped)
-{
- overlapped.Internal = 0;
- overlapped.InternalHigh = 0;
- overlapped.Offset = 0;
- overlapped.OffsetHigh = 0;
-}
-
-QSerialPortPrivate::QSerialPortPrivate(QSerialPort *q)
- : QSerialPortPrivateData(q)
- , handle(INVALID_HANDLE_VALUE)
- , parityErrorOccurred(false)
- , readChunkBuffer(ReadChunkSize, 0)
- , readyReadEmitted(0)
- , writeStarted(false)
- , readStarted(false)
- , communicationNotifier(new QWinEventNotifier(q))
- , readCompletionNotifier(new QWinEventNotifier(q))
- , writeCompletionNotifier(new QWinEventNotifier(q))
- , startAsyncWriteTimer(Q_NULLPTR)
- , originalEventMask(0)
- , triggeredEventMask(0)
- , actualBytesToWrite(0)
-{
- ::ZeroMemory(&communicationOverlapped, sizeof(communicationOverlapped));
- communicationOverlapped.hEvent = ::CreateEvent(Q_NULLPTR, FALSE, FALSE, Q_NULLPTR);
- if (!communicationOverlapped.hEvent)
- q->setError(decodeSystemError());
- else {
- communicationNotifier->setHandle(communicationOverlapped.hEvent);
- q->connect(communicationNotifier, SIGNAL(activated(HANDLE)), q, SLOT(_q_completeAsyncCommunication()));
- }
-
- ::ZeroMemory(&readCompletionOverlapped, sizeof(readCompletionOverlapped));
- readCompletionOverlapped.hEvent = ::CreateEvent(Q_NULLPTR, FALSE, FALSE, Q_NULLPTR);
- if (!readCompletionOverlapped.hEvent)
- q->setError(decodeSystemError());
- else {
- readCompletionNotifier->setHandle(readCompletionOverlapped.hEvent);
- q->connect(readCompletionNotifier, SIGNAL(activated(HANDLE)), q, SLOT(_q_completeAsyncRead()));
- }
-
- ::ZeroMemory(&writeCompletionOverlapped, sizeof(writeCompletionOverlapped));
- writeCompletionOverlapped.hEvent = ::CreateEvent(Q_NULLPTR, FALSE, FALSE, Q_NULLPTR);
- if (!writeCompletionOverlapped.hEvent)
- q->setError(decodeSystemError());
- else {
- writeCompletionNotifier->setHandle(writeCompletionOverlapped.hEvent);
- q->connect(writeCompletionNotifier, SIGNAL(activated(HANDLE)), q, SLOT(_q_completeAsyncWrite()));
- }
-}
-
-QSerialPortPrivate::~QSerialPortPrivate()
-{
- if (communicationOverlapped.hEvent)
- CloseHandle(communicationOverlapped.hEvent);
- if (readCompletionOverlapped.hEvent)
- CloseHandle(readCompletionOverlapped.hEvent);
- if (writeCompletionOverlapped.hEvent)
- CloseHandle(writeCompletionOverlapped.hEvent);
-}
-
bool QSerialPortPrivate::open(QIODevice::OpenMode mode)
{
Q_Q(QSerialPort);
@@ -159,7 +97,7 @@ bool QSerialPortPrivate::open(QIODevice::OpenMode mode)
return false;
}
- if (initialize(mode))
+ if (initialize())
return true;
::CloseHandle(handle);
@@ -173,18 +111,14 @@ void QSerialPortPrivate::close()
if (!::CancelIo(handle))
q->setError(decodeSystemError());
- readCompletionNotifier->setEnabled(false);
- writeCompletionNotifier->setEnabled(false);
- communicationNotifier->setEnabled(false);
+ if (notifier)
+ notifier->deleteLater();
readStarted = false;
- readBuffer.clear();
-
writeStarted = false;
writeBuffer.clear();
actualBytesToWrite = 0;
- readyReadEmitted = false;
parityErrorOccurred = false;
if (settingsRestoredOnClose) {
@@ -320,17 +254,18 @@ bool QSerialPortPrivate::setBreakEnabled(bool set)
qint64 QSerialPortPrivate::readData(char *data, qint64 maxSize)
{
- const qint64 result = readBuffer.read(data, maxSize);
+ Q_UNUSED(data);
+ Q_UNUSED(maxSize);
+
// We need try to start async reading to read a remainder from a driver's queue
// in case we have a limited read buffer size. Because the read notification can
// be stalled since Windows do not re-triggered an EV_RXCHAR event if a driver's
// buffer has a remainder of data ready to read until a new data will be received.
- if (readBufferMaxSize
- && result > 0
- && (result == readBufferMaxSize || flowControl == QSerialPort::HardwareControl)) {
+ if (readBufferMaxSize || flowControl == QSerialPort::HardwareControl)
startAsyncRead();
- }
- return result;
+
+ // return 0 indicating there may be more data in the future
+ return qint64(0);
}
bool QSerialPortPrivate::waitForReadyRead(int msecs)
@@ -338,34 +273,36 @@ bool QSerialPortPrivate::waitForReadyRead(int msecs)
if (!writeStarted && !_q_startAsyncWrite())
return false;
- const qint64 initialReadBufferSize = readBuffer.size();
+ const qint64 initialReadBufferSize = buffer.size();
qint64 currentReadBufferSize = initialReadBufferSize;
QElapsedTimer stopWatch;
stopWatch.start();
do {
- HANDLE triggeredEvent = Q_NULLPTR;
- if (!waitAnyEvent(timeoutValue(msecs, stopWatch.elapsed()), &triggeredEvent) || !triggeredEvent)
+ OVERLAPPED *overlapped = waitForNotified(timeoutValue(msecs, stopWatch.elapsed()));
+ if (!overlapped)
return false;
- if (triggeredEvent == communicationOverlapped.hEvent) {
- if (!_q_completeAsyncCommunication())
+ const qint64 bytesTransferred = overlappedResult(overlapped);
+
+ if (overlapped == &communicationOverlapped) {
+ if (!completeAsyncCommunication(bytesTransferred))
return false;
- } else if (triggeredEvent == readCompletionOverlapped.hEvent) {
- if (!_q_completeAsyncRead())
+ } else if (overlapped == &readCompletionOverlapped) {
+ if (!completeAsyncRead(bytesTransferred))
return false;
- const qint64 readBytesForOneReadOperation = qint64(readBuffer.size()) - currentReadBufferSize;
+ const qint64 readBytesForOneReadOperation = qint64(buffer.size()) - currentReadBufferSize;
if (readBytesForOneReadOperation == ReadChunkSize) {
- currentReadBufferSize = readBuffer.size();
+ currentReadBufferSize = buffer.size();
} else if (readBytesForOneReadOperation == 0) {
if (initialReadBufferSize != currentReadBufferSize)
return true;
} else {
return true;
}
- } else if (triggeredEvent == writeCompletionOverlapped.hEvent) {
- if (!_q_completeAsyncWrite())
+ } else if (overlapped == &writeCompletionOverlapped) {
+ if (!completeAsyncWrite(bytesTransferred))
return false;
} else {
return false;
@@ -388,18 +325,20 @@ bool QSerialPortPrivate::waitForBytesWritten(int msecs)
stopWatch.start();
forever {
- HANDLE triggeredEvent = Q_NULLPTR;
- if (!waitAnyEvent(timeoutValue(msecs, stopWatch.elapsed()), &triggeredEvent) || !triggeredEvent)
+ OVERLAPPED *overlapped = waitForNotified(timeoutValue(msecs, stopWatch.elapsed()));
+ if (!overlapped)
return false;
- if (triggeredEvent == communicationOverlapped.hEvent) {
- if (!_q_completeAsyncCommunication())
+ const qint64 bytesTransferred = overlappedResult(overlapped);
+
+ if (overlapped == &communicationOverlapped) {
+ if (!completeAsyncCommunication(bytesTransferred))
return false;
- } else if (triggeredEvent == readCompletionOverlapped.hEvent) {
- if (!_q_completeAsyncRead())
+ } else if (overlapped == &readCompletionOverlapped) {
+ if (!completeAsyncRead(bytesTransferred))
return false;
- } else if (triggeredEvent == writeCompletionOverlapped.hEvent) {
- return _q_completeAsyncWrite();
+ } else if (overlapped == &writeCompletionOverlapped) {
+ return completeAsyncWrite(bytesTransferred);
} else {
return false;
}
@@ -508,9 +447,9 @@ bool QSerialPortPrivate::setDataErrorPolicy(QSerialPort::DataErrorPolicy policy)
return true;
}
-bool QSerialPortPrivate::_q_completeAsyncCommunication()
+bool QSerialPortPrivate::completeAsyncCommunication(qint64 bytesTransferred)
{
- if (overlappedResult(communicationOverlapped) == qint64(-1))
+ if (bytesTransferred == qint64(-1))
return false;
if (EV_ERR & triggeredEventMask)
handleLineStatusErrors();
@@ -518,15 +457,15 @@ bool QSerialPortPrivate::_q_completeAsyncCommunication()
return startAsyncRead();
}
-bool QSerialPortPrivate::_q_completeAsyncRead()
+bool QSerialPortPrivate::completeAsyncRead(qint64 bytesTransferred)
{
- const qint64 bytesTransferred = overlappedResult(readCompletionOverlapped);
if (bytesTransferred == qint64(-1)) {
readStarted = false;
return false;
}
if (bytesTransferred > 0) {
- readBuffer.append(readChunkBuffer.left(bytesTransferred));
+ char *ptr = buffer.reserve(bytesTransferred);
+ ::memcpy(ptr, readChunkBuffer.constData(), bytesTransferred);
if (!emulateErrorPolicy())
emitReadyRead();
}
@@ -535,18 +474,17 @@ bool QSerialPortPrivate::_q_completeAsyncRead()
if ((bytesTransferred == ReadChunkSize) && (policy == QSerialPort::IgnorePolicy))
return startAsyncRead();
- else if (readBufferMaxSize == 0 || readBufferMaxSize > readBuffer.size())
+ else if (readBufferMaxSize == 0 || readBufferMaxSize > buffer.size())
return startAsyncCommunication();
else
return true;
}
-bool QSerialPortPrivate::_q_completeAsyncWrite()
+bool QSerialPortPrivate::completeAsyncWrite(qint64 bytesTransferred)
{
Q_Q(QSerialPort);
if (writeStarted) {
- const qint64 bytesTransferred = overlappedResult(writeCompletionOverlapped);
if (bytesTransferred == qint64(-1)) {
writeStarted = false;
return false;
@@ -564,7 +502,7 @@ bool QSerialPortPrivate::startAsyncCommunication()
{
Q_Q(QSerialPort);
- initializeOverlappedStructure(communicationOverlapped);
+ ::ZeroMemory(&communicationOverlapped, sizeof(communicationOverlapped));
if (!::WaitCommEvent(handle, &triggeredEventMask, &communicationOverlapped)) {
QSerialPort::SerialPortError error = decodeSystemError();
if (error != QSerialPort::NoError) {
@@ -586,8 +524,8 @@ bool QSerialPortPrivate::startAsyncRead()
DWORD bytesToRead = policy == QSerialPort::IgnorePolicy ? ReadChunkSize : 1;
- if (readBufferMaxSize && bytesToRead > (readBufferMaxSize - readBuffer.size())) {
- bytesToRead = readBufferMaxSize - readBuffer.size();
+ if (readBufferMaxSize && bytesToRead > (readBufferMaxSize - buffer.size())) {
+ bytesToRead = readBufferMaxSize - buffer.size();
if (bytesToRead == 0) {
// Buffer is full. User must read data from the buffer
// before we can read more from the port.
@@ -595,7 +533,7 @@ bool QSerialPortPrivate::startAsyncRead()
}
}
- initializeOverlappedStructure(readCompletionOverlapped);
+ ::ZeroMemory(&readCompletionOverlapped, sizeof(readCompletionOverlapped));
if (::ReadFile(handle, readChunkBuffer.data(), bytesToRead, Q_NULLPTR, &readCompletionOverlapped)) {
readStarted = true;
return true;
@@ -622,12 +560,10 @@ bool QSerialPortPrivate::_q_startAsyncWrite()
if (writeBuffer.isEmpty() || writeStarted)
return true;
- initializeOverlappedStructure(writeCompletionOverlapped);
-
const int writeBytes = writeBuffer.nextDataBlockSize();
+ ::ZeroMemory(&writeCompletionOverlapped, sizeof(writeCompletionOverlapped));
if (!::WriteFile(handle, writeBuffer.readPointer(),
- writeBytes,
- Q_NULLPTR, &writeCompletionOverlapped)) {
+ writeBytes, Q_NULLPTR, &writeCompletionOverlapped)) {
QSerialPort::SerialPortError error = decodeSystemError();
if (error != QSerialPort::NoError) {
@@ -643,6 +579,26 @@ bool QSerialPortPrivate::_q_startAsyncWrite()
return true;
}
+void QSerialPortPrivate::_q_notified(DWORD numberOfBytes, DWORD errorCode, OVERLAPPED *overlapped)
+{
+ Q_Q(QSerialPort);
+
+ const QSerialPort::SerialPortError error = decodeSystemError(errorCode);
+ if (error != QSerialPort::NoError) {
+ q->setError(error);
+ return;
+ }
+
+ if (overlapped == &communicationOverlapped)
+ completeAsyncCommunication(numberOfBytes);
+ else if (overlapped == &readCompletionOverlapped)
+ completeAsyncRead(numberOfBytes);
+ else if (overlapped == &writeCompletionOverlapped)
+ completeAsyncWrite(numberOfBytes);
+ else
+ Q_ASSERT(!"Unknown OVERLAPPED activated");
+}
+
bool QSerialPortPrivate::emulateErrorPolicy()
{
if (!parityErrorOccurred)
@@ -652,11 +608,11 @@ bool QSerialPortPrivate::emulateErrorPolicy()
switch (policy) {
case QSerialPort::SkipPolicy:
- readBuffer.getChar();
+ buffer.getChar();
break;
case QSerialPort::PassZeroPolicy:
- readBuffer.getChar();
- readBuffer.putChar('\0');
+ buffer.getChar();
+ buffer.ungetChar('\0');
emitReadyRead();
break;
case QSerialPort::IgnorePolicy:
@@ -675,7 +631,6 @@ void QSerialPortPrivate::emitReadyRead()
{
Q_Q(QSerialPort);
- readyReadEmitted = true;
emit q->readyRead();
}
@@ -724,7 +679,19 @@ void QSerialPortPrivate::handleLineStatusErrors()
}
}
-inline bool QSerialPortPrivate::initialize(QIODevice::OpenMode mode)
+OVERLAPPED *QSerialPortPrivate::waitForNotified(int msecs)
+{
+ Q_Q(QSerialPort);
+
+ OVERLAPPED *overlapped = notifier->waitForAnyNotified(msecs);
+ if (!overlapped) {
+ q->setError(decodeSystemError(WAIT_TIMEOUT));
+ return 0;
+ }
+ return overlapped;
+}
+
+inline bool QSerialPortPrivate::initialize()
{
Q_Q(QSerialPort);
@@ -761,22 +728,21 @@ inline bool QSerialPortPrivate::initialize(QIODevice::OpenMode mode)
if (!updateCommTimeouts())
return false;
- if (mode & QIODevice::ReadOnly)
- readCompletionNotifier->setEnabled(true);
-
- if (mode & QIODevice::WriteOnly)
- writeCompletionNotifier->setEnabled(true);
-
if (!::SetCommMask(handle, originalEventMask)) {
q->setError(decodeSystemError());
return false;
}
+ notifier = new QWinOverlappedIoNotifier(q);
+ q->connect(notifier, SIGNAL(notified(quint32, quint32, OVERLAPPED*)),
+ q, SLOT(_q_notified(quint32, quint32, OVERLAPPED*)),
+ Qt::QueuedConnection);
+ notifier->setHandle(handle);
+ notifier->setEnabled(true);
+
if (!startAsyncCommunication())
return false;
- communicationNotifier->setEnabled(true);
-
return true;
}
@@ -802,19 +768,19 @@ bool QSerialPortPrivate::updateCommTimeouts()
return true;
}
-qint64 QSerialPortPrivate::overlappedResult(OVERLAPPED &overlapped)
+qint64 QSerialPortPrivate::overlappedResult(OVERLAPPED *overlapped)
{
Q_Q(QSerialPort);
DWORD bytesTransferred = 0;
- if (!::GetOverlappedResult(handle, &overlapped, &bytesTransferred, FALSE)) {
+ if (!::GetOverlappedResult(handle, overlapped, &bytesTransferred, FALSE)) {
const QSerialPort::SerialPortError error = decodeSystemError();
if (error == QSerialPort::NoError)
return qint64(0);
if (error != QSerialPort::ResourceError) {
- if (&overlapped == &readCompletionOverlapped)
+ if (overlapped == &readCompletionOverlapped)
q->setError(QSerialPort::ReadError);
- else if (&overlapped == &writeCompletionOverlapped)
+ else if (overlapped == &writeCompletionOverlapped)
q->setError(QSerialPort::WriteError);
else
q->setError(error);
@@ -824,10 +790,16 @@ qint64 QSerialPortPrivate::overlappedResult(OVERLAPPED &overlapped)
return bytesTransferred;
}
-QSerialPort::SerialPortError QSerialPortPrivate::decodeSystemError() const
+QSerialPort::SerialPortError QSerialPortPrivate::decodeSystemError(int systemErrorCode) const
{
+ if (systemErrorCode == -1)
+ systemErrorCode = ::GetLastError();
+
QSerialPort::SerialPortError error;
- switch (::GetLastError()) {
+ switch (systemErrorCode) {
+ case ERROR_SUCCESS:
+ error = QSerialPort::NoError;
+ break;
case ERROR_IO_PENDING:
error = QSerialPort::NoError;
break;
@@ -858,6 +830,9 @@ QSerialPort::SerialPortError QSerialPortPrivate::decodeSystemError() const
case ERROR_OPERATION_ABORTED:
error = QSerialPort::ResourceError;
break;
+ case WAIT_TIMEOUT:
+ error = QSerialPort::TimeoutError;
+ break;
default:
error = QSerialPort::UnknownError;
break;
@@ -865,32 +840,6 @@ QSerialPort::SerialPortError QSerialPortPrivate::decodeSystemError() const
return error;
}
-bool QSerialPortPrivate::waitAnyEvent(int msecs, HANDLE *triggeredEvent)
-{
- Q_Q(QSerialPort);
-
- QVector<HANDLE> handles = QVector<HANDLE>()
- << communicationOverlapped.hEvent
- << readCompletionOverlapped.hEvent
- << writeCompletionOverlapped.hEvent;
-
- DWORD waitResult = ::WaitForMultipleObjects(handles.count(),
- handles.constData(),
- FALSE, // wait any event
- msecs == -1 ? INFINITE : msecs);
- if (waitResult == WAIT_TIMEOUT) {
- q->setError(QSerialPort::TimeoutError, qt_error_string(WAIT_TIMEOUT));
- return false;
- }
- if (waitResult >= DWORD(WAIT_OBJECT_0 + handles.count())) {
- q->setError(decodeSystemError());
- return false;
- }
-
- *triggeredEvent = handles.at(waitResult - WAIT_OBJECT_0);
- return true;
-}
-
// This table contains standard values of baud rates that
// are defined in MSDN and/or in Win SDK file winbase.h
diff --git a/src/serialport/qserialport_win_p.h b/src/serialport/qserialport_win_p.h
deleted file mode 100644
index b4097ff..0000000
--- a/src/serialport/qserialport_win_p.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtSerialPort module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSERIALPORT_WIN_P_H
-#define QSERIALPORT_WIN_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qserialport_p.h"
-
-#include <QtCore/qhash.h>
-
-#include <qt_windows.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWinEventNotifier;
-class QTimer;
-
-class QSerialPortPrivate : public QSerialPortPrivateData
-{
- Q_DECLARE_PUBLIC(QSerialPort)
-
-public:
- QSerialPortPrivate(QSerialPort *q);
- ~QSerialPortPrivate();
-
- bool open(QIODevice::OpenMode mode);
- void close();
-
- QSerialPort::PinoutSignals pinoutSignals();
-
- bool setDataTerminalReady(bool set);
- bool setRequestToSend(bool set);
-
- bool flush();
- bool clear(QSerialPort::Directions directions);
-
- bool sendBreak(int duration);
- bool setBreakEnabled(bool set);
-
- qint64 readData(char *data, qint64 maxSize);
-
- bool waitForReadyRead(int msec);
- bool waitForBytesWritten(int msec);
-
- bool setBaudRate();
- bool setBaudRate(qint32 baudRate, QSerialPort::Directions directions);
- bool setDataBits(QSerialPort::DataBits dataBits);
- bool setParity(QSerialPort::Parity parity);
- bool setStopBits(QSerialPort::StopBits stopBits);
- bool setFlowControl(QSerialPort::FlowControl flowControl);
- bool setDataErrorPolicy(QSerialPort::DataErrorPolicy policy);
-
- void handleLineStatusErrors();
- QSerialPort::SerialPortError decodeSystemError() const;
-
- bool _q_completeAsyncCommunication();
- bool _q_completeAsyncRead();
- bool _q_completeAsyncWrite();
-
- bool startAsyncCommunication();
- bool startAsyncRead();
- bool _q_startAsyncWrite();
-
- bool emulateErrorPolicy();
- void emitReadyRead();
-
- qint64 bytesToWrite() const;
- qint64 writeData(const char *data, qint64 maxSize);
-
- static qint32 baudRateFromSetting(qint32 setting);
- static qint32 settingFromBaudRate(qint32 baudRate);
-
- static QList<qint32> standardBaudRates();
-
- DCB currentDcb;
- DCB restoredDcb;
- COMMTIMEOUTS currentCommTimeouts;
- COMMTIMEOUTS restoredCommTimeouts;
- HANDLE handle;
- bool parityErrorOccurred;
- QByteArray readChunkBuffer;
- bool readyReadEmitted;
- bool writeStarted;
- bool readStarted;
- QWinEventNotifier *communicationNotifier;
- QWinEventNotifier *readCompletionNotifier;
- QWinEventNotifier *writeCompletionNotifier;
- QTimer *startAsyncWriteTimer;
- OVERLAPPED communicationOverlapped;
- OVERLAPPED readCompletionOverlapped;
- OVERLAPPED writeCompletionOverlapped;
- DWORD originalEventMask;
- DWORD triggeredEventMask;
- qint64 actualBytesToWrite;
-
-private:
- bool initialize(QIODevice::OpenMode mode);
- bool updateDcb();
- bool updateCommTimeouts();
- qint64 overlappedResult(OVERLAPPED &overlapped);
-
- bool waitAnyEvent(int msecs, HANDLE *triggeredEvent);
-
-};
-
-QT_END_NAMESPACE
-
-#endif // QSERIALPORT_WIN_P_H
diff --git a/src/serialport/qserialport_wince.cpp b/src/serialport/qserialport_wince.cpp
index 99cc603..b8affb6 100644
--- a/src/serialport/qserialport_wince.cpp
+++ b/src/serialport/qserialport_wince.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
** Copyright (C) 2012 Andre Hartmann <aha_1980@gmx.de>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -12,9 +12,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -25,15 +25,15 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "qserialport_wince_p.h"
+#include "qserialport_p.h"
#include <QtCore/qelapsedtimer.h>
#include <QtCore/qthread.h>
@@ -179,14 +179,6 @@ private:
#include "qserialport_wince.moc"
-QSerialPortPrivate::QSerialPortPrivate(QSerialPort *q)
- : QSerialPortPrivateData(q)
- , handle(INVALID_HANDLE_VALUE)
- , parityErrorOccurred(false)
- , eventNotifier(Q_NULLPTR)
-{
-}
-
bool QSerialPortPrivate::open(QIODevice::OpenMode mode)
{
Q_Q(QSerialPort);
@@ -339,12 +331,12 @@ bool QSerialPortPrivate::setBreakEnabled(bool set)
qint64 QSerialPortPrivate::readData(char *data, qint64 maxSize)
{
- return readBuffer.read(data, maxSize);
+ return buffer.read(data, maxSize);
}
bool QSerialPortPrivate::waitForReadyRead(int msec)
{
- if (!readBuffer.isEmpty())
+ if (!buffer.isEmpty())
return true;
QElapsedTimer stopWatch;
@@ -501,8 +493,8 @@ bool QSerialPortPrivate::notifyRead()
DWORD bytesToRead = (policy == QSerialPort::IgnorePolicy) ? ReadChunkSize : 1;
- if (readBufferMaxSize && bytesToRead > (readBufferMaxSize - readBuffer.size())) {
- bytesToRead = readBufferMaxSize - readBuffer.size();
+ if (readBufferMaxSize && bytesToRead > (readBufferMaxSize - buffer.size())) {
+ bytesToRead = readBufferMaxSize - buffer.size();
if (bytesToRead == 0) {
// Buffer is full. User must read data from the buffer
// before we can read more from the port.
@@ -510,18 +502,18 @@ bool QSerialPortPrivate::notifyRead()
}
}
- char *ptr = readBuffer.reserve(bytesToRead);
+ char *ptr = buffer.reserve(bytesToRead);
DWORD readBytes = 0;
BOOL sucessResult = ::ReadFile(handle, ptr, bytesToRead, &readBytes, Q_NULLPTR);
if (!sucessResult) {
- readBuffer.truncate(bytesToRead);
+ buffer.chop(bytesToRead);
q->setError(QSerialPort::ReadError);
return false;
}
- readBuffer.truncate(readBytes);
+ buffer.chop(readBytes);
// Process emulate policy.
if ((policy != QSerialPort::IgnorePolicy) && parityErrorOccurred) {
@@ -530,11 +522,11 @@ bool QSerialPortPrivate::notifyRead()
switch (policy) {
case QSerialPort::SkipPolicy:
- readBuffer.getChar();
+ buffer.getChar();
return true;
case QSerialPort::PassZeroPolicy:
- readBuffer.getChar();
- readBuffer.putChar('\0');
+ buffer.getChar();
+ buffer.ungetChar('\0');
break;
case QSerialPort::StopReceivingPolicy:
// FIXME: Maybe need disable read notifier?
@@ -689,8 +681,10 @@ bool QSerialPortPrivate::updateCommTimeouts()
return true;
}
-QSerialPort::SerialPortError QSerialPortPrivate::decodeSystemError() const
+QSerialPort::SerialPortError QSerialPortPrivate::decodeSystemError(int systemErrorCode) const
{
+ Q_UNUSED(systemErrorCode);
+
QSerialPort::SerialPortError error;
switch (::GetLastError()) {
case ERROR_IO_PENDING:
diff --git a/src/serialport/qserialport_wince_p.h b/src/serialport/qserialport_wince_p.h
deleted file mode 100644
index 57977f1..0000000
--- a/src/serialport/qserialport_wince_p.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtSerialPort module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSERIALPORT_WINCE_P_H
-#define QSERIALPORT_WINCE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qserialport_p.h"
-
-#include <QtCore/qmutex.h>
-
-#include <qt_windows.h>
-
-QT_BEGIN_NAMESPACE
-
-class QThread;
-
-class QSerialPortPrivate : public QSerialPortPrivateData
-{
- Q_DECLARE_PUBLIC(QSerialPort)
-
-public:
- QSerialPortPrivate(QSerialPort *q);
-
- bool open(QIODevice::OpenMode mode);
- void close();
-
- QSerialPort::PinoutSignals pinoutSignals();
-
- bool setDataTerminalReady(bool set);
- bool setRequestToSend(bool set);
-
- bool flush();
- bool clear(QSerialPort::Directions directions);
-
- bool sendBreak(int duration);
- bool setBreakEnabled(bool set);
-
- qint64 readData(char *data, qint64 maxSize);
-
- bool waitForReadyRead(int msec);
- bool waitForBytesWritten(int msec);
-
- bool setBaudRate();
- bool setBaudRate(qint32 baudRate, QSerialPort::Directions directions);
- bool setDataBits(QSerialPort::DataBits dataBits);
- bool setParity(QSerialPort::Parity parity);
- bool setStopBits(QSerialPort::StopBits stopBits);
- bool setFlowControl(QSerialPort::FlowControl flowControl);
- bool setDataErrorPolicy(QSerialPort::DataErrorPolicy policy);
-
- void processIoErrors(bool error);
- QSerialPort::SerialPortError decodeSystemError() const;
-
- bool notifyRead();
- bool notifyWrite();
-
- qint64 bytesToWrite() const;
- qint64 writeData(const char *data, qint64 maxSize);
-
- static qint32 baudRateFromSetting(qint32 setting);
- static qint32 settingFromBaudRate(qint32 baudRate);
-
- static QList<qint32> standardBaudRates();
-
- DCB currentDcb;
- DCB restoredDcb;
- COMMTIMEOUTS currentCommTimeouts;
- COMMTIMEOUTS restoredCommTimeouts;
- HANDLE handle;
- bool parityErrorOccurred;
-
- QThread *eventNotifier;
- QMutex settingsChangeMutex;
-
-private:
- bool initialize(DWORD eventMask);
- bool updateDcb();
- bool updateCommTimeouts();
-
- bool waitForReadOrWrite(bool *selectForRead, bool *selectForWrite,
- bool checkRead, bool checkWrite,
- int msecs);
-
-};
-
-QT_END_NAMESPACE
-
-#endif // QSERIALPORT_WINCE_P_H
diff --git a/src/serialport/qserialportglobal.h b/src/serialport/qserialportglobal.h
index 7aa5caa..ec0cd5c 100644
--- a/src/serialport/qserialportglobal.h
+++ b/src/serialport/qserialportglobal.h
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -11,9 +11,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -24,8 +24,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -50,23 +50,6 @@ QT_BEGIN_NAMESPACE
# define Q_SERIALPORT_EXPORT
#endif
-// These macros have been available only since Qt 5.0
-#ifndef QT_DEPRECATED_SINCE
-#define QT_DEPRECATED_SINCE(major, minor) 1
-#endif
-
-#ifndef Q_DECL_OVERRIDE
-#define Q_DECL_OVERRIDE
-#endif
-
-#ifndef QStringLiteral
-#define QStringLiteral(str) QString::fromUtf8(str)
-#endif
-
-#ifndef Q_NULLPTR
-#define Q_NULLPTR NULL
-#endif
-
QT_END_NAMESPACE
#endif // QSERIALPORTGLOBAL_H
diff --git a/src/serialport/qserialportinfo.cpp b/src/serialport/qserialportinfo.cpp
index 26b275d..be3eed1 100644
--- a/src/serialport/qserialportinfo.cpp
+++ b/src/serialport/qserialportinfo.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2011-2012 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2011 Sergey Belyashov <Sergey.Belyashov@gmail.com>
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -12,9 +12,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -25,8 +25,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/serialport/qserialportinfo.h b/src/serialport/qserialportinfo.h
index 714708d..9f0352b 100644
--- a/src/serialport/qserialportinfo.h
+++ b/src/serialport/qserialportinfo.h
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -11,9 +11,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -24,8 +24,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/serialport/qserialportinfo_mac.cpp b/src/serialport/qserialportinfo_mac.cpp
index 54abe21..558dcbd 100644
--- a/src/serialport/qserialportinfo_mac.cpp
+++ b/src/serialport/qserialportinfo_mac.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2011-2012 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2011 Sergey Belyashov <Sergey.Belyashov@gmail.com>
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -12,9 +12,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -25,8 +25,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -35,7 +35,7 @@
#include "qserialportinfo.h"
#include "qserialportinfo_p.h"
-#include "qserialport_unix_p.h"
+#include "qserialport_p.h"
#include "private/qcore_mac_p.h"
@@ -89,11 +89,6 @@ static bool isCompleteInfo(const QSerialPortInfoPrivate &priv)
&& priv.hasVendorIdentifier;
}
-static QString devicePortName(io_registry_entry_t ioRegistryEntry)
-{
- return searchStringProperty(ioRegistryEntry, QCFString(kIOTTYDeviceKey));
-}
-
static QString deviceSystemLocation(io_registry_entry_t ioRegistryEntry)
{
return searchStringProperty(ioRegistryEntry, QCFString(kIOCalloutDeviceKey));
@@ -163,11 +158,11 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts()
QSerialPortInfoPrivate priv;
forever {
- if (priv.portName.isEmpty())
- priv.portName = devicePortName(serialPortService);
-
- if (priv.device.isEmpty())
+ if (priv.device.isEmpty()) {
priv.device = deviceSystemLocation(serialPortService);
+ if (!priv.device.isEmpty())
+ priv.portName = QSerialPortInfoPrivate::portNameFromSystemLocation(priv.device);
+ }
if (priv.description.isEmpty())
priv.description = deviceDescription(serialPortService);
@@ -245,14 +240,14 @@ bool QSerialPortInfo::isValid() const
QString QSerialPortInfoPrivate::portNameToSystemLocation(const QString &source)
{
return (source.startsWith(QLatin1Char('/'))
- || source.startsWith(QStringLiteral("./"))
- || source.startsWith(QStringLiteral("../")))
- ? source : (QStringLiteral("/dev/") + source);
+ || source.startsWith(QLatin1String("./"))
+ || source.startsWith(QLatin1String("../")))
+ ? source : (QLatin1String("/dev/") + source);
}
QString QSerialPortInfoPrivate::portNameFromSystemLocation(const QString &source)
{
- return source.startsWith(QStringLiteral("/dev/"))
+ return source.startsWith(QLatin1String("/dev/"))
? source.mid(5) : source;
}
diff --git a/src/serialport/qserialportinfo_p.h b/src/serialport/qserialportinfo_p.h
index c9f1086..5a15dcf 100644
--- a/src/serialport/qserialportinfo_p.h
+++ b/src/serialport/qserialportinfo_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2011-2012 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2011 Sergey Belyashov <Sergey.Belyashov@gmail.com>
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -12,9 +12,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -25,8 +25,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/serialport/qserialportinfo_symbian.cpp b/src/serialport/qserialportinfo_symbian.cpp
deleted file mode 100644
index d320b11..0000000
--- a/src/serialport/qserialportinfo_symbian.cpp
+++ /dev/null
@@ -1,234 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011-2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Copyright (C) 2011 Sergey Belyashov <Sergey.Belyashov@gmail.com>
-** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtSerialPort module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qserialportinfo.h"
-#include "qserialportinfo_p.h"
-#include "qserialport_symbian_p.h"
-
-#include <e32base.h>
-#include <c32comm.h>
-#include <f32file.h>
-
-#include <QtCore/qobject.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifdef __WINS__
-_LIT(KPddName, "ECDRV");
-#else
-_LIT(KPddName, "EUART");
-#endif
-
-_LIT(KLddName,"ECOMM");
-
-_LIT(KRS232ModuleName , "ECUART");
-_LIT(KBluetoothModuleName , "BTCOMM");
-_LIT(KInfraRedModuleName , "IRCOMM");
-_LIT(KACMModuleName, "ECACM");
-
-static bool loadDevices()
-{
- TInt r = KErrNone;
-#ifdef __WINS__
- RFs fileServer;
- r = User::LeaveIfError(fileServer.Connect());
- if (r != KErrNone)
- return false;
- fileServer.Close ();
-#endif
-
- r = User::LoadPhysicalDevice(KPddName);
- if (r != KErrNone && r != KErrAlreadyExists)
- return false;
-
- r = User::LoadLogicalDevice(KLddName);
- if (r != KErrNone && r != KErrAlreadyExists)
- return false;
-
-#ifndef __WINS__
- r = StartC32();
- if (r != KErrNone && r != KErrAlreadyExists)
- return false;
-#endif
-
- return true;
-}
-
-QList<QSerialPortInfo> QSerialPortInfo::availablePorts()
-{
- QList<QSerialPortInfo> serialPortInfoList;
-
- if (!loadDevices())
- return serialPortInfoList;
-
- RCommServ server;
- TInt r = server.Connect();
- if (r != KErrNone)
- return serialPortInfoList;
-
- TSerialInfo nativeSerialInfo;
- QString s("%1::%2");
-
- // FIXME: Get info about RS232 ports.
- r = server.LoadCommModule(KRS232ModuleName);
- if (r == KErrNone) {
- r = server.GetPortInfo(KRS232ModuleName, nativeSerialInfo);
- if (r == KErrNone) {
- for (quint32 i = nativeSerialInfo.iLowUnit; i < nativeSerialInfo.iHighUnit + 1; ++i) {
-
- QSerialPortInfo serialPortInfo;
-
- serialPortInfo.d_ptr->device = s
- .arg(QString::fromUtf16(nativeSerialInfo.iName.Ptr(), nativeSerialInfo.iName.Length()))
- .arg(i);
- serialPortInfo.d_ptr->portName = serialPortInfo.d_ptr->device;
- serialPortInfo.d_ptr->description =
- QString::fromUtf16(nativeSerialInfo.iDescription.Ptr(), nativeSerialInfo.iDescription.Length());
- serialPortInfo.d_ptr->manufacturer = QString(QObject::tr("Unknown."));
- serialPortInfo.d_ptr->serialNumber = QString(QObject::tr("Unknown."));
- serialPortInfoList.append(serialPortInfo);
- }
- }
- }
-
- // FIXME: Get info about Bluetooth ports.
- r = server.LoadCommModule(KBluetoothModuleName);
- if (r == KErrNone) {
- r = server.GetPortInfo(KBluetoothModuleName, nativeSerialInfo);
- if (r == KErrNone) {
- for (quint32 i = nativeSerialInfo.iLowUnit; i < nativeSerialInfo.iHighUnit + 1; ++i) {
-
- QSerialPortInfo serialPortInfo;
-
- serialPortInfo.d_ptr->device = s
- .arg(QString::fromUtf16(nativeSerialInfo.iName.Ptr(), nativeSerialInfo.iName.Length()))
- .arg(i);
- serialPortInfo.d_ptr->portName = serialPortInfo.d_ptr->device;
- serialPortInfo.d_ptr->description =
- QString::fromUtf16(nativeSerialInfo.iDescription.Ptr(), nativeSerialInfo.iDescription.Length());
- serialPortInfo.d_ptr->manufacturer = QString(QObject::tr("Unknown."));
- serialPortInfo.d_ptr->serialNumber = QString(QObject::tr("Unknown."));
- serialPortInfoList.append(serialPortInfo);
- }
- }
- }
-
- // FIXME: Get info about InfraRed ports.
- r = server.LoadCommModule(KInfraRedModuleName);
- if (r == KErrNone) {
- r = server.GetPortInfo(KInfraRedModuleName, nativeSerialInfo);
- if (r == KErrNone) {
- for (quint32 i = nativeSerialInfo.iLowUnit; i < nativeSerialInfo.iHighUnit + 1; ++i) {
-
- QSerialPortInfo serialPortInfo;
-
- serialPortInfo.d_ptr->device = s
- .arg(QString::fromUtf16(nativeSerialInfo.iName.Ptr(), nativeSerialInfo.iName.Length()))
- .arg(i);
- serialPortInfo.d_ptr->portName = serialPortInfo.d_ptr->device;
- serialPortInfo.d_ptr->description =
- QString::fromUtf16(nativeSerialInfo.iDescription.Ptr(), nativeSerialInfo.iDescription.Length());
- serialPortInfo.d_ptr->manufacturer = QString(QObject::tr("Unknown."));
- serialPortInfoList.append(serialPortInfo);
- }
- }
- }
-
- // FIXME: Get info about ACM ports.
- r = server.LoadCommModule(KACMModuleName);
- if (r == KErrNone) {
- r = server.GetPortInfo(KACMModuleName, nativeSerialInfo);
- if (r == KErrNone) {
- for (quint32 i = nativeSerialInfo.iLowUnit; i < nativeSerialInfo.iHighUnit + 1; ++i) {
-
- QSerialPortInfo serialPortInfo;
-
- serialPortInfo.d_ptr->device = s
- .arg(QString::fromUtf16(nativeSerialInfo.iName.Ptr(), nativeSerialInfo.iName.Length()))
- .arg(i);
- serialPortInfo.d_ptr->portName = QSerialPortPrivate::portNameFromSystemLocation(serialPortInfo.d_ptr->device);
- serialPortInfo.d_ptr->description =
- QString::fromUtf16(nativeSerialInfo.iDescription.Ptr(), nativeSerialInfo.iDescription.Length());
- serialPortInfo.d_ptr->manufacturer = QString(QObject::tr("Unknown."));
- serialPortInfoList.append(serialPortInfo);
- }
- }
- }
-
- return serialPortInfoList;
-}
-
-QList<qint32> QSerialPortInfo::standardBaudRates()
-{
- return QSerialPortPrivate::standardBaudRates();
-}
-
-bool QSerialPortInfo::isBusy() const
-{
- if (!loadDevices())
- return false;
-
- RCommServ server;
- TInt r = server.Connect();
- if (r != KErrNone)
- return false;
-
- RComm port;
- TPtrC portName(static_cast<const TUint16*>(systemLocation().utf16()), systemLocation().length());
- r = port.Open(server, portName, ECommExclusive);
- if (r == KErrNone)
- port.Close();
- return r == KErrLocked;
-}
-
-bool QSerialPortInfo::isValid() const
-{
- if (!loadDevices())
- return false;
-
- RCommServ server;
- TInt r = server.Connect();
- if (r != KErrNone)
- return false;
-
- RComm port;
- TPtrC portName(static_cast<const TUint16*>(systemLocation().utf16()), systemLocation().length());
- r = port.Open(server, portName, ECommExclusive);
- if (r == KErrNone)
- port.Close();
- return r == KErrNone || r == KErrLocked;
-}
-
-QT_END_NAMESPACE
diff --git a/src/serialport/qserialportinfo_unix.cpp b/src/serialport/qserialportinfo_unix.cpp
index 07587ec..0add5b6 100644
--- a/src/serialport/qserialportinfo_unix.cpp
+++ b/src/serialport/qserialportinfo_unix.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2011-2012 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2011 Sergey Belyashov <Sergey.Belyashov@gmail.com>
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -12,9 +12,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -25,8 +25,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -35,7 +35,7 @@
#include "qserialportinfo.h"
#include "qserialportinfo_p.h"
-#include "qserialport_unix_p.h"
+#include "qserialport_p.h"
#include <QtCore/qlockfile.h>
#include <QtCore/qfile.h>
@@ -67,9 +67,9 @@ static QStringList filteredDeviceFilePaths()
<< QStringLiteral("ttyAMA*") // AMBA serial device for embedded platform on ARM (i.e. Raspberry Pi).
<< QStringLiteral("rfcomm*") // Bluetooth serial device.
<< QStringLiteral("ircomm*"); // IrDA serial device.
-#elif defined (Q_OS_FREEBSD)
+#elif defined(Q_OS_FREEBSD)
<< QStringLiteral("cu*");
-#elif defined (Q_OS_QNX)
+#elif defined(Q_OS_QNX)
<< QStringLiteral("ser*");
#else
;
@@ -111,7 +111,7 @@ QList<QSerialPortInfo> availablePortsByFiltersOfDevices(bool &ok)
static bool isSerial8250Driver(const QString &driverName)
{
- return (driverName == QStringLiteral("serial8250"));
+ return (driverName == QLatin1String("serial8250"));
}
static bool isValidSerial8250(const QString &systemLocation)
@@ -134,7 +134,7 @@ static bool isValidSerial8250(const QString &systemLocation)
static bool isRfcommDevice(const QString &portName)
{
- if (!portName.startsWith(QStringLiteral("rfcomm")))
+ if (!portName.startsWith(QLatin1String("rfcomm")))
return false;
bool ok;
@@ -170,7 +170,7 @@ static QString deviceName(const QDir &targetDir)
static QString deviceDriver(const QDir &targetDir)
{
- const QDir deviceDir(targetDir.absolutePath() + "/device");
+ const QDir deviceDir(targetDir.absolutePath() + QLatin1String("/device"));
return ueventProperty(deviceDir, "DRIVER=");
}
@@ -472,14 +472,14 @@ bool QSerialPortInfo::isValid() const
QString QSerialPortInfoPrivate::portNameToSystemLocation(const QString &source)
{
return (source.startsWith(QLatin1Char('/'))
- || source.startsWith(QStringLiteral("./"))
- || source.startsWith(QStringLiteral("../")))
- ? source : (QStringLiteral("/dev/") + source);
+ || source.startsWith(QLatin1String("./"))
+ || source.startsWith(QLatin1String("../")))
+ ? source : (QLatin1String("/dev/") + source);
}
QString QSerialPortInfoPrivate::portNameFromSystemLocation(const QString &source)
{
- return source.startsWith(QStringLiteral("/dev/"))
+ return source.startsWith(QLatin1String("/dev/"))
? source.mid(5) : source;
}
diff --git a/src/serialport/qserialportinfo_win.cpp b/src/serialport/qserialportinfo_win.cpp
index 493c4d0..546d5e1 100644
--- a/src/serialport/qserialportinfo_win.cpp
+++ b/src/serialport/qserialportinfo_win.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2011-2012 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2011 Sergey Belyashov <Sergey.Belyashov@gmail.com>
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -12,9 +12,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -25,8 +25,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -35,7 +35,7 @@
#include "qserialportinfo.h"
#include "qserialportinfo_p.h"
-#include "qserialport_win_p.h"
+#include "qserialport_p.h"
#include <QtCore/quuid.h>
#include <QtCore/qpair.h>
@@ -258,13 +258,13 @@ static QString parseDeviceSerialNumber(const QString &instanceIdentifier)
{
int firstbound = instanceIdentifier.lastIndexOf(QLatin1Char('\\'));
int lastbound = instanceIdentifier.indexOf(QLatin1Char('_'), firstbound);
- if (instanceIdentifier.startsWith(QStringLiteral("USB\\"))) {
+ if (instanceIdentifier.startsWith(QLatin1String("USB\\"))) {
if (lastbound != instanceIdentifier.size() - 3)
lastbound = instanceIdentifier.size();
int ampersand = instanceIdentifier.indexOf(QLatin1Char('&'), firstbound);
if (ampersand != -1 && ampersand < lastbound)
return QString();
- } else if (instanceIdentifier.startsWith(QStringLiteral("FTDIBUS\\"))) {
+ } else if (instanceIdentifier.startsWith(QLatin1String("FTDIBUS\\"))) {
firstbound = instanceIdentifier.lastIndexOf(QLatin1Char('+'));
lastbound = instanceIdentifier.indexOf(QLatin1Char('\\'), firstbound);
if (lastbound == -1)
@@ -304,7 +304,7 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts()
DWORD index = 0;
while (::SetupDiEnumDeviceInfo(deviceInfoSet, index++, &deviceInfoData)) {
const QString portName = devicePortName(deviceInfoSet, &deviceInfoData);
- if (portName.isEmpty() || portName.contains(QStringLiteral("LPT")))
+ if (portName.isEmpty() || portName.contains(QLatin1String("LPT")))
continue;
if (std::find_if(serialPortInfoList.begin(), serialPortInfoList.end(),
@@ -381,14 +381,14 @@ bool QSerialPortInfo::isValid() const
QString QSerialPortInfoPrivate::portNameToSystemLocation(const QString &source)
{
- return source.startsWith(QStringLiteral("COM"))
- ? (QStringLiteral("\\\\.\\") + source) : source;
+ return source.startsWith(QLatin1String("COM"))
+ ? (QLatin1String("\\\\.\\") + source) : source;
}
QString QSerialPortInfoPrivate::portNameFromSystemLocation(const QString &source)
{
- return (source.startsWith(QStringLiteral("\\\\.\\"))
- || source.startsWith(QStringLiteral("//./")))
+ return (source.startsWith(QLatin1String("\\\\.\\"))
+ || source.startsWith(QLatin1String("//./")))
? source.mid(4) : source;
}
diff --git a/src/serialport/qserialportinfo_wince.cpp b/src/serialport/qserialportinfo_wince.cpp
index 78439c9..aa590ba 100644
--- a/src/serialport/qserialportinfo_wince.cpp
+++ b/src/serialport/qserialportinfo_wince.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2011-2012 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2011 Sergey Belyashov <Sergey.Belyashov@gmail.com>
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -12,9 +12,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -25,8 +25,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -35,7 +35,7 @@
#include "qserialportinfo.h"
#include "qserialportinfo_p.h"
-#include "qserialport_wince_p.h"
+#include "qserialport_p.h"
#include <QtCore/qstringlist.h>
diff --git a/src/serialport/qt4support/include/QtCore/qlockfile.h b/src/serialport/qt4support/include/QtCore/qlockfile.h
deleted file mode 100644
index a35eee5..0000000
--- a/src/serialport/qt4support/include/QtCore/qlockfile.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 David Faure <faure+bluesystems@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QLOCKFILE_H
-#define QLOCKFILE_H
-
-#include <QtCore/qstring.h>
-#include <QtCore/qscopedpointer.h>
-
-QT_BEGIN_NAMESPACE
-
-class QLockFilePrivate;
-
-class Q_CORE_EXPORT QLockFile
-{
-public:
- QLockFile(const QString &fileName);
- ~QLockFile();
-
- bool lock();
- bool tryLock(int timeout = 0);
- void unlock();
-
- void setStaleLockTime(int);
- int staleLockTime() const;
-
- bool isLocked() const;
- bool getLockInfo(qint64 *pid, QString *hostname, QString *appname) const;
- bool removeStaleLockFile();
-
- enum LockError {
- NoError = 0,
- LockFailedError = 1,
- PermissionError = 2,
- UnknownError = 3
- };
- LockError error() const;
-
-protected:
- QScopedPointer<QLockFilePrivate> d_ptr;
-
-private:
- Q_DECLARE_PRIVATE(QLockFile)
- Q_DISABLE_COPY(QLockFile)
-};
-
-QT_END_NAMESPACE
-
-#endif // QLOCKFILE_H
diff --git a/src/serialport/qt4support/include/QtCore/qwineventnotifier.h b/src/serialport/qt4support/include/QtCore/qwineventnotifier.h
deleted file mode 100644
index 6d83592..0000000
--- a/src/serialport/qt4support/include/QtCore/qwineventnotifier.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWINEVENTNOTIFIER_H
-#define QWINEVENTNOTIFIER_H
-
-#include "QtCore/qobject.h"
-
-#ifdef Q_OS_WIN
-#include "QtCore/qt_windows.h"
-
-QT_BEGIN_NAMESPACE
-
-class Q_CORE_EXPORT QWinEventNotifier : public QObject
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QObject)
-
-public:
- explicit QWinEventNotifier(QObject *parent = 0);
- explicit QWinEventNotifier(HANDLE hEvent, QObject *parent = 0);
- ~QWinEventNotifier();
-
- void setHandle(HANDLE hEvent);
- HANDLE handle() const;
-
- bool isEnabled() const;
-
-public Q_SLOTS:
- void setEnabled(bool enable);
-
-Q_SIGNALS:
- void activated(HANDLE hEvent);
-
-protected:
- bool event(QEvent * e);
-
-private:
- Q_DISABLE_COPY(QWinEventNotifier)
-
- HANDLE handleToEvent;
- bool enabled;
-};
-
-QT_END_NAMESPACE
-
-#endif // Q_OS_WIN
-
-#endif // QWINEVENTNOTIFIER_H
diff --git a/src/serialport/qt4support/include/private/qcore_mac_p.h b/src/serialport/qt4support/include/private/qcore_mac_p.h
deleted file mode 100644
index a5c79fa..0000000
--- a/src/serialport/qt4support/include/private/qcore_mac_p.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCORE_MAC_P_H
-#define QCORE_MAC_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#ifndef __IMAGECAPTURE__
-# define __IMAGECAPTURE__
-#endif
-
-#if defined(QT_BOOTSTRAPPED)
-#include <ApplicationServices/ApplicationServices.h>
-#else
-#include <CoreFoundation/CoreFoundation.h>
-#endif
-
-#include "qglobal.h"
-
-#ifdef Q_OS_MACX
-#include <CoreServices/CoreServices.h>
-#endif
-
-#ifdef __OBJC__
-#include <Foundation/Foundation.h>
-#endif
-
-#include "qstring.h"
-
-#if defined( __OBJC__) && defined(QT_NAMESPACE)
-#define QT_NAMESPACE_ALIAS_OBJC_CLASS(__KLASS__) @compatibility_alias __KLASS__ QT_MANGLE_NAMESPACE(__KLASS__)
-#else
-#define QT_NAMESPACE_ALIAS_OBJC_CLASS(__KLASS__)
-#endif
-
-QT_BEGIN_NAMESPACE
-
-/*
- Helper class that automates refernce counting for CFtypes.
- After constructing the QCFType object, it can be copied like a
- value-based type.
-
- Note that you must own the object you are wrapping.
- This is typically the case if you get the object from a Core
- Foundation function with the word "Create" or "Copy" in it. If
- you got the object from a "Get" function, either retain it or use
- constructFromGet(). One exception to this rule is the
- HIThemeGet*Shape functions, which in reality are "Copy" functions.
-*/
-template <typename T>
-class Q_CORE_EXPORT QCFType
-{
-public:
- inline QCFType(const T &t = 0) : type(t) {}
- inline QCFType(const QCFType &helper) : type(helper.type) { if (type) CFRetain(type); }
- inline ~QCFType() { if (type) CFRelease(type); }
- inline operator T() { return type; }
- inline QCFType operator =(const QCFType &helper)
- {
- if (helper.type)
- CFRetain(helper.type);
- CFTypeRef type2 = type;
- type = helper.type;
- if (type2)
- CFRelease(type2);
- return *this;
- }
- inline T *operator&() { return &type; }
- template <typename X> X as() const { return reinterpret_cast<X>(type); }
- static QCFType constructFromGet(const T &t)
- {
- CFRetain(t);
- return QCFType<T>(t);
- }
-protected:
- T type;
-};
-
-class Q_CORE_EXPORT QCFString : public QCFType<CFStringRef>
-{
-public:
- inline QCFString(const QString &str) : QCFType<CFStringRef>(0), string(str) {}
- inline QCFString(const CFStringRef cfstr = 0) : QCFType<CFStringRef>(cfstr) {}
- inline QCFString(const QCFType<CFStringRef> &other) : QCFType<CFStringRef>(other) {}
- operator QString() const;
- operator CFStringRef() const;
- static QString toQString(CFStringRef cfstr);
- static CFStringRef toCFStringRef(const QString &str);
-#ifdef __OBJC__
- static QString toQString(const NSString *nsstr);
- static NSString *toNSString(const QString &string);
-#endif
-
-private:
- QString string;
-};
-
-QT_END_NAMESPACE
-
-#endif // QCORE_MAC_P_H
diff --git a/src/serialport/qt4support/include/private/qcore_unix_p.h b/src/serialport/qt4support/include/private/qcore_unix_p.h
deleted file mode 100644
index 640525a..0000000
--- a/src/serialport/qt4support/include/private/qcore_unix_p.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCORE_UNIX_P_H
-#define QCORE_UNIX_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of Qt code on Unix. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qplatformdefs.h"
-
-#ifndef Q_OS_UNIX
-# error "qcore_unix_p.h included on a non-Unix system"
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include <errno.h>
-#include <fcntl.h>
-
-#define EINTR_LOOP(var, cmd) \
- do { \
- var = cmd; \
- } while (var == -1 && errno == EINTR)
-
-QT_BEGIN_NAMESPACE
-
-// don't call QT_OPEN or ::open
-// call qt_safe_open
-static inline int qt_safe_open(const char *pathname, int flags, mode_t mode = 0777)
-{
-#ifdef O_CLOEXEC
- flags |= O_CLOEXEC;
-#endif
- int fd;
- EINTR_LOOP(fd, QT_OPEN(pathname, flags, mode));
-
- // unknown flags are ignored, so we have no way of verifying if
- // O_CLOEXEC was accepted
- if (fd != -1)
- ::fcntl(fd, F_SETFD, FD_CLOEXEC);
- return fd;
-}
-#undef QT_OPEN
-#define QT_OPEN qt_safe_open
-
-static inline qint64 qt_safe_read(int fd, void *data, qint64 maxlen)
-{
- qint64 ret = 0;
- EINTR_LOOP(ret, QT_READ(fd, data, maxlen));
- return ret;
-}
-#undef QT_READ
-#define QT_READ qt_safe_read
-
-static inline qint64 qt_safe_write(int fd, const void *data, qint64 len)
-{
- qint64 ret = 0;
- EINTR_LOOP(ret, QT_WRITE(fd, data, len));
- return ret;
-}
-#undef QT_WRITE
-#define QT_WRITE qt_safe_write
-
-static inline int qt_safe_close(int fd)
-{
- int ret;
- EINTR_LOOP(ret, QT_CLOSE(fd));
- return ret;
-}
-#undef QT_CLOSE
-#define QT_CLOSE qt_safe_close
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/serialport/qt4support/include/private/qlockfile_p.h b/src/serialport/qt4support/include/private/qlockfile_p.h
deleted file mode 100644
index ec36733..0000000
--- a/src/serialport/qt4support/include/private/qlockfile_p.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 David Faure <faure+bluesystems@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QLOCKFILE_P_H
-#define QLOCKFILE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qlockfile.h>
-#include <QtCore/qfile.h>
-
-#ifdef Q_OS_WIN
-#include <qt_windows.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class QLockFilePrivate
-{
-public:
- QLockFilePrivate(const QString &fn)
- : fileName(fn),
-#ifdef Q_OS_WIN
- fileHandle(INVALID_HANDLE_VALUE),
-#else
- fileHandle(-1),
-#endif
- staleLockTime(30 * 1000), // 30 seconds
- lockError(QLockFile::NoError),
- isLocked(false)
- {
- }
- QLockFile::LockError tryLock_sys();
- bool removeStaleLock();
- bool getLockInfo(qint64 *pid, QString *hostname, QString *appname) const;
- // Returns \c true if the lock belongs to dead PID, or is old.
- // The attempt to delete it will tell us if it was really stale or not, though.
- bool isApparentlyStale() const;
-
-#ifdef Q_OS_UNIX
- static int checkFcntlWorksAfterFlock();
-#endif
-
- QString fileName;
-#ifdef Q_OS_WIN
- Qt::HANDLE fileHandle;
-#else
- int fileHandle;
-#endif
- int staleLockTime; // "int milliseconds" is big enough for 24 days
- QLockFile::LockError lockError;
- bool isLocked;
-};
-
-QT_END_NAMESPACE
-
-#endif /* QLOCKFILE_P_H */
diff --git a/src/serialport/qt4support/include/private/qringbuffer_p.h b/src/serialport/qt4support/include/private/qringbuffer_p.h
deleted file mode 100644
index 2279f1b..0000000
--- a/src/serialport/qt4support/include/private/qringbuffer_p.h
+++ /dev/null
@@ -1,311 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QRINGBUFFER_P_H
-#define QRINGBUFFER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of a number of Qt sources files. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qbytearray.h>
-#include <QtCore/qlist.h>
-
-QT_BEGIN_NAMESPACE
-
-class QRingBuffer
-{
-public:
- explicit inline QRingBuffer(int growth = 4096) :
- head(0), tail(0), tailBuffer(0), basicBlockSize(growth), bufferSize(0) {
- buffers.append(QByteArray());
- }
-
- inline int nextDataBlockSize() const {
- return (tailBuffer == 0 ? tail : buffers.first().size()) - head;
- }
-
- inline const char *readPointer() const {
- return buffers.isEmpty() ? 0 : (buffers.first().constData() + head);
- }
-
- // access the bytes at a specified position
- // the out-variable length will contain the amount of bytes readable
- // from there, e.g. the amount still the same QByteArray
- inline const char *readPointerAtPosition(qint64 pos, qint64 &length) const {
- if (pos >= 0) {
- pos += head;
- for (int i = 0; i < buffers.size(); ++i) {
- length = (i == tailBuffer ? tail : buffers[i].size());
- if (length > pos) {
- length -= pos;
- return buffers[i].constData() + pos;
- }
- pos -= length;
- }
- }
-
- length = 0;
- return 0;
- }
-
- inline void free(int bytes) {
- while (bytes > 0) {
- int blockSize = buffers.first().size() - head;
-
- if (tailBuffer == 0 || blockSize > bytes) {
- bufferSize -= bytes;
- if (bufferSize <= 0)
- clear(); // try to minify/squeeze us
- else
- head += bytes;
- return;
- }
-
- bufferSize -= blockSize;
- bytes -= blockSize;
- buffers.removeFirst();
- --tailBuffer;
- head = 0;
- }
- }
-
- inline char *reserve(int bytes) {
- if (bytes <= 0)
- return 0;
-
- // if need buffer reallocation
- if (tail + bytes > buffers.last().size()) {
- if (tail >= basicBlockSize) {
- // shrink this buffer to its current size
- buffers.last().resize(tail);
-
- // create a new QByteArray
- buffers.append(QByteArray());
- ++tailBuffer;
- tail = 0;
- }
- buffers.last().resize(qMax(basicBlockSize, tail + bytes));
- }
-
- char *writePtr = buffers.last().data() + tail;
- bufferSize += bytes;
- tail += bytes;
- return writePtr;
- }
-
- inline void truncate(int pos) {
- if (pos < size())
- chop(size() - pos);
- }
-
- inline void chop(int bytes) {
- while (bytes > 0) {
- if (tailBuffer == 0 || tail > bytes) {
- bufferSize -= bytes;
- if (bufferSize <= 0)
- clear(); // try to minify/squeeze us
- else
- tail -= bytes;
- return;
- }
-
- bufferSize -= tail;
- bytes -= tail;
- buffers.removeLast();
- --tailBuffer;
- tail = buffers.last().size();
- }
- }
-
- inline bool isEmpty() const {
- return tailBuffer == 0 && tail == 0;
- }
-
- inline int getChar() {
- if (isEmpty())
- return -1;
- char c = *readPointer();
- free(1);
- return int(uchar(c));
- }
-
- inline void putChar(char c) {
- char *ptr = reserve(1);
- *ptr = c;
- }
-
- inline void ungetChar(char c) {
- --head;
- if (head < 0) {
- buffers.prepend(QByteArray());
- buffers.first().resize(basicBlockSize);
- head = basicBlockSize - 1;
- ++tailBuffer;
- }
- buffers.first()[head] = c;
- ++bufferSize;
- }
-
- inline int size() const {
- return bufferSize;
- }
-
- inline void clear() {
- buffers.erase(buffers.begin() + 1, buffers.end());
- buffers.first().clear();
-
- head = tail = 0;
- tailBuffer = 0;
- bufferSize = 0;
- }
-
- inline int indexOf(char c) const {
- int index = 0;
- int j = head;
- for (int i = 0; i < buffers.size(); ++i) {
- const char *ptr = buffers[i].constData() + j;
- j = index + (i == tailBuffer ? tail : buffers[i].size()) - j;
-
- while (index < j) {
- if (*ptr++ == c)
- return index;
- ++index;
- }
- j = 0;
- }
- return -1;
- }
-
- inline int indexOf(char c, int maxLength) const {
- int index = 0;
- int j = head;
- for (int i = 0; index < maxLength && i < buffers.size(); ++i) {
- const char *ptr = buffers[i].constData() + j;
- j = qMin(index + (i == tailBuffer ? tail : buffers[i].size()) - j, maxLength);
-
- while (index < j) {
- if (*ptr++ == c)
- return index;
- ++index;
- }
- j = 0;
- }
- return -1;
- }
-
- inline int read(char *data, int maxLength) {
- int bytesToRead = qMin(size(), maxLength);
- int readSoFar = 0;
- while (readSoFar < bytesToRead) {
- int bytesToReadFromThisBlock = qMin(bytesToRead - readSoFar, nextDataBlockSize());
- if (data)
- memcpy(data + readSoFar, readPointer(), bytesToReadFromThisBlock);
- readSoFar += bytesToReadFromThisBlock;
- free(bytesToReadFromThisBlock);
- }
- return readSoFar;
- }
-
- // read an unspecified amount (will read the first buffer)
- inline QByteArray read() {
- if (bufferSize == 0)
- return QByteArray();
-
- QByteArray qba(buffers.takeFirst());
-
- qba.reserve(0); // avoid that resizing needlessly reallocates
- if (tailBuffer == 0) {
- qba.resize(tail);
- tail = 0;
- buffers.append(QByteArray());
- } else {
- --tailBuffer;
- }
- qba.remove(0, head); // does nothing if head is 0
- head = 0;
- bufferSize -= qba.size();
- return qba;
- }
-
- // append a new buffer to the end
- inline void append(const QByteArray &qba) {
- if (tail == 0) {
- buffers.last() = qba;
- } else {
- buffers.last().resize(tail);
- buffers.append(qba);
- ++tailBuffer;
- }
- tail = qba.size();
- bufferSize += tail;
- }
-
- inline int skip(int length) {
- return read(0, length);
- }
-
- inline int readLine(char *data, int maxLength) {
- if (!data || --maxLength <= 0)
- return -1;
-
- int i = indexOf('\n', maxLength);
- i = read(data, i >= 0 ? (i + 1) : maxLength);
-
- // Terminate it.
- data[i] = '\0';
- return i;
- }
-
- inline bool canReadLine() const {
- return indexOf('\n') >= 0;
- }
-
-private:
- QList<QByteArray> buffers;
- int head, tail;
- int tailBuffer; // always buffers.size() - 1
- const int basicBlockSize;
- int bufferSize;
-};
-
-QT_END_NAMESPACE
-
-#endif // QRINGBUFFER_P_H
diff --git a/src/serialport/qt4support/install-helper.pri b/src/serialport/qt4support/install-helper.pri
deleted file mode 100644
index a860758..0000000
--- a/src/serialport/qt4support/install-helper.pri
+++ /dev/null
@@ -1,52 +0,0 @@
-QTSERIALPORT_PROJECT_INCLUDEDIR = $$QTSERIALPORT_BUILD_ROOT/include/QtSerialPort
-QTSERIALPORT_PROJECT_INCLUDEDIR ~=s,/,$$QMAKE_DIR_SEP,
-
-system("$$QMAKE_MKDIR $$QTSERIALPORT_PROJECT_INCLUDEDIR")
-
-for(header_file, PUBLIC_HEADERS) {
- header_file ~=s,/,$$QMAKE_DIR_SEP,
- system("$$QMAKE_COPY \"$${header_file}\" \"$$QTSERIALPORT_PROJECT_INCLUDEDIR\"")
-}
-
-unix:!symbian {
- SOURCES += \
- $$PWD/src/qlockfile.cpp \
- $$PWD/src/qlockfile_unix.cpp
-}
-
-# This is a quick workaround for generating forward header with Qt4.
-
-!equals(QMAKE_HOST.os, Windows): maybe_quote = "\'"
-system("echo $${maybe_quote}$${LITERAL_HASH}include \"qserialport.h\"$${maybe_quote} > \"$$QTSERIALPORT_PROJECT_INCLUDEDIR/QSerialPort\"")
-system("echo $${maybe_quote}$${LITERAL_HASH}include \"qserialportinfo.h\"$${maybe_quote} > \"$$QTSERIALPORT_PROJECT_INCLUDEDIR/QSerialPortInfo\"")
-
-PUBLIC_HEADERS += \
- $$PUBLIC_HEADERS \
- \"$$QTSERIALPORT_PROJECT_INCLUDEDIR/QSerialPort\" \
- \"$$QTSERIALPORT_PROJECT_INCLUDEDIR/QSerialPortInfo\"
-
-target_headers.files = $$PUBLIC_HEADERS
-target_headers.path = $$[QT_INSTALL_HEADERS]/QtSerialPort
-INSTALLS += target_headers
-
-mkspecs_features.files = $$QTSERIALPORT_PROJECT_ROOT/src/serialport/qt4support/serialport.prf
-mkspecs_features.path = $$[QT_INSTALL_DATA]/mkspecs/features
-INSTALLS += mkspecs_features
-
-win32 {
- dlltarget.path = $$[QT_INSTALL_BINS]
- INSTALLS += dlltarget
-}
-
-target.path = $$[QT_INSTALL_LIBS]
-INSTALLS += target
-
-INCLUDEPATH += $$QTSERIALPORT_BUILD_ROOT/include $$QTSERIALPORT_BUILD_ROOT/include/QtSerialPort
-lessThan(QT_MAJOR_VERSION, 5) {
- QTSERIALPORT_PROJECT_QT4SUPPORT_INCLUDEDIR = $$QTSERIALPORT_PROJECT_ROOT/src/serialport/qt4support/include
- INCLUDEPATH += \
- $$QTSERIALPORT_PROJECT_QT4SUPPORT_INCLUDEDIR \
- $$QTSERIALPORT_PROJECT_QT4SUPPORT_INCLUDEDIR/QtCore \
- $$QTSERIALPORT_PROJECT_QT4SUPPORT_INCLUDEDIR/private
-}
-DEFINES += QT_BUILD_SERIALPORT_LIB
diff --git a/src/serialport/qt4support/serialport.prf b/src/serialport/qt4support/serialport.prf
deleted file mode 100644
index b1d65e1..0000000
--- a/src/serialport/qt4support/serialport.prf
+++ /dev/null
@@ -1,27 +0,0 @@
-!mac:qtAddLibrary(QtSerialPort)
-
-!isEmpty(QTSERIALPORT_BUILD_ROOT) {
- INCLUDEPATH -= $$QMAKE_INCDIR_QT/QtSerialPort
- QMAKE_INCDIR += $$QTSERIALPORT_BUILD_ROOT/include $$QTSERIALPORT_BUILD_ROOT/include/QtSerialPort
-
- QTSERIALPORT_BUILD_SUBDIR = src/serialport
- debug_and_release_target {
- CONFIG(debug, debug|release) {
- QTSERIALPORT_BUILD_SUBDIR = $$QTSERIALPORT_BUILD_SUBDIR/debug
- } else {
- QTSERIALPORT_BUILD_SUBDIR = $$QTSERIALPORT_BUILD_SUBDIR/release
- }
- }
-
- QMAKE_LIBDIR += $$QTSERIALPORT_BUILD_ROOT/$$QTSERIALPORT_BUILD_SUBDIR
-}
-
-mac {
- INCLUDEPATH += $$[QT_INSTALL_HEADERS]/QtSerialPort
-
- if(!debug_and_release|build_pass):CONFIG(debug, debug|release) {
- LIBS += -lQtSerialPort$${QT_LIBINFIX}_debug
- } else {
- LIBS += -lQtSerialPort$${QT_LIBINFIX}
- }
-}
diff --git a/src/serialport/qt4support/src/qlockfile.cpp b/src/serialport/qt4support/src/qlockfile.cpp
deleted file mode 100644
index 1f406cf..0000000
--- a/src/serialport/qt4support/src/qlockfile.cpp
+++ /dev/null
@@ -1,344 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 David Faure <faure+bluesystems@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qlockfile.h"
-#include "qlockfile_p.h"
-
-#include <QtCore/qthread.h>
-#include <QtCore/qelapsedtimer.h>
-#include <QtCore/qdatetime.h>
-
-QT_BEGIN_NAMESPACE
-
-class QLockFileThread : public QThread
-{
-public:
- static void msleep(unsigned long msecs) { QThread::msleep(msecs); }
-};
-
-/*!
- \class QLockFile
- \inmodule QtCore
- \brief The QLockFile class provides locking between processes using a file.
- \since 5.1
-
- A lock file can be used to prevent multiple processes from accessing concurrently
- the same resource. For instance, a configuration file on disk, or a socket, a port,
- a region of shared memory...
-
- Serialization is only guaranteed if all processes that access the shared resource
- use QLockFile, with the same file path.
-
- QLockFile supports two use cases:
- to protect a resource for a short-term operation (e.g. verifying if a configuration
- file has changed before saving new settings), and for long-lived protection of a
- resource (e.g. a document opened by a user in an editor) for an indefinite amount of time.
-
- When protecting for a short-term operation, it is acceptable to call lock() and wait
- until any running operation finishes.
- When protecting a resource over a long time, however, the application should always
- call setStaleLockTime(0) and then tryLock() with a short timeout, in order to
- warn the user that the resource is locked.
-
- If the process holding the lock crashes, the lock file stays on disk and can prevent
- any other process from accessing the shared resource, ever. For this reason, QLockFile
- tries to detect such a "stale" lock file, based on the process ID written into the file,
- and (in case that process ID got reused meanwhile), on the last modification time of
- the lock file (30s by default, for the use case of a short-lived operation).
- If the lock file is found to be stale, it will be deleted.
-
- For the use case of protecting a resource over a long time, you should therefore call
- setStaleLockTime(0), and when tryLock() returns LockFailedError, inform the user
- that the document is locked, possibly using getLockInfo() for more details.
-*/
-
-/*!
- \enum QLockFile::LockError
-
- This enum describes the result of the last call to lock() or tryLock().
-
- \value NoError The lock was acquired successfully.
- \value LockFailedError The lock could not be acquired because another process holds it.
- \value PermissionError The lock file could not be created, for lack of permissions
- in the parent directory.
- \value UnknownError Another error happened, for instance a full partition
- prevented writing out the lock file.
-*/
-
-/*!
- Constructs a new lock file object.
- The object is created in an unlocked state.
- When calling lock() or tryLock(), a lock file named \a fileName will be created,
- if it doesn't already exist.
-
- \sa lock(), unlock()
-*/
-QLockFile::QLockFile(const QString &fileName)
- : d_ptr(new QLockFilePrivate(fileName))
-{
-}
-
-/*!
- Destroys the lock file object.
- If the lock was acquired, this will release the lock, by deleting the lock file.
-*/
-QLockFile::~QLockFile()
-{
- unlock();
-}
-
-/*!
- Sets \a staleLockTime to be the time in milliseconds after which
- a lock file is considered stale.
- The default value is 30000, i.e. 30 seconds.
- If your application typically keeps the file locked for more than 30 seconds
- (for instance while saving megabytes of data for 2 minutes), you should set
- a bigger value using setStaleLockTime().
-
- The value of \a staleLockTime is used by lock() and tryLock() in order
- to determine when an existing lock file is considered stale, i.e. left over
- by a crashed process. This is useful for the case where the PID got reused
- meanwhile, so the only way to detect a stale lock file is by the fact that
- it has been around for a long time.
-
- \sa staleLockTime()
-*/
-void QLockFile::setStaleLockTime(int staleLockTime)
-{
- Q_D(QLockFile);
- d->staleLockTime = staleLockTime;
-}
-
-/*!
- Returns the time in milliseconds after which
- a lock file is considered stale.
-
- \sa setStaleLockTime()
-*/
-int QLockFile::staleLockTime() const
-{
- Q_D(const QLockFile);
- return d->staleLockTime;
-}
-
-/*!
- Returns \c true if the lock was acquired by this QLockFile instance,
- otherwise returns \c false.
-
- \sa lock(), unlock(), tryLock()
-*/
-bool QLockFile::isLocked() const
-{
- Q_D(const QLockFile);
- return d->isLocked;
-}
-
-/*!
- Creates the lock file.
-
- If another process (or another thread) has created the lock file already,
- this function will block until that process (or thread) releases it.
-
- Calling this function multiple times on the same lock from the same
- thread without unlocking first is not allowed. This function will
- \e dead-lock when the file is locked recursively.
-
- Returns \c true if the lock was acquired, false if it could not be acquired
- due to an unrecoverable error, such as no permissions in the parent directory.
-
- \sa unlock(), tryLock()
-*/
-bool QLockFile::lock()
-{
- return tryLock(-1);
-}
-
-/*!
- Attempts to create the lock file. This function returns \c true if the
- lock was obtained; otherwise it returns \c false. If another process (or
- another thread) has created the lock file already, this function will
- wait for at most \a timeout milliseconds for the lock file to become
- available.
-
- Note: Passing a negative number as the \a timeout is equivalent to
- calling lock(), i.e. this function will wait forever until the lock
- file can be locked if \a timeout is negative.
-
- If the lock was obtained, it must be released with unlock()
- before another process (or thread) can successfully lock it.
-
- Calling this function multiple times on the same lock from the same
- thread without unlocking first is not allowed, this function will
- \e always return false when attempting to lock the file recursively.
-
- \sa lock(), unlock()
-*/
-bool QLockFile::tryLock(int timeout)
-{
- Q_D(QLockFile);
- QElapsedTimer timer;
- if (timeout > 0)
- timer.start();
- int sleepTime = 100;
- forever {
- d->lockError = d->tryLock_sys();
- switch (d->lockError) {
- case NoError:
- d->isLocked = true;
- return true;
- case PermissionError:
- case UnknownError:
- return false;
- case LockFailedError:
- if (!d->isLocked && d->isApparentlyStale()) {
- // Stale lock from another thread/process
- // Ensure two processes don't remove it at the same time
- QLockFile rmlock(d->fileName + QLatin1String(".rmlock"));
- if (rmlock.tryLock()) {
- if (d->isApparentlyStale() && d->removeStaleLock())
- continue;
- }
- }
- break;
- }
- if (timeout == 0 || (timeout > 0 && timer.hasExpired(timeout)))
- return false;
- QLockFileThread::msleep(sleepTime);
- if (sleepTime < 5 * 1000)
- sleepTime *= 2;
- }
- // not reached
- return false;
-}
-
-/*!
- \fn void QLockFile::unlock()
- Releases the lock, by deleting the lock file.
-
- Calling unlock() without locking the file first, does nothing.
-
- \sa lock(), tryLock()
-*/
-
-/*!
- Retrieves information about the current owner of the lock file.
-
- If tryLock() returns \c false, and error() returns LockFailedError,
- this function can be called to find out more information about the existing
- lock file:
- \list
- \li the PID of the application (returned in \a pid)
- \li the \a hostname it's running on (useful in case of networked filesystems),
- \li the name of the application which created it (returned in \a appname),
- \endlist
-
- Note that tryLock() automatically deleted the file if there is no
- running application with this PID, so LockFailedError can only happen if there is
- an application with this PID (it could be unrelated though).
-
- This can be used to inform users about the existing lock file and give them
- the choice to delete it. After removing the file using removeStaleLockFile(),
- the application can call tryLock() again.
-
- This function returns \c true if the information could be successfully retrieved, false
- if the lock file doesn't exist or doesn't contain the expected data.
- This can happen if the lock file was deleted between the time where tryLock() failed
- and the call to this function. Simply call tryLock() again if this happens.
-*/
-bool QLockFile::getLockInfo(qint64 *pid, QString *hostname, QString *appname) const
-{
- Q_D(const QLockFile);
- return d->getLockInfo(pid, hostname, appname);
-}
-
-bool QLockFilePrivate::getLockInfo(qint64 *pid, QString *hostname, QString *appname) const
-{
- QFile reader(fileName);
- if (!reader.open(QIODevice::ReadOnly))
- return false;
-
- QByteArray pidLine = reader.readLine();
- pidLine.chop(1);
- QByteArray appNameLine = reader.readLine();
- appNameLine.chop(1);
- QByteArray hostNameLine = reader.readLine();
- hostNameLine.chop(1);
- if (pidLine.isEmpty() || appNameLine.isEmpty())
- return false;
-
- qint64 thePid = pidLine.toLongLong();
- if (pid)
- *pid = thePid;
- if (appname)
- *appname = QString::fromUtf8(appNameLine);
- if (hostname)
- *hostname = QString::fromUtf8(hostNameLine);
- return thePid > 0;
-}
-
-/*!
- Attempts to forcefully remove an existing lock file.
-
- Calling this is not recommended when protecting a short-lived operation: QLockFile
- already takes care of removing lock files after they are older than staleLockTime().
-
- This method should only be called when protecting a resource for a long time, i.e.
- with staleLockTime(0), and after tryLock() returned LockFailedError, and the user
- agreed on removing the lock file.
-
- Returns \c true on success, false if the lock file couldn't be removed. This happens
- on Windows, when the application owning the lock is still running.
-*/
-bool QLockFile::removeStaleLockFile()
-{
- Q_D(QLockFile);
- if (d->isLocked) {
- qWarning("removeStaleLockFile can only be called when not holding the lock");
- return false;
- }
- return d->removeStaleLock();
-}
-
-/*!
- Returns the lock file error status.
-
- If tryLock() returns \c false, this function can be called to find out
- the reason why the locking failed.
-*/
-QLockFile::LockError QLockFile::error() const
-{
- Q_D(const QLockFile);
- return d->lockError;
-}
-
-QT_END_NAMESPACE
diff --git a/src/serialport/qt4support/src/qlockfile_unix.cpp b/src/serialport/qt4support/src/qlockfile_unix.cpp
deleted file mode 100644
index fbcb57e..0000000
--- a/src/serialport/qt4support/src/qlockfile_unix.cpp
+++ /dev/null
@@ -1,191 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 David Faure <faure+bluesystems@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "private/qlockfile_p.h"
-
-#include "QtCore/qtemporaryfile.h"
-#include "QtCore/qcoreapplication.h"
-#include "QtCore/qfileinfo.h"
-#include "QtCore/qdebug.h"
-#include "QtCore/qdatetime.h"
-
-#include <sys/file.h> // flock
-#include <sys/types.h> // kill
-#include <signal.h> // kill
-#include <unistd.h>
-
-#include <errno.h>
-
-QT_BEGIN_NAMESPACE
-
-#define EINTR_LOOP(var, cmd) \
- do { \
- var = cmd; \
- } while (var == -1 && errno == EINTR)
-
-// don't call QT_OPEN or ::open
-// call qt_safe_open
-static inline int qt_safe_open(const char *pathname, int flags, mode_t mode = 0777)
-{
-#ifdef O_CLOEXEC
- flags |= O_CLOEXEC;
-#endif
- int fd;
- EINTR_LOOP(fd, ::open(pathname, flags, mode));
-
- // unknown flags are ignored, so we have no way of verifying if
- // O_CLOEXEC was accepted
- if (fd != -1)
- ::fcntl(fd, F_SETFD, FD_CLOEXEC);
- return fd;
-}
-
-static inline qint64 qt_safe_write(int fd, const void *data, qint64 len)
-{
- qint64 ret = 0;
- EINTR_LOOP(ret, ::write(fd, data, len));
- return ret;
-}
-
-static QString localHostName() // from QHostInfo::localHostName()
-{
- char hostName[512];
- if (gethostname(hostName, sizeof(hostName)) == -1)
- return QString();
- hostName[sizeof(hostName) - 1] = '\0';
- return QString::fromLocal8Bit(hostName);
-}
-
-// ### merge into qt_safe_write?
-static qint64 qt_write_loop(int fd, const char *data, qint64 len)
-{
- qint64 pos = 0;
- while (pos < len) {
- const qint64 ret = qt_safe_write(fd, data + pos, len - pos);
- if (ret == -1) // e.g. partition full
- return pos;
- pos += ret;
- }
- return pos;
-}
-
-static bool setNativeLocks(int fd)
-{
-#if defined(LOCK_EX) && defined(LOCK_NB)
- if (flock(fd, LOCK_EX | LOCK_NB) == -1) // other threads, and other processes on a local fs
- return false;
-#endif
- struct flock flockData;
- flockData.l_type = F_WRLCK;
- flockData.l_whence = SEEK_SET;
- flockData.l_start = 0;
- flockData.l_len = 0; // 0 = entire file
- flockData.l_pid = getpid();
- if (fcntl(fd, F_SETLK, &flockData) == -1) // for networked filesystems
- return false;
- return true;
-}
-
-QLockFile::LockError QLockFilePrivate::tryLock_sys()
-{
- // Assemble data, to write in a single call to write
- // (otherwise we'd have to check every write call)
- // Use operator% from the fast builder to avoid multiple memory allocations.
- QByteArray fileData = QByteArray::number(QCoreApplication::applicationPid()) + '\n'
- + qAppName().toUtf8() + '\n'
- + localHostName().toUtf8() + '\n';
-
- const QByteArray lockFileName = QFile::encodeName(fileName);
- const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY | O_CREAT | O_EXCL, 0644);
- if (fd < 0) {
- switch (errno) {
- case EEXIST:
- return QLockFile::LockFailedError;
- case EACCES:
- case EROFS:
- return QLockFile::PermissionError;
- default:
- return QLockFile::UnknownError;
- }
- }
- // Ensure nobody else can delete the file while we have it
- if (!setNativeLocks(fd))
- qWarning() << "setNativeLocks failed:" << strerror(errno);
-
- // We hold the lock, continue.
- fileHandle = fd;
-
- QLockFile::LockError error = QLockFile::NoError;
- if (qt_write_loop(fd, fileData.constData(), fileData.size()) < fileData.size())
- error = QLockFile::UnknownError; // partition full
- return error;
-}
-
-bool QLockFilePrivate::removeStaleLock()
-{
- const QByteArray lockFileName = QFile::encodeName(fileName);
- const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY, 0644);
- if (fd < 0) // gone already?
- return false;
- bool success = setNativeLocks(fd) && (::unlink(lockFileName) == 0);
- close(fd);
- return success;
-}
-
-bool QLockFilePrivate::isApparentlyStale() const
-{
- qint64 pid;
- QString hostname, appname;
- if (!getLockInfo(&pid, &hostname, &appname))
- return false;
- if (hostname == localHostName()) {
- if (::kill(pid, 0) == -1 && errno == ESRCH)
- return true; // PID doesn't exist anymore
- }
- const qint64 age = QFileInfo(fileName).lastModified().msecsTo(QDateTime::currentDateTime());
- return staleLockTime > 0 && age > staleLockTime;
-}
-
-void QLockFile::unlock()
-{
- Q_D(QLockFile);
- if (!d->isLocked)
- return;
- close(d->fileHandle);
- d->fileHandle = -1;
- QFile::remove(d->fileName);
- d->lockError = QLockFile::NoError;
- d->isLocked = false;
-}
-
-QT_END_NAMESPACE
diff --git a/src/serialport/qtudev_p.h b/src/serialport/qtudev_p.h
index c83a5c0..6f2cabd 100644
--- a/src/serialport/qtudev_p.h
+++ b/src/serialport/qtudev_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -93,15 +93,9 @@ GENERATE_SYMBOL_VARIABLE(void, udev_device_unref, struct udev_device *)
GENERATE_SYMBOL_VARIABLE(void, udev_enumerate_unref, struct udev_enumerate *)
GENERATE_SYMBOL_VARIABLE(void, udev_unref, struct udev *)
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
inline QFunctionPointer resolveSymbol(QLibrary *udevLibrary, const char *symbolName)
{
QFunctionPointer symbolFunctionPointer = udevLibrary->resolve(symbolName);
-#else
-inline void *resolveSymbol(QLibrary *udevLibrary, const char *symbolName)
-{
- void *symbolFunctionPointer = udevLibrary->resolve(symbolName);
-#endif
if (!symbolFunctionPointer)
qWarning("Failed to resolve the udev symbol: %s", symbolName);
diff --git a/src/serialport/serialport-lib.pri b/src/serialport/serialport-lib.pri
index 9c9b076..e1a2333 100644
--- a/src/serialport/serialport-lib.pri
+++ b/src/serialport/serialport-lib.pri
@@ -1,19 +1,9 @@
INCLUDEPATH += $$PWD
-unix {
- greaterThan(QT_MAJOR_VERSION, 4) {
- contains(QT_CONFIG, libudev) {
- DEFINES += LINK_LIBUDEV
- INCLUDEPATH += $$QMAKE_INCDIR_LIBUDEV
- LIBS_PRIVATE += $$QMAKE_LIBS_LIBUDEV
- }
- } else {
- packagesExist(libudev) {
- CONFIG += link_pkgconfig
- DEFINES += LINK_LIBUDEV
- PKGCONFIG += libudev
- }
- }
+unix:contains(QT_CONFIG, libudev) {
+ DEFINES += LINK_LIBUDEV
+ INCLUDEPATH += $$QMAKE_INCDIR_LIBUDEV
+ LIBS_PRIVATE += $$QMAKE_LIBS_LIBUDEV
}
PUBLIC_HEADERS += \
@@ -30,9 +20,6 @@ SOURCES += \
$$PWD/qserialportinfo.cpp
win32:!wince* {
- PRIVATE_HEADERS += \
- $$PWD/qserialport_win_p.h
-
SOURCES += \
$$PWD/qserialport_win.cpp \
$$PWD/qserialportinfo_win.cpp
@@ -41,42 +28,12 @@ win32:!wince* {
}
wince* {
- PRIVATE_HEADERS += \
- $$PWD/qserialport_wince_p.h
-
SOURCES += \
$$PWD/qserialport_wince.cpp \
$$PWD/qserialportinfo_wince.cpp
}
-symbian {
- MMP_RULES += EXPORTUNFROZEN
- #MMP_RULES += DEBUGGABLE_UDEBONLY
- TARGET.UID3 = 0xE7E62DFD
- TARGET.CAPABILITY =
- TARGET.EPOCALLOWDLLDATA = 1
- addFiles.sources = QtSerialPort.dll
- addFiles.path = !:/sys/bin
- DEPLOYMENT += addFiles
-
- # FIXME !!!
- #INCLUDEPATH += c:/Nokia/devices/Nokia_Symbian3_SDK_v1.0/epoc32/include/platform
- INCLUDEPATH += c:/QtSDK/Symbian/SDKs/Symbian3Qt473/epoc32/include/platform
-
- PRIVATE_HEADERS += \
- $$PWD/qserialport_symbian_p.h
-
- SOURCES += \
- $$PWD/qserialport_symbian.cpp \
- $$PWD/qserialportinfo_symbian.cpp
-
- LIBS_PRIVATE += -leuser -lefsrv -lc32
-}
-
unix:!symbian {
- PRIVATE_HEADERS += \
- $$PWD/qserialport_unix_p.h
-
SOURCES += \
$$PWD/qserialport_unix.cpp
diff --git a/src/serialport/serialport.pro b/src/serialport/serialport.pro
index feb6e9c..40c0339 100644
--- a/src/serialport/serialport.pro
+++ b/src/serialport/serialport.pro
@@ -1,19 +1,10 @@
-QT = core
+TARGET = QtSerialPort
+QT = core-private
QMAKE_DOCS = $$PWD/doc/qtserialport.qdocconf
-include($$PWD/serialport-lib.pri)
-greaterThan(QT_MAJOR_VERSION, 4) {
- load(qt_build_config)
- QT += core-private
- TARGET = QtSerialPort
- load(qt_module)
-} else {
- TEMPLATE = lib
- TARGET = $$qtLibraryTarget(QtSerialPort$$QT_LIBINFIX)
- include($$PWD/qt4support/install-helper.pri)
- CONFIG += module create_prl
- mac:QMAKE_FRAMEWORK_BUNDLE_NAME = $$TARGET
-}
+load(qt_module)
+
+include($$PWD/serialport-lib.pri)
PRECOMPILED_HEADER =
diff --git a/tests/auto/qserialport/qserialport.pro b/tests/auto/qserialport/qserialport.pro
index c16cd5e..5435fa3 100644
--- a/tests/auto/qserialport/qserialport.pro
+++ b/tests/auto/qserialport/qserialport.pro
@@ -2,10 +2,6 @@ QT = core testlib
TARGET = tst_qserialport
#CONFIG += testcase
-greaterThan(QT_MAJOR_VERSION, 4) {
- QT += serialport
-} else {
- include($$QTSERIALPORT_PROJECT_ROOT/src/serialport/qt4support/serialport.prf)
-}
+QT += serialport
SOURCES = tst_qserialport.cpp
diff --git a/tests/auto/qserialport/tst_qserialport.cpp b/tests/auto/qserialport/tst_qserialport.cpp
index e064333..1a714b2 100644
--- a/tests/auto/qserialport/tst_qserialport.cpp
+++ b/tests/auto/qserialport/tst_qserialport.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -56,12 +56,7 @@ public:
static void enterLoopMsecs(int msecs)
{
++loopLevel;
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
QTestEventLoop::instance().enterLoopMSecs(msecs);
-#else
- Q_UNUSED(msecs);
- QTestEventLoop::instance().enterLoop(1);
-#endif
--loopLevel;
}
@@ -112,6 +107,8 @@ private slots:
void readAfterInputClear();
#endif
+ void controlBreak();
+
protected slots:
void handleBytesWrittenAndExitLoopSlot(qint64 bytesWritten);
void handleBytesWrittenAndExitLoopSlot2(qint64 bytesWritten);
@@ -174,11 +171,7 @@ void tst_QSerialPort::initTestCase()
"\n";
#endif
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
QSKIP(message);
-#else
- QSKIP(message, SkipAll);
-#endif
} else {
m_availablePortNames << m_senderPortName << m_receiverPortName;
}
@@ -241,11 +234,7 @@ void tst_QSerialPort::constructByInfo()
static const char message[] =
"Test doesn't work because the specified serial ports aren't"
" found in system and can't be constructed by QSerialPortInfo.\n";
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
QSKIP(message);
-#else
- QSKIP(message, SkipAll);
-#endif
}
#endif
@@ -332,11 +321,7 @@ void tst_QSerialPort::handleBytesWrittenAndExitLoopSlot(qint64 bytesWritten)
void tst_QSerialPort::flush()
{
#ifdef Q_OS_WIN
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
QSKIP("flush() does not work on Windows");
-#else
- QSKIP("flush() does not work on Windows", SkipAll);
-#endif
#endif
QSerialPort serialPort(m_senderPortName);
@@ -367,11 +352,7 @@ void tst_QSerialPort::handleBytesWrittenAndExitLoopSlot2(qint64 bytesWritten)
void tst_QSerialPort::doubleFlush()
{
#ifdef Q_OS_WIN
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
QSKIP("flush() does not work on Windows");
-#else
- QSKIP("flush() does not work on Windows", SkipAll);
-#endif
#endif
QSerialPort serialPort(m_senderPortName);
@@ -760,5 +741,62 @@ void tst_QSerialPort::readAfterInputClear()
}
#endif
+class BreakReader : public QObject
+{
+ Q_OBJECT
+public:
+ explicit BreakReader(QSerialPort &port)
+ : serialPort(port)
+ {
+ connect(&serialPort, SIGNAL(readyRead()), this, SLOT(receive()));
+ }
+
+private slots:
+ void receive()
+ {
+ tst_QSerialPort::exitLoop();
+ }
+
+private:
+ QSerialPort &serialPort;
+};
+
+void tst_QSerialPort::controlBreak()
+{
+#ifdef Q_OS_WIN
+ clearReceiver();
+#endif
+
+ QSerialPort senderPort(m_senderPortName);
+ QVERIFY(senderPort.open(QSerialPort::WriteOnly));
+ QCOMPARE(senderPort.isBreakEnabled(), false);
+
+ QSignalSpy breakSpy(&senderPort, SIGNAL(breakEnabledChanged(bool)));
+ QVERIFY(breakSpy.isValid());
+
+ QSerialPort receiverPort(m_receiverPortName);
+ QVERIFY(receiverPort.open(QSerialPort::ReadOnly));
+
+ BreakReader reader(receiverPort);
+
+ QVERIFY(senderPort.setBreakEnabled(true));
+ QCOMPARE(senderPort.isBreakEnabled(), true);
+
+ enterLoop(1);
+ QVERIFY2(!timeout(), "Timed out when waiting for the read of break state.");
+ QVERIFY(receiverPort.bytesAvailable() > 0);
+
+ foreach (const char c, receiverPort.readAll()) {
+ QCOMPARE(c, char(0));
+ }
+
+ QVERIFY(senderPort.setBreakEnabled(false));
+ QCOMPARE(senderPort.isBreakEnabled(), false);
+
+ QCOMPARE(breakSpy.count(), 2);
+ QCOMPARE(qvariant_cast<bool>(breakSpy.at(0).at(0)), true);
+ QCOMPARE(qvariant_cast<bool>(breakSpy.at(1).at(0)), false);
+}
+
QTEST_MAIN(tst_QSerialPort)
#include "tst_qserialport.moc"
diff --git a/tests/auto/qserialportinfo/tst_qserialportinfo.cpp b/tests/auto/qserialportinfo/tst_qserialportinfo.cpp
index e421aa4..f0e6e9a 100644
--- a/tests/auto/qserialportinfo/tst_qserialportinfo.cpp
+++ b/tests/auto/qserialportinfo/tst_qserialportinfo.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
** Copyright (C) 2014 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -83,11 +75,7 @@ void tst_QSerialPortInfo::initTestCase()
#else
"\n";
#endif
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
QSKIP(message);
-#else
- QSKIP(message, SkipAll);
-#endif
} else {
m_availablePortNames << m_senderPortName << m_receiverPortName;
}
diff --git a/tests/auto/qserialportinfoprivate/tst_qserialportinfoprivate.cpp b/tests/auto/qserialportinfoprivate/tst_qserialportinfoprivate.cpp
index cfd2d85..fa76a1a 100644
--- a/tests/auto/qserialportinfoprivate/tst_qserialportinfoprivate.cpp
+++ b/tests/auto/qserialportinfoprivate/tst_qserialportinfoprivate.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
** Copyright (C) 2014 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -64,14 +56,14 @@ void tst_QSerialPortInfoPrivate::canonical_data()
QTest::addColumn<QString>("name");
QTest::addColumn<QString>("location");
-#if defined (Q_OS_WINCE)
+#if defined(Q_OS_WINCE)
QTest::newRow("Test1") << "COM1" << "COM1" << "COM1:";
QTest::newRow("Test2") << "COM1:" << "COM1" << "COM1:";
-#elif defined (Q_OS_WIN32)
+#elif defined(Q_OS_WIN32)
QTest::newRow("Test1") << "COM1" << "COM1" << "\\\\.\\COM1";
QTest::newRow("Test2") << "\\\\.\\COM1" << "COM1" << "\\\\.\\COM1";
QTest::newRow("Test3") << "//./COM1" << "COM1" << "//./COM1";
-#elif defined (Q_OS_OSX)
+#elif defined(Q_OS_OSX)
QTest::newRow("Test1") << "ttyS0" << "ttyS0" << "/dev/ttyS0";
QTest::newRow("Test2") << "cu.serial1" << "cu.serial1" << "/dev/cu.serial1";
QTest::newRow("Test3") << "tty.serial1" << "tty.serial1" << "/dev/tty.serial1";
@@ -84,7 +76,7 @@ void tst_QSerialPortInfoPrivate::canonical_data()
QTest::newRow("Test10") << "serial/ttyS0" << "serial/ttyS0" << "/dev/serial/ttyS0";
QTest::newRow("Test11") << "./ttyS0" << "./ttyS0" << "./ttyS0";
QTest::newRow("Test12") << "../ttyS0" << "../ttyS0" << "../ttyS0";
-#elif defined (Q_OS_UNIX)
+#elif defined(Q_OS_UNIX)
QTest::newRow("Test1") << "ttyS0" << "ttyS0" << "/dev/ttyS0";
QTest::newRow("Test2") << "/dev/ttyS0" << "ttyS0" << "/dev/ttyS0";
QTest::newRow("Test3") << "/dev/serial/ttyS0" << "serial/ttyS0" << "/dev/serial/ttyS0";
diff --git a/tests/manual/qserialport/qserialport.pro b/tests/manual/qserialport/qserialport.pro
index 504e766..3858b6b 100644
--- a/tests/manual/qserialport/qserialport.pro
+++ b/tests/manual/qserialport/qserialport.pro
@@ -2,10 +2,6 @@ TEMPLATE = app
TARGET = tst_qserialport
QT = core testlib
-greaterThan(QT_MAJOR_VERSION, 4) {
- QT += serialport
-} else {
- include($$QTSERIALPORT_PROJECT_ROOT/src/serialport/qt4support/serialport.prf)
-}
+QT += serialport
SOURCES += tst_qserialport.cpp
diff --git a/tests/manual/qserialport/tst_qserialport.cpp b/tests/manual/qserialport/tst_qserialport.cpp
index 961e855..f6f3252 100644
--- a/tests/manual/qserialport/tst_qserialport.cpp
+++ b/tests/manual/qserialport/tst_qserialport.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -61,11 +61,7 @@ void tst_QSerialPort::initTestCase()
serialPortInfoList = QSerialPortInfo::availablePorts();
if (serialPortInfoList.isEmpty()) {
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
QSKIP("Test doesn't work because the serial ports are not detected.");
-#else
- QSKIP("Test doesn't work because the serial ports are not detected.", SkipAll);
-#endif
}
}
diff --git a/tests/manual/qserialportinfo/qserialportinfo.pro b/tests/manual/qserialportinfo/qserialportinfo.pro
index 8e08264..57f6ea6 100644
--- a/tests/manual/qserialportinfo/qserialportinfo.pro
+++ b/tests/manual/qserialportinfo/qserialportinfo.pro
@@ -2,10 +2,6 @@ TEMPLATE = app
TARGET = tst_qserialportinfo
QT = core testlib
-greaterThan(QT_MAJOR_VERSION, 4) {
- QT += serialport
-} else {
- include($$QTSERIALPORT_PROJECT_ROOT/src/serialport/qt4support/serialport.prf)
-}
+QT += serialport
SOURCES += tst_qserialportinfo.cpp
diff --git a/tests/manual/qserialportinfo/tst_qserialportinfo.cpp b/tests/manual/qserialportinfo/tst_qserialportinfo.cpp
index 9f2d245..3bcc0b3 100644
--- a/tests/manual/qserialportinfo/tst_qserialportinfo.cpp
+++ b/tests/manual/qserialportinfo/tst_qserialportinfo.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2013 Laszlo Papp <lpapp@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialPort module of the Qt Toolkit.
**
@@ -11,9 +11,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -24,8 +24,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$