| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
Implement the proper interface from QBluetoothSocketBasePrivate,
remove a dummy base class. Remove all public API from
qbluetoothsocket_osx.mm and re-use the code in qbluetoothsocket.cpp.
The code generally is the same, a bit of re-hashin/deletion.
Task-number: QTBUG-75348
Change-Id: I0034dfd283daf9d51775d8f9551b85d2d436aa85
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- use the shared *._p.h file/class declaration for the private class
- use the shared *.cpp with the public class implementation
- get rid of *_ios.mm - iOS/tvOS/watchOS specific implementation
and use the shared (by macOS, iOS, tvOS, watchOS) *_darwin.mm source.
- get rid of somewhat weird 'isValid' in the private class, it is
is not taken care of in the public API anyway and today its
whole concept/usage looks (quite) buggy to me. I only have to
check that the default controller is not nil and has the
state 'ON'.
Task-number: QTBUG-75348
Change-Id: I5383e4f8df02ac12f069c2f59e252cb8a200800b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
... to simplify future code de-duplication. In this patch we:
- For simplicity move all C++ delegate classes into their
own header. Since we have to hide Objective-C from C++ compiler
(while compiling *.cpp files), these updated delegates
have to use void * instead of Objective-C classes.
- Introduce a new RAII classes, that work with Objective-C
instances but have a header that can be included into the
*.cpp files, thus making it possible to share *_p.h files with
all back-ends.
I'm also switching to a new naming convention, which will later
propagate to the pre-existing code - given files are already in
a sub-directory 'osx', having a prefix 'osxbt' in a name is
excessive. Now it's becoming 'bt' (include "osx/btsomething.h").
Later 'osx' dir is to be renamed into 'darwin', which is what
it is these days. Namespace OSXBluetooth is to become DarwinBluetooth.
Task-number: QTBUG-75348
Change-Id: Iebaeab7d0c5e672efebab8218debdec761353633
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
QtBluetooth is using its own dispatch queue in CoreBluetooth
back-end - this is where CoreBluetooth is executing all callbacks
we're providing in delegate classes. Some operations like service
discovery/characteristic or descriptor read(s) amd write(s) e.t.c.
may sometimes fail to finish - no value read, no error reported
(so delegate's method - callback - is never called). To deal with
this we introduce the class OSXBTGCDTimer and GCDTimerDelegate
protocol; GCDTimer periodically inserts blocks into the serial
LE queue and checks for timeouts upon their execution.
Task-number: QTBUG-68422
Change-Id: Ic17bf91d4223ad1ffc7b9808da36c902a4158227
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
|
|
|
|
|
| |
Change-Id: I041606473b333500da29c821d7dc089313856f65
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
|
|\
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
src/bluetooth/osx/osxbtledeviceinquiry.mm
src/bluetooth/qbluetoothdevicediscoveryagent_osx.mm
Change-Id: I7dc75c187af73917f31c28b9edfaf8bcf9652a3e
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- With recent SDK changes CoreBluetooth is not in IOBluetooth anymore.
This makes corebluetoothwrapper_p.h even uglier, now we have to care
about v != 10.9 && v < 10.12; v == 10.9; v >= 10.12.
- Using osxbluetooth_p.h we can get rid of forward declarations (for
Obj-C classes) and weird includes like <IOBluetooth/IOBluetoothRFCOMChannel.h>
- use osxbluetooth_p.h instead (and it will correctly include
IOBluetooth/IOBluetooth.h etc.).
Change-Id: Ia85ef2e2cc1ac7b15a58864ed25d85a0772e5c86
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| | |
CoreBluetooth for tvOS does not support peripheral role.
Change-Id: I82e7a61abfd907ea53faf33264951727f3cbe5a2
Reviewed-by: Mike Krus <mike.krus@kdab.com>
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
|
|/
|
|
|
|
|
|
|
| |
CoreBluetooth has CBPeripheralManager/CBMutableService both on iOS (since 6.0) and OS X
(>= 10.9). This lets me implement the Qt's BTLE 'advertisement'
API and peripheral role for both iOS and OS X.
Change-Id: I3e69a5870535a45bc16bbd9862ca84300b01daca
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ATM CBCentralManager's delegate does its work on the main queue. With
CoreFoundation event dispatcher it's now possible to use QtBluetooth from
non-gui thread (more generally - from a thread other than main).
This makes main queue useless - and we have to move to a dedicated dispatch
queue. Also, we have to make sure we do not have race conditioins/dead-locks.
This patch:
1. decouples OSXBTLECentralManager and QLowEnergyController so that these
two objects working (potentially) on different threads do not share any data
and do not have to use locks, removes the explicit 'delegate' interface/inheritance
and replaces them with LECentralNotifier class - to be able to use Qt's signal/slot mechanics
for inter-thread communication.
2. all OSXBTLECentralManager's are now executed on qt_LE_queue queue
to avoid any race-conditions (since they potentially update manager's
internal state).
3. Results/errors are now reported using LECentralNotifier's object
(QLowEnergyController has corresponding slots connected to the notifier)
Task-number: QTBUG-49476
Change-Id: Ie07cdc13ad559c96a7d2ff010843fb7bcce07c99
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
|
|
|
|
|
|
|
|
|
|
|
| |
lupdate cannot parse .mm files. Therefore tr markup must be inside of
C++ files.
Some error strings where slightly modified to make use of already
existing translations for other backends such as Bluez and QNX.
Change-Id: I97fe6cfe2227e32fdbc61edd253080a1cd68edc9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
|
|
|
|
|
|
|
|
| |
Replace handwritten 'signatures' with Q_FUNC_INFO, remove spurious
debug messages. Get rid of 'transient delegate' trick.
Change-Id: I2c490271baba7247af11df128964b61d0255ef95
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
|
|
|
|
|
|
|
| |
Enable Core Bluetooth-based version for iOS.
Change-Id: Ica13fdc6c01744713483771e7c8ad6153c9fccdf
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implement connect to device/disconnect from device methods,
add CentralManager class dealing with CBCentralManager (with
additional external logic).
- Improve error handling while in 'connecting' state.
- Use the proper error (ConnectionError) instead of UnknownError +
make the error handling more uniform while isConnecting == true.
- Use isNull on QBluetoothUuid, no need in ugly 'hasUuid'.
Change-Id: I84a704a746b4677ccb870b9c132db5f7359030c6
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Unfortunately IOBluetoothDeviceInquiry does not scan for LE devices,
so I need a separate scan for OS X and iOS imeplemented with CoreBluetooth
framework.
- CoreBluetooth hides addresses - "think different" in action. So we'll
have to use 'identifiers' (NSUUID actually) provided by CoreBluetooth instead
and we'll have to ask CBCentralManager to retrieve peripheral with a given
NSUUID (or however we encode it).
- Inform a delegate about LE device discovered.
- Add the second scan/pass (Bluetooth LE) in QBluetoothDeviceDiscoveryAgent.
- Make it all more "protocol conformant"
- Do a proper cleanup + fix auto-test failure
- Make a device inquiry longer + remove totally useless (??) 'name update'.
- Use a plain bool instead of IOReturn (no this type(??) on iOS).
- CoreBluetooth provides enumerators to check if LE is supported or not,
no need to manipulate with StatePowerOn and other flags.
- Add a workaround for a broken SDK (10.9 + CoreBluetooth headers + c++11).
NSUUID is quite new - added in 10.8/6.0, works only on 10.9 and 7.0 (works ==
there is required interface).
- CBCentralManager: it looks like it's impossible to delete an object of this type
before centralDidUpdateStatus was called - this is not good, since a C++ object
(the owner) can be deleted at any point - some preliminary workaround is to
create a temporary delegate and pass the ownership from the dealloc. To be
investigated/tested.
- Move the TransientCentralManagerDelegate into the separate file - it'll
be reused in future by other users of CBCentralManager.
Change-Id: I4434c23366618061029be4022cfa0f7647df45b9
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implement file transfer using IOBluetoothOBEXSession.
- Add OBEX session class and session delegate.
- Implement OBEX connect operation.
- Aux. function to convert OBEX data into Qt's data types.
- Start implementing OBEX put.
- Extract a connection ID from response headers (if any?).
- OBEX Put (without response/event handler yet).
- OBEX Put completed - send the remaining chunks of data (if any).
Change the unicode string encoding - byte order.
- OBEX change error handling - there can be real errors (OBEX event type == error_type)
but also response code can be not something good - handle them both.
- Emit all signals and make Qt' btfiletransfer really working now.
- Protect a service discovery against the early stop (can be a result of emit serviceDiscovered).
- After a file transfer finished (either success or a failure) - disconnect (if connected)
OBEX session - to make it possible to send more files.
- Implement OBEXPutError + isFinished/isRunning and signals on error.
- Add proper 'abort' and 'start' slots. Also emit finished on errors.
- If we do not have a file, but just an input stream, generate
a _really_ random and unique name, not 'XXXXX' template.
Change-Id: Ib6fb35d8e0eb07d71ccd2d7b565bba226bef119c
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implement QBluetoothServer using IOBluetooth framework.
- Add empty (for now) implementation + modify .pro file.
- Add a 'socket listener'. Actually, there are no sockets,
no 'listen' but I still have to emulate this to make a server work.
- Implement (to some degree) QBluetoothServer::listen member functions:
on OS X QBluetoothServer::listen(address, port) does not really create
a listening socket, it just checks that this port is not busy yet
(IOBluetooth can either listen on a port you provide, or can
listen on any port, but it can not select some port and listen on it.
Only after service registered (with 'invalid' port first) - we have a real
channelID or PSM.
- Server port - either a "fake" port assigned by QBluetoothServer::listen,
or a real port as registered by IOBluetooth.
- Update a dependency.
- Implement nextPendingConnection.
- Implement fake server ports (something similar to Android version), but
on OS X these fake ports can later be replaced with real ports.
- Service info updates PSM/ChannelID with a real port and also starts a listener.
- Unregister a server (dtor, close, etc.)
- Do not update a 'fake' port with a real one: it can happen, that a real port
is already taken by some 'fake' port and this will break the whole idea of
fake ports. Let them be always fake, the real is required only when starting
a 'listener'.
- With 'fake' server ports '0' is not valid anymore (use serverPort() instead).
Change-Id: I44537a35891c6806e58ec874a18bd938d4b41c53
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implement QBluetoothSocket using IOBluetooth framework on OS X
(will implement Qt's API as close as possible with a given Apple's API).
Update 0: add (empty for now) delegate classes (L2CAP/RFCOMM).
Update 1: add service discovery (called doDeviceDiscovery though).
Update 2: implement the public class' logic (QBluetoothSocket, connectToService).
Update 3: more public logic implemented (since it's easy :) )
Update 4: L2CAP delegate - initial logic.
Update 5: connectToService - L2CAP "socket".
Update 6: fix pivate header files.
Update 7: fix dependency after the previous patch was merged.
Update 8: writeData - initial version for L2CAP.
Update 9: since RFCOM/L2CAP delegates have the same interface,
no need in duplicating the same class - add a "generic"
ChannelDelegate instead.
Update 10: more RFCOMM logic.
Update 11: function to build a service description from
QBluetoothServiceInfo (to be registered on SDP server).
Update 12: QBluetoothSocket::close/abort.
Update 13: Create a dictioinary out of QBluetoothServiceInfo to register a service.
Update 14: Add service registration.
Update 15: Convert attributes (sequences and 'scalars') from QBluetoothServiceInfor
into NSDictionary.
Update 16: Update QBluetoothServiceInfo with a real PSM/ChannelID
after a service was registered.
Update 17: Move a private class (bluetooth socket) into the separate private
header file (to make it visible for bluetooth_server_osx)
Update 18: Add an interface to create a bluetooth socket (private class)
from a channel, reported by a notification (found by a listening
server).
Update 19: Fix an invalid assert - any state (Inactive/ServiceDiscovery/DeviceDiscovery)
is possible, not only Inactive.
Implement the missing 'readData' and 'writeData' for RFCOMM.
Set SDP query as non-active after query finished.
Temporary (!) workaround - can not invokeMethod on a private socket (d_ptr).
Update 20: When creating a socket wrapper from an incoming notification/channel, set:
socket type + channel's delegate.
Change-Id: Idd6d5478597206ed759f49e282baed948d105ddf
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
QBluetoothServiceInfo and QBluetoothServiceDiscoveryAgent - version for
OS X (IOBluetooth-based).
Update 0: initial dummy version + mods to enable this new classes to be built
with qtconnectivity.
Update 1: SDP query + initial implementation of a services discovery agent.
Update 2: aux functions to "parse" a service records once I got it.
Update 3: extract services UUIDs on a discovered device, if any.
Update 4: refactor
Update 5: "fix" asserts
Update 6: more asserts fixed.
Update 7: add the ability to stop SDP query (to be tested!!!)
Update 8: mods as suggested in review.
Update 9: no reason to check the size of discoveredDevices after 'clear' call.
Update 10: set an error and error description only if it's a 'singleDevice'.
Update 11: fix private header (_p suffix).
Update 12: on 10.7 (with quite old clang) there is no 'subscript operator'
syntax for NSDictionary.
Change-Id: Ib3b07b49e3ed6381af75fb8b1e29cdf1e7a11237
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
|
|
QBluetoothLocalDevice and QBluetoothDeviceDiscoveryAgent for OS X -
Bluetooth Classic (the implementation based on IOBluetooth).
+ a very simple non-gui test (requires QApplication to work though).
Update 0: style issues reported by Qt-Bot + fix a test.
Update 1: QBluetoothLocalDevice - display confirmation
Update 2: Device discovery agent - follow the expected logic
and apply suggested fixes.
Update 3: started/finished delegate methods seems to be synchronous and immediately follow
start/stop calls on an inquiry.
Update 4: remove unused function and redundant error message.
Update 5: the first attempt to fix pairingStatus/requestPairing on a local device.
Update 6: on OS X it's impossible (with a given public API) to request 'Unpaired'.
I was only able to find some quite terrible hacks with private APIs or
even worse - playing with SystemConfiguration frameworks and changing
System Preferencies programmatically (requires authorization and looks like a
total hack, since it has nothing to do with Bluetooth framework).
Update 7: A very limited support for deviceConnected and connectedDevices.
Update 8: Fix an invalid invokeMethod's argument.
Update 9: Subject changed.
Update 10: fixes in a documentation.
Update 11: asserts in a coding convetion/style.
Update 12: "fix" asserts + emit errors if a start/stop failed.
Update 13: deviceDisconnected implemented.
Update 14: use not only paired && connected devices (QBluetoothLocalDevice::connectedDevices),
but also devices discovered by the connection monitor.
Update 15: remove a test, not required (there are 'auto' tests).
Update 16: fix private headers - they MUST have _p suffix :(
Update 17: tests are known to fail (at the moment) - IOBluetooth
requires adjustment (QApplication instead of QCoreApplication,
lack of ability to power on/off a device (not possible on Mac) +
other things).
Change-Id: Iea1c8a98f1fd719f4560ec8920d00cc07eaa8146
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
|