Use extended SDP discovery in btchat example.

Android's minimal service discovery is very limited and more often than
not fails entirely. Using FulklDiscovery dramatically increases the
chance to find the remote SPP chat server.

Task-number: QTBUG-38140
Change-Id: I1df55f74a6896312236ef06485c4063c9e893e6c
Reviewed-by: Nedim Hadzic <nhadzic@blackberry.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Build snippets during developer builds with examples only.

This replaces an earlier Android specific solution against
a more generic solution.

Task-number: QTBUG-37638
Change-Id: I472ea48567e872c658094a5576b9260bf2d02c89
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Fix inconsistent behavior between BtDiscoveryModel & BtServiceDiscoveryAgent

The model always resets the model content when starting a new service
discovery. However QBluetoothServiceDiscovery doesn't do that. It adds
newly discovered services and maintains the existing services. Since
the model updates its content based on the serviceDiscovered signal,
every second run created an empty list or only ever added services.

Change-Id: I9c1d29562b9178678ab42bee98d5d1e3d0c4367f
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Doc: Improved example documentation

-include a section about running the example (from qtbase/doc/global)
-added links to Qt Bluetooth or Qt NFC
-updated copyright year
-added markup to a string and other small corrections
-added \brief

Task-number: QTBUG-33597
Change-Id: Ia65821549a0e2e3fbf164188982114b4741be233
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
Don't double up the internal list of discovered services

Convention is that calling QBluetoothServiceDiscoveryAgent
maintains an internal list of discovered services. When start() is called
already discovered services are kept unless clear() was called. The Bluez
code never checked which services were already discovered by previous
discovery runs. This patch fixes this problem.

Change-Id: I3987d6ea65ea41aefc9726acc31f6abaa478c72c
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Do not always filter Serial Port profiles out anymore on Android

1.) If we find a custom and SPP uuid we create only on service
using custom uuid as service uuid and SPP as service class uuid.
THis is the recommended way. Any remote service should really
advertise a custom uuid. Unfortunately this is not always the
case on some embedded devices. Hence we need to cover the cases
below.

2.) If we find a custom uuid only we create a service which uses
the custom uuid as service uuid but we do not set a service class.

3.) If we find a SPP uuid only, we create a service which uses SPP
as service uuid and as service class uuid. This is no problem as
Android's connectToRfcommService() call explicitly permits an SPP
uuid as connection parameter.

4.) We find none of the above the problem doesn't exist in the
first place and no service was found.

Task-number: QTBUG-38140
Change-Id: I2e9080f65b98db23782264ef9e62a410ab9f91f1
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Add Qt 5.3.0 change log for QtNfc and QtBluetooth

Change-Id: Id489adfe1cfb4c652907e67950b8a12bf1c18c8c
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Refactor disconnection signals emittance in QBluetoothSocket

This fixes duplicate switching to the unconnected state in case
the disconnect() signal is used to reconnect.

[ChangeLog][QtBluetooth][QBluetoothSocket] Fixed duplicate emission
of unconnected state in the reconnection case.

Change-Id: If449420d936c96e62518fc408e6a1e35b79988a8
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Fix internal buffer corruption in QBluetoothSocket (BlueZ)

When _q_readNotify() is called and no data is available (e.g. in case
of timeout), then the internal buffer grows indefinitely, causing a
one time corruption of the following good data.

Change-Id: I75929382db73953bbccdd86b9ae248329df879fa
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Fix a crash in QBluetoothSocket on reconnection attempt (BlueZ)

Ensure a native socket is obtained after QBluetoothSocket has been closed.

[ChangeLog][QtBluetooth][QBluetoothSocket] Fixed a crash on reconnect.

Change-Id: I9f470d23366250dc20ad3305ddec16300c1ad8ec
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Fix discovery hanging in unrecoverable state due to incorrect error handling

The discovery of services happens in a sequentiali per-device order.
Once the first device's services were found, the results are processed
and the discovery is started on the next device. Unfortunately
if the search didn't create any results due to the remote device
refusing the SDP discovery or because the given remote Bluetooth
address was not valid, the discovery agent didn't continue with
the next device.

Now the error handling ensures that the discovery process is continued
with the next device (if there is any).

Task-number: QTBUG-38362
Change-Id: Ie27bbc5327eadc4bcc31b589227c51dc4fa2c7c1
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Provide correct code snippet for QBluetoothServiceDiscoveryAgent

Change-Id: I8b975a2f55833c58479edac5d62809c1e83ea417
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Bluez4: Fix incorrect list of connected devices in QBluetoothLocalDevice

ConnectionChange signals were never emitted for
remote devices which already existed at class instanciation time.

At the same time this patch removes the delayed creation of the
connectedDevices set. This simplifies the code and the caching did
not save much effort.

Task-number: QTBUG-38402
Change-Id: Ic871f919435c0d42ce2d79fd54f0da693816010a
Reviewed-by: Oleg Shparber <trollixx@gmail.com>
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Fix crash in QDeclarativeBluetoothService

The crash was caused by the listen() always returning -1 because the
condition m_service->socketProtocol() == UnknownProtocol was always true.

Change-Id: I13725bb13db3e7000e01a80601fdcb3380710798
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Bump MODULE_VERSION to 5.3.1

Change-Id: I295b61c203f2bb43f0cc0e71da78cefb4b6ddc0c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Merge remote-tracking branch 'origin/release' into stable

Change-Id: Ic86710cdf2550f5cf70c81af3f351d6712cd1b0e
Remove duplicate function definition

Change-Id: I1d76c50d84a0c33e56c2e197e5eb528b00082949
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Build snippet outside of example build configurations too.

This is a partial revert of 9615e7fbf439d0b2b9476ea7cb15ad145e675583.

The CI does not test a combined developer-build and example
configuration. Ensuring the snippet compiles is mostly a private test.
This patch drops the additional example condition to provide an
increased chance of compiling the snippets on the CI.

So far the condition never triggered and hence the CI couldn't ensure
a compiling snippet.

Task-number: QTBUG-37638
Change-Id: I8d815c6ddeaa2955c2824697a937d3b08729b979
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Fix a renamed qdoc tag and improve grammar/spelling

Change-Id: Iee11fdfe3b57fbe94d7e3362454851867d25e98a
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
Check for QT_NO_DEBUG_STREAM for QBluetoothUuid QDebug helper

[ChangeLog][QtBluetooth] QDebug helper for QBluetoothUuid became
aware of QT_NO_DEBUG_STREAM define.

Change-Id: I20941c32560bfc6beaa8f4f465799af987d0b0cd
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>