summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarsten Heimrich <karsten.heimrich@qt.io>2021-01-18 10:44:03 +0100
committerKarsten Heimrich <karsten.heimrich@qt.io>2021-01-22 12:39:54 +0100
commit36c0c8d92adffbaecb3c195e1a40eff67857e19e (patch)
tree7616598895e2bf3271c65bcc3aea2909a6a51c66 /src
parent6a14f2a56866c6ff636f6e0619ca5d6b479f9fea (diff)
QtSerialPort: apply API changes for Qt6
Task-number: QTBUG-89880 Change-Id: If64f461fa8b6bb207dd6f116f104bd894f04a4e4 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/serialport/qserialport.cpp202
-rw-r--r--src/serialport/qserialport.h82
-rw-r--r--src/serialport/qserialportinfo.cpp26
-rw-r--r--src/serialport/qserialportinfo.h6
-rw-r--r--src/serialport/qserialportinfo_freebsd.cpp31
-rw-r--r--src/serialport/qserialportinfo_osx.cpp33
-rw-r--r--src/serialport/qserialportinfo_unix.cpp33
-rw-r--r--src/serialport/qserialportinfo_win.cpp32
8 files changed, 5 insertions, 440 deletions
diff --git a/src/serialport/qserialport.cpp b/src/serialport/qserialport.cpp
index 44d6cd14..7f10d404 100644
--- a/src/serialport/qserialport.cpp
+++ b/src/serialport/qserialport.cpp
@@ -102,9 +102,6 @@ void QSerialPortPrivate::setError(const QSerialPortErrorInfo &errorInfo)
error = errorInfo.errorCode;
q->setErrorString(errorInfo.errorString);
emit q->errorOccurred(error);
-#if QT_DEPRECATED_SINCE(5, 8)
- emit q->error(error);
-#endif
}
/*!
@@ -235,9 +232,6 @@ void QSerialPortPrivate::setError(const QSerialPortErrorInfo &errorInfo)
\value Baud38400 38400 baud.
\value Baud57600 57600 baud.
\value Baud115200 115200 baud.
- \value UnknownBaud Unknown baud. This value is obsolete. It is provided to
- keep old source code working. We strongly advise against
- using it in new code.
\sa QSerialPort::baudRate
*/
@@ -259,9 +253,6 @@ void QSerialPortPrivate::setError(const QSerialPortErrorInfo &errorInfo)
is used for most kinds of data, as this size matches
the size of a byte. It is almost universally used in
newer applications.
- \value UnknownDataBits Unknown number of bits. This value is obsolete. It
- is provided to keep old source code working. We
- strongly advise against using it in new code.
\sa QSerialPort::dataBits
*/
@@ -285,9 +276,6 @@ void QSerialPortPrivate::setError(const QSerialPortErrorInfo &errorInfo)
\value MarkParity Mark parity. The parity bit is always set to the
mark signal condition (logical 1). It does not
provide error detection information.
- \value UnknownParity Unknown parity. This value is obsolete. It is
- provided to keep old source code working. We
- strongly advise against using it in new code.
\sa QSerialPort::parity
*/
@@ -300,9 +288,6 @@ void QSerialPortPrivate::setError(const QSerialPortErrorInfo &errorInfo)
\value OneStop 1 stop bit.
\value OneAndHalfStop 1.5 stop bits. This is only for the Windows platform.
\value TwoStop 2 stop bits.
- \value UnknownStopBits Unknown number of stop bits. This value is obsolete.
- It is provided to keep old source code working. We
- strongly advise against using it in new code.
\sa QSerialPort::stopBits
*/
@@ -315,9 +300,6 @@ void QSerialPortPrivate::setError(const QSerialPortErrorInfo &errorInfo)
\value NoFlowControl No flow control.
\value HardwareControl Hardware flow control (RTS/CTS).
\value SoftwareControl Software flow control (XON/XOFF).
- \value UnknownFlowControl Unknown flow control. This value is obsolete. It
- is provided to keep old source code working. We
- strongly advise against using it in new code.
\sa QSerialPort::flowControl
*/
@@ -328,14 +310,6 @@ void QSerialPortPrivate::setError(const QSerialPortErrorInfo &errorInfo)
This enum describes the possible RS-232 pinout signals.
\value NoSignal No line active
- \value TransmittedDataSignal TxD (Transmitted Data). This value is
- obsolete. It is provided to keep old
- source code working. We strongly
- advise against using it in new code.
- \value ReceivedDataSignal RxD (Received Data). This value is
- obsolete. It is provided to keep old
- source code working. We strongly
- advise against using it in new code.
\value DataTerminalReadySignal DTR (Data Terminal Ready).
\value DataCarrierDetectSignal DCD (Data Carrier Detect).
\value DataSetReadySignal DSR (Data Set Ready).
@@ -349,24 +323,6 @@ void QSerialPortPrivate::setError(const QSerialPortErrorInfo &errorInfo)
QSerialPort::requestToSend
*/
-#if QT_DEPRECATED_SINCE(5, 2)
-/*!
- \enum QSerialPort::DataErrorPolicy
- \obsolete
-
- This enum describes the policies for the received symbols
- while parity errors were detected.
-
- \value SkipPolicy Skips the bad character.
- \value PassZeroPolicy Replaces bad character with zero.
- \value IgnorePolicy Ignores the error for a bad character.
- \value StopReceivingPolicy Stops data reception on error.
- \value UnknownPolicy Unknown policy.
-
- \sa QSerialPort::dataErrorPolicy
-*/
-#endif
-
/*!
\enum QSerialPort::SerialPortError
@@ -391,18 +347,6 @@ void QSerialPortPrivate::setError(const QSerialPortErrorInfo &errorInfo)
device is open. This value was introduced in
QtSerialPort 5.2.
- \value ParityError Parity error detected by the hardware while
- reading data. This value is obsolete. We strongly
- advise against using it in new code.
-
- \value FramingError Framing error detected by the hardware while
- reading data. This value is obsolete. We strongly
- advise against using it in new code.
-
- \value BreakConditionError Break condition detected by the hardware on
- the input line. This value is obsolete. We strongly
- advise against using it in new code.
-
\value WriteError An I/O error occurred while writing the data.
\value ReadError An I/O error occurred while reading the data.
@@ -429,7 +373,6 @@ void QSerialPortPrivate::setError(const QSerialPortErrorInfo &errorInfo)
*/
QSerialPort::QSerialPort(QObject *parent)
: QIODevice(*new QSerialPortPrivate, parent)
- , d_dummy(0)
{
}
@@ -441,7 +384,6 @@ QSerialPort::QSerialPort(QObject *parent)
*/
QSerialPort::QSerialPort(const QString &name, QObject *parent)
: QIODevice(*new QSerialPortPrivate, parent)
- , d_dummy(0)
{
setPortName(name);
}
@@ -453,7 +395,6 @@ QSerialPort::QSerialPort(const QString &name, QObject *parent)
*/
QSerialPort::QSerialPort(const QSerialPortInfo &serialPortInfo, QObject *parent)
: QIODevice(*new QSerialPortPrivate, parent)
- , d_dummy(0)
{
setPort(serialPortInfo);
}
@@ -581,53 +522,6 @@ void QSerialPort::close()
QIODevice::close();
}
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
-
-#if QT_DEPRECATED_SINCE(5, 3)
-/*!
- \property QSerialPort::settingsRestoredOnClose
- \brief the flag which specifies to restore the previous settings when closing
- the serial port.
- \obsolete
-
- If this flag is \c true, the settings will be restored; otherwise not.
- The default state of the QSerialPort class is to restore the
- settings.
-*/
-void QSerialPort::setSettingsRestoredOnClose(bool restore)
-{
- Q_D(QSerialPort);
-
- if (d->settingsRestoredOnClose != restore) {
- d->settingsRestoredOnClose = restore;
- emit settingsRestoredOnCloseChanged(d->settingsRestoredOnClose);
- }
-}
-
-QT_WARNING_POP
-
-bool QSerialPort::settingsRestoredOnClose() const
-{
- Q_D(const QSerialPort);
- return d->settingsRestoredOnClose;
-}
-#endif // QT_DEPRECATED_SINCE(5,3)
-
-#if QT_DEPRECATED_SINCE(5, 5)
-/*!
- \fn void QSerialPort::settingsRestoredOnCloseChanged(bool restore)
- \obsolete
-
- This signal is emitted after the flag which specifies to restore the
- previous settings while closing the serial port has been changed. The new
- flag which specifies to restore the previous settings while closing the serial
- port is passed as \a restore.
-
- \sa QSerialPort::settingsRestoredOnClose
-*/
-#endif // QT_DEPRECATED_SINCE(5, 5)
-
/*!
\property QSerialPort::baudRate
\brief the data baud rate for the desired direction
@@ -1087,62 +981,6 @@ bool QSerialPort::atEnd() const
return QIODevice::atEnd();
}
-#if QT_DEPRECATED_SINCE(5, 2)
-/*!
- \property QSerialPort::dataErrorPolicy
- \brief the error policy for how the process receives characters in the case where
- a parity error is detected.
- \obsolete
-
- If the setting is successful, returns \c true; otherwise returns \c false. The
- default policy set is IgnorePolicy.
-
- \note The serial port has to be open before trying to set this property;
- otherwise returns \c 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::setDataErrorPolicy(DataErrorPolicy policy)
-{
- Q_D(QSerialPort);
-
- if (!isOpen()) {
- d->setError(QSerialPortErrorInfo(QSerialPort::NotOpenError));
- qWarning("%s: device not open", Q_FUNC_INFO);
- return false;
- }
-
- if (policy != QSerialPort::IgnorePolicy) {
- d->setError(QSerialPortErrorInfo(QSerialPort::UnsupportedOperationError,
- tr("The device supports only the ignoring policy")));
- return false;
- }
-
- return true;
-}
-
-QSerialPort::DataErrorPolicy QSerialPort::dataErrorPolicy() const
-{
- return QSerialPort::IgnorePolicy;
-}
-#endif // QT_DEPRECATED_SINCE(5, 2)
-
-#if QT_DEPRECATED_SINCE(5, 5)
-/*!
- \fn void QSerialPort::dataErrorPolicyChanged(DataErrorPolicy policy)
- \obsolete
-
- This signal is emitted after the error policy for how the process receives
- characters in case of parity error detection has been changed. The new error
- policy for how the process receives the character in case of parity error
- detection is passed as \a policy.
-
- \sa QSerialPort::dataErrorPolicy
-*/
-#endif // QT_DEPRECATED_SINCE(5, 5)
-
/*!
\property QSerialPort::error
\brief the error status of the serial port
@@ -1166,15 +1004,6 @@ void QSerialPort::clearError()
d->setError(QSerialPortErrorInfo(QSerialPort::NoError));
}
-#if QT_DEPRECATED_SINCE(5, 8)
-/*!
- \fn void QSerialPort::error(SerialPortError error)
- \obsolete
-
- Use errorOccurred() instead.
-*/
-#endif
-
/*!
\fn void QSerialPort::errorOccurred(SerialPortError error)
\since 5.8
@@ -1327,37 +1156,6 @@ bool QSerialPort::waitForBytesWritten(int msecs)
return d->waitForBytesWritten(msecs);
}
-#if QT_DEPRECATED_SINCE(5, 5)
-/*!
- Sends a continuous stream of zero bits during a specified period
- of time \a duration in msec if the terminal is using asynchronous
- serial data. If successful, returns \c true; otherwise returns \c false.
-
- If the duration is zero then zero bits are transmitted by at least
- \c 0.25 seconds, but no more than \c 0.5 seconds.
-
- If the duration is non zero then zero bits are transmitted within a certain
- period of time depending on the implementation.
-
- \note The serial port has to be open before trying to send a break
- duration; otherwise returns \c false and sets the NotOpenError error code.
-
- \sa setBreakEnabled()
-*/
-bool QSerialPort::sendBreak(int duration)
-{
- Q_D(QSerialPort);
-
- if (!isOpen()) {
- d->setError(QSerialPortErrorInfo(QSerialPort::NotOpenError));
- qWarning("%s: device not open", Q_FUNC_INFO);
- return false;
- }
-
- return d->sendBreak(duration);
-}
-#endif // QT_DEPRECATED_SINCE(5, 5)
-
/*!
\property QSerialPort::breakEnabled
\since 5.5
diff --git a/src/serialport/qserialport.h b/src/serialport/qserialport.h
index c4c7367a..99890bf8 100644
--- a/src/serialport/qserialport.h
+++ b/src/serialport/qserialport.h
@@ -60,15 +60,9 @@ class Q_SERIALPORT_EXPORT QSerialPort : public QIODevice
Q_PROPERTY(Parity parity READ parity WRITE setParity NOTIFY parityChanged)
Q_PROPERTY(StopBits stopBits READ stopBits WRITE setStopBits NOTIFY stopBitsChanged)
Q_PROPERTY(FlowControl flowControl READ flowControl WRITE setFlowControl NOTIFY flowControlChanged)
-#if QT_DEPRECATED_SINCE(5, 2)
- Q_PROPERTY(DataErrorPolicy dataErrorPolicy READ dataErrorPolicy WRITE setDataErrorPolicy NOTIFY dataErrorPolicyChanged)
-#endif
Q_PROPERTY(bool dataTerminalReady READ isDataTerminalReady WRITE setDataTerminalReady NOTIFY dataTerminalReadyChanged)
Q_PROPERTY(bool requestToSend READ isRequestToSend WRITE setRequestToSend NOTIFY requestToSendChanged)
Q_PROPERTY(SerialPortError error READ error RESET clearError NOTIFY error)
-#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)
#if defined(Q_OS_WIN32)
@@ -95,8 +89,7 @@ public:
Baud19200 = 19200,
Baud38400 = 38400,
Baud57600 = 57600,
- Baud115200 = 115200,
- UnknownBaud = -1
+ Baud115200 = 115200
};
Q_ENUM(BaudRate)
@@ -104,8 +97,7 @@ public:
Data5 = 5,
Data6 = 6,
Data7 = 7,
- Data8 = 8,
- UnknownDataBits = -1
+ Data8 = 8
};
Q_ENUM(DataBits)
@@ -114,31 +106,26 @@ public:
EvenParity = 2,
OddParity = 3,
SpaceParity = 4,
- MarkParity = 5,
- UnknownParity = -1
+ MarkParity = 5
};
Q_ENUM(Parity)
enum StopBits {
OneStop = 1,
OneAndHalfStop = 3,
- TwoStop = 2,
- UnknownStopBits = -1
+ TwoStop = 2
};
Q_ENUM(StopBits)
enum FlowControl {
NoFlowControl,
HardwareControl,
- SoftwareControl,
- UnknownFlowControl = -1
+ SoftwareControl
};
Q_ENUM(FlowControl)
enum PinoutSignal {
NoSignal = 0x00,
- TransmittedDataSignal = 0x01,
- ReceivedDataSignal = 0x02,
DataTerminalReadySignal = 0x04,
DataCarrierDetectSignal = 0x08,
DataSetReadySignal = 0x10,
@@ -151,37 +138,11 @@ public:
Q_FLAG(PinoutSignal)
Q_DECLARE_FLAGS(PinoutSignals, PinoutSignal)
-#if QT_DEPRECATED_SINCE(5, 2)
-#if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG)
-#pragma deprecated(UnknownBaud)
-#pragma deprecated(UnknownDataBits)
-#pragma deprecated(UnknownParity)
-#pragma deprecated(UnknownStopBits)
-#pragma deprecated(UnknownFlowControl)
-#pragma deprecated(TransmittedDataSignal)
-#pragma deprecated(ReceivedDataSignal)
-#endif
-#endif
-
-#if QT_DEPRECATED_SINCE(5, 2)
- enum DataErrorPolicy {
- SkipPolicy,
- PassZeroPolicy,
- IgnorePolicy,
- StopReceivingPolicy,
- UnknownPolicy = -1
- };
- Q_ENUM(DataErrorPolicy)
-#endif
-
enum SerialPortError {
NoError,
DeviceNotFoundError,
PermissionError,
OpenError,
- ParityError,
- FramingError,
- BreakConditionError,
WriteError,
ReadError,
ResourceError,
@@ -192,14 +153,6 @@ public:
};
Q_ENUM(SerialPortError)
-#if QT_DEPRECATED_SINCE(5, 6)
-#if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG)
-#pragma deprecated(ParityError)
-#pragma deprecated(FramingError)
-#pragma deprecated(BreakConditionError)
-#endif
-#endif
-
explicit QSerialPort(QObject *parent = nullptr);
explicit QSerialPort(const QString &name, QObject *parent = nullptr);
explicit QSerialPort(const QSerialPortInfo &info, QObject *parent = nullptr);
@@ -213,11 +166,6 @@ public:
bool open(OpenMode mode) override;
void close() override;
-#if QT_DEPRECATED_SINCE(5, 3)
- QT_DEPRECATED void setSettingsRestoredOnClose(bool restore);
- QT_DEPRECATED bool settingsRestoredOnClose() const;
-#endif
-
bool setBaudRate(qint32 baudRate, Directions directions = AllDirections);
qint32 baudRate(Directions directions = AllDirections) const;
@@ -245,11 +193,6 @@ public:
bool clear(Directions directions = AllDirections);
bool atEnd() const override; // ### Qt6: remove me
-#if QT_DEPRECATED_SINCE(5, 2)
- QT_DEPRECATED bool setDataErrorPolicy(DataErrorPolicy policy = IgnorePolicy);
- QT_DEPRECATED DataErrorPolicy dataErrorPolicy() const;
-#endif
-
SerialPortError error() const;
void clearError();
@@ -265,9 +208,6 @@ public:
bool waitForReadyRead(int msecs = 30000) override;
bool waitForBytesWritten(int msecs = 30000) override;
-#if QT_DEPRECATED_SINCE(5, 5)
- QT_DEPRECATED bool sendBreak(int duration = 0);
-#endif
bool setBreakEnabled(bool set = true);
bool isBreakEnabled() const;
@@ -279,18 +219,9 @@ Q_SIGNALS:
void parityChanged(QSerialPort::Parity parity);
void stopBitsChanged(QSerialPort::StopBits stopBits);
void flowControlChanged(QSerialPort::FlowControl flowControl);
-#if QT_DEPRECATED_SINCE(5, 5)
- QT_DEPRECATED void dataErrorPolicyChanged(QSerialPort::DataErrorPolicy policy);
-#endif
void dataTerminalReadyChanged(bool set);
void requestToSendChanged(bool set);
-#if QT_DEPRECATED_SINCE(5, 8)
- void error(QSerialPort::SerialPortError serialPortError);
-#endif
void errorOccurred(QSerialPort::SerialPortError error);
-#if QT_DEPRECATED_SINCE(5, 5)
- QT_DEPRECATED void settingsRestoredOnCloseChanged(bool restore);
-#endif
void breakEnabledChanged(bool set);
protected:
@@ -299,9 +230,6 @@ protected:
qint64 writeData(const char *data, qint64 maxSize) override;
private:
- // ### Qt6: remove me.
- QSerialPortPrivate * const d_dummy;
-
Q_DISABLE_COPY(QSerialPort)
#if defined(Q_OS_WIN32)
diff --git a/src/serialport/qserialportinfo.cpp b/src/serialport/qserialportinfo.cpp
index 3bfa56c4..d823eac7 100644
--- a/src/serialport/qserialportinfo.cpp
+++ b/src/serialport/qserialportinfo.cpp
@@ -255,33 +255,7 @@ bool QSerialPortInfo::hasProductIdentifier() const
Returns whether this QSerialPortInfo object holds a
serial port definition.
-
- \sa isBusy()
-*/
-
-#if QT_DEPRECATED_SINCE(5, 6)
-/*!
- \fn bool QSerialPortInfo::isBusy() const
- \obsolete
-
- Returns \c true if serial port is busy;
- otherwise returns \c false.
-
- \sa isNull()
-*/
-#endif // QT_DEPRECATED_SINCE(5, 6)
-
-#if QT_DEPRECATED_SINCE(5, 2)
-/*!
- \fn bool QSerialPortInfo::isValid() const
- \obsolete
-
- Returns \c true if serial port is present on system;
- otherwise returns \c false.
-
- \sa isNull(), isBusy()
*/
-#endif // QT_DEPRECATED_SINCE(5, 2)
/*!
\fn QList<qint32> QSerialPortInfo::standardBaudRates()
diff --git a/src/serialport/qserialportinfo.h b/src/serialport/qserialportinfo.h
index e4c92885..9ef8c22d 100644
--- a/src/serialport/qserialportinfo.h
+++ b/src/serialport/qserialportinfo.h
@@ -78,12 +78,6 @@ public:
bool hasProductIdentifier() const;
bool isNull() const;
-#if QT_DEPRECATED_SINCE(5, 6)
- bool isBusy() const;
-#endif
-#if QT_DEPRECATED_SINCE(5, 2)
- QT_DEPRECATED bool isValid() const;
-#endif
static QList<qint32> standardBaudRates();
static QList<QSerialPortInfo> availablePorts();
diff --git a/src/serialport/qserialportinfo_freebsd.cpp b/src/serialport/qserialportinfo_freebsd.cpp
index 5514fa45..53416c28 100644
--- a/src/serialport/qserialportinfo_freebsd.cpp
+++ b/src/serialport/qserialportinfo_freebsd.cpp
@@ -337,37 +337,6 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts()
return serialPortInfoList;
}
-bool QSerialPortInfo::isBusy() const
-{
- QString lockFilePath = serialPortLockFilePath(portName());
- if (lockFilePath.isEmpty())
- return false;
-
- QFile reader(lockFilePath);
- if (!reader.open(QIODevice::ReadOnly))
- return false;
-
- QByteArray pidLine = reader.readLine();
- pidLine.chop(1);
- if (pidLine.isEmpty())
- return false;
-
- qint64 pid = pidLine.toLongLong();
-
- if (pid && (::kill(pid, 0) == -1) && (errno == ESRCH))
- return false; // PID doesn't exist anymore
-
- return true;
-}
-
-#if QT_DEPRECATED_SINCE(5, 2)
-bool QSerialPortInfo::isValid() const
-{
- QFile f(systemLocation());
- return f.exists();
-}
-#endif // QT_DEPRECATED_SINCE(5, 2)
-
QString QSerialPortInfoPrivate::portNameToSystemLocation(const QString &source)
{
return (source.startsWith(QLatin1Char('/'))
diff --git a/src/serialport/qserialportinfo_osx.cpp b/src/serialport/qserialportinfo_osx.cpp
index 2e46397c..8daa8a7e 100644
--- a/src/serialport/qserialportinfo_osx.cpp
+++ b/src/serialport/qserialportinfo_osx.cpp
@@ -230,39 +230,6 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts()
return serialPortInfoList;
}
-#if QT_DEPRECATED_SINCE(5, 6)
-bool QSerialPortInfo::isBusy() const
-{
- QString lockFilePath = serialPortLockFilePath(portName());
- if (lockFilePath.isEmpty())
- return false;
-
- QFile reader(lockFilePath);
- if (!reader.open(QIODevice::ReadOnly))
- return false;
-
- QByteArray pidLine = reader.readLine();
- pidLine.chop(1);
- if (pidLine.isEmpty())
- return false;
-
- qint64 pid = pidLine.toLongLong();
-
- if (pid && (::kill(pid, 0) == -1) && (errno == ESRCH))
- return false; // PID doesn't exist anymore
-
- return true;
-}
-#endif // QT_DEPRECATED_SINCE(5, 6)
-
-#if QT_DEPRECATED_SINCE(5, 2)
-bool QSerialPortInfo::isValid() const
-{
- QFile f(systemLocation());
- return f.exists();
-}
-#endif // QT_DEPRECATED_SINCE(5, 2)
-
QString QSerialPortInfoPrivate::portNameToSystemLocation(const QString &source)
{
return (source.startsWith(QLatin1Char('/'))
diff --git a/src/serialport/qserialportinfo_unix.cpp b/src/serialport/qserialportinfo_unix.cpp
index 7b967574..93760e22 100644
--- a/src/serialport/qserialportinfo_unix.cpp
+++ b/src/serialport/qserialportinfo_unix.cpp
@@ -472,39 +472,6 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts()
return serialPortInfoList;
}
-#if QT_DEPRECATED_SINCE(5, 6)
-bool QSerialPortInfo::isBusy() const
-{
- QString lockFilePath = serialPortLockFilePath(portName());
- if (lockFilePath.isEmpty())
- return false;
-
- QFile reader(lockFilePath);
- if (!reader.open(QIODevice::ReadOnly))
- return false;
-
- QByteArray pidLine = reader.readLine();
- pidLine.chop(1);
- if (pidLine.isEmpty())
- return false;
-
- qint64 pid = pidLine.toLongLong();
-
- if (pid && (::kill(pid, 0) == -1) && (errno == ESRCH))
- return false; // PID doesn't exist anymore
-
- return true;
-}
-#endif // QT_DEPRECATED_SINCE(5, 6)
-
-#if QT_DEPRECATED_SINCE(5, 2)
-bool QSerialPortInfo::isValid() const
-{
- QFile f(systemLocation());
- return f.exists();
-}
-#endif // QT_DEPRECATED_SINCE(5, 2)
-
QString QSerialPortInfoPrivate::portNameToSystemLocation(const QString &source)
{
return (source.startsWith(QLatin1Char('/'))
diff --git a/src/serialport/qserialportinfo_win.cpp b/src/serialport/qserialportinfo_win.cpp
index 1bab3e9c..2c584471 100644
--- a/src/serialport/qserialportinfo_win.cpp
+++ b/src/serialport/qserialportinfo_win.cpp
@@ -347,38 +347,6 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts()
return serialPortInfoList;
}
-#if QT_DEPRECATED_SINCE(5, 6)
-bool QSerialPortInfo::isBusy() const
-{
- const HANDLE handle = ::CreateFile(reinterpret_cast<const wchar_t*>(systemLocation().utf16()),
- GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, nullptr);
-
- if (handle == INVALID_HANDLE_VALUE) {
- if (::GetLastError() == ERROR_ACCESS_DENIED)
- return true;
- } else {
- ::CloseHandle(handle);
- }
- return false;
-}
-#endif // QT_DEPRECATED_SINCE(5, 6)
-
-#if QT_DEPRECATED_SINCE(5, 2)
-bool QSerialPortInfo::isValid() const
-{
- const HANDLE handle = ::CreateFile(reinterpret_cast<const wchar_t*>(systemLocation().utf16()),
- GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, nullptr);
-
- if (handle == INVALID_HANDLE_VALUE) {
- if (::GetLastError() != ERROR_ACCESS_DENIED)
- return false;
- } else {
- ::CloseHandle(handle);
- }
- return true;
-}
-#endif // QT_DEPRECATED_SINCE(5, 2)
-
QString QSerialPortInfoPrivate::portNameToSystemLocation(const QString &source)
{
return source.startsWith(QLatin1String("COM"))