summaryrefslogtreecommitdiffstats
path: root/src/serialport/qserialport_wince.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Get rid of QSPP::updateCommTimeouts() methodDenis Shienkov2016-01-111-10/+3
| | | | | | | | | | This method is used only once when initializing of a device. Thus its code can be moved to an initialization place, and this method can be removed then. Change-Id: Ie9a40da1d6a2980829327f66830893ad7179bd57 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Do not use settingFromBaudRate() on Windowsv5.6.0-beta1Denis Shienkov2015-12-131-9/+0
| | | | | | | | This function makes sense only on *nix platforms. Change-Id: Ia1d107e1b0d9095f4f20e1aa472798aa0af11f0f Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Use qt_subtract_from_timeout() to reduce a code duplicationDenis Shienkov2015-10-101-2/+2
| | | | | | | | | | Commit qtbase/ed0c0070f9b05c647019270dfc42073d071c830a introduces a new helper function qt_subtract_from_timeout() which can be used to reduce a code duplication. Change-Id: I5c4941360f524225c14eac8c308fb16a546c802f Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Remove unused QSPP::baudRateFromSetting() methodDenis Shienkov2015-10-061-9/+0
| | | | | | Change-Id: Ida5f8f8b3374d52b6e20e560aff97cbdc1fe8776 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Cleanup remainders of code relating to data error policy handlingDenis Shienkov2015-09-241-56/+2
| | | | | | | | | | | | | | | | | | | 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>
* Use the new signal/slot syntax everywherev5.6.0-alpha1Denis Shienkov2015-09-021-2/+2
| | | | | Change-Id: Ia9868d010106abbfeb8f8d24e84adf37de879991 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Unify common error strings in QSerialPortErrorInfoDenis Shienkov2015-08-281-7/+7
| | | | | | Change-Id: I1275e80988274e2409455217d5ffb03014962604 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Handle ERROR_PATH_NOT_FOUND error code on WindowsDenis Shienkov2015-08-261-0/+3
| | | | | | | | | This error occurs at attempt to open an empty device name. In this case we need to interpret it as QSerialPort::DeviceNotFoundError. Change-Id: Icdf8cd5735bcc38e6ddc2ca9c326f0f993b5cd72 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Give custom descriptions to errors which had none beforeDenis Shienkov2015-07-091-12/+10
| | | | | | Change-Id: Ic083cbd58e4e775ede0cdf610f61407003834207 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Improve the processing of errorsDenis Shienkov2015-07-081-57/+42
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* WinCE: Fix reading of data from serial portTobias Koenig2015-07-031-1/+1
| | | | | | | | | Do not remove all read bytes from the input buffer, but only the difference between the reserved ones and the actual read ones. Change-Id: Ib114e3972ec295f57d011ae9ffa6613313712e32 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* WinCE: Fix closing the serial portTobias Koenig2015-07-031-6/+5
| | | | | | | | | | | | | | | | | | | | | | Terminate the notifier thread instead of relying that the 'running' member variable is evaluated. Most of the time, the notifier thread is blocked inside the ::WaitCommEvent() call, so even if the main thread requests a close by setting 'running' to false, the condition of the while loop is not evaluated until some data come in on the serial line, which might not happen in an acceptable time frame. WinCE supports proper termination of threads, so there shouldn't be a problem with the new approach. The code was tested on a WinCE7 system, closing and reopening QSerialPort works as expected now. Change-Id: Ic311a1cc5d2a1f9a1aec6750faddd396e448dd46 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Get rid of QSPP::bytesToWrite()Denis Shienkov2015-07-011-5/+0
| | | | | | | | | It is not worth to spread the platform-specifics over multiple files, as the difference are actually tiny and much better expressed with an ifdef. Change-Id: I5279e05d52ce5243ad3d0655c6353e1fb18891a1 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Get rid of QSPP::readData()Denis Shienkov2015-06-301-5/+0
| | | | | | | | | | | | | | Because we now (in the Qt 5.5 branch) use QIODevicePrivate's internal read buffer directly, there is no need to call buffer.read() in QSP::readData(). There is also no point in keeping the platform-specific implementations of QSPP::readData(), so remove them. Tested on Windows using the virtual com0com serial ports, and on Linux usig the virtual tty0tty serial ports. Change-Id: I136c6d10708cc6fc99a77c351c3945470530845d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
* Merge remote-tracking branch 'origin/5.4' into 5.5Frederik Gladhorn2015-02-251-19/+12
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf 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.cpp src/serialport/qserialport_wince_p.h Change-Id: Ibb917652b132e66fbb90f437bf762c1094911dc0
| * Use Q_NULLPTR where it is possibleDenis Shienkov2014-12-101-9/+9
| | | | | | | | | | Change-Id: I7261a92ea4405c8aeab7670f73e7225ed7e4d9d0 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
| * Simplify and improve the QSP::TimeoutError handlingDenis Shienkov2014-11-281-11/+4
| | | | | | | | | | | | | | | | | | | | | | | | It is reasonable to get rid of duplicating a code of TimeoutError handling. A common parts of a code can be moved to one place. Also, can be improved some of related if/else conditions. Tested on Windows 8 and Linux with virtual serial ports. Change-Id: I63112727faf42d4357f64f3450ea422167eaee90 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@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 remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2015-01-191-18/+0
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Allow to use custom devices pathsDenis Shienkov2014-11-271-16/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QSP incorrectly transforms non-standard device names to their paths and vice-versa (for example, "/home/ttyS0", "//./COM1", and so on). Now this problem is solved: * The transformation code is moved to QSPP. * Added autotests auto/qserialportinfoprivate to testing of conversion algorithm. These tests are private and can be activated with building of QtSerialPort with: qmake "QT_CONFIG+=private_tests warnings_are_errors" \ DEFINES+=QT_BUILD_INTERNAL Tested on Windows 8, Linux, OSX with auto-tests, with on-board and virtual serial ports. Task-number: QTBUG-38639 Change-Id: I43757a7f1390f53ed2b1d70de59c6bfb71892a59 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
| * Declare QElapsedTimer closer to usageDenis Shienkov2014-11-221-2/+0
| | | | | | | | | | Change-Id: I74622eaf3a7f5179ff25fc815997d5e4cf3cc2c7 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* | Use QWinOverlappedIoNotifier instead of QWinEventNotifierDenis Shienkov2014-11-271-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 internal read buffer of QIODeviceDenis Shienkov2014-11-171-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is reasonable to use the internal read buffer of QIODevice instead of additional QRingBuffer which currently are used. It will allow to reduce an overhead when copying data as now there is not an excess chain with QRingBuffer. Besides, the majority of I/O classes from QtCore (except QProcess) also use the internal QIODevice buffer which are optimized for this purpoze. Tested on Windows 8 and Linux with the virtual com0com and on-board serial ports. Change-Id: I6c3d4b84593940ccfef8c15c9fbef16bddcd002f Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* | Move all platform-specific declarations into one QSPPrivateDenis Shienkov2014-11-141-9/+1
|/ | | | | | | | | | This is near to the internal Qt PIMPL style. Also it will allow to use QIODevicePrivate is more smoothly in next patches. Tested on Windows 8, Linux, OSX 10.9 with on-board serial port. Change-Id: Ieef4b05d0bf11cf2da6420e58629bea1818108f9 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-10-141-3/+15
|\ | | | | | | Change-Id: Id7e66059233e8d07ba44cad19048d9cddc68e250
| * Fix QSP::bytesToWrite() on WindowsDenis Shienkov2014-10-061-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After calling the WriteFile() function, QSP::bytesToWrite() should return zero, but did return the size of writeBuffer. On Windows, we must not to cut a size of the writeBuffer until the asynchronous write operation has completed. So we need to make use of an additional actualBytesToWrite variable, the value of which is increased when new data is added to the writeBuffer, and decreased after calling the WriteFile() function. This change also entails the modification of the QSP::writeData() method and deleting the QSP::startWriting() method. Now all platform-dependent code (related to startWriting(), and to copying of memory to writeBuffer) resides in the new QSP::writeData() method. But this modification does not change the behavior on platforms other than Windows. Tested on Windows with the virtual com0com serial ports using Qt5. Change-Id: I35c1428ad374c0709d6c352a93c552898e947bde Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
| * Fix reading on Windows at limited read buffer sizeDenis Shienkov2014-10-021-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case the read buffer has a limited size then are impossible to read remainder which is still can be in driver's queue, since no readyRead signal emmitted and reading are stalled. Problem is that Windows does not fire the EV_RXCHAR event in case a driver's queue has ready to read remainder; this event will be triggered only when a new data are received. The solution is to start of asynchronous read operation for reading of possible remainder from the queue after doing QSP::read() from the user. Besides is necessary to meet conditions: - do not start reading in case a reading already is started - do not start reading in case is not in limited buffer size - do not start reading in case is a previous reading returns a less data than read buffer size or are not in the hardware flow control mode Tested on Windows 8 with virtual com0com serial ports using Qt5 and then Qt4. Task-number: QTBUG-41295 Change-Id: I01797e6f8d6006751244144fead3616b1de1b811 Reviewed-by: Robert Kurjata <rkurjata@gmail.com> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@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 leak of a descriptor after unsuccessful openingDenis Shienkov2014-07-311-36/+47
| | | | | | | | | In case of unsuccessful initialization of a device at the opening, a valid descriptor has to be closed before return from the open() method. Task-number: QTBUG-40414 Change-Id: I45568f176e003d9be1fe8c3017da29f39908efb0 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Move the WinCE implementation into separate moduleDenis Shienkov2014-05-201-28/+409
| | | | | | | | | | | | | | | | | WinCE implementation was mixed a common code with the Win32 implementation that caused some problems with maintenance. More correct decision is moving a common code which was used in *win.cpp into *wince.cpp module without modifications. Now the Win32 and the WinCE implementation are independent from each other. Tested build with Qt5 on "win32-msvc2012" and then with Qt4 on "wincewm50pocket-msvc2008" configurations. Change-Id: I63f687468beffa9a75b534a4fbe536b854b12210 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Use Q_NULLPTR for null pointer purposes with NULL fallback for Qt 4Laszlo Papp2014-05-131-1/+1
| | | | | | | 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>
* Make it possible to set the port values before openingLaszlo Papp2014-03-061-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch also changes the behavior of the open method. We do not use port detection anymore for good. It has been a broken concept, and it is very unlikely that anyone has ever relied on it. If anyone had done that, they would be in trouble anyway, getting noisy warnings needlessly and all that. The other option was also considered to keep this behavior optionally as the default, but that would complicate the API too much without not much gain. The default port settings are now also the sane 9600,8,N,1, and no flow control. Also please note that the serial port is closed automatically in the open method if any of the settings fails. Several subsequent changes can follow this one, namely: * Changing the examples to show this usage. * Add a QSerialPortSettings data structure as it seems to be common currently in client codes. * Add the QML plugin with only thin wrapper declarative classes and all that. * Deprecate the restore settings on close API. * Remove the internal current and restored data representations. * Add further error values to the API for the fine tuning of the error reporting when there are setting errors on open. * Add proper test coverage. In short, this change opens the gate up for many interesting subsequent changes that would be useful for the module overall. In general, this change makes it possible to reach the feature parity with QextSerialPort so that we are not much worse anymore. We could do the same that QextSerialPort could do many years ago, already. Task-number: QTBUG-33774 Change-Id: I8527672f8b0bb2581fa7054ccffda66ab7fa4a85 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Keep the DTR line state at changing of DCB propertiesDenis Shienkov2014-02-111-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Updating of the DCB structure (in case of setup of some properties through setXX() methods) leads to reset of a status of the DTR line to an initial state. For example, after opening of port the DTR state was "high", further the call of method setDataTerminalReady(false) will drop the DTR to "low" state. But if now to change any properties of the device (e.g. to setup a new baud rate), the DTR will again be set to "high". The reason of this behavior is the fDtrControl flag of DCB structure: http://msdn.microsoft.com/en-us/library/windows/desktop/aa363214%28v=vs.85%29.aspx To control of DTR is used the EscapeCommFunction() function which has no relation to the DCB structure. Therefore any re-initialization of the DCB discard the results of the EscapeCommFunction() function in case a state of the fDtrControl flag not equal to the real DTR state. Solution is change of a fDtrControl flag after successfully call of the EscapeCommFunction() function. Then further change of any property will be with a correct DCB. Besides, it is necessary to drop the flag DTR_CONTROL_HANDSHAKE at opening of device. Because in this mode the manual control of the DTR line is forbidden. Thanks to Dr. Alexander W. Lenhardt Task-number: QTBUG-36490 Change-Id: I14b040761f7e28108db87e667eb76f559be436cb Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Initialize the DCB structure before using itDenis Shienkov2014-02-101-0/+3
| | | | | | | | | | | | | | Please refer to the MSDN documentation for details: http://msdn.microsoft.com/en-us/library/windows/desktop/aa363214%28v=vs.85%29.aspx and http://msdn.microsoft.com/en-us/library/windows/desktop/aa363201%28v=vs.85%29.aspx Change-Id: Id60f6d1b4a9237c2ae74063ac52221f42761b004 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Rename the "descriptor" to handle on WindowsLaszlo Papp2014-02-101-27/+27
| | | | | | | | | | | | | * Windows uses the term handle instead of descriptor. * It is also consistent with the rest how Qt manages it. Conflicts: src/serialport/qserialport_win.cpp Change-Id: I68a672ea2d8e88e26ad5d822b157ccab79a3d2d9 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Optimize access to the write bufferDenis Shienkov2014-01-151-9/+1
| | | | | | | | | | | | | | | Earlier for writing in writeBuffer was used the QSerialPortPrivate::writeToBuffer() method which contained a similar code for each platform. Therefore it is reasonable to delete this method, and to move its common functionality to the QSerialPort::writeData(). Also all platform-dependent code of start of data transfer move to the QSerialPortPrivate::startWriting() method. Change-Id: I1423723fd69c05df974f8ba597e3dd71d5a797dd Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Reimplement low level data sendingDenis Shienkov2013-12-301-6/+6
| | | | | | | | | | | | | | | | | | | | | | | A feature of writing of the buffer by chunks of 512 bytes (by default) was introduced earlier as the developers option in order that it was possible to regulate load of the CPU and quantity of emitted signals of bytesWritten() just change WriteChunkSize value in source code. As shows of the practice, the most optimal mode is writing of whole content of the buffer without division into chunks. It reduces load of CPU (because reduces a quantity of the events triggers) and also simplifies the source code. But potentially there can be negative consequences of writing of whole buffer directly in case of broken driver: * A kernel panic (or BSOD) in case of writing a data large than driver's internal queue. * Can be transferred not all data from the buffer, but only their part. Change-Id: I0fcac1ccf3c752579978b4745771accbf8274267 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Use direct access to the read bufferDenis Shienkov2013-11-281-29/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Use the auxiliary array to store the chunks of data at reading on Windows. The additional array is used for temporary storing the data chunks of the each asynchronous reading operation. This data will be appended to the class read buffer when asynchronous operation completed. It reduce quantity of calls for reallocation of the input ring buffer because now the reallocation with the actual data is carried out once in the completeAsyncRead() method. 2. Delete the bytesAvailable() and readFromBuffer() methods from the QSerialPortPrivate. These methods are not necessary any more, because now the size and content of the read buffer always has actual value. Now all dependent methods can access to the read buffer directly without the intermediaries, like bytesAvailable() and readFromBuffer(). Tested the build with Qt4 and then Qt5 for: * Windows 7/8, MinGW * Windows CE Pocket PC, VS2005 * Android platforms ARM and x86 * Archlinux 64-bit Tested the work with the terminal, the creader(a)sync, the cwriter(a)sync examples with Qt4 and then Qt5 for: * Windows 7/8 with the virtual com0com, the physical on-board and the USB PL2303 devices * Archlinux 64-bit with the physical on-board and the USB PL2303 devices Change-Id: I6871f8933588377646ffeccf1d2c21bb6caada24 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Laszlo Papp <lpapp@kde.org>
* Use local QLatin1Char as opposed to a static QLatin1StringLaszlo Papp2013-11-061-6/+4
| | | | | | Change-Id: I3bf8a439bef4edc86943d19b3f0e8d2e0dcbe0c4 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Add the Q_OBJECT macro to the notifiersDenis Shienkov2013-10-171-2/+2
| | | | | | | | | | | The notifiers are derived from QObject and shall have the Q_OBJECT macro. Tested the build on Windows, Windows CE, Android with Qt4 and then Qt5. Change-Id: Ie860a02cb5e73b9af62e0f0b5de379e34c077c0e Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Merge branch 'stable' into devSergio Ahumada2013-09-061-3/+3
|\ | | | | | | Change-Id: Ie8f70b5101225453355a1eb6b0fdc3f3d8a34824
| * Use the term 'directions' for representing the directionsLaszlo Papp2013-09-041-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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/+5
|/ | | | | | | Task-number: QTBUG-32680 Change-Id: I1e69bea596b45867119c681bd22abba6dbb1861c Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Eliminate the "q_ptr->" call by using Q_Q(QSerialPort)Laszlo Papp2013-07-281-10/+20
| | | | | | | | | | | Unfortunately, the q_ptr data member cannot yet be deleted from the internal data class because QIODevicePrivate would need to be inherited then. That is not a simple change considering the Qt4 support. Hence, that part of the logic is put on hold, but can be expected in an upcoming change at some point, soon. Change-Id: Ic8ba9621dd647f4afa1b91d01c858c836d1cc0c8 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Workaround for fix sending of data for WinCE platformDenis Shienkov2013-04-241-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The commit * sha1: 544f927c3724344d01d45d19151d236c143f8c83 entered regression of implementation of data writing to the serial port. Regression is that after data writing to the internal ring buffer of a class these data really aren't transferred to the serial port and remain in this buffer because no event EV_TXEMPTY triggered. This event will occur only after the serial port will transfer at least one byte of data and the FIFO buffer of the driver becomes the free for transmission of the next portion of data from ring buffer of class. Thus the simplest decision is the forced call of WriteFile() of function after each addition of the internal ring buffer to trigger EV_TXEMPTY sequence. In this case we launch WriteFile() implicitly through the notifyWrite() method with the WriteChunkSize parameter (instead of one byte) to optimize transmission for speed (theoretically). WARNING: This decision is just a workaround and not a real fix, shall be decided in the future in more correct and effective way. Tested for target: "-platform win32-msvc2005 -xplatform wincewm50pocket-msvc2005" on standard Pocket PC WM5.0 Device Emulator. Task-number: QTPLAYGROUND-13 Change-Id: I4b3a36fa064dee92406a7511eb2b98b2a55e5315 Reviewed-by: Laszlo Papp <lpapp@kde.org>
* Fix of errors of compilation on WinCE platformDenis Shienkov2013-04-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Some previous commits entered regressions in compile process, namely: * sha1: 544f927c3724344d01d45d19151d236c143f8c83 After implementation of a new concept of internal architecture of library, is entered regression for the indefinite eventMask variable in the waitForReadOrWrite() method. Solution - to define a variable into this method. * sha1: 3ea635d74d4035c9036c2b7208b162620f51aa8b Entered the name space regression for the class CommEventNotifier. Solution - not to use a name space for this class. Tested for target: "-platform win32-msvc2005 -xplatform wincewm50pocket-msvc2005" Task-number: QTPLAYGROUND-13 Change-Id: I9dbcc0023f06c1b0e6d7b1b670828650382ab785 Reviewed-by: Laszlo Papp <lpapp@kde.org>
* Make a good use of the new "override" C++11 specifier when availableLaszlo Papp2013-03-241-1/+1
| | | | | | | | | | | | | | | | | | The usage of the specifier helps to catch mistakes in general and also explicitly shows the intention. Furthermore, leave the "virtual" specifier out as per Qt Coding Style: http://qt-project.org/wiki/Qt_Coding_Style#fe675674b70cdaca505f3cff0244fbae It does not make much sense in general with the override specifier either anyhow. Note: an empty define is still necessary as long as QtSerialPort supports Qt4 which is the current situation. Change-Id: Iedf01071e6303d88305c140f4a767bb43059f593 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Windows: Fix receive policies processingDenis Shienkov2013-03-161-3/+4
| | | | | | | | Policies should be handled only with ParityError occurred according to the description of the method setDataErrorPolicy(). Change-Id: Ie0dc9347e50d358508def5ba1a84dadbb0ead4be Reviewed-by: Laszlo Papp <lpapp@kde.org>
* Modify the restore settings on close API to lean towards the Qt'ish styleLaszlo Papp2013-02-101-1/+1
| | | | | | Change-Id: Idb648c9e8d0607826e775f4b92f092b5c81c9790 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Remove the QtSerialPort namespace define and hence namespace usageLaszlo Papp2013-02-071-4/+0
| | | | | | | | | | * This is for following the convention in the Qt Project with the rest. * This fixes examples and tests to build now as all of them are broken due to the regression. Change-Id: I3f4d64d97466520aea621da582a64a0d97e32136 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>