| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
SDP discovery on Android only returns a flat list of uuids. It mixes
service class uuid and service uuids. Furthermore it is unable to detect
whether a serial connection uses rfcomm or l2cp as base protocol. The
last limitation is the fact that serial sockets can only be established
using rfcomm (no l2cp).
This poses a serious challenge because there is no way to say whether
a given custom service uuid is indeed an SPP based service or whether
it uses rfcomm. The only way to know for sure is to connect and check
whether it succeeds.
This also means QBluetoothServiceInfo instances returned by
QBluetoothServiceDiscoveryAgent may or may not mark a serial service
with SPP uuid or rfcomm protocol tag. Currently, it guess that that a
custom uuid together with SPP uuid implies an rfcomm setup. If the SPP
uuid was not found, rfcomm is never set (but is a requirement for
QBluetoothSocket). This patch makes QBluetoothSocket on Android a bit
more forgiving by assuming every given QBluetoothServiceInfo instance
requires rfcomm. After all that's the only supported protocol on Android.
Fixes: QTBUG-75035
Change-Id: I498ac5acd2a394b198a113fd23d750bbf17a7f7b
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
|
|
|
|
|
| |
Change-Id: Idb12d3bb116d6c5b34f1ca145f473b118b58d5ee
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
|
|
|
|
|
|
|
|
| |
The related bug only happens for custom uuids.
Fixes: QTBUG-72681
Change-Id: I22d87b84bf3958ecce9b6020e3323f1e6c6a9255
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of duplicating that logic everywhere, it can be handled
in one place.
Additionally setOpenMode should be called before setSocketState
so that every member variable is changed, before signals are
emitted.
Change-Id: Ic1d4317ba31046d78d97874ec00c59481a67bb50
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
|
|
|
|
|
|
|
|
| |
This only happens when QBluetoothSocket was used in connection with
QBluetoothServer.
Change-Id: I9fcc3026415f815f9a44a10d721056437465f8b8
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The private implementation can much more easily determine whether the
socket closure is already done or not.
On Bluez DBus, this avoids disconnected() being
emitted twice. Another platform that is still delayed is Android.
The patch permits the removal of Android specific ifdefs.
Last but not least the patch cleans up missing signals in WinRT.
Task-number: QTBUG-68550
Change-Id: I189e1dbc9f6d410522da1a82113fdf4fe79a4cbd
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
This permits each platform to customize the implementations without
the need for ifdefs. Upcoming changes such as the BLuez DBuS addition
will increase the platform differences.
Task-number: QTBUG-68550
Change-Id: I8fc9a74d3ce704466f0bf2c16287e32f222c4376
Reviewed-by: Lubomir I. Ivanov <neolit123@gmail.com>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The goal is to move the various QBluetoothSocket::connectoService()
implementations into the private classes. Common parts can be split into
QBluetoothSocketBasePrivate and the platform specific code. The code
becomes cleaner and has less ifdefs.
However this creates a symbol clash with the currently existing private
implementation as it has a function with the same signature but different
purpose. This rename provides the foundation for future changes.
Task-number: QTBUG-68550
Change-Id: I121f08d93e00790c1619c0449629f47bca8a964d
Reviewed-by: Lubomir I. Ivanov <neolit123@gmail.com>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
|
|
|
|
|
|
|
| |
Task-number: QTBUG-68550
Change-Id: Iac05cccd4f6e1b44a30568fb9b6c9171204b53fd
Reviewed-by: Lubomir I. Ivanov <neolit123@gmail.com>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch introduces a generic interface towards QBluetoothSocketPrivate.
Later on, the QBluetoothSocketPrivate class will be split into
platform specific overloads/interfaces.
Ultimately, this will be needed to support runtime selection of
the QBluetootSocket d-pointer on Linux. The Linux Bluez5 implementation is
significantly different from the Bluez4 (raw socket) implementation.
Since recent Bluez5 releases the raw socket implementation is no longer
functional and/or the user has to have root permission
and enable bluetooth --compat mode. Therefore a second QBluetoothSocket
for the dbus socket API is needed. QBLuetoothSocket has to choose at runtime
(during its instanciation) which implementation to use.
Task-number: QTBUG-68550
Change-Id: I5d0b8e24b8acd1b149b897f52f0d82eade7f3823
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Lubomir I. Ivanov <neolit123@gmail.com>
|
|
|
|
|
|
|
|
|
| |
This fixes the problem for all supported platforms.
Task-number: QTBUG-67672
Change-Id: I9cecfbe8a73df46070293eba1870ea3bee738b7b
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
QBluetoothSocket::write() emits the bytesWritten(int) signal when the write
was successful. java.io.OutputStream.write() returns an exception when
it fails. We should not emit bytesWritten() if such an exception occurred.
Change-Id: I76e7a85188102e8227d586450c3e733c046e9957
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Not all platforms use txbuffer for writes. Fortunately those platforms
who do not use it do not use any buffering at all. Hence bytesToWrite()
returned the correct value as txbuffer always had size zero. Therefore
this patch is effectively a NOP.
Nevertheless this patch encourages the right implementation across the
platform.
This does not affect macOS as it has a separate implementation for
QBluetoothSocket::bytesToWrite().
Task-number: QTBUG-58190
Change-Id: Ic05f4358b079f612ee7e0e4dbb7fb9aa78fd6556
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On Android, the socket's read buffer is managed in the Java thread.
QBluetoothSocket::canReadLine() is public API (most likely) being called
by in the main Qt thread though. The function directly called into the
Java buffer instance without proper locking. This can create race conditions.
Starting with this patch canReadLine() calls another QBluetoothSocketPrivate
indirection to allow a platform specific implementation. This affects
WinRT, BlueZ and the dummy backend too.
This is not an issue on macOS as its implementation of QBluetoothSocket
is separate and does not have to deal with multiple
QBluetoothSocketPrivate implementations.
Task-number: QTBUG-58190
Task-number: QTBUG-60830
Change-Id: Idae19f1aee6f809699d36519b01a3c68ad9c563d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Due to an Android platform bug, SDP discovery may return the wrong uuid
for the remote service. This bug was introduced by Android 6.0.1 and
tracked by https://issuetracker.google.com/issues/37076498.
The returned UUID is byte swapped. To increase
the QBluetoothSocket::connectToService() convenience QBluetoothSocket
uses a fallback which attempts to connect to the remote service assuming
the uuid was byte swapped. This will only happen if the uuid is not
derived from the official Bluetooth base UUID (aka the given UUID is
truly custom).
There is the slight chance that the reversed UUID is a different service
but that chance is very marginal when considering the amount of possible
custom UUIDs.
Task-number: QTBUG-61392
Change-Id: Ia41d670ab8d0666628f067e174965b698d0f26b0
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
|
|
|
|
|
|
|
|
|
| |
The private BluetoothDevice.getServiceChannel() is no longer available
since Android release 6.0+ (v23+). We silently skip it on those
platforms.
Change-Id: Ia924f1c2fe81ccfb50b8abcfb682c350e9ce49ff
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
getServiceChannel() does not exist on more recent Android platforms.
The JNI call returns an exception and socketChannel is either 0 on debug
or undefined in release builds. The previous code did not reliably
recognize the case "0" (debug) or "random int" (release) as an error
state and hence channel variable was overridden with wrong value.
Change-Id: Ia81219376661be3fbbe0c9122f707bb82defa946
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see
http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/
Updated license headers to use new LGPL header instead of LGPL21 one
(in those files which will be under LGPL v3)
Change-Id: I856c13e2a6d4d12c46e1286b0ca1c092ee4608f8
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch permits Android clients to choose the security level
before connecting to the server.
This may also used by some older devices (Android 4.1 or lower)
to connect if they don't support the so far predetermined secure
way of connecting via rfcomm.
Task-number: QTBUG-46377
Change-Id: I3f72f183e7ead16bec57a0ce83e9a96324675312
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
|
|
|
|
|
|
|
|
|
| |
This permits the API user to determine the security parameters for the
connect attempt to the remote SPP service.
Task-number: QTBUG-46377
Change-Id: I1ed5ea0f5a32aa08dcedc46a34b0377654e420b2
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
|
|\
| |
| |
| | |
Change-Id: I177affc6c60fd3cc55e914a7ea2a9aeba260906f
|
| |
| |
| |
| |
| |
| |
| |
| | |
This happened when the remote device closes the socket and the local
Android device tries to reconnect using connectToDevice().
Change-Id: I1d8e3bfaea5f956cd71e390f4ab6e9d39256a66d
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
|
| |
| |
| |
| |
| |
| |
| |
| | |
[ChangeLog][QBluetooth][Android] Forced QBluetoothSocket to close when
its dtor is called
Change-Id: Ie31a6b64e4939c800983b5c497532c6fcf90c7c0
Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Calling BluetoothSocket.connect in Java blocks for a certain amount of
time. Previously, QtConcurrent::run() was used to separate the
Java connect() call out into a different thread. Since the function
executed by QtConcurrent and the user facing class shared data fields,
a crash occurred if the user deleted QBluetoothSocket while
QtConcurrent hadn't executed its service connect call yet.
The problem is solved by using QThread and Standard signal/slots
which separates the shared data members. The only remaining shared data
member is Java's BluetoothSocket instance which is shared via
QAndroidJniObject references. This is no problem as deleting one
reference retains the other reference.
Calling close() on an Android BluetoothSocket while a connect() is
ongoing seems to be buggy. Sometimes the close() returns, the pending
connect() throws an exception but the physical connection still
gets established. To avoid this the patch queues the close() call
up until after the connect() statement has returned. It is
accepted behavior that the connection might still get enabled for
a very brief moment despite a close() being issues before the connect()
actually finished.
The SocketConnectThread cleans itself up once the thread finished().
Task-number: QTBUG-44930
Change-Id: I8324497a7395de390529ecd0b97b1a326cd78f63
Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
|
| |
| |
| |
| |
| |
| |
| |
| | |
The template version of QAndroidJniObject::getStaticObjectField() is
deprecated. Use the non-template version instead.
Change-Id: If60abfc33e55dbdfdfedb7c603f191285cd13eeb
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
|
|\|
| |
| |
| | |
Change-Id: I5e86b84a6a4a7eb3dd5d64855a9f6a435bd2dcb6
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This applies to Android versions 4.1.x and below. The function returns
BluetoothDevice.ERROR or -1 in case of an error. So far only the ERROR
case was caught.
Task-number: QTBUG-44792
Change-Id: I512f846d74f2a03b2e6f5bf4df4127d584993f6c
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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: I3822a6484e8f7a420330de1cb1aeb0c3d1cf41b7
Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
|
|\|
| |
| |
| | |
Change-Id: Ia70c3fe64e2ffcb27181bf912b06e6af59d2bc92
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In certain situations internal java objects of QBluetoothSocket
cannot be deleted fast enough. This causes a crash when the local
reference table exceeds its maximum size of entries.
This patch converts the pure JNI code to a QAndroidJniObject based
version. It ensures faster cleanup of local jobject references
and improves readability too.
[ChangeLog][Platform Specific Changes][Android] Fixed leaking
of java objects when calling QBluetoothSocket::connectToService() on
Android.
Task-number: QTBUG-44164
Change-Id: Iaa696bfeee69c6a79f3aeddec262ae34d8891743
Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is much safer and cleaner.
[ChangeLog][QtBluetooth][Important Behavior Changes] Q_DECLARE_METATYPE
added for QBluetoothServiceDiscoveryAgent::Error,
QBluetoothSocket::SocketState, QBluetoothSocket::SocketError and
QBluetoothDeviceInfo. This breaks source compatibility if application
code has defined the above metatypes already. The applications
Q_DECLARE_METATYPE must be removed to fix the compile error.
Change-Id: I1c7cb1ee25832b7e5337c9aca6f36b21e8caf22e
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
|
|
|
|
|
|
| |
Change-Id: Ib8800fa30c74678c74df9ed943b143ea4cf49bb2
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
|
|
|
|
|
|
|
| |
Change-Id: Ifd6b5ed8176aa7959ed8da0edc762266aa2bd6fa
Task-number: QTBUG-32704
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
|
|\
| |
| |
| |
| |
| |
| | |
Conflicts:
src/bluetooth/qbluetoothdevicediscoveryagent_p.cpp
Change-Id: Ie8bf1903f9c7c1ccd5b05a3f97049ae0882b88b8
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Previously the remote rfcomm channel was fixed to 1 which may not
always match the correct rfcomm port.
At the end of the day this is still a workaround for failure to connect
when socket creation via UUID fails. We assume that the remote rfcomm
service can be reached via the channel number.
There is the remote chance that we connect to the wrong remote channel
because getServiceChannel() fails and we attempt to connect to the
hardcoded channel 1. However the workaround significantly reduces the
chance of failure as a few devices (especially on the low end margin)
cannot successfully connect via the UUID.
The patch improves code readability and formatting too.
Task-number: QTBUG-40172
Change-Id: Iae90252c877ca13953a81ea1ed83cc2c73abdf2a
Reviewed-by: firatagdas <firatagdas@gmail.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
|
| |
| |
| |
| |
| | |
Change-Id: Ibc4c835a9778bfa220ad6553f2c0140a7727d75d
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
These two functions are really only needed by Linux style socket code.
There is no need for other platforms to implement them as dummy too.
It simplifies the code somewhat.
Change-Id: I3e0aced8d9f7b590d1c6aaa60f97bd060ee8f4b4
Reviewed-by: Aaron McCarthy <mccarthy.aaron@gmail.com>
|
|/
|
|
|
|
|
|
|
| |
- Renamed LICENSE.LGPL to LICENSE.LGPLv21
- Added LICENSE.LGPLv3 & LICENSE.GPLv2
- Removed LICENSE.GPL
Change-Id: I7a8b8b787fcae9a178794364efdefe1021d10b1b
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It seems not all devices reliably return the correct value when calling
isConnected(). connect() succeeds but isConnected() is still false.
On the positive side it is not really needed either.
Calling connect() returns an exception if it fails and close() can be
safely called multiple times. Therefore we only have to check for ocurring
exceptions.
Furthermore isConnected() is API lvl 14 and was not guarded. Removing
the call resolves this problem too.
Task-number: QTBUG-39815
Change-Id: Idf8472c268231a2cfac0f5cd87294384ff779c3f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
|
|
|
|
|
|
|
|
| |
The signal/slot connection actually uses an int as parameter
Change-Id: Ib9221137c36020d71834dca53040e174f855318e
Reviewed-by: Nedim Hadzic <nhadzic@blackberry.com>
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
|
|
|
|
|
|
|
|
| |
Performance improvement
Change-Id: I9565771ab6ed15dccc67d5d7e7d5c02759a40367
Reviewed-by: Nedim Hadzic <nhadzic@blackberry.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
|
|
|
|
|
|
| |
Change-Id: I01e867cb5efb231e7c85b0d106897b2f31448977
Reviewed-by: Aaron McCarthy <mccarthy.aaron@gmail.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
|
|
|
|
|
|
| |
Change-Id: I933d1f1e196b1009de6b33a2e603043d85d28b08
Reviewed-by: Nedim Hadzic <nedimhadzija@gmail.com>
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
The previous QThread did not always properly resume when
InputStream.read() was interrupted by BluetoothSocket.close().
This patch converts the QThread to a Java thread which works
as the Android API docs suggested.
Task-number: QTBUG-37061
Change-Id: Id6ac9b57a28f3b532cbe49ff1dfdc9d1e6432aaa
Reviewed-by: Nedim Hadzic <nedimhadzija@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Java's BluetoothSocketServer.accept() is meant to be interrupted
via BluetoothSocketServer.close(). Unfortunately if the surrounding
thread is a QThread the returning accept call crashes the thread. This
does not happen if it is a Java Thread.
This commit changes the server's private backend to a Java thread.
Task-number: QTBUG-36754
Change-Id: I5aacc5444bbcd1275a11743b6aa04d2b11a5b22b
Reviewed-by: Nedim Hadzic <nedimhadzija@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
|
|
|
|
|
|
|
|
|
| |
The function is not required as the public accessor function directly
returns the socket descriptor.
Change-Id: I6d64bec7b4f0542ce213dc90dcfe30c3885ed21d
Reviewed-by: Nedim Hadzic <nedimhadzija@gmail.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
|
|
|
|
|
|
|
|
| |
This includes unification of error messages, fixes for spelling
mistakes, hints for translators and other forms of simplifications.
Change-Id: Idd0e01614b24ff2d19133f0d19d49649d59e3f57
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
|
|
This is a feature merge to dev targeting Qt 5.3.
Known issues:
-QTBUG-36754: QBluetoothServer::close() crashes
-QTBUG-36763: QBluetothTransferManager port to Android not possible
-QTBUG-36764: Improve QBluetoothLocalDevice::connectedDevices()
-QTBUG-36810: Remove direct use of Android action strings
The above issues and some other minor TODO's will be addressed
until final release time.
Task-number: QTBUG-33792
[ChangeLog][QtBluetooth][Android] QtBluetooth has been ported to
Android.
Change-Id: I31ba83e3b7d6aa68e7258b7e43235de7d1a6e68a
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
|