creadersync: do not return successful read for empty data

In case of handling of the TimeoutError it is necessary to check on
existence of the read data (for this concrete implementation of the
example). Otherwise the application always return the TimeoutError
even if a data was successfully read.

Change-Id: I2437461f2ed2806bb7d7e16deb6925df035f62a1
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Merge remote-tracking branch 'origin/stable' into dev

Change-Id: I9b4871e9d69e73a1267a700aa953efaa0267c0e1
Unify of the internal API of asynchronous handling

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>
Optimize access to the write buffer

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>
Bump MODULE_VERSION to 5.2.2

Change-Id: Ic1184214f9ce933fc3df47629e0a707e0b8d63f5
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Merge remote-tracking branch 'origin/stable' into dev

Conflicts:
	.qmake.conf

Change-Id: Id8be0cbb66eabf59c47011e4605e71cf29c1f532