Merge tag 'v6.5.7-lts' into tqtc/lts-6.5-opensource
Qt 6.5.7-lts release Conflicts solved: dependencies.yaml Change-Id: I048d0527aa2e8a0fb84206f14dbace664926d38c
This commit is contained in:
commit
c8c5ffc300
|
|
@ -1,3 +1,3 @@
|
|||
set(QT_REPO_MODULE_VERSION "6.5.6")
|
||||
set(QT_REPO_MODULE_VERSION "6.5.7")
|
||||
set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1")
|
||||
set(QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_AS_CONST=1")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
dependencies:
|
||||
../tqtc-qtbase:
|
||||
ref: 5d8e9a8415562ba004b38508d91e1fa0254c17d3
|
||||
ref: fc0e66eefe3a08428ca4a6e92c66f37ac126d3c4
|
||||
required: true
|
||||
../tqtc-qtdeclarative:
|
||||
ref: ff0a47c8f267e905113b82c53af2742027f0eca6
|
||||
ref: 844f9b9b376838bcb44324984876f8bf99d85d38
|
||||
required: false
|
||||
|
|
|
|||
|
|
@ -1530,6 +1530,7 @@ public class QtBluetoothLE {
|
|||
break;
|
||||
case Mtu:
|
||||
skip = executeMtuExchange();
|
||||
break;
|
||||
case Rssi:
|
||||
skip = executeRemoteRssiRead();
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -6,14 +6,23 @@
|
|||
#include "btdelegates_p.h"
|
||||
#include "btutility_p.h"
|
||||
|
||||
#include <QtCore/qtimer.h>
|
||||
|
||||
QT_USE_NAMESPACE
|
||||
|
||||
namespace {
|
||||
|
||||
static constexpr auto channelOpenTimeoutMs = std::chrono::milliseconds{20000};
|
||||
|
||||
} // namespace
|
||||
|
||||
@implementation DarwinBTRFCOMMChannel
|
||||
{
|
||||
QT_PREPEND_NAMESPACE(DarwinBluetooth)::ChannelDelegate *delegate;
|
||||
IOBluetoothDevice *device;
|
||||
IOBluetoothRFCOMMChannel *channel;
|
||||
bool connected;
|
||||
std::unique_ptr<QTimer> channelOpenTimer;
|
||||
}
|
||||
|
||||
- (id)initWithDelegate:(DarwinBluetooth::ChannelDelegate *)aDelegate
|
||||
|
|
@ -89,12 +98,24 @@ QT_USE_NAMESPACE
|
|||
const IOReturn status = [device openRFCOMMChannelAsync:&channel
|
||||
withChannelID:channelID delegate:self];
|
||||
if (status != kIOReturnSuccess) {
|
||||
qCCritical(QT_BT_DARWIN) << "failed to open L2CAP channel";
|
||||
qCCritical(QT_BT_DARWIN) << "failed to open RFCOMM channel";
|
||||
// device is still autoreleased.
|
||||
device = nil;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (!channelOpenTimer) {
|
||||
channelOpenTimer.reset(new QTimer);
|
||||
QObject::connect(channelOpenTimer.get(), &QTimer::timeout,
|
||||
channelOpenTimer.get(), [self]() {
|
||||
qCDebug(QT_BT_DARWIN) << "Could not open the RFCOMM channel within the specified "
|
||||
"timeout. Assuming that the remote device is not available.";
|
||||
[self handleChannelOpenTimeout];
|
||||
});
|
||||
channelOpenTimer->setSingleShot(true);
|
||||
}
|
||||
channelOpenTimer->start(channelOpenTimeoutMs);
|
||||
|
||||
[channel retain];// What if we're closed already?
|
||||
[device retain];
|
||||
|
||||
|
|
@ -121,10 +142,13 @@ QT_USE_NAMESPACE
|
|||
{
|
||||
Q_UNUSED(rfcommChannel);
|
||||
|
||||
Q_ASSERT_X(channelOpenTimer.get(), Q_FUNC_INFO, "invalid timer (null)");
|
||||
Q_ASSERT_X(delegate, Q_FUNC_INFO, "invalid delegate (null)");
|
||||
|
||||
channelOpenTimer->stop();
|
||||
if (error != kIOReturnSuccess) {
|
||||
delegate->setChannelError(error);
|
||||
delegate->channelClosed();
|
||||
} else {
|
||||
connected = true;
|
||||
delegate->channelOpenComplete();
|
||||
|
|
@ -221,5 +245,14 @@ QT_USE_NAMESPACE
|
|||
return [channel writeAsync:data length:length refcon:nullptr];
|
||||
}
|
||||
|
||||
- (void)handleChannelOpenTimeout
|
||||
{
|
||||
Q_ASSERT_X(delegate, Q_FUNC_INFO, "invalid delegate (null)");
|
||||
Q_ASSERT_X(channel, Q_FUNC_INFO, "invalid RFCOMM channel");
|
||||
|
||||
delegate->setChannelError(kIOReturnNotOpen);
|
||||
[channel closeChannel];
|
||||
delegate->channelClosed();
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ QT_END_NAMESPACE
|
|||
- (IOReturn) writeSync:(void*)data length:(UInt16)length;
|
||||
- (IOReturn) writeAsync:(void*)data length:(UInt16)length;
|
||||
|
||||
- (void)handleChannelOpenTimeout;
|
||||
|
||||
@end
|
||||
|
||||
QT_NAMESPACE_ALIAS_OBJC_CLASS(DarwinBTRFCOMMChannel);
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ public:
|
|||
}
|
||||
void init()
|
||||
{
|
||||
m_watcher.AllowExtendedAdvertisements(true);
|
||||
m_watcher.ScanningMode(BluetoothLEScanningMode::Active);
|
||||
}
|
||||
void start() {
|
||||
|
|
|
|||
|
|
@ -74,8 +74,8 @@ QT_IMPL_METATYPE_EXTERN_TAGGED(QBluetoothLocalDevice::Error, QBluetoothLocalDevi
|
|||
as service discovery can be skipped on devices not in LimitedInquiry mode. In this mode, the device will
|
||||
be connectable and powered on, if required. This mode is is not supported on Android.
|
||||
|
||||
\note On \macos, it is not possible to set the \l hostMode() to
|
||||
HostConnectable or HostPoweredOff.
|
||||
\note On \macos, it is not possible to set the \l hostMode(). The
|
||||
reported host modes are limited to HostPoweredOff and HostConnectable.
|
||||
|
||||
\note On Windows, it is not possible to set the \l hostMode() to
|
||||
HostDiscoverable or HostDiscoverableLimitedInquiry. Using these modes is
|
||||
|
|
|
|||
|
|
@ -18,15 +18,33 @@
|
|||
#include <Foundation/Foundation.h>
|
||||
|
||||
#include <IOBluetooth/IOBluetooth.h>
|
||||
#include <CoreBluetooth/CoreBluetooth.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QBluetoothLocalDevicePrivate;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
@interface QT_MANGLE_NAMESPACE(QDarwinBluetoothStateMonitor) : NSObject <CBCentralManagerDelegate>
|
||||
|
||||
@property (strong, nonatomic) CBCentralManager *manager;
|
||||
@property (assign, nonatomic) QT_PREPEND_NAMESPACE(QBluetoothLocalDevicePrivate) *localDevicePrivate;
|
||||
|
||||
- (instancetype)initWith:(QT_PREPEND_NAMESPACE(QBluetoothLocalDevicePrivate) *)localDevicePrivate;
|
||||
- (CBManagerState)currentState;
|
||||
- (void)startMonitoring;
|
||||
- (void)stopMonitoring;
|
||||
|
||||
@end
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QBluetoothLocalDevicePrivate : public DarwinBluetooth::PairingDelegate,
|
||||
public DarwinBluetooth::ConnectionMonitor
|
||||
{
|
||||
friend class QBluetoothLocalDevice;
|
||||
Q_DECLARE_PUBLIC(QBluetoothLocalDevice)
|
||||
public:
|
||||
typedef QBluetoothLocalDevice::Pairing Pairing;
|
||||
|
||||
|
|
@ -38,6 +56,8 @@ public:
|
|||
void requestPairing(const QBluetoothAddress &address, Pairing pairing);
|
||||
Pairing pairingStatus(const QBluetoothAddress &address) const;
|
||||
|
||||
void bluetoothStateChanged(CBManagerState newState);
|
||||
|
||||
private:
|
||||
|
||||
// PairingDelegate:
|
||||
|
|
@ -59,6 +79,9 @@ private:
|
|||
|
||||
void unpair(const QBluetoothAddress &deviceAddress);
|
||||
|
||||
DarwinBluetooth::ObjCScopedPointer<QT_MANGLE_NAMESPACE(QDarwinBluetoothStateMonitor)> bluetoothStateMonitor;
|
||||
QBluetoothLocalDevice::HostMode hostMode = QBluetoothLocalDevice::HostMode::HostPoweredOff;
|
||||
|
||||
QBluetoothLocalDevice *q_ptr;
|
||||
|
||||
using HostController = DarwinBluetooth::ObjCScopedPointer<IOBluetoothHostController>;
|
||||
|
|
@ -113,14 +136,45 @@ QBluetoothLocalDevicePrivate::QBluetoothLocalDevicePrivate(QBluetoothLocalDevice
|
|||
// This one is optional, if it fails to initialize, we do not care at all.
|
||||
connectionMonitor.reset([[DarwinBTConnectionMonitor alloc] initWithMonitor:this],
|
||||
DarwinBluetooth::RetainPolicy::noInitialRetain);
|
||||
// Set the initial host mode
|
||||
if ([hostController powerState])
|
||||
hostMode = QBluetoothLocalDevice::HostConnectable;
|
||||
else
|
||||
hostMode = QBluetoothLocalDevice::HostPoweredOff;
|
||||
|
||||
// Start monitoring for bluetooth state changes
|
||||
bluetoothStateMonitor.reset([[QT_MANGLE_NAMESPACE(QDarwinBluetoothStateMonitor) alloc] initWith:this],
|
||||
DarwinBluetooth::RetainPolicy::doInitialRetain);
|
||||
[bluetoothStateMonitor startMonitoring];
|
||||
}
|
||||
|
||||
QBluetoothLocalDevicePrivate::~QBluetoothLocalDevicePrivate()
|
||||
{
|
||||
|
||||
[bluetoothStateMonitor stopMonitoring];
|
||||
[connectionMonitor stopMonitoring];
|
||||
}
|
||||
|
||||
void QBluetoothLocalDevicePrivate::bluetoothStateChanged(CBManagerState state)
|
||||
{
|
||||
Q_Q(QBluetoothLocalDevice);
|
||||
qCDebug(QT_BT_DARWIN) << "Bluetooth state changed to" << state;
|
||||
// States other than 'powered ON' and 'powered OFF' are ambiguous to map
|
||||
// unto Qt HostModes. For example lack of permissions might temporarily
|
||||
// generate an 'unauthorized' state irrespective of bluetooth power state.
|
||||
QBluetoothLocalDevice::HostMode mode;
|
||||
if (state == CBManagerState::CBManagerStatePoweredOff)
|
||||
mode = QBluetoothLocalDevice::HostPoweredOff;
|
||||
else if (state == CBManagerState::CBManagerStatePoweredOn)
|
||||
mode = QBluetoothLocalDevice::HostConnectable;
|
||||
else
|
||||
return;
|
||||
|
||||
if (hostMode != mode) {
|
||||
hostMode = mode;
|
||||
emit q->hostModeStateChanged(hostMode);
|
||||
}
|
||||
}
|
||||
|
||||
bool QBluetoothLocalDevicePrivate::isValid() const
|
||||
{
|
||||
return hostController;
|
||||
|
|
@ -375,10 +429,22 @@ void QBluetoothLocalDevice::setHostMode(QBluetoothLocalDevice::HostMode mode)
|
|||
|
||||
QBluetoothLocalDevice::HostMode QBluetoothLocalDevice::hostMode() const
|
||||
{
|
||||
if (!isValid() || ![d_ptr->hostController powerState])
|
||||
Q_D(const QBluetoothLocalDevice);
|
||||
if (!isValid())
|
||||
return HostPoweredOff;
|
||||
|
||||
return HostConnectable;
|
||||
auto state = [d->bluetoothStateMonitor currentState];
|
||||
// If the monitored state is unknown or ambiguous, use the HCI state directly.
|
||||
// Otherwise use the monitored state. We can't use HCI state always, because there can
|
||||
// be a significant delay from "monitored state change" to "HCI state change", causing
|
||||
// handlers of hostModeStateChanged() signal to perceive conflicting results (signal
|
||||
// parameter value vs. what this getter returns).
|
||||
if (state == CBManagerState::CBManagerStatePoweredOff)
|
||||
return HostPoweredOff;
|
||||
else if (state == CBManagerState::CBManagerStatePoweredOn)
|
||||
return HostConnectable;
|
||||
|
||||
return [d->hostController powerState] ? HostConnectable : HostPoweredOff;
|
||||
}
|
||||
|
||||
QList<QBluetoothAddress> QBluetoothLocalDevice::connectedDevices() const
|
||||
|
|
@ -455,3 +521,45 @@ QBluetoothLocalDevice::Pairing QBluetoothLocalDevice::pairingStatus(const QBluet
|
|||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
@implementation QT_MANGLE_NAMESPACE(QDarwinBluetoothStateMonitor)
|
||||
|
||||
- (instancetype)initWith:(QT_PREPEND_NAMESPACE(QBluetoothLocalDevicePrivate) *)localDevicePrivate
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
self.manager = nil;
|
||||
self.localDevicePrivate = localDevicePrivate;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)startMonitoring
|
||||
{
|
||||
if (self.manager != nil)
|
||||
return;
|
||||
self.manager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
|
||||
}
|
||||
|
||||
- (void)stopMonitoring
|
||||
{
|
||||
if (self.manager == nil)
|
||||
return;
|
||||
self.manager.delegate = nil;
|
||||
self.manager = nil;
|
||||
}
|
||||
|
||||
- (CBManagerState)currentState
|
||||
{
|
||||
Q_ASSERT(self.manager);
|
||||
return self.manager.state;
|
||||
}
|
||||
|
||||
- (void)centralManagerDidUpdateState:(CBCentralManager *)aManager
|
||||
{
|
||||
Q_ASSERT(self.manager);
|
||||
Q_ASSERT(self.localDevicePrivate);
|
||||
Q_ASSERT(self.manager == aManager);
|
||||
self.localDevicePrivate->bluetoothStateChanged(aManager.state);
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -497,6 +497,8 @@ void QBluetoothSocketPrivateDarwin::channelClosed()
|
|||
// (thus close/abort probably will not work).
|
||||
|
||||
if (!isConnecting) {
|
||||
if (state == QBluetoothSocket::SocketState::ConnectedState)
|
||||
q_ptr->setSocketError(QBluetoothSocket::SocketError::RemoteHostClosedError);
|
||||
q_ptr->setOpenMode(QIODevice::NotOpen);
|
||||
q_ptr->setSocketState(QBluetoothSocket::SocketState::UnconnectedState);
|
||||
emit q_ptr->readChannelFinished();
|
||||
|
|
|
|||
|
|
@ -60,7 +60,8 @@ static void parseAttributeValues(sdp_data_t *data, int indentation, QByteArray &
|
|||
xmlOutput.append(snBuffer);
|
||||
break;
|
||||
case SDP_UINT64:
|
||||
qsnprintf(snBuffer, BUFFER_SIZE, "<uint64 value=\"0x%016x\"/>\n", data->val.uint64);
|
||||
qsnprintf(snBuffer, BUFFER_SIZE, "<uint64 value=\"0x%016llx\"/>\n",
|
||||
qulonglong(data->val.uint64));
|
||||
xmlOutput.append(snBuffer);
|
||||
break;
|
||||
case SDP_UINT128:
|
||||
|
|
@ -83,7 +84,8 @@ static void parseAttributeValues(sdp_data_t *data, int indentation, QByteArray &
|
|||
xmlOutput.append(snBuffer);
|
||||
break;
|
||||
case SDP_INT64:
|
||||
qsnprintf(snBuffer, BUFFER_SIZE, "<int64 value=\"%d\"/>/n", data->val.int64);
|
||||
qsnprintf(snBuffer, BUFFER_SIZE, "<int64 value=\"%lld\"/>/n",
|
||||
qlonglong(data->val.int64));
|
||||
xmlOutput.append(snBuffer);
|
||||
break;
|
||||
case SDP_INT128:
|
||||
|
|
|
|||
Loading…
Reference in New Issue