summaryrefslogtreecommitdiff
path: root/src/serialport/qserialport.h
Commit message (Collapse)AuthorAgeFilesLines
* Replace QSP::error signal with QSP::errorOccurredDenis Shienkov2016-08-091-0/+3
| | | | | | | | | | | | | | Make the name of the signal and the name of the getter unambiguous, which in turn allows the easy use of Qt 5-style connects. This commit message was taken from commit qtbase/4672e31. [ChangeLog][QtSerialPort][QSerialPort] Deprecated QSP::error() signal in favor of new QSP::errorOccurred() one. Change-Id: I3f04bb8b1ae686d5368d43741cd0e97748b31b8f Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Add missng default parameters to waitFor() methodsDenis Shienkov2016-07-281-2/+2
| | | | | | | | | | ... and adjust their documentation a bit. [ChangeLog][QtSerialPort][QSerialPort] Added missing parameters for waitFor() methods Change-Id: I95d7076bfef47dd75d37960ca8a719ae779737d6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace 'Q_NULLPTR' and 'NULL' with 'nullptr'Denis Shienkov2016-06-171-3/+3
| | | | | | | | | We can use nullptr since Qt 5.7. Change-Id: Id5354280d6a94b2c1f4c5967c65a22db878eca3e Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Drop the Win CE supportDenis Shienkov2016-05-021-1/+1
| | | | | | | | | | | Now we can drop the WinCE (5/6) support, because its compilers do not support the C++11 features, that lead to the further API limitations and so on. Change-Id: I2431d15b1361f1e093fc09ff7fbe824daeac3984 Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Unify license header usageAntti Kokko2016-02-021-13/+19
| | | | | | | | Update old header.LGPL3 to header.LGPL Change-Id: I1b17b6f798ee521d2e3bd8c37024df7cd65ee0c4 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Jani Heikkinen <jani.heikkinen@theqtcompany.com>
* QSerialPort::atEnd(): remove code duplicationAlex Trotsenko2016-01-211-1/+1
| | | | | | | These conditions are checked in the base implementation. Change-Id: I4bb010d48c6a581a140ba697f9dc31390d2067d2 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Cleanup remainders of code relating to data error policy handlingDenis Shienkov2015-09-241-0/+8
| | | | | | | | | | | | | | | | | | | It is impossible to implement all these features on all platforms, and particular drivers may not support them, too. Consequently, the user should handle such errors themselves by applying platform-specific ioctls on the device descriptor and/or parsing the stream's byte-stuffing. This commit also deprecates ParityError, FramingError, and BreakConditionError. Tested on Windows and Linux with the virtual and the USB serial ports. Change-Id: I4ffc2f067787bc304a83326acb2a2421b428f986 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Merge remote-tracking branch 'origin/5.5' into devFrederik Gladhorn2015-08-091-2/+0
|\ | | | | | | Change-Id: I913394721091750d64dad3ed0fd08ef8616edcf9
| * Improve the processing of errorsDenis Shienkov2015-07-081-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes the error string would contain a wrong description which did not correspond to the system error code. The reason was qt_error_string() being called too late, when the system error might have already been overwritten. The error processing is now in QSPP::getSystemError(), which returns both the error code and the error description as soon as possible. * Now the QSPP::getSystemError() returns the new class QSerialPortErrorInfo which contains all necessary fields. * The new method QSPP::setError() which accepts the QSerialPortErrorInfo as input parameter is used. * The old private method QSP::setError() is removed, because it is not used anywhere. Change-Id: Ia7e4d617b863e2131175c52812cdf426ed963795 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* | Use the new Q_ENUM and Q_FLAG macroDenis Shienkov2015-07-081-3/+9
|/ | | | | | Change-Id: I7ccfc1d374a6beca390f4f4ab27f7f4b5195ee08 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Mark some signals as deprecated since 5.5Denis Shienkov2015-06-061-2/+2
| | | | | | | Because retroactive deprecations are not allowed. Change-Id: I8f08e68c35abaae8112cb904fc1024c97453b89f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Mark the signal QSP::settingsRestoredOnCloseChanged() as deprecatedDenis Shienkov2015-05-121-1/+3
| | | | | | | | | This was missed since Qt 5.3. Change-Id: Ifb00421dec915682fd35587128aae6bd36bd9c9e Reviewed-by: Eric Lemanissier <eric.lemanissier@gmail.com> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Add the missed macro QT_DEPRECATED for QSP::sendBreak()Denis Shienkov2015-05-121-1/+1
| | | | | | Change-Id: Iba0b5a63d225a469fd70125a90e306ef67f68cb9 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Mark the signal QSP::dataErrorPolicyChanged() as deprecatedDenis Shienkov2015-05-121-1/+3
| | | | | | | | | | This was missed since Qt 5.2. Task-number: QTBUG-46066 Change-Id: I105728382a682def9bbecbf1e33d28bfff00a6e8 Reviewed-by: Eric Lemanissier <eric.lemanissier@gmail.com> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Remove space between "if/elif defined" macro and its bracketDenis Shienkov2015-03-121-2/+2
| | | | | | | | It is the recommended coding-style which is used in the Qt core. Change-Id: Id2efc3b2276b2d86d75fe0b7240077dbb61286f0 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Update copyright headersJani Heikkinen2015-02-131-6/+6
| | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I35f551de8408a2eb6a0f39df1f09d90c8084a7c0 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Merge "Merge remote-tracking branch 'origin/5.4' into dev" into refs/staging/devFrederik Gladhorn2015-01-201-1/+1
|\
| * Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2015-01-191-1/+1
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/serialport/qserialport.cpp src/serialport/qserialport.h src/serialport/qserialport_unix.cpp src/serialport/qserialport_unix_p.h src/serialport/qserialport_win.cpp src/serialport/qserialport_win_p.h src/serialport/qserialport_wince_p.h src/serialport/qt4support/include/private/qcore_unix_p.h Change-Id: Ifaa5ce8c1c0eb1c70246c54782719b91f3c95771
| | * Remove Q_OS_WIN64 since Q_OS_WIN32 defines 64-bit tooDenis Shienkov2014-11-241-1/+1
| | | | | | | | | | | | | | | Change-Id: I32eaf132f19a3b6fcbd5fd55d0690c3bd62bb641 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* | | Improve usage of the break state for the Tx lineDenis Shienkov2015-01-151-0/+5
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Now the sendBreak() method is deprecated since it is blocking and impossible to implement same behavior on different platforms using their API's. Besides, this method can be implemented via setBreakEnabled() and QTimer. 2. Introduced the new property named as "breakEnabled" which consist of setBreakEnabled() and isBreakEnabled() methods and the signal breakEnabledChanged(). Note: After opening, the port always is in non-break state. Task-number: QTBUG-36571 Change-Id: Ib808dab7eaed8cc5449c66d8186a29a7b7e45afc Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* | Use QWinOverlappedIoNotifier instead of QWinEventNotifierDenis Shienkov2014-11-271-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reasons of this change are following: 1) Implementation of QEventDispatcherWin32 has restrictions to maximum quantity of QWinEvenNotifier instances in one thread. Method QEventDispatcherWin32::registerEventNotifier() registers the [MAXIMUM_WAIT_OBJECTS - 2] numbers of notifiers only. Where the MAXIMUM_WAIT_OBJECTS that is equal to 64, since it is a part of "Multiple-object Wait Functions" API: http://msdn.microsoft.com/en-us/library/windows/desktop/ms687069%28v=vs.85%29.aspx 2) There is need to have three instances of QWinEventNotifier to watch I/O events of each serial port. It has limits to the maximum number of used serial ports and it is [(MAXIMUM_WAIT_OBJECTS - 2) / 3] = 20 for the one thread. 3) Attempting to move or to resize a window of GUI application lead to suspending of I/O events from serial port. A long suspension can lead to overflowing of FIFO of device, so the data can be lost. All these shortcomings are resolved with QWinOverlappedIoNotifier, which uses the "I/O Completion Ports" API: http://msdn.microsoft.com/en-us/library/windows/desktop/aa365198%28v=vs.85%29.aspx Tested on Windows 8 with the virtual (com0com), on-board and the USB (PL2303) serial ports. Task-number: QTBUG-34946 Change-Id: I879d939f86c8dcde0fe21a8d6267e81152822aa4 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* | Use QIODevicePrivate for PIMPLDenis Shienkov2014-11-161-1/+2
|/ | | | | | | | | | | | It is reasonable to get rid of excess D/Q pointers and to use their equivalents from QIODevicePrivate. Also in the future it will allow to use the internal read buffer of QIODevicePrivate. Tested on Windows 8 and Linux with the on-board and com0com serial ports. Change-Id: I9d0923c6f9adc5981dc49dacea163b286620ed5c Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-09-161-2/+1
|\ | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I5887622f233275703cca8cc2a5db4aaaccc72d97
| * Fix Qt 4 buildSamuel Gaist2014-09-121-2/+0
| | | | | | | | | | | | | | | | | | | | Following the discussion on the development mailing list with Thiago Macieira, remove the guard around the signals since it's not supported to build with Qt 4. Task-number: QTBUG-41190 Change-Id: I8df1b7fa8cc69a2aacdcb4fedea0cc6fe092eece Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * Fix a race condition at writing on Windowsv5.3.25.3.2Denis Shienkov2014-08-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. The writeStarted flag shall be reset to false after bytesWritten() signal is emitted, but not before it. 2. In case of start of writing from the startAsyncWriteTimer it is necessary to call the startAsyncWrite() method but not the completeAsyncWrite() method. It give guarantees to exclude of race condition to multiple call of the WriteFile twice until the write operation is not completed. For example, a race condition is watched in case of writing data from the slots which are connected to the bytesWritten() signal from a device; or to the timeout() signal from a timer with zero interval. To checking of these scenarios are added additional autotests. Tested on Windows 8 with the on-board and USB serial ports, using Qt5. Task-number: QTBUG-40769 Change-Id: Iedabbf38847debeee795a10fd7a4c54c65d2a338 Reviewed-by: Patrick Noffke <patrick.noffke@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* | Update license headers and add new license filesAntti Kokko2014-09-091-18/+10
|/ | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I08685205169cdd4b49a651ed98f36ba1e6c1bb29 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Fix compilation of apps with QT_DISABLE_DEPRECATED_BEFORE=0x050300Marcel Krems2014-08-111-0/+2
| | | | | | | | | | The enum is already marked as deprecated leading to this error: qserialport.h:267:46: error: no type named 'DataErrorPolicy' in 'QSerialPort' void dataErrorPolicyChanged(QSerialPort::DataErrorPolicy policy); ~~~~~~~~~~~~~^ Change-Id: I8d178f0d0921b8f5308183e1f09a4c8388448e26 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Improve error handling for the waitForXX() methods on WindowsDenis Shienkov2014-07-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | The slots _q_completeXX() returns empty values, therefore the waitForXX() methods continue to work even if occurs an error from the I/O completion. Is reasonable allow to return of boolean values for the I/O completion slots. Besides, it allows avoiding indirect detection of an error, comparing of the sizes of I/O buffers before and after the operation completion. Though, for the waitForReadyRead(), for this purpose it is necessary to add additional modifications in a following patches. Tested on Windows 7/8 with the virtual com0com ports using Qt4 and then Qt5. Testing was made using of autotests and examples. Change-Id: I95a76461af4595f6658f0cad766a4fff14eb7afc Reviewed-by: Peter Kümmel <syntheticpp@gmx.net> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Use Q_NULLPTR for null pointer purposes with NULL fallback for Qt 4Laszlo Papp2014-05-131-3/+3
| | | | | | | Change-Id: I5422376a26111f7c8e084791a059215238a16868 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Steven Ceuppens <steven.ceuppens@icloud.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Mark the settingsRestoredOnClose property deprecated since 5.3Denis Shienkov2014-04-281-3/+8
| | | | | | | | | Commit bc0a65234440b6a08d862840a48ebae0d3421fbc incorrectly marked this api as deprecated since 5.2 Change-Id: Ia4ea3d7a394376a16511a3bf2ad8ba6e051bc24d Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Obsolete the "settings restore on close" APILaszlo Papp2014-03-071-4/+3
| | | | | | | | | Now that the settings detection is removed, it would be better to make this API deprecate because it does not make much sense anymore. It was a bad idea to add this, but we cannot remove it for now, hence the obsoletion. Change-Id: I5e02959cb54281995b911ff0f64bd2fa36b80060 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Rename the flow to flowControl for consistencyLaszlo Papp2014-03-011-2/+2
| | | | | Change-Id: Ida3c4ff049f21bd96fd64b41c66787b3961ada5e Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Merge remote-tracking branch 'origin/release' into stableFrederik Gladhorn2014-02-111-10/+12
|\ | | | | | | | | | | | | Conflicts: src/serialport/qserialport_win.cpp Change-Id: Ib00a645c6660a3c81dbc9e159110f7bfc392ea36
| * Obsolete the TxD/RxD signalsv5.2.1Laszlo Papp2014-01-271-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They are not much of use due to the low-level OS limitations as of now, hence the obsolete proposal. It can be brought back to life at any point when we have a more clear idea what to do with this API. "faking" this signal as RealTterm probably does it, is not a nice impression for the end users. That would be more like a software "signal" (which we already have in place) rather than a real pinout hardware signal. It is interesting why Windows, Linux, etc do not provide an option for this. There must be some strong reason for it. Change-Id: Ia065e2ee9226d16e724f5e2690b25b954329d78e Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* | Unify of the internal API of asynchronous handlingDenis Shienkov2014-01-151-3/+3
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It makes sense to unify internal methods of asynchronous I/O where to each method of start of operation corresponds the method of completion of operation: * startAsyncCommunication() - it is a new method which has a code relating to the handling of the WaitCommEvent() function. It implementations is taken directly by copy/paste with minimal modifications relating with adding of returns a boolean values. * _q_completeAsyncCommunication() - it is an existing method which is renamed from the _q_canCompleteCommunication(). * startAsyncRead() - it is an existing method without modifications. * _q_completeAsyncRead() - it is an existing method which is renamed from the _q_canCompleteRead(). Earlier this method contained a subfunction of the completeAsyncRead(DWORD) which is deleted now, and its code (related with the policy processing) is moved into body of the _q_completeAsyncRead() with the minimum modifications which do not change it behavior. * startAsyncWrite() - it is an existing method without modifications. * _q_completeAsyncWrite() - it is an existing method which is renamed from the _q_canCompleteWrite(). Earlier this method contained a subfunction of the completeAsyncWrite(DWORD) which is deleted now, and its code is moved into body of the _q_completeAsyncWrite() without modifications. Also in addition is added the new method emitReadyRead() and the code of policy emulation is moved into new method emulateErrorPolicy(). Change-Id: I58345e3270d676879a16efc4b7f35f74869894d8 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Use the signals/slots for internal events handling on WindowsDenis Shienkov2013-12-181-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The principal idea of this patch - to simplify a code and to minimize risks of UB in operation with the notifiers. Details are below: 1) Use a separate instances for the each notifier. It allows to get rid from an lookupXX() methods because now we always know which of notifiers was triggered. 2) Now each notifier is created once and used during serial port life. Moreover now in the open() and the close() methods are carried out a simply enabling and disabling of the notifiers. It allows to simplify code and to reduce overhead costs of check of a validity of the notifier pointers. 3) Use the signals/slots mechanism for the internal events handling. Use a slots excludes any UB in the notifier handlers because now isn't present a deep callbacks and so on. Even if some notifier will be deleted, we never got a crash at processing of triggered handle, we can just got an some error code and handle it. 4) There is no more need for existence of separate classes of notifiers which were inherited from the QWinEventNotifier. Now, the objects of QWinEventNotifier are use directly, only for delivery a triggered events to the appropriate slots. All logic of a events handling are in the _q_xx() slots. 5) The overlappedPointer() methods aren't necessary to us anymore. Now we know each OVERLAPPAD structure instance. It gives us to pass a pointers of these structures directly to the ReadFile/WriteFile/WaitCommEvent functions and have direct access to the hEvent field for the waitForXXX() methods. 6) The errors handling inside of the _q_xx() handlers are simplified. Now is not used a dptr-pointer to the QSerialPortPrivate class. So, earlier entered additional method QSerialPortPrivate::setError() is removed. This patch with using of slots is a strategic step because in the future in case of fix of a bug QTBUG-34946 instead of the QWinEventNotifier it is necessary to use the QWinOverlappedIoNotifier which provides only the signal/slot API. Note: Also this patch implicitly fix a bug QTBUG-33938. Task-number: QTBUG-33938 Change-Id: Iba9137e13e0bd6001c665434698b8cd965bc36e5 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Do not remove obsolete enum values for gcc and clangv5.2.0Laszlo Papp2013-12-041-27/+11
| | | | | | | | | | | | | | | Do not try to work around the gcc/clang limitations with external variables since some people have some concern that it may break the binary compatibility due to the underlying representation layout. Talk to upstream (gcc) if a warning for this is desired. It is out of scope for us. C++14 will help with the [[deprecated]] attribute, but that is light years ahead. Task-number: QTBUG-35354 Change-Id: I1c4e0fb950469adceca85147084fa896503de78b Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Deprecate further Unknown* property values similarly to UnknownParityLaszlo Papp2013-12-031-20/+35
| | | | | | | Task-number: QTBUG-35215 Change-Id: Id8175af00c431cc8f80f05d518b3a2ee0e8ac71b Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Obsolete the QSerialPort::UnknownParity enum value in QSerialPortLaszlo Papp2013-11-301-0/+10
| | | | | | | Task-number: QTBUG-35215 Change-Id: I53af65ba485216a6fde238245580fe0422a2ed9a Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Obsolete the isValid() method in QSerialPortInfoLaszlo Papp2013-11-301-4/+0
| | | | | | | Task-number: QTBUG-35184 Change-Id: Ie822943bcaf071024bc4f9782441b0534fcbd43d Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Mark most of the the data error policy as deprecatedLaszlo Papp2013-11-011-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately, this is a bit bad heritage of the QSerialDevice project. It is not well-thought, and it was added in rush. If this feature ever comes back, it has to be rethought and maybe redesigned. Currently, it is not much usable nicely. It is done similarly to the following change: https://codereview.qt-project.org/#patch,all,43441,7 Having done this, the users will get a warning, and they will hopefully stop using it. Then, the feature redesign it for 5.3 or later. It can get undeprecated anytime in Qt 5.X, but it cannot be removed with bumping the library version. That should be the last resort. In fact, this feature is very likely not to be redesigned. It is unfortunately a broken concept. The following long-living serial port frameworks do not provide "Policy" API either which is a clear sign for its usage pattern: * PySerial * Java SerialPort * C#/.NET SerialPort * QextSerialPort ... so to recap: it was not a good idea to introduce it. Unfortunately, the side effect is that we have got warnings for the deprecated method since moc cannot handle it properly. It needs to call it for internal reasons. Note that enum and Q_PROPERTY cannot be deprecated because Q_PROPERTY simply cannot be, and the enum cannot be deprecated either since that would cause further warnings for the library itself due its usage for the accessor and mutator, etc. However, they can be put behind the QT_DEPRECATED_SINCE macro so that the users can get compilation errors if they define QT_DISABLE_DEPRECATED_BEFORE to get rid of old deprecated symbols easily by getting errors instead of warnings. The following coding can be run to show the expected warnings when used from a QtSerialPort based application or library: main.cpp: int main() { QSerialPort serialPort; serialPort.dataErrorPolicy(); return 0; } ============================================================================== 1) Qt 5 g++ -fPIC -Wall -DQT_DEPRECATED_WARNINGS -I/usr/include/qt -lQt5SerialPort main.cpp main.cpp: In function ‘int main()’: main.cpp:6:32: warning: ‘QSerialPort::DataErrorPolicy QSerialPort::dataErrorPolicy() const’ is deprecated (declared at /usr/include/qt/QtSerialPort/qserialport.h:222) [-Wdeprecated-declarations] serialPort.dataErrorPolicy(); Tested on Linux with Qt 4.8.5 and then Qt 5.1.1. ============================================================================== 2) Qt 4 g++ -fPIC -Wall -DQT_DEPRECATED_WARNINGS -I/usr/include/qt4/ -lQtSerialPort main.cpp main.cpp: In function ‘int main()’: main.cpp:6:32: warning: ‘QSerialPort::DataErrorPolicy QSerialPort::dataErrorPolicy() const’ is deprecated (declared at /usr/include/qt4/QtSerialPort/qserialport.h:222) [-Wdeprecated-declarations] serialPort.dataErrorPolicy(); ^ ============================================================================== Task-number: QTBUG-34429 Change-Id: Ia183817b841fb172d232f550b8402f7a314b8492 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Add an "UnknownSignal" value for the pinout signalsLaszlo Papp2013-10-061-1/+2
| | | | | | | | | | | | | This needs to be added to the API because there are situations where the serial line state is unknown. The two typical use cases are: 1) The syscall cannot retrieve the state for some reason. 2) The serial port is not open. This has been (only build!) tested on Linux (Arch) with Qt 4 and then 5. Change-Id: I471a68b2e335b54d9a94071f08b1b31a6fb0056a Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Add a new error value called "NotOpenError"Laszlo Papp2013-10-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This error message is used when the serial port parameter setters are called even though the serial port is not open, and it should be. The details are very similar to the previously introduced TimeoutError, as in: 1) The "\since 5.2" notion has to be added manually as qdoc has no support for enumeration values in that regard. 2) The value itself has to be added at the end of the enumeration not to break the binary compatibility unnecessarily. It is fine as long as the error documentation for the end users can be kept in the order we wish to do. Each method documentation already contains the information that the error is set properly when that occurs, so this change can be considered as a bug fix rather than a new feature. It is a behavior change of course just as any bug fix. The previous operation was wrong to go ahead down to the syscalls even though the serial port was not open. Thereby, that was a bit pointless. Unfortunately, there is no similar error introduced for the existing QIODevice subclasses just yet, but this term is at least inline with the open mode of QIODevice which is "NotOpen". For sure, when the parameter setters are called by the end user without the device being open results false return value as per method documentation. This change was tested on Linux with Qt 4 and then 5. Change-Id: I1bc7309e34bdf59793f1de510866dae1bb48b539 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Merge branch 'stable' into devSergio Ahumada2013-09-061-4/+4
|\ | | | | | | Change-Id: Ie8f70b5101225453355a1eb6b0fdc3f3d8a34824
| * Use the term 'directions' for representing the directionsLaszlo Papp2013-09-041-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | 1) The previous 'dir' is incorrect because it should be plural for consistency based upon the other variable names. 2) 'dir' can be misleading in the context where such a term is also used for representing a directory, like in our case. Change-Id: I650cc64c2669286a4d7ef071a2ab3b7b63228977 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* | Add API for handling the time out errors when waiting for read or writeLaszlo Papp2013-08-211-1/+2
| | | | | | | | | | | | | | Task-number: QTBUG-32680 Change-Id: I1e69bea596b45867119c681bd22abba6dbb1861c Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* | Add function to get serial port handleAlex Henrie2013-08-061-0/+8
|/ | | | | | | | | | | | | | Sometimes the Qt functions are just not enough, and for this reason Qt provides functions like QFileDevice::handle(), QAbstractSocket:: socketDescriptor(), QWidget::winId(), and QProcess::pid(). QSerialPort should do the same. In my case, I find that QSerialPort is easy to use and works nicely with the rest of Qt, but my application needs to set TIOCNXCL right after the serial port is opened. Change-Id: Ie740e478b5825fa2e699ead079d78c514a0caef4 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Mika Korhonen <mika.j.korhonen@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Put Q_DECLARE_PRIVATE in the beginning of the classLaszlo Papp2013-07-271-1/+1
| | | | | | | | | This seems to be a usual practice by the majority of the Qt classes. There are a few examples against it, but that is the minority. Change-Id: I92f47f283a6cd279bc978761cb1ee375a514eeba Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Revert "Add property to set exclusivity"Laszlo Papp2013-07-081-14/+1
| | | | | | | | | | | | | | | | | | | This reverts commit 4c67500e5d14e561e37b4bdc056f059d3eefdfa4. "dev: unfrozen branch, containing alpha-quality code that is ready to go into beta testing at any time" ... from: http://qt-project.org/wiki/Branch-Guidelines Please respect the basic principles. In doubts, do not approve changes yourself, but ask for help. Besides the illegit nature of this change, it has fundamental documentation issues as well. It is summer, and this can wait until 5.2, so please do /not/ rush with approvals. Change-Id: Ic2763394035c776088cb28f9c04086920cedb3a2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add property to set exclusivityAlex Henrie2013-07-031-1/+14
| | | | | | | | | Disabling the serial port driver's exclusive mode is necessary for pseudo serial ports and some USB/serial adapters to work correctly. Change-Id: I74d45feed619817b61e265b00aec8b0ebfae7a33 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>