Fix memory leaks in Bluez specific device and SDP discovery classes.

[ChangeLog][QtBluetooth][Platform Specific Changes] Memory leaks fixed
in Bluez device and service discovery implementations.

Change-Id: Ibc7c883d42d81a97310ff44ba40ffa94c71f611f
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Reviewed-by: Aaron McCarthy <mccarthy.aaron@gmail.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Cleanup dead code in Bluez SDP discovery backend

The change tweaks the discovery debug output log too.

Change-Id: I4ef3e2e8ebaf0d9e593eee35a669641e3914da01
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Reviewed-by: Aaron McCarthy <mccarthy.aaron@gmail.com>
Improve QBluetoothServiceDiscoveryAgent documentation

[ChangeLog][QtBluetooth][QBluetoothServiceDiscoveryAgent] The
QBluetoothServiceDiscoveryAgent class documentation has been improved.

Change-Id: I5472e9ceda45d9bcf0634b5bf2cecf265986bc10
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Reviewed-by: Aaron McCarthy <mccarthy.aaron@gmail.com>
Do not clear result lists while the SDP search is ongoing.

Or bad things will happen...

Change-Id: I7df3925ff5d15f3f904f4dd38e24b247ec151fd1
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Reviewed-by: Aaron McCarthy <mccarthy.aaron@gmail.com>
Add missing documentation for QQmlNdefRecord::Unknown enum value.

Change-Id: Ida3f7816340f9379629e653abc5ef89f5aa38486
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Stop SDP search if QML Model is turned off

So far, we only ever disabled the device search. If a SDP discovery was
running and we changed to device discovery the SDP discovery kept running
in the background.

Change-Id: I5f2cf88ecf7f9b5cfe2608e0ceda366b552982e5
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Update changelog for 5.2.1

Change-Id: Ie67e598578628663fff9cee7b0f82200f575f2b2
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Fix crash during SDP discovery on Bluez

Stopping the discovery during an ongoing SDP search may cause
a crash because discoveredDevices has been cleared although
we still access the list later on. Even if list access wouldn't
be required anymore there is no reason to continue the
discovery. Entry guards for the involved slots were added.

Additionally it revealed a memory leak which has been fixed

Change-Id: I3fd3c99a82a9d7b61e853a3f9f3877b8ad7f6d41
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Merge remote-tracking branch 'origin/release' into stable

Change-Id: I7e74e90225c27cb22e51c488a6a0e563359042fe
Fix broken SDP discovery on QBluetoothSocket

ThHis is only used on Bluez at this stage. THe SDP agent was initialized
with the local adapter being the remote address of the remote service.
This could never work. The remote address is now properly set (being the
handed over bt address to QBluetoothSocket::connectToService()).

[ChangeLog][QtBluetooth][QtBluetoothSocket] Fixed incorrect
invocation of QBluetoothDiscoveryAgent where the remote service address
was incorrectly assumed to be the local Bt adapter address. This prevented
the detection of the remote service. This bug only affects the Bluez
backend.

Change-Id: Ice2b9c351bfd42f1f4398b14ac68f76315f01fa8
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Fix crash in Bluez implementation for QBluetoothSocket

The internal socket was closed but not reset to -1 after calling close()
or abort(). As a consequence the subsequent connect() call crashed since
internal socket notifier were invalid

[ChangeLog][QtBluetooth][QBluetoothSocket] Fixed a crash in Bluez part
of QBluetoothSocket() which was caused when triggered when calling
the sequence connect() - abort() - connect().

Change-Id: I21b779c7808d0a5211df9e2481da28e2e9753ca9
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Initialize QBluetoothSocket::socketError properly.

So far the initial value is compiler dependent. In most cases this meant
it was set to 0. However 0 is not even a valid
QBluetoothSocket::SocketError enum value. The NoSocketError value is -2.

Change-Id: Ieee4f7bd1c97d758295f4d0cc1297f62c114f4f3
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Refine documentation for QBluetoothSocket::localXYZ() functions.

Bluez never returns anything until the connection has been established.
BlackBerry and the future Android port are much quicker.

Change-Id: Ic465a9b68176e7fff5f0c88b4fb602f8665f7197
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Don't cache the QBluetoothSocket::localName() & peerName()

This affects Bluez only. The other platforms don't use this feature.
The problem was triggered when connecting, disconnecting and connecting
again to another device. localName() might change due to a different
local Bluetooth adapter being used and peerName() is different anyway
in such cases.

Change-Id: I8983a355832cf4f4d9a654971c54f5624be288e6
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Synchronize setting of QBluetoothSocket's error string, code and signal

This fixes a few cases where errorString, error signal and error code
where out of sync because one was set but not the other. This was
addressed by unifying the usage pattern for error activation to a
pattern where errorString is set and setSocketError() is called
afterwards.

Change-Id: Ibfb04772cf560936aa4ce8ea9643d6a410cc9ee2
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Use qt_error_string rather than strerror.

Change-Id: Ide3f00cacd7a42e99823441a45609f8e50063fce
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Merge remote-tracking branch 'gerrit/stable' into dev

Conflicts:
	src/bluetooth/qbluetoothservicediscoveryagent.cpp

Change-Id: I52831fc8c69062e90c003836fd9402f19d6a0ba5
Merge "Merge remote-tracking branch 'gerrit/stable' into dev" into refs/staging/dev