Unify Windows logging categories
There were two logging categories on Windows: qt.bluetooth.winrt and qt.bluetooth.windows. As there is now only one Windows backend, multiple logging categories are not required. This patch removes qt.bluetooth.winrt and changes all usages to qt.bluetooth.windows. Change-Id: I3f42774e77326fa30f3f7bff6cac8160bf4e644f Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
This commit is contained in:
parent
24f12bce2c
commit
e6f7e7b756
|
@ -11,6 +11,9 @@ General
|
|||
|
||||
- Win32 backend has been removed. There will not be a working Bluetooth backend when Qt is built with mingw.
|
||||
|
||||
- Since there is now only one Windows backend, the logging category qt.bluetooth.winrt was removed.
|
||||
The corresponding log messages are now in qt.bluetooth.windows.
|
||||
|
||||
QBluetooth namespace
|
||||
--------------------
|
||||
|
||||
|
|
|
@ -103,7 +103,6 @@ Q_LOGGING_CATEGORY(QT_BT, "qt.bluetooth")
|
|||
Q_LOGGING_CATEGORY(QT_BT_ANDROID, "qt.bluetooth.android")
|
||||
Q_LOGGING_CATEGORY(QT_BT_BLUEZ, "qt.bluetooth.bluez")
|
||||
Q_LOGGING_CATEGORY(QT_BT_WINDOWS, "qt.bluetooth.windows")
|
||||
Q_LOGGING_CATEGORY(QT_BT_WINRT, "qt.bluetooth.winrt")
|
||||
Q_LOGGING_CATEGORY(QT_BT_WINRT_SERVICE_THREAD, "qt.bluetooth.winrt.service.thread")
|
||||
Q_LOGGING_CATEGORY(QT_BT_WINDOWS_SERVICE_THREAD, "qt.bluetooth.winrt.service.thread")
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
@ -69,24 +69,24 @@ using namespace ABI::Windows::Storage::Streams;
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(QT_BT_WINRT)
|
||||
Q_DECLARE_LOGGING_CATEGORY(QT_BT_WINDOWS)
|
||||
|
||||
#define EMIT_WORKER_ERROR_AND_RETURN_IF_FAILED(msg, error, ret) \
|
||||
if (FAILED(hr)) { \
|
||||
emit errorOccured(error); \
|
||||
qCWarning(QT_BT_WINRT) << msg; \
|
||||
qCWarning(QT_BT_WINDOWS) << msg; \
|
||||
ret; \
|
||||
}
|
||||
|
||||
#define WARN_AND_RETURN_IF_FAILED(msg, ret) \
|
||||
if (FAILED(hr)) { \
|
||||
qCWarning(QT_BT_WINRT) << msg; \
|
||||
qCWarning(QT_BT_WINDOWS) << msg; \
|
||||
ret; \
|
||||
}
|
||||
|
||||
#define WARN_AND_CONTINUE_IF_FAILED(msg) \
|
||||
if (FAILED(hr)) { \
|
||||
qCWarning(QT_BT_WINRT) << msg; \
|
||||
qCWarning(QT_BT_WINDOWS) << msg; \
|
||||
continue; \
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ static ManufacturerData extractManufacturerData(ComPtr<IBluetoothLEAdvertisement
|
|||
WARN_AND_CONTINUE_IF_FAILED("Could not obtain manufacturer data set.");
|
||||
const QByteArray bufferData = byteArrayFromBuffer(buffer);
|
||||
if (ret.contains(id))
|
||||
qCWarning(QT_BT_WINRT) << "Company ID already present in manufacturer data.";
|
||||
qCWarning(QT_BT_WINDOWS) << "Company ID already present in manufacturer data.";
|
||||
ret.insert(id, bufferData);
|
||||
}
|
||||
return ret;
|
||||
|
@ -214,7 +214,7 @@ void QWinRTBluetoothDeviceDiscoveryWorker::start()
|
|||
setupLEDeviceWatcher();
|
||||
}
|
||||
|
||||
qCDebug(QT_BT_WINRT) << "Worker started";
|
||||
qCDebug(QT_BT_WINDOWS) << "Worker started";
|
||||
}
|
||||
|
||||
void QWinRTBluetoothDeviceDiscoveryWorker::stopLEWatcher()
|
||||
|
@ -264,7 +264,7 @@ void QWinRTBluetoothDeviceDiscoveryWorker::startDeviceDiscovery(QBluetoothDevice
|
|||
|
||||
void QWinRTBluetoothDeviceDiscoveryWorker::onDeviceDiscoveryFinished(IAsyncOperation<DeviceInformationCollection *> *op, QBluetoothDeviceDiscoveryAgent::DiscoveryMethod mode)
|
||||
{
|
||||
qCDebug(QT_BT_WINRT) << (mode == QBluetoothDeviceDiscoveryAgent::ClassicMethod ? "BT" : "BTLE")
|
||||
qCDebug(QT_BT_WINDOWS) << (mode == QBluetoothDeviceDiscoveryAgent::ClassicMethod ? "BT" : "BTLE")
|
||||
<< " scan completed";
|
||||
ComPtr<IVectorView<DeviceInformation *>> devices;
|
||||
HRESULT hr;
|
||||
|
@ -461,7 +461,7 @@ void QWinRTBluetoothDeviceDiscoveryWorker::classicBluetoothInfoFromDeviceIdAsync
|
|||
if (!m_pendingPairedDevices
|
||||
&& !(requestedModes & QBluetoothDeviceDiscoveryAgent::LowEnergyMethod))
|
||||
finishDiscovery();
|
||||
qCWarning(QT_BT_WINRT) << "Could not obtain bluetooth device from id";
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not obtain bluetooth device from id";
|
||||
return;
|
||||
}
|
||||
QPointer<QWinRTBluetoothDeviceDiscoveryWorker> thisPointer(this);
|
||||
|
@ -481,7 +481,7 @@ void QWinRTBluetoothDeviceDiscoveryWorker::classicBluetoothInfoFromDeviceIdAsync
|
|||
if (!m_pendingPairedDevices
|
||||
&& !(requestedModes & QBluetoothDeviceDiscoveryAgent::LowEnergyMethod))
|
||||
finishDiscovery();
|
||||
qCWarning(QT_BT_WINRT) << "Could not register device found callback";
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not register device found callback";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -495,7 +495,7 @@ void QWinRTBluetoothDeviceDiscoveryWorker::leBluetoothInfoFromDeviceIdAsync(HSTR
|
|||
if (FAILED(hr)) {
|
||||
emit errorOccured(QBluetoothDeviceDiscoveryAgent::UnknownError);
|
||||
--m_pendingPairedDevices;
|
||||
qCWarning(QT_BT_WINRT) << "Could not obtain bluetooth device from id";
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not obtain bluetooth device from id";
|
||||
return;
|
||||
}
|
||||
QPointer<QWinRTBluetoothDeviceDiscoveryWorker> thisPointer(this);
|
||||
|
@ -512,7 +512,7 @@ void QWinRTBluetoothDeviceDiscoveryWorker::leBluetoothInfoFromDeviceIdAsync(HSTR
|
|||
if (FAILED(hr)) {
|
||||
emit errorOccured(QBluetoothDeviceDiscoveryAgent::UnknownError);
|
||||
--m_pendingPairedDevices;
|
||||
qCWarning(QT_BT_WINRT) << "Could not register device found callback";
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not register device found callback";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -526,7 +526,7 @@ void QWinRTBluetoothDeviceDiscoveryWorker::leBluetoothInfoFromAddressAsync(quint
|
|||
HRESULT hr = m_leDeviceStatics->FromBluetoothAddressAsync(address, &deviceFromAddressOperation);
|
||||
if (FAILED(hr)) {
|
||||
emit errorOccured(QBluetoothDeviceDiscoveryAgent::UnknownError);
|
||||
qCWarning(QT_BT_WINRT) << "Could not obtain bluetooth device from address";
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not obtain bluetooth device from address";
|
||||
return;
|
||||
}
|
||||
QPointer<QWinRTBluetoothDeviceDiscoveryWorker> thisPointer(this);
|
||||
|
@ -539,7 +539,7 @@ void QWinRTBluetoothDeviceDiscoveryWorker::leBluetoothInfoFromAddressAsync(quint
|
|||
}).Get());
|
||||
if (FAILED(hr)) {
|
||||
emit errorOccured(QBluetoothDeviceDiscoveryAgent::UnknownError);
|
||||
qCWarning(QT_BT_WINRT) << "Could not register device found callback";
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not register device found callback";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -583,7 +583,7 @@ HRESULT QWinRTBluetoothDeviceDiscoveryWorker::onPairedClassicBluetoothDeviceFoun
|
|||
IVectorView <Rfcomm::RfcommDeviceService *> *deviceServices;
|
||||
hr = device->get_RfcommServices(&deviceServices);
|
||||
if (hr == E_ACCESSDENIED) {
|
||||
qCWarning(QT_BT_WINRT) << "Could not obtain device services. Please check you have "
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not obtain device services. Please check you have "
|
||||
"permission to access the device.";
|
||||
} else {
|
||||
EMIT_WORKER_ERROR_AND_RETURN_IF_FAILED("Could not obtain device services",
|
||||
|
@ -614,7 +614,7 @@ HRESULT QWinRTBluetoothDeviceDiscoveryWorker::onPairedClassicBluetoothDeviceFoun
|
|||
uuids.append(QBluetoothUuid(uuid));
|
||||
}
|
||||
|
||||
qCDebug(QT_BT_WINRT) << "Discovered BT device: " << QString::number(address) << btName
|
||||
qCDebug(QT_BT_WINDOWS) << "Discovered BT device: " << QString::number(address) << btName
|
||||
<< "Num UUIDs" << uuids.count();
|
||||
|
||||
QBluetoothDeviceInfo info(QBluetoothAddress(address), btName, classOfDeviceInt);
|
||||
|
@ -668,7 +668,7 @@ HRESULT QWinRTBluetoothDeviceDiscoveryWorker::onBluetoothLEDeviceFoundAsync(IAsy
|
|||
HRESULT QWinRTBluetoothDeviceDiscoveryWorker::onBluetoothLEDeviceFound(ComPtr<IBluetoothLEDevice> device, PairingCheck pairingCheck)
|
||||
{
|
||||
if (!device) {
|
||||
qCDebug(QT_BT_WINRT) << "onBluetoothLEDeviceFound: No device given";
|
||||
qCDebug(QT_BT_WINDOWS) << "onBluetoothLEDeviceFound: No device given";
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -684,7 +684,7 @@ HRESULT QWinRTBluetoothDeviceDiscoveryWorker::onBluetoothLEDeviceFound(ComPtr<IB
|
|||
QBluetoothDeviceDiscoveryAgent::Error::UnknownError,
|
||||
return S_OK);
|
||||
if (!deviceInfo) {
|
||||
qCDebug(QT_BT_WINRT) << "onBluetoothLEDeviceFound: Could not obtain device information";
|
||||
qCDebug(QT_BT_WINDOWS) << "onBluetoothLEDeviceFound: Could not obtain device information";
|
||||
return S_OK;
|
||||
}
|
||||
ComPtr<IDeviceInformation2> deviceInfo2;
|
||||
|
@ -718,7 +718,7 @@ HRESULT QWinRTBluetoothDeviceDiscoveryWorker::onBluetoothLEDeviceFound(ComPtr<IB
|
|||
return S_OK;
|
||||
|
||||
if (status != AsyncStatus::Completed) {
|
||||
qCDebug(QT_BT_WINRT) << "Could not pair device";
|
||||
qCDebug(QT_BT_WINDOWS) << "Could not pair device";
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -727,7 +727,7 @@ HRESULT QWinRTBluetoothDeviceDiscoveryWorker::onBluetoothLEDeviceFound(ComPtr<IB
|
|||
hr = op->GetResults(&result);
|
||||
if (FAILED(hr)) {
|
||||
emit tPointer->errorOccured(QBluetoothDeviceDiscoveryAgent::UnknownError);
|
||||
qCWarning(QT_BT_WINRT) << "Could not obtain pairing result";
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not obtain pairing result";
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -735,7 +735,7 @@ HRESULT QWinRTBluetoothDeviceDiscoveryWorker::onBluetoothLEDeviceFound(ComPtr<IB
|
|||
hr = result.Get()->get_Status(&pairingStatus);
|
||||
if (FAILED(hr) || pairingStatus != DevicePairingResultStatus_Paired) {
|
||||
emit tPointer->errorOccured(QBluetoothDeviceDiscoveryAgent::UnknownError);
|
||||
qCWarning(QT_BT_WINRT) << "Device pairing failed";
|
||||
qCWarning(QT_BT_WINDOWS) << "Device pairing failed";
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -788,7 +788,7 @@ HRESULT QWinRTBluetoothDeviceDiscoveryWorker::onBluetoothLEDeviceFound(ComPtr<IB
|
|||
const qint16 rssi = m_foundLEDevices.value(address);
|
||||
const ManufacturerData manufacturerData = m_foundLEManufacturerData.value(address);
|
||||
|
||||
qCDebug(QT_BT_WINRT) << "Discovered BTLE device: " << QString::number(address) << btName
|
||||
qCDebug(QT_BT_WINDOWS) << "Discovered BTLE device: " << QString::number(address) << btName
|
||||
<< "Num UUIDs" << uuids.count() << "RSSI:" << rssi
|
||||
<< "Num manufacturer data" << manufacturerData.count();
|
||||
|
||||
|
@ -808,7 +808,7 @@ HRESULT QWinRTBluetoothDeviceDiscoveryWorker::onBluetoothLEDeviceFound(ComPtr<IB
|
|||
HRESULT QWinRTBluetoothDeviceDiscoveryWorker::onBluetoothLEDeviceFound(ComPtr<IBluetoothLEDevice> device)
|
||||
{
|
||||
if (!device) {
|
||||
qCDebug(QT_BT_WINRT) << "onBluetoothLEDeviceFound: No device given";
|
||||
qCDebug(QT_BT_WINDOWS) << "onBluetoothLEDeviceFound: No device given";
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -834,7 +834,7 @@ HRESULT QWinRTBluetoothDeviceDiscoveryWorker::onBluetoothLEDeviceFound(ComPtr<IB
|
|||
QBluetoothDeviceDiscoveryAgent::Error::UnknownError,
|
||||
return S_OK);
|
||||
if (!deviceInfo) {
|
||||
qCDebug(QT_BT_WINRT) << "onBluetoothLEDeviceFound: Could not obtain device information";
|
||||
qCDebug(QT_BT_WINDOWS) << "onBluetoothLEDeviceFound: Could not obtain device information";
|
||||
return S_OK;
|
||||
}
|
||||
ComPtr<IDeviceInformation2> deviceInfo2;
|
||||
|
@ -886,7 +886,7 @@ HRESULT QWinRTBluetoothDeviceDiscoveryWorker::onBluetoothLEDeviceFound(ComPtr<IB
|
|||
}
|
||||
const ManufacturerData manufacturerData = m_foundLEManufacturerData.value(address);
|
||||
|
||||
qCDebug(QT_BT_WINRT) << "Discovered BTLE device: " << QString::number(address) << btName
|
||||
qCDebug(QT_BT_WINDOWS) << "Discovered BTLE device: " << QString::number(address) << btName
|
||||
<< "Num UUIDs" << uuids.count() << "RSSI:" << rssi
|
||||
<< "Num manufacturer data" << manufacturerData.count();
|
||||
|
||||
|
@ -974,7 +974,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::registerDevice(const QBluetoothDevic
|
|||
for (QList<QBluetoothDeviceInfo>::iterator iter = discoveredDevices.begin();
|
||||
iter != discoveredDevices.end(); ++iter) {
|
||||
if (iter->address() == info.address()) {
|
||||
qCDebug(QT_BT_WINRT) << "Updating device" << iter->name() << iter->address();
|
||||
qCDebug(QT_BT_WINDOWS) << "Updating device" << iter->name() << iter->address();
|
||||
// merge service uuids
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QList<QBluetoothUuid> uuids = iter->serviceUuids();
|
||||
|
@ -1007,7 +1007,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::updateDeviceData(const QBluetoothAdd
|
|||
for (QList<QBluetoothDeviceInfo>::iterator iter = discoveredDevices.begin();
|
||||
iter != discoveredDevices.end(); ++iter) {
|
||||
if (iter->address() == address) {
|
||||
qCDebug(QT_BT_WINRT) << "Updating data for device" << iter->name() << iter->address();
|
||||
qCDebug(QT_BT_WINDOWS) << "Updating data for device" << iter->name() << iter->address();
|
||||
if (fields.testFlag(QBluetoothDeviceInfo::Field::RSSI))
|
||||
iter->setRssi(rssi);
|
||||
if (fields.testFlag(QBluetoothDeviceInfo::Field::ManufacturerData))
|
||||
|
|
|
@ -63,7 +63,7 @@ typedef ITypedEventHandler<StreamSocketListener *, StreamSocketListenerConnectio
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(QT_BT_WINRT)
|
||||
Q_DECLARE_LOGGING_CATEGORY(QT_BT_WINDOWS)
|
||||
|
||||
QHash<QBluetoothServerPrivate *, int> __fakeServerPorts;
|
||||
|
||||
|
@ -121,7 +121,7 @@ HRESULT QBluetoothServerPrivate::handleClientConnection(IStreamSocketListener *l
|
|||
{
|
||||
Q_Q(QBluetoothServer);
|
||||
if (!socketListener || socketListener.Get() != listener) {
|
||||
qCDebug(QT_BT_WINRT) << "Accepting connection from wrong listener. We should not be here.";
|
||||
qCDebug(QT_BT_WINDOWS) << "Accepting connection from wrong listener. We should not be here.";
|
||||
Q_UNREACHABLE();
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -132,12 +132,12 @@ HRESULT QBluetoothServerPrivate::handleClientConnection(IStreamSocketListener *l
|
|||
Q_ASSERT_SUCCEEDED(hr);
|
||||
QMutexLocker locker(&pendingConnectionsMutex);
|
||||
if (pendingConnections.count() < maxPendingConnections) {
|
||||
qCDebug(QT_BT_WINRT) << "Accepting connection";
|
||||
qCDebug(QT_BT_WINDOWS) << "Accepting connection";
|
||||
pendingConnections.append(socket);
|
||||
locker.unlock();
|
||||
q->newConnection();
|
||||
} else {
|
||||
qCDebug(QT_BT_WINRT) << "Refusing connection";
|
||||
qCDebug(QT_BT_WINDOWS) << "Refusing connection";
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
|
@ -185,9 +185,9 @@ bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port)
|
|||
if (__fakeServerPorts.key(port) == 0) {
|
||||
__fakeServerPorts[d] = port;
|
||||
|
||||
qCDebug(QT_BT_WINRT) << "Port" << port << "registered";
|
||||
qCDebug(QT_BT_WINDOWS) << "Port" << port << "registered";
|
||||
} else {
|
||||
qCWarning(QT_BT_WINRT) << "server with port" << port << "already registered or port invalid";
|
||||
qCWarning(QT_BT_WINDOWS) << "server with port" << port << "already registered or port invalid";
|
||||
d->m_lastError = ServiceAlreadyRegisteredError;
|
||||
emit errorOccurred(d->m_lastError);
|
||||
return false;
|
||||
|
@ -201,7 +201,7 @@ void QBluetoothServer::setMaxPendingConnections(int numConnections)
|
|||
Q_D(QBluetoothServer);
|
||||
QMutexLocker locker(&d->pendingConnectionsMutex);
|
||||
if (d->pendingConnections.count() > numConnections) {
|
||||
qCWarning(QT_BT_WINRT) << "There are currently more than" << numConnections << "connections"
|
||||
qCWarning(QT_BT_WINDOWS) << "There are currently more than" << numConnections << "connections"
|
||||
<< "pending. Number of maximum pending connections was not changed.";
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ typedef Collections::IIterator<ValueItem *> ValueIterator;
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(QT_BT_WINRT)
|
||||
Q_DECLARE_LOGGING_CATEGORY(QT_BT_WINDOWS)
|
||||
|
||||
#define TYPE_UINT8 8
|
||||
#define TYPE_UINT16 9
|
||||
|
@ -132,7 +132,7 @@ void QWinRTBluetoothServiceDiscoveryWorker::start()
|
|||
HRESULT QWinRTBluetoothServiceDiscoveryWorker::onBluetoothDeviceFoundAsync(IAsyncOperation<BluetoothDevice *> *op, AsyncStatus status)
|
||||
{
|
||||
if (status != Completed) {
|
||||
qCDebug(QT_BT_WINRT) << "Could not find device";
|
||||
qCDebug(QT_BT_WINDOWS) << "Could not find device";
|
||||
emit errorOccured();
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ HRESULT QWinRTBluetoothServiceDiscoveryWorker::onBluetoothDeviceFoundAsync(IAsyn
|
|||
([address, this](IAsyncOperation<RfcommDeviceServicesResult *> *op, AsyncStatus status)
|
||||
{
|
||||
if (status != Completed) {
|
||||
qCDebug(QT_BT_WINRT) << "Could not obtain service list";
|
||||
qCDebug(QT_BT_WINDOWS) << "Could not obtain service list";
|
||||
emit errorOccured();
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -277,33 +277,33 @@ void QWinRTBluetoothServiceDiscoveryWorker::processServiceSearchResult(quint64 a
|
|||
hr = dataReader->ReadByte(&value);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
info.setAttribute(key, value);
|
||||
qCDebug(QT_BT_WINRT) << "UUID" << uuid << "KEY" << Qt::hex << key << "TYPE" << Qt::dec << type << "UINT8" << Qt::hex << value;
|
||||
qCDebug(QT_BT_WINDOWS) << "UUID" << uuid << "KEY" << Qt::hex << key << "TYPE" << Qt::dec << type << "UINT8" << Qt::hex << value;
|
||||
} else if (type == TYPE_UINT16) {
|
||||
quint16 value;
|
||||
hr = dataReader->ReadUInt16(&value);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
info.setAttribute(key, value);
|
||||
qCDebug(QT_BT_WINRT) << "UUID" << uuid << "KEY" << Qt::hex << key << "TYPE" << Qt::dec << type << "UINT16" << Qt::hex << value;
|
||||
qCDebug(QT_BT_WINDOWS) << "UUID" << uuid << "KEY" << Qt::hex << key << "TYPE" << Qt::dec << type << "UINT16" << Qt::hex << value;
|
||||
} else if (type == TYPE_UINT32) {
|
||||
quint32 value;
|
||||
hr = dataReader->ReadUInt32(&value);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
info.setAttribute(key, value);
|
||||
qCDebug(QT_BT_WINRT) << "UUID" << uuid << "KEY" << Qt::hex << key << "TYPE" << Qt::dec << type << "UINT32" << Qt::hex << value;
|
||||
qCDebug(QT_BT_WINDOWS) << "UUID" << uuid << "KEY" << Qt::hex << key << "TYPE" << Qt::dec << type << "UINT32" << Qt::hex << value;
|
||||
} else if (type == TYPE_SHORT_UUID) {
|
||||
quint16 value;
|
||||
hr = dataReader->ReadUInt16(&value);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
const QBluetoothUuid uuid(value);
|
||||
info.setAttribute(key, uuid);
|
||||
qCDebug(QT_BT_WINRT) << "UUID" << uuid << "KEY" << Qt::hex << key << "TYPE" << Qt::dec << type << "UUID" << Qt::hex << uuid;
|
||||
qCDebug(QT_BT_WINDOWS) << "UUID" << uuid << "KEY" << Qt::hex << key << "TYPE" << Qt::dec << type << "UUID" << Qt::hex << uuid;
|
||||
} else if (type == TYPE_LONG_UUID) {
|
||||
GUID value;
|
||||
hr = dataReader->ReadGuid(&value);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
const QBluetoothUuid uuid(value);
|
||||
info.setAttribute(key, uuid);
|
||||
qCDebug(QT_BT_WINRT) << "UUID" << uuid << "KEY" << Qt::hex << key << "TYPE" << Qt::dec << type << "UUID" << Qt::hex << uuid;
|
||||
qCDebug(QT_BT_WINDOWS) << "UUID" << uuid << "KEY" << Qt::hex << key << "TYPE" << Qt::dec << type << "UUID" << Qt::hex << uuid;
|
||||
} else if (type == TYPE_STRING) {
|
||||
BYTE length;
|
||||
hr = dataReader->ReadByte(&length);
|
||||
|
@ -313,18 +313,18 @@ void QWinRTBluetoothServiceDiscoveryWorker::processServiceSearchResult(quint64 a
|
|||
Q_ASSERT_SUCCEEDED(hr);
|
||||
const QString str = QString::fromWCharArray(WindowsGetStringRawBuffer(value.Get(), nullptr));
|
||||
info.setAttribute(key, str);
|
||||
qCDebug(QT_BT_WINRT) << "UUID" << uuid << "KEY" << Qt::hex << key << "TYPE" << Qt::dec << type << "STRING" << str;
|
||||
qCDebug(QT_BT_WINDOWS) << "UUID" << uuid << "KEY" << Qt::hex << key << "TYPE" << Qt::dec << type << "STRING" << str;
|
||||
} else if (type == TYPE_SEQUENCE) {
|
||||
bool ok;
|
||||
QBluetoothServiceInfo::Sequence sequence = readSequence(dataReader, &ok, nullptr);
|
||||
if (ok) {
|
||||
info.setAttribute(key, sequence);
|
||||
qCDebug(QT_BT_WINRT) << "UUID" << uuid << "KEY" << Qt::hex << key << "TYPE" << Qt::dec << type << "SEQUENCE" << sequence;
|
||||
qCDebug(QT_BT_WINDOWS) << "UUID" << uuid << "KEY" << Qt::hex << key << "TYPE" << Qt::dec << type << "SEQUENCE" << sequence;
|
||||
} else {
|
||||
qCDebug(QT_BT_WINRT) << "UUID" << uuid << "KEY" << Qt::hex << key << "TYPE" << Qt::dec << type << "SEQUENCE ERROR";
|
||||
qCDebug(QT_BT_WINDOWS) << "UUID" << uuid << "KEY" << Qt::hex << key << "TYPE" << Qt::dec << type << "SEQUENCE ERROR";
|
||||
}
|
||||
} else {
|
||||
qCDebug(QT_BT_WINRT) << "UUID" << uuid << "KEY" << Qt::hex << key << "TYPE" << Qt::dec << type;
|
||||
qCDebug(QT_BT_WINDOWS) << "UUID" << uuid << "KEY" << Qt::hex << key << "TYPE" << Qt::dec << type;
|
||||
}
|
||||
hr = iterator->MoveNext(¤t);
|
||||
}
|
||||
|
@ -453,7 +453,7 @@ QBluetoothServiceInfo::Sequence QWinRTBluetoothServiceDiscoveryWorker::readSeque
|
|||
break;
|
||||
}
|
||||
default:
|
||||
qCDebug(QT_BT_WINRT) << "SEQUENCE ERROR" << type;
|
||||
qCDebug(QT_BT_WINDOWS) << "SEQUENCE ERROR" << type;
|
||||
result.clear();
|
||||
return result;
|
||||
}
|
||||
|
@ -561,7 +561,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::processFoundService(quint64 deviceA
|
|||
|
||||
if (!isDuplicatedService(returnInfo)) {
|
||||
discoveredServices.append(returnInfo);
|
||||
qCDebug(QT_BT_WINRT) << "Discovered services" << discoveredDevices.at(0).address().toString()
|
||||
qCDebug(QT_BT_WINDOWS) << "Discovered services" << discoveredDevices.at(0).address().toString()
|
||||
<< returnInfo.serviceName() << returnInfo.serviceUuid()
|
||||
<< ">>>" << returnInfo.serviceClassUuids();
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ using namespace ABI::Windows::Storage::Streams;
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(QT_BT_WINRT)
|
||||
Q_DECLARE_LOGGING_CATEGORY(QT_BT_WINDOWS)
|
||||
|
||||
#define TYPE_VOID 0
|
||||
#define TYPE_UINT8 8
|
||||
|
@ -133,7 +133,7 @@ bool writeStringHelper(const QString &string, ComPtr<IDataWriter> writer)
|
|||
const int stringLength = string.length();
|
||||
unsigned char type = TYPE_STRING_BASE;
|
||||
if (stringLength < 0) {
|
||||
qCWarning(QT_BT_WINRT) << "Can not write invalid string value to buffer";
|
||||
qCWarning(QT_BT_WINDOWS) << "Can not write invalid string value to buffer";
|
||||
return false;
|
||||
} if (stringLength <= 0xff) {
|
||||
type += 5;
|
||||
|
@ -159,7 +159,7 @@ bool writeStringHelper(const QString &string, ComPtr<IDataWriter> writer)
|
|||
hr = writer->WriteString(stringRef.Get(), &bytesWritten);
|
||||
RETURN_FALSE_IF_FAILED("Could not write string to buffer.");
|
||||
if (bytesWritten != string.length()) {
|
||||
qCWarning(QT_BT_WINRT) << "Did not write full value to buffer";
|
||||
qCWarning(QT_BT_WINDOWS) << "Did not write full value to buffer";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -180,7 +180,7 @@ bool repairProfileDescriptorListIfNeeded(ComPtr<IBuffer> &buffer)
|
|||
hr = reader->ReadByte(&type);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
if (!typeIsOfBase(type, TYPE_SEQUENCE_BASE)) {
|
||||
qCWarning(QT_BT_WINRT) << Q_FUNC_INFO << "Malformed profile descriptor list read";
|
||||
qCWarning(QT_BT_WINDOWS) << Q_FUNC_INFO << "Malformed profile descriptor list read";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ bool repairProfileDescriptorListIfNeeded(ComPtr<IBuffer> &buffer)
|
|||
Q_ASSERT_SUCCEEDED(hr);
|
||||
// We have to "repair" the structure if the outer sequence contains a uuid directly
|
||||
if (type == TYPE_UUID16 && length == 4) {
|
||||
qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Repairing profile descriptor list";
|
||||
qCDebug(QT_BT_WINDOWS) << Q_FUNC_INFO << "Repairing profile descriptor list";
|
||||
quint16 uuid;
|
||||
hr = reader->ReadUInt16(&uuid);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
|
@ -234,68 +234,68 @@ static ComPtr<IBuffer> bufferFromAttribute(const QVariant &attribute)
|
|||
|
||||
switch (int(attribute.type())) {
|
||||
case QMetaType::Void:
|
||||
qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Registering attribute of type QMetaType::Void:";
|
||||
qCDebug(QT_BT_WINDOWS) << Q_FUNC_INFO << "Registering attribute of type QMetaType::Void:";
|
||||
hr = writer->WriteByte(TYPE_VOID);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
break;
|
||||
case QMetaType::UChar:
|
||||
qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Registering attribute of type QMetaType::UChar:" << attribute.value<quint8>();
|
||||
qCDebug(QT_BT_WINDOWS) << Q_FUNC_INFO << "Registering attribute of type QMetaType::UChar:" << attribute.value<quint8>();
|
||||
hr = writer->WriteByte(TYPE_UINT8);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
hr = writer->WriteByte(attribute.value<quint8>());
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
break;
|
||||
case QMetaType::UShort:
|
||||
qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Registering attribute of type QMetaType::UShort:" << attribute.value<quint16>();
|
||||
qCDebug(QT_BT_WINDOWS) << Q_FUNC_INFO << "Registering attribute of type QMetaType::UShort:" << attribute.value<quint16>();
|
||||
hr = writer->WriteByte(TYPE_UINT16);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
hr = writer->WriteUInt16(attribute.value<quint16>());
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
break;
|
||||
case QMetaType::UInt:
|
||||
qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Registering attribute of type QMetaType::UInt:" << attribute.value<quint32>();
|
||||
qCDebug(QT_BT_WINDOWS) << Q_FUNC_INFO << "Registering attribute of type QMetaType::UInt:" << attribute.value<quint32>();
|
||||
hr = writer->WriteByte(TYPE_UINT32);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
hr = writer->WriteUInt32(attribute.value<quint32>());
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
break;
|
||||
case QMetaType::ULongLong:
|
||||
qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Registering attribute of type QMetaType::ULongLong:" << attribute.value<quint64>();
|
||||
qCDebug(QT_BT_WINDOWS) << Q_FUNC_INFO << "Registering attribute of type QMetaType::ULongLong:" << attribute.value<quint64>();
|
||||
hr = writer->WriteByte(TYPE_UINT64);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
hr = writer->WriteUInt64(attribute.value<quint64>());
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
break;
|
||||
case QMetaType::Char:
|
||||
qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Registering attribute of type QMetaType::Char:" << attribute.value<qint8>();
|
||||
qCDebug(QT_BT_WINDOWS) << Q_FUNC_INFO << "Registering attribute of type QMetaType::Char:" << attribute.value<qint8>();
|
||||
hr = writer->WriteByte(TYPE_INT8);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
hr = writer->WriteByte(attribute.value<qint8>());
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
break;
|
||||
case QMetaType::Short:
|
||||
qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Registering attribute of type QMetaType::Short:" << attribute.value<qint16>();
|
||||
qCDebug(QT_BT_WINDOWS) << Q_FUNC_INFO << "Registering attribute of type QMetaType::Short:" << attribute.value<qint16>();
|
||||
hr = writer->WriteByte(TYPE_INT16);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
hr = writer->WriteInt16(attribute.value<qint16>());
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
break;
|
||||
case QMetaType::Int:
|
||||
qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Registering attribute of type QMetaType::Int:" << attribute.value<qint32>();
|
||||
qCDebug(QT_BT_WINDOWS) << Q_FUNC_INFO << "Registering attribute of type QMetaType::Int:" << attribute.value<qint32>();
|
||||
hr = writer->WriteByte(TYPE_INT32);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
hr = writer->WriteInt32(attribute.value<qint32>());
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
break;
|
||||
case QMetaType::LongLong:
|
||||
qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Registering attribute of type QMetaType::LongLong:" << attribute.value<qint64>();
|
||||
qCDebug(QT_BT_WINDOWS) << Q_FUNC_INFO << "Registering attribute of type QMetaType::LongLong:" << attribute.value<qint64>();
|
||||
hr = writer->WriteByte(TYPE_INT64);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
hr = writer->WriteInt64(attribute.value<qint64>());
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
break;
|
||||
case QMetaType::QByteArray: {
|
||||
qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Registering attribute of type QMetaType::QByteArray:" << attribute.value<QString>();
|
||||
qCDebug(QT_BT_WINDOWS) << Q_FUNC_INFO << "Registering attribute of type QMetaType::QByteArray:" << attribute.value<QString>();
|
||||
const QString stringValue = QString::fromLatin1(attribute.value<QByteArray>().toHex());
|
||||
const bool writeSuccess = writeStringHelper(stringValue, writer);
|
||||
if (!writeSuccess)
|
||||
|
@ -303,7 +303,7 @@ static ComPtr<IBuffer> bufferFromAttribute(const QVariant &attribute)
|
|||
break;
|
||||
}
|
||||
case QMetaType::QString: {
|
||||
qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Registering attribute of type QMetaType::QString:" << attribute.value<QString>();
|
||||
qCDebug(QT_BT_WINDOWS) << Q_FUNC_INFO << "Registering attribute of type QMetaType::QString:" << attribute.value<QString>();
|
||||
const QString stringValue = attribute.value<QString>();
|
||||
const bool writeSucces = writeStringHelper(stringValue, writer);
|
||||
if (!writeSucces)
|
||||
|
@ -311,14 +311,14 @@ static ComPtr<IBuffer> bufferFromAttribute(const QVariant &attribute)
|
|||
break;
|
||||
}
|
||||
case QMetaType::Bool:
|
||||
qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Registering attribute of type QMetaType::Bool:" << attribute.value<bool>();
|
||||
qCDebug(QT_BT_WINDOWS) << Q_FUNC_INFO << "Registering attribute of type QMetaType::Bool:" << attribute.value<bool>();
|
||||
hr = writer->WriteByte(TYPE_BOOLEAN);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
hr = writer->WriteByte(attribute.value<bool>());
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
break;
|
||||
case QMetaType::QUrl:
|
||||
qCWarning(QT_BT_WINRT) << "Don't know how to register QMetaType::QUrl";
|
||||
qCWarning(QT_BT_WINDOWS) << "Don't know how to register QMetaType::QUrl";
|
||||
return nullptr;
|
||||
break;
|
||||
case QVariant::UserType:
|
||||
|
@ -327,17 +327,17 @@ static ComPtr<IBuffer> bufferFromAttribute(const QVariant &attribute)
|
|||
const int minimumSize = uuid.minimumSize();
|
||||
switch (uuid.minimumSize()) {
|
||||
case 0:
|
||||
qCWarning(QT_BT_WINRT) << "Don't know how to register Uuid of length 0";
|
||||
qCWarning(QT_BT_WINDOWS) << "Don't know how to register Uuid of length 0";
|
||||
return nullptr;
|
||||
case 2:
|
||||
qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Registering Uuid attribute with length 2:" << uuid;
|
||||
qCDebug(QT_BT_WINDOWS) << Q_FUNC_INFO << "Registering Uuid attribute with length 2:" << uuid;
|
||||
hr = writer->WriteByte(TYPE_UUID16);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
hr = writer->WriteUInt16(uuid.toUInt16());
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
break;
|
||||
case 4:
|
||||
qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Registering Uuid attribute with length 4:" << uuid;
|
||||
qCDebug(QT_BT_WINDOWS) << Q_FUNC_INFO << "Registering Uuid attribute with length 4:" << uuid;
|
||||
hr = writer->WriteByte(TYPE_UUID32);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
hr = writer->WriteUInt32(uuid.toUInt32());
|
||||
|
@ -345,7 +345,7 @@ static ComPtr<IBuffer> bufferFromAttribute(const QVariant &attribute)
|
|||
break;
|
||||
case 16:
|
||||
default:
|
||||
qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Registering Uuid attribute:" << uuid;
|
||||
qCDebug(QT_BT_WINDOWS) << Q_FUNC_INFO << "Registering Uuid attribute:" << uuid;
|
||||
hr = writer->WriteByte(TYPE_UUID128);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
hr = writer->WriteGuid(uuid);
|
||||
|
@ -353,7 +353,7 @@ static ComPtr<IBuffer> bufferFromAttribute(const QVariant &attribute)
|
|||
break;
|
||||
}
|
||||
} else if (attribute.userType() == qMetaTypeId<QBluetoothServiceInfo::Sequence>()) {
|
||||
qCDebug(QT_BT_WINRT) << "Registering sequence attribute";
|
||||
qCDebug(QT_BT_WINDOWS) << "Registering sequence attribute";
|
||||
const QBluetoothServiceInfo::Sequence *sequence =
|
||||
static_cast<const QBluetoothServiceInfo::Sequence *>(attribute.data());
|
||||
ComPtr<IDataWriter> tmpWriter;
|
||||
|
@ -363,7 +363,7 @@ static ComPtr<IBuffer> bufferFromAttribute(const QVariant &attribute)
|
|||
for (const QVariant &v : *sequence) {
|
||||
ComPtr<IBuffer> tmpBuffer = bufferFromAttribute(v);
|
||||
if (!tmpBuffer) {
|
||||
qCWarning(QT_BT_WINRT) << "Could not create buffer from attribute in sequence";
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not create buffer from attribute in sequence";
|
||||
return nullptr;
|
||||
}
|
||||
quint32 l;
|
||||
|
@ -403,14 +403,14 @@ static ComPtr<IBuffer> bufferFromAttribute(const QVariant &attribute)
|
|||
// write sequence data
|
||||
hr = writer->WriteBuffer(tmpBuffer.Get());
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Registered sequence attribute with length" << length;
|
||||
qCDebug(QT_BT_WINDOWS) << Q_FUNC_INFO << "Registered sequence attribute with length" << length;
|
||||
} else if (attribute.userType() == qMetaTypeId<QBluetoothServiceInfo::Alternative>()) {
|
||||
qCWarning(QT_BT_WINRT) << "Don't know how to register user type Alternative";
|
||||
qCWarning(QT_BT_WINDOWS) << "Don't know how to register user type Alternative";
|
||||
return nullptr;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
qCWarning(QT_BT_WINRT) << "Unknown variant type" << attribute.userType();
|
||||
qCWarning(QT_BT_WINDOWS) << "Unknown variant type" << attribute.userType();
|
||||
return nullptr;
|
||||
}
|
||||
ComPtr<IBuffer> buffer;
|
||||
|
@ -440,7 +440,7 @@ bool QBluetoothServiceInfoPrivate::registerService(const QBluetoothAddress &loca
|
|||
return false;
|
||||
|
||||
if (protocolDescriptor(QBluetoothUuid::ProtocolUuid::Rfcomm).isEmpty()) {
|
||||
qCWarning(QT_BT_WINRT) << Q_FUNC_INFO << "Only RFCOMM services can be registered on WinRT";
|
||||
qCWarning(QT_BT_WINDOWS) << Q_FUNC_INFO << "Only RFCOMM services can be registered on WinRT";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -466,7 +466,7 @@ bool QBluetoothServiceInfoPrivate::registerService(const QBluetoothAddress &loca
|
|||
Q_ASSERT_SUCCEEDED(hr);
|
||||
hr = QWinRTFunctions::await(op, serviceProvider.GetAddressOf());
|
||||
if (hr == HRESULT_FROM_WIN32(ERROR_DEVICE_NOT_AVAILABLE)) {
|
||||
qCWarning(QT_BT_WINRT) << Q_FUNC_INFO << "No bluetooth adapter available.";
|
||||
qCWarning(QT_BT_WINDOWS) << Q_FUNC_INFO << "No bluetooth adapter available.";
|
||||
return false;
|
||||
} else {
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
|
@ -474,7 +474,7 @@ bool QBluetoothServiceInfoPrivate::registerService(const QBluetoothAddress &loca
|
|||
|
||||
ComPtr<IStreamSocketListener> listener = sPriv->listener();
|
||||
if (!listener) {
|
||||
qCWarning(QT_BT_WINRT) << Q_FUNC_INFO << "Could not obtain listener from server.";
|
||||
qCWarning(QT_BT_WINDOWS) << Q_FUNC_INFO << "Could not obtain listener from server.";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -493,17 +493,17 @@ bool QBluetoothServiceInfoPrivate::registerService(const QBluetoothAddress &loca
|
|||
|
||||
result = writeSdpAttributes();
|
||||
if (!result) {
|
||||
qCWarning(QT_BT_WINRT) << "Could not write SDP attributes.";
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not write SDP attributes.";
|
||||
return false;
|
||||
}
|
||||
qCDebug(QT_BT_WINRT) << "SDP attributes written.";
|
||||
qCDebug(QT_BT_WINDOWS) << "SDP attributes written.";
|
||||
|
||||
ComPtr<IRfcommServiceProvider2> serviceProvider2;
|
||||
hr = serviceProvider.As(&serviceProvider2);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
hr = serviceProvider2->StartAdvertisingWithRadioDiscoverability(listener.Get(), true);
|
||||
if (FAILED(hr)) {
|
||||
qCWarning(QT_BT_WINRT) << Q_FUNC_INFO << "Could not start advertising. Check your SDP data.";
|
||||
qCWarning(QT_BT_WINDOWS) << Q_FUNC_INFO << "Could not start advertising. Check your SDP data.";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -559,7 +559,7 @@ bool QBluetoothServiceInfoPrivate::writeSdpAttributes()
|
|||
HRESULT hr;
|
||||
ComPtr<IBuffer> buffer = bufferFromAttribute(attribute);
|
||||
if (!buffer) {
|
||||
qCWarning(QT_BT_WINRT) << "Could not create buffer from attribute with id:" << key;
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not create buffer from attribute with id:" << key;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -567,7 +567,7 @@ bool QBluetoothServiceInfoPrivate::writeSdpAttributes()
|
|||
// WinRT accept the list without breaking existing apps we have to repair this structure.
|
||||
if (key == QBluetoothServiceInfo::BluetoothProfileDescriptorList) {
|
||||
if (!repairProfileDescriptorListIfNeeded(buffer)) {
|
||||
qCWarning(QT_BT_WINRT) << Q_FUNC_INFO << "Error while checking/repairing structure of profile descriptor list";
|
||||
qCWarning(QT_BT_WINDOWS) << Q_FUNC_INFO << "Error while checking/repairing structure of profile descriptor list";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -582,7 +582,7 @@ bool QBluetoothServiceInfoPrivate::writeSdpAttributes()
|
|||
hr = rawAttributes->Insert(key, buffer.Get(), &replaced);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
Q_ASSERT(!replaced);
|
||||
qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Registered attribute" << QString::number(key, 16).rightJustified(4, '0') << "with value" << attribute;
|
||||
qCDebug(QT_BT_WINDOWS) << Q_FUNC_INFO << "Registered attribute" << QString::number(key, 16).rightJustified(4, '0') << "with value" << attribute;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ typedef IAsyncOperationWithProgress<IBuffer *, UINT32> IAsyncBufferOperation;
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(QT_BT_WINRT)
|
||||
Q_DECLARE_LOGGING_CATEGORY(QT_BT_WINDOWS)
|
||||
|
||||
struct SocketGlobal
|
||||
{
|
||||
|
@ -98,7 +98,7 @@ static qint64 writeIOStream(ComPtr<IOutputStream> stream, const char *data, qint
|
|||
{
|
||||
ComPtr<IBuffer> buffer;
|
||||
if (len > UINT32_MAX) {
|
||||
qCWarning(QT_BT_WINRT) << "writeIOStream can only write up to" << UINT32_MAX << "bytes.";
|
||||
qCWarning(QT_BT_WINDOWS) << "writeIOStream can only write up to" << UINT32_MAX << "bytes.";
|
||||
len = UINT32_MAX;
|
||||
}
|
||||
quint32 ulen = static_cast<quint32>(len);
|
||||
|
@ -412,7 +412,7 @@ void QBluetoothSocketPrivateWinRT::connectToService(
|
|||
|
||||
if (q->state() != QBluetoothSocket::SocketState::UnconnectedState
|
||||
&& q->state() != QBluetoothSocket::SocketState::ServiceLookupState) {
|
||||
qCWarning(QT_BT_WINRT) << "QBluetoothSocket::connectToService called on busy socket";
|
||||
qCWarning(QT_BT_WINDOWS) << "QBluetoothSocket::connectToService called on busy socket";
|
||||
errorString = QBluetoothSocket::tr("Trying to connect while connection is in progress");
|
||||
q->setSocketError(QBluetoothSocket::SocketError::OperationError);
|
||||
return;
|
||||
|
@ -467,10 +467,10 @@ void QBluetoothSocketPrivateWinRT::connectToService(
|
|||
// try doing service discovery to see if we can find the socket
|
||||
if (service.serviceUuid().isNull()
|
||||
&& !service.serviceClassUuids().contains(QBluetoothUuid::ServiceClassUuid::SerialPort)) {
|
||||
qCWarning(QT_BT_WINRT) << "No port, no PSM, and no UUID provided. Unable to connect";
|
||||
qCWarning(QT_BT_WINDOWS) << "No port, no PSM, and no UUID provided. Unable to connect";
|
||||
return;
|
||||
}
|
||||
qCDebug(QT_BT_WINRT) << "Need a port/psm, doing discovery";
|
||||
qCDebug(QT_BT_WINDOWS) << "Need a port/psm, doing discovery";
|
||||
q->doDeviceDiscovery(service, openMode);
|
||||
}
|
||||
}
|
||||
|
@ -481,7 +481,7 @@ void QBluetoothSocketPrivateWinRT::connectToService(
|
|||
Q_Q(QBluetoothSocket);
|
||||
|
||||
if (q->state() != QBluetoothSocket::SocketState::UnconnectedState) {
|
||||
qCWarning(QT_BT_WINRT) << "QBluetoothSocketPrivateWinRT::connectToService called on busy socket";
|
||||
qCWarning(QT_BT_WINDOWS) << "QBluetoothSocketPrivateWinRT::connectToService called on busy socket";
|
||||
errorString = QBluetoothSocket::tr("Trying to connect while connection is in progress");
|
||||
q->setSocketError(QBluetoothSocket::SocketError::OperationError);
|
||||
return;
|
||||
|
@ -506,7 +506,7 @@ void QBluetoothSocketPrivateWinRT::connectToService(
|
|||
Q_Q(QBluetoothSocket);
|
||||
|
||||
if (q->state() != QBluetoothSocket::SocketState::UnconnectedState) {
|
||||
qCWarning(QT_BT_WINRT) << "QBluetoothSocketPrivateWinRT::connectToService called on busy socket";
|
||||
qCWarning(QT_BT_WINDOWS) << "QBluetoothSocketPrivateWinRT::connectToService called on busy socket";
|
||||
errorString = QBluetoothSocket::tr("Trying to connect while connection is in progress");
|
||||
q->setSocketError(QBluetoothSocket::SocketError::OperationError);
|
||||
return;
|
||||
|
@ -590,7 +590,7 @@ quint16 QBluetoothSocketPrivateWinRT::localPort() const
|
|||
bool ok = true;
|
||||
const uint port = qt_QStringFromHString(localPortString).toUInt(&ok);
|
||||
if (!ok || port > UINT16_MAX) {
|
||||
qCWarning(QT_BT_WINRT) << "Unexpected local port";
|
||||
qCWarning(QT_BT_WINDOWS) << "Unexpected local port";
|
||||
return 0;
|
||||
}
|
||||
return quint16(port);
|
||||
|
@ -647,7 +647,7 @@ quint16 QBluetoothSocketPrivateWinRT::peerPort() const
|
|||
bool ok = true;
|
||||
const uint port = qt_QStringFromHString(remotePortString).toUInt(&ok);
|
||||
if (!ok || port > UINT16_MAX) {
|
||||
qCWarning(QT_BT_WINRT) << "Unexpected remote port";
|
||||
qCWarning(QT_BT_WINDOWS) << "Unexpected remote port";
|
||||
return 0;
|
||||
}
|
||||
return quint16(port);
|
||||
|
@ -670,7 +670,7 @@ qint64 QBluetoothSocketPrivateWinRT::writeData(const char *data, qint64 maxSize)
|
|||
|
||||
qint64 bytesWritten = writeIOStream(stream, data, maxSize);
|
||||
if (bytesWritten < 0) {
|
||||
qCWarning(QT_BT_WINRT) << "Socket::writeData: " << state;
|
||||
qCWarning(QT_BT_WINDOWS) << "Socket::writeData: " << state;
|
||||
errorString = QBluetoothSocket::tr("Cannot read while not connected");
|
||||
q->setSocketError(QBluetoothSocket::SocketError::OperationError);
|
||||
}
|
||||
|
@ -710,7 +710,7 @@ bool QBluetoothSocketPrivateWinRT::setSocketDescriptor(int socketDescriptor, QBl
|
|||
Q_UNUSED(socketType);
|
||||
Q_UNUSED(socketState);
|
||||
Q_UNUSED(openMode);
|
||||
qCWarning(QT_BT_WINRT) << "No socket descriptor support on WinRT.";
|
||||
qCWarning(QT_BT_WINDOWS) << "No socket descriptor support on WinRT.";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(QT_BT)
|
||||
Q_DECLARE_LOGGING_CATEGORY(QT_BT_WINRT)
|
||||
Q_DECLARE_LOGGING_CATEGORY(QT_BT_WINDOWS)
|
||||
|
||||
/*!
|
||||
\class QLowEnergyController
|
||||
|
|
|
@ -85,13 +85,13 @@ typedef IGattReadClientCharacteristicConfigurationDescriptorResult IClientCharCo
|
|||
|
||||
#define WARN_AND_CONTINUE_IF_FAILED(hr, msg) \
|
||||
if (FAILED(hr)) { \
|
||||
qCWarning(QT_BT_WINRT) << msg; \
|
||||
qCWarning(QT_BT_WINDOWS) << msg; \
|
||||
continue; \
|
||||
}
|
||||
|
||||
#define CHECK_FOR_DEVICE_CONNECTION_ERROR_IMPL(this, hr, msg, ret) \
|
||||
if (FAILED(hr)) { \
|
||||
qCWarning(QT_BT_WINRT) << msg; \
|
||||
qCWarning(QT_BT_WINDOWS) << msg; \
|
||||
this->unregisterFromStatusChanges(); \
|
||||
this->setError(QLowEnergyController::ConnectionError); \
|
||||
this->setState(QLowEnergyController::UnconnectedState); \
|
||||
|
@ -103,13 +103,13 @@ typedef IGattReadClientCharacteristicConfigurationDescriptorResult IClientCharCo
|
|||
|
||||
#define CHECK_HR_AND_SET_SERVICE_ERROR(hr, msg, service, error, ret) \
|
||||
if (FAILED(hr)) { \
|
||||
qCDebug(QT_BT_WINRT) << msg; \
|
||||
qCDebug(QT_BT_WINDOWS) << msg; \
|
||||
service->setError(error); \
|
||||
ret; \
|
||||
}
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(QT_BT_WINRT)
|
||||
Q_DECLARE_LOGGING_CATEGORY(QT_BT_WINRT_SERVICE_THREAD)
|
||||
Q_DECLARE_LOGGING_CATEGORY(QT_BT_WINDOWS)
|
||||
Q_DECLARE_LOGGING_CATEGORY(QT_BT_WINDOWS_SERVICE_THREAD)
|
||||
|
||||
static QByteArray byteArrayFromGattResult(const ComPtr<IGattReadResult> &gattResult,
|
||||
bool isWCharString = false)
|
||||
|
@ -118,7 +118,7 @@ static QByteArray byteArrayFromGattResult(const ComPtr<IGattReadResult> &gattRes
|
|||
HRESULT hr;
|
||||
hr = gattResult->get_Value(&buffer);
|
||||
if (FAILED(hr) || !buffer) {
|
||||
qCWarning(QT_BT_WINRT) << "Could not obtain buffer from GattReadResult";
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not obtain buffer from GattReadResult";
|
||||
return QByteArray();
|
||||
}
|
||||
return byteArrayFromBuffer(buffer, isWCharString);
|
||||
|
@ -133,7 +133,7 @@ public:
|
|||
QLowEnergyService::DiscoveryMode mode)
|
||||
: mService(service), mMode(mode), mDeviceService(deviceService)
|
||||
{
|
||||
qCDebug(QT_BT_WINRT) << __FUNCTION__;
|
||||
qCDebug(QT_BT_WINDOWS) << __FUNCTION__;
|
||||
}
|
||||
|
||||
~QWinRTLowEnergyServiceHandlerNew()
|
||||
|
@ -144,7 +144,7 @@ public slots:
|
|||
void obtainCharList()
|
||||
{
|
||||
mIndicateChars.clear();
|
||||
qCDebug(QT_BT_WINRT) << __FUNCTION__;
|
||||
qCDebug(QT_BT_WINDOWS) << __FUNCTION__;
|
||||
ComPtr<IAsyncOperation<GattCharacteristicsResult *>> characteristicsOp;
|
||||
ComPtr<IGattCharacteristicsResult> characteristicsResult;
|
||||
HRESULT hr = mDeviceService->GetCharacteristicsAsync(&characteristicsOp);
|
||||
|
@ -172,7 +172,7 @@ public slots:
|
|||
ComPtr<IGattCharacteristic> characteristic;
|
||||
hr = characteristics->GetAt(i, &characteristic);
|
||||
if (FAILED(hr)) {
|
||||
qCWarning(QT_BT_WINRT) << "Could not obtain characteristic at" << i;
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not obtain characteristic at" << i;
|
||||
--mCharacteristicsCountToBeDiscovered;
|
||||
continue;
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ public slots:
|
|||
ComPtr<IGattCharacteristic3> characteristic3;
|
||||
hr = characteristic.As(&characteristic3);
|
||||
if (FAILED(hr)) {
|
||||
qCWarning(QT_BT_WINRT) << "Could not cast characteristic";
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not cast characteristic";
|
||||
--mCharacteristicsCountToBeDiscovered;
|
||||
continue;
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ public slots:
|
|||
ComPtr<IAsyncOperation<GattDescriptorsResult*>> descAsyncResult;
|
||||
hr = characteristic3->GetDescriptorsAsync(&descAsyncResult);
|
||||
if (FAILED(hr)) {
|
||||
qCWarning(QT_BT_WINRT) << "Could not obtain list of descriptors";
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not obtain list of descriptors";
|
||||
--mCharacteristicsCountToBeDiscovered;
|
||||
continue;
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ public slots:
|
|||
(IAsyncOperation<GattDescriptorsResult *> *op,
|
||||
AsyncStatus status) {
|
||||
if (status != AsyncStatus::Completed) {
|
||||
qCWarning(QT_BT_WINRT) << "Descriptor operation unsuccessful";
|
||||
qCWarning(QT_BT_WINDOWS) << "Descriptor operation unsuccessful";
|
||||
--mCharacteristicsCountToBeDiscovered;
|
||||
checkAllCharacteristicsDiscovered();
|
||||
return S_OK;
|
||||
|
@ -211,7 +211,7 @@ public slots:
|
|||
|
||||
HRESULT hr = characteristic->get_AttributeHandle(&handle);
|
||||
if (FAILED(hr)) {
|
||||
qCWarning(QT_BT_WINRT) << "Could not obtain characteristic's attribute handle";
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not obtain characteristic's attribute handle";
|
||||
--mCharacteristicsCountToBeDiscovered;
|
||||
checkAllCharacteristicsDiscovered();
|
||||
return S_OK;
|
||||
|
@ -225,7 +225,7 @@ public slots:
|
|||
GUID guuid;
|
||||
hr = characteristic->get_Uuid(&guuid);
|
||||
if (FAILED(hr)) {
|
||||
qCWarning(QT_BT_WINRT) << "Could not obtain characteristic's Uuid";
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not obtain characteristic's Uuid";
|
||||
--mCharacteristicsCountToBeDiscovered;
|
||||
checkAllCharacteristicsDiscovered();
|
||||
return S_OK;
|
||||
|
@ -234,7 +234,7 @@ public slots:
|
|||
GattCharacteristicProperties properties;
|
||||
hr = characteristic->get_CharacteristicProperties(&properties);
|
||||
if (FAILED(hr)) {
|
||||
qCWarning(QT_BT_WINRT) << "Could not obtain characteristic's properties";
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not obtain characteristic's properties";
|
||||
--mCharacteristicsCountToBeDiscovered;
|
||||
checkAllCharacteristicsDiscovered();
|
||||
return S_OK;
|
||||
|
@ -246,7 +246,7 @@ public slots:
|
|||
hr = characteristic->ReadValueWithCacheModeAsync(BluetoothCacheMode_Uncached,
|
||||
&readOp);
|
||||
if (FAILED(hr)) {
|
||||
qCWarning(QT_BT_WINRT) << "Could not read characteristic";
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not read characteristic";
|
||||
--mCharacteristicsCountToBeDiscovered;
|
||||
checkAllCharacteristicsDiscovered();
|
||||
return S_OK;
|
||||
|
@ -254,13 +254,13 @@ public slots:
|
|||
ComPtr<IGattReadResult> readResult;
|
||||
hr = QWinRTFunctions::await(readOp, readResult.GetAddressOf());
|
||||
if (FAILED(hr)) {
|
||||
qCWarning(QT_BT_WINRT) << "Could not obtain characteristic read result";
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not obtain characteristic read result";
|
||||
--mCharacteristicsCountToBeDiscovered;
|
||||
checkAllCharacteristicsDiscovered();
|
||||
return S_OK;
|
||||
}
|
||||
if (!readResult)
|
||||
qCWarning(QT_BT_WINRT) << "Characteristic read result is null";
|
||||
qCWarning(QT_BT_WINDOWS) << "Characteristic read result is null";
|
||||
else
|
||||
charData.value = byteArrayFromGattResult(readResult);
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ public slots:
|
|||
ComPtr<IGattDescriptorsResult> result;
|
||||
hr = op->GetResults(&result);
|
||||
if (FAILED(hr)) {
|
||||
qCWarning(QT_BT_WINRT) << "Could not obtain descriptor read result";
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not obtain descriptor read result";
|
||||
--mCharacteristicsCountToBeDiscovered;
|
||||
checkAllCharacteristicsDiscovered();
|
||||
return S_OK;
|
||||
|
@ -279,7 +279,7 @@ public slots:
|
|||
GattCommunicationStatus commStatus;
|
||||
hr = result->get_Status(&commStatus);
|
||||
if (FAILED(hr) || commStatus != GattCommunicationStatus_Success) {
|
||||
qCWarning(QT_BT_WINRT) << "Descriptor operation failed";
|
||||
qCWarning(QT_BT_WINDOWS) << "Descriptor operation failed";
|
||||
--mCharacteristicsCountToBeDiscovered;
|
||||
checkAllCharacteristicsDiscovered();
|
||||
return S_OK;
|
||||
|
@ -287,7 +287,7 @@ public slots:
|
|||
|
||||
hr = result->get_Descriptors(&descriptors);
|
||||
if (FAILED(hr)) {
|
||||
qCWarning(QT_BT_WINRT) << "Could not obtain list of descriptors";
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not obtain list of descriptors";
|
||||
--mCharacteristicsCountToBeDiscovered;
|
||||
checkAllCharacteristicsDiscovered();
|
||||
return S_OK;
|
||||
|
@ -296,7 +296,7 @@ public slots:
|
|||
uint descriptorCount;
|
||||
hr = descriptors->get_Size(&descriptorCount);
|
||||
if (FAILED(hr)) {
|
||||
qCWarning(QT_BT_WINRT) << "Could not obtain list of descriptors' size";
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not obtain list of descriptors' size";
|
||||
--mCharacteristicsCountToBeDiscovered;
|
||||
checkAllCharacteristicsDiscovered();
|
||||
return S_OK;
|
||||
|
@ -380,7 +380,7 @@ public slots:
|
|||
return S_OK;
|
||||
}).Get());
|
||||
if (FAILED(hr)) {
|
||||
qCWarning(QT_BT_WINRT) << "Could not register descriptor callback";
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not register descriptor callback";
|
||||
--mCharacteristicsCountToBeDiscovered;
|
||||
continue;
|
||||
}
|
||||
|
@ -456,7 +456,7 @@ void QLowEnergyControllerPrivateWinRT::init()
|
|||
|
||||
void QLowEnergyControllerPrivateWinRT::connectToDevice()
|
||||
{
|
||||
qCDebug(QT_BT_WINRT) << __FUNCTION__;
|
||||
qCDebug(QT_BT_WINDOWS) << __FUNCTION__;
|
||||
mAbortPending = false;
|
||||
Q_Q(QLowEnergyController);
|
||||
if (remoteDevice.isNull()) {
|
||||
|
@ -478,7 +478,7 @@ void QLowEnergyControllerPrivateWinRT::connectToDevice()
|
|||
hr = QWinRTFunctions::await(deviceFromIdOperation, mDevice.GetAddressOf(),
|
||||
QWinRTFunctions::ProcessMainThreadEvents, 5000);
|
||||
if (FAILED(hr) || !mDevice) {
|
||||
qCWarning(QT_BT_WINRT) << "Could not find LE device";
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not find LE device";
|
||||
setError(QLowEnergyController::InvalidBluetoothAdapterError);
|
||||
setState(QLowEnergyController::UnconnectedState);
|
||||
return;
|
||||
|
@ -502,7 +502,7 @@ void QLowEnergyControllerPrivateWinRT::connectToDevice()
|
|||
|
||||
void QLowEnergyControllerPrivateWinRT::disconnectFromDevice()
|
||||
{
|
||||
qCDebug(QT_BT_WINRT) << __FUNCTION__;
|
||||
qCDebug(QT_BT_WINDOWS) << __FUNCTION__;
|
||||
Q_Q(QLowEnergyController);
|
||||
setState(QLowEnergyController::ClosingState);
|
||||
unregisterFromValueChanges();
|
||||
|
@ -520,7 +520,7 @@ ComPtr<IGattDeviceService> QLowEnergyControllerPrivateWinRT::getNativeService(
|
|||
HRESULT hr;
|
||||
hr = mDevice->GetGattService(serviceUuid, &deviceService);
|
||||
if (FAILED(hr))
|
||||
qCDebug(QT_BT_WINRT) << "Could not obtain native service for Uuid" << serviceUuid;
|
||||
qCDebug(QT_BT_WINDOWS) << "Could not obtain native service for Uuid" << serviceUuid;
|
||||
return deviceService;
|
||||
}
|
||||
|
||||
|
@ -564,7 +564,7 @@ ComPtr<IGattCharacteristic> QLowEnergyControllerPrivateWinRT::getNativeCharacter
|
|||
void QLowEnergyControllerPrivateWinRT::registerForValueChanges(const QBluetoothUuid &serviceUuid,
|
||||
const QBluetoothUuid &charUuid)
|
||||
{
|
||||
qCDebug(QT_BT_WINRT) << "Registering characteristic" << charUuid << "in service"
|
||||
qCDebug(QT_BT_WINDOWS) << "Registering characteristic" << charUuid << "in service"
|
||||
<< serviceUuid << "for value changes";
|
||||
for (const ValueChangedEntry &entry : qAsConst(mValueChangedTokens)) {
|
||||
GUID guuid;
|
||||
|
@ -576,7 +576,7 @@ void QLowEnergyControllerPrivateWinRT::registerForValueChanges(const QBluetoothU
|
|||
}
|
||||
ComPtr<IGattCharacteristic> characteristic = getNativeCharacteristic(serviceUuid, charUuid);
|
||||
if (!characteristic) {
|
||||
qCDebug(QT_BT_WINRT).nospace() << "Could not obtain native characteristic " << charUuid
|
||||
qCDebug(QT_BT_WINDOWS).nospace() << "Could not obtain native characteristic " << charUuid
|
||||
<< " from service " << serviceUuid << ". Qt will not be able to signal"
|
||||
<< " changes for this characteristic.";
|
||||
return;
|
||||
|
@ -589,23 +589,23 @@ void QLowEnergyControllerPrivateWinRT::registerForValueChanges(const QBluetoothU
|
|||
&token);
|
||||
RETURN_IF_FAILED("Could not register characteristic for value changes", return)
|
||||
mValueChangedTokens.append(ValueChangedEntry(characteristic, token));
|
||||
qCDebug(QT_BT_WINRT) << "Characteristic" << charUuid << "in service"
|
||||
qCDebug(QT_BT_WINDOWS) << "Characteristic" << charUuid << "in service"
|
||||
<< serviceUuid << "registered for value changes";
|
||||
}
|
||||
|
||||
void QLowEnergyControllerPrivateWinRT::unregisterFromValueChanges()
|
||||
{
|
||||
qCDebug(QT_BT_WINRT) << "Unregistering " << mValueChangedTokens.count() << " value change tokens";
|
||||
qCDebug(QT_BT_WINDOWS) << "Unregistering " << mValueChangedTokens.count() << " value change tokens";
|
||||
HRESULT hr;
|
||||
for (const ValueChangedEntry &entry : qAsConst(mValueChangedTokens)) {
|
||||
if (!entry.characteristic) {
|
||||
qCWarning(QT_BT_WINRT) << "Unregistering from value changes for characteristic failed."
|
||||
qCWarning(QT_BT_WINDOWS) << "Unregistering from value changes for characteristic failed."
|
||||
<< "Characteristic has been deleted";
|
||||
continue;
|
||||
}
|
||||
hr = entry.characteristic->remove_ValueChanged(entry.token);
|
||||
if (FAILED(hr))
|
||||
qCWarning(QT_BT_WINRT) << "Unregistering from value changes for characteristic failed.";
|
||||
qCWarning(QT_BT_WINDOWS) << "Unregistering from value changes for characteristic failed.";
|
||||
}
|
||||
mValueChangedTokens.clear();
|
||||
}
|
||||
|
@ -628,7 +628,7 @@ bool QLowEnergyControllerPrivateWinRT::registerForStatusChanges()
|
|||
if (!mDevice)
|
||||
return false;
|
||||
|
||||
qCDebug(QT_BT_WINRT) << __FUNCTION__;
|
||||
qCDebug(QT_BT_WINDOWS) << __FUNCTION__;
|
||||
|
||||
HRESULT hr;
|
||||
hr = mDevice->add_ConnectionStatusChanged(
|
||||
|
@ -640,7 +640,7 @@ bool QLowEnergyControllerPrivateWinRT::registerForStatusChanges()
|
|||
|
||||
void QLowEnergyControllerPrivateWinRT::unregisterFromStatusChanges()
|
||||
{
|
||||
qCDebug(QT_BT_WINRT) << __FUNCTION__;
|
||||
qCDebug(QT_BT_WINDOWS) << __FUNCTION__;
|
||||
if (mDevice && mStatusChangedToken.value) {
|
||||
mDevice->remove_ConnectionStatusChanged(mStatusChangedToken);
|
||||
mStatusChangedToken.value = 0;
|
||||
|
@ -708,7 +708,7 @@ void QLowEnergyControllerPrivateWinRT::obtainIncludedServices(
|
|||
WARN_AND_CONTINUE_IF_FAILED(hr, "Could not obtain included service's Uuid");
|
||||
const QBluetoothUuid includedUuid(guuid);
|
||||
QSharedPointer<QLowEnergyServicePrivate> includedPointer;
|
||||
qCDebug(QT_BT_WINRT_SERVICE_THREAD) << __FUNCTION__
|
||||
qCDebug(QT_BT_WINDOWS_SERVICE_THREAD) << __FUNCTION__
|
||||
<< "Changing service pointer from thread"
|
||||
<< QThread::currentThread();
|
||||
if (serviceList.contains(includedUuid)) {
|
||||
|
@ -734,7 +734,7 @@ HRESULT QLowEnergyControllerPrivateWinRT::onServiceDiscoveryFinished(ABI::Window
|
|||
{
|
||||
Q_Q(QLowEnergyController);
|
||||
if (status != AsyncStatus::Completed) {
|
||||
qCDebug(QT_BT_WINRT) << "Could not obtain services";
|
||||
qCDebug(QT_BT_WINDOWS) << "Could not obtain services";
|
||||
return S_OK;
|
||||
}
|
||||
ComPtr<IGattDeviceServicesResult> result;
|
||||
|
@ -766,7 +766,7 @@ HRESULT QLowEnergyControllerPrivateWinRT::onServiceDiscoveryFinished(ABI::Window
|
|||
WARN_AND_CONTINUE_IF_FAILED(hr, "Could not obtain service's Uuid");
|
||||
const QBluetoothUuid service(guuid);
|
||||
|
||||
qCDebug(QT_BT_WINRT_SERVICE_THREAD) << __FUNCTION__
|
||||
qCDebug(QT_BT_WINDOWS_SERVICE_THREAD) << __FUNCTION__
|
||||
<< "Changing service pointer from thread"
|
||||
<< QThread::currentThread();
|
||||
QSharedPointer<QLowEnergyServicePrivate> pointer;
|
||||
|
@ -795,7 +795,7 @@ HRESULT QLowEnergyControllerPrivateWinRT::onServiceDiscoveryFinished(ABI::Window
|
|||
|
||||
void QLowEnergyControllerPrivateWinRT::discoverServices()
|
||||
{
|
||||
qCDebug(QT_BT_WINRT) << "Service discovery initiated";
|
||||
qCDebug(QT_BT_WINDOWS) << "Service discovery initiated";
|
||||
|
||||
ComPtr<IBluetoothLEDevice3> device3;
|
||||
HRESULT hr = mDevice.As(&device3);
|
||||
|
@ -813,29 +813,29 @@ void QLowEnergyControllerPrivateWinRT::discoverServices()
|
|||
void QLowEnergyControllerPrivateWinRT::discoverServiceDetails(
|
||||
const QBluetoothUuid &service, QLowEnergyService::DiscoveryMode mode)
|
||||
{
|
||||
qCDebug(QT_BT_WINRT) << __FUNCTION__ << service;
|
||||
qCDebug(QT_BT_WINDOWS) << __FUNCTION__ << service;
|
||||
if (!serviceList.contains(service)) {
|
||||
qCWarning(QT_BT_WINRT) << "Discovery done of unknown service:"
|
||||
qCWarning(QT_BT_WINDOWS) << "Discovery done of unknown service:"
|
||||
<< service.toString();
|
||||
return;
|
||||
}
|
||||
|
||||
ComPtr<IGattDeviceService> deviceService = getNativeService(service);
|
||||
if (!deviceService) {
|
||||
qCDebug(QT_BT_WINRT) << "Could not obtain native service for uuid " << service;
|
||||
qCDebug(QT_BT_WINDOWS) << "Could not obtain native service for uuid " << service;
|
||||
return;
|
||||
}
|
||||
|
||||
auto reactOnDiscoveryError = [](QSharedPointer<QLowEnergyServicePrivate> service,
|
||||
const QString &msg)
|
||||
{
|
||||
qCDebug(QT_BT_WINRT) << msg;
|
||||
qCDebug(QT_BT_WINDOWS) << msg;
|
||||
service->setError(QLowEnergyService::UnknownError);
|
||||
service->setState(QLowEnergyService::RemoteService);
|
||||
};
|
||||
//update service data
|
||||
QSharedPointer<QLowEnergyServicePrivate> pointer = serviceList.value(service);
|
||||
qCDebug(QT_BT_WINRT_SERVICE_THREAD) << __FUNCTION__ << "Changing service pointer from thread"
|
||||
qCDebug(QT_BT_WINDOWS_SERVICE_THREAD) << __FUNCTION__ << "Changing service pointer from thread"
|
||||
<< QThread::currentThread();
|
||||
pointer->setState(QLowEnergyService::RemoteServiceDiscovering);
|
||||
ComPtr<IGattDeviceService3> deviceService3;
|
||||
|
@ -887,7 +887,7 @@ void QLowEnergyControllerPrivateWinRT::discoverServiceDetails(
|
|||
|
||||
const QBluetoothUuid service(guuid);
|
||||
if (service.isNull()) {
|
||||
qCDebug(QT_BT_WINRT) << "Could not find service";
|
||||
qCDebug(QT_BT_WINDOWS) << "Could not find service";
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -913,7 +913,7 @@ void QLowEnergyControllerPrivateWinRT::discoverServiceDetails(
|
|||
QLowEnergyServicePrivate::CharData> charList, QList<QBluetoothUuid> indicateChars,
|
||||
QLowEnergyHandle startHandle, QLowEnergyHandle endHandle) {
|
||||
if (!serviceList.contains(service)) {
|
||||
qCWarning(QT_BT_WINRT) << "Discovery done of unknown service:"
|
||||
qCWarning(QT_BT_WINDOWS) << "Discovery done of unknown service:"
|
||||
<< service.toString();
|
||||
return;
|
||||
}
|
||||
|
@ -955,8 +955,8 @@ void QLowEnergyControllerPrivateWinRT::readCharacteristic(
|
|||
const QSharedPointer<QLowEnergyServicePrivate> service,
|
||||
const QLowEnergyHandle charHandle)
|
||||
{
|
||||
qCDebug(QT_BT_WINRT) << __FUNCTION__ << service << charHandle;
|
||||
qCDebug(QT_BT_WINRT_SERVICE_THREAD) << __FUNCTION__ << "Changing service pointer from thread"
|
||||
qCDebug(QT_BT_WINDOWS) << __FUNCTION__ << service << charHandle;
|
||||
qCDebug(QT_BT_WINDOWS_SERVICE_THREAD) << __FUNCTION__ << "Changing service pointer from thread"
|
||||
<< QThread::currentThread();
|
||||
Q_ASSERT(!service.isNull());
|
||||
if (role == QLowEnergyController::PeripheralRole) {
|
||||
|
@ -966,18 +966,18 @@ void QLowEnergyControllerPrivateWinRT::readCharacteristic(
|
|||
}
|
||||
|
||||
if (!service->characteristicList.contains(charHandle)) {
|
||||
qCDebug(QT_BT_WINRT) << charHandle << "could not be found in service" << service->uuid;
|
||||
qCDebug(QT_BT_WINDOWS) << charHandle << "could not be found in service" << service->uuid;
|
||||
service->setError(QLowEnergyService::CharacteristicReadError);
|
||||
return;
|
||||
}
|
||||
|
||||
const QLowEnergyServicePrivate::CharData charData = service->characteristicList.value(charHandle);
|
||||
if (!(charData.properties & QLowEnergyCharacteristic::Read))
|
||||
qCDebug(QT_BT_WINRT) << "Read flag is not set for characteristic" << charData.uuid;
|
||||
qCDebug(QT_BT_WINDOWS) << "Read flag is not set for characteristic" << charData.uuid;
|
||||
|
||||
ComPtr<IGattCharacteristic> characteristic = getNativeCharacteristic(service->uuid, charData.uuid);
|
||||
if (!characteristic) {
|
||||
qCDebug(QT_BT_WINRT) << "Could not obtain native characteristic" << charData.uuid
|
||||
qCDebug(QT_BT_WINDOWS) << "Could not obtain native characteristic" << charData.uuid
|
||||
<< "from service" << service->uuid;
|
||||
service->setError(QLowEnergyService::CharacteristicReadError);
|
||||
return;
|
||||
|
@ -990,7 +990,7 @@ void QLowEnergyControllerPrivateWinRT::readCharacteristic(
|
|||
(IAsyncOperation<GattReadResult*> *op, AsyncStatus status)
|
||||
{
|
||||
if (status == AsyncStatus::Canceled || status == AsyncStatus::Error) {
|
||||
qCDebug(QT_BT_WINRT) << "Characteristic" << charHandle << "read operation failed.";
|
||||
qCDebug(QT_BT_WINDOWS) << "Characteristic" << charHandle << "read operation failed.";
|
||||
service->setError(QLowEnergyService::CharacteristicReadError);
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -1018,8 +1018,8 @@ void QLowEnergyControllerPrivateWinRT::readDescriptor(
|
|||
const QLowEnergyHandle charHandle,
|
||||
const QLowEnergyHandle descHandle)
|
||||
{
|
||||
qCDebug(QT_BT_WINRT) << __FUNCTION__ << service << charHandle << descHandle;
|
||||
qCDebug(QT_BT_WINRT_SERVICE_THREAD) << __FUNCTION__ << "Changing service pointer from thread"
|
||||
qCDebug(QT_BT_WINDOWS) << __FUNCTION__ << service << charHandle << descHandle;
|
||||
qCDebug(QT_BT_WINDOWS_SERVICE_THREAD) << __FUNCTION__ << "Changing service pointer from thread"
|
||||
<< QThread::currentThread();
|
||||
Q_ASSERT(!service.isNull());
|
||||
if (role == QLowEnergyController::PeripheralRole) {
|
||||
|
@ -1029,7 +1029,7 @@ void QLowEnergyControllerPrivateWinRT::readDescriptor(
|
|||
}
|
||||
|
||||
if (!service->characteristicList.contains(charHandle)) {
|
||||
qCDebug(QT_BT_WINRT) << "Descriptor" << descHandle << "in characteristic" << charHandle
|
||||
qCDebug(QT_BT_WINDOWS) << "Descriptor" << descHandle << "in characteristic" << charHandle
|
||||
<< "cannot be found in service" << service->uuid;
|
||||
service->setError(QLowEnergyService::DescriptorReadError);
|
||||
return;
|
||||
|
@ -1038,7 +1038,7 @@ void QLowEnergyControllerPrivateWinRT::readDescriptor(
|
|||
const QLowEnergyServicePrivate::CharData charData = service->characteristicList.value(charHandle);
|
||||
ComPtr<IGattCharacteristic> characteristic = getNativeCharacteristic(service->uuid, charData.uuid);
|
||||
if (!characteristic) {
|
||||
qCDebug(QT_BT_WINRT) << "Could not obtain native characteristic" << charData.uuid
|
||||
qCDebug(QT_BT_WINDOWS) << "Could not obtain native characteristic" << charData.uuid
|
||||
<< "from service" << service->uuid;
|
||||
service->setError(QLowEnergyService::DescriptorReadError);
|
||||
return;
|
||||
|
@ -1046,7 +1046,7 @@ void QLowEnergyControllerPrivateWinRT::readDescriptor(
|
|||
|
||||
// Get native descriptor
|
||||
if (!charData.descriptorList.contains(descHandle))
|
||||
qCDebug(QT_BT_WINRT) << "Descriptor" << descHandle << "cannot be found in characteristic" << charHandle;
|
||||
qCDebug(QT_BT_WINDOWS) << "Descriptor" << descHandle << "cannot be found in characteristic" << charHandle;
|
||||
const QLowEnergyServicePrivate::DescData descData = charData.descriptorList.value(descHandle);
|
||||
const QBluetoothUuid descUuid = descData.uuid;
|
||||
if (descUuid == QBluetoothUuid(QBluetoothUuid::DescriptorType::ClientCharacteristicConfiguration)) {
|
||||
|
@ -1058,7 +1058,7 @@ void QLowEnergyControllerPrivateWinRT::readDescriptor(
|
|||
(IAsyncOperation<ClientCharConfigDescriptorResult *> *op, AsyncStatus status)
|
||||
{
|
||||
if (status == AsyncStatus::Canceled || status == AsyncStatus::Error) {
|
||||
qCDebug(QT_BT_WINRT) << "Descriptor" << descHandle << "read operation failed";
|
||||
qCDebug(QT_BT_WINDOWS) << "Descriptor" << descHandle << "read operation failed";
|
||||
service->setError(QLowEnergyService::DescriptorReadError);
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -1084,7 +1084,7 @@ void QLowEnergyControllerPrivateWinRT::readDescriptor(
|
|||
if (value == GattClientCharacteristicConfigurationDescriptorValue_None)
|
||||
correct = true;
|
||||
if (!correct) {
|
||||
qCDebug(QT_BT_WINRT) << "Descriptor" << descHandle
|
||||
qCDebug(QT_BT_WINDOWS) << "Descriptor" << descHandle
|
||||
<< "read operation failed. Obtained unexpected value.";
|
||||
service->setError(QLowEnergyService::DescriptorReadError);
|
||||
return S_OK;
|
||||
|
@ -1136,11 +1136,11 @@ void QLowEnergyControllerPrivateWinRT::readDescriptor(
|
|||
CHECK_HR_AND_SET_SERVICE_ERROR(hr, "Could not await descritpor list's size",
|
||||
service, QLowEnergyService::DescriptorReadError, return)
|
||||
if (size == 0) {
|
||||
qCWarning(QT_BT_WINRT) << "No descriptor with uuid" << descData.uuid << "was found.";
|
||||
qCWarning(QT_BT_WINDOWS) << "No descriptor with uuid" << descData.uuid << "was found.";
|
||||
service->setError(QLowEnergyService::DescriptorReadError);
|
||||
return;
|
||||
} else if (size > 1) {
|
||||
qCWarning(QT_BT_WINRT) << "There is more than 1 descriptor with uuid" << descData.uuid;
|
||||
qCWarning(QT_BT_WINDOWS) << "There is more than 1 descriptor with uuid" << descData.uuid;
|
||||
}
|
||||
|
||||
ComPtr<IGattDescriptor> descriptor;
|
||||
|
@ -1155,7 +1155,7 @@ void QLowEnergyControllerPrivateWinRT::readDescriptor(
|
|||
(IAsyncOperation<GattReadResult*> *op, AsyncStatus status)
|
||||
{
|
||||
if (status == AsyncStatus::Canceled || status == AsyncStatus::Error) {
|
||||
qCDebug(QT_BT_WINRT) << "Descriptor" << descHandle << "read operation failed";
|
||||
qCDebug(QT_BT_WINDOWS) << "Descriptor" << descHandle << "read operation failed";
|
||||
service->setError(QLowEnergyService::DescriptorReadError);
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -1163,7 +1163,7 @@ void QLowEnergyControllerPrivateWinRT::readDescriptor(
|
|||
HRESULT hr;
|
||||
hr = op->GetResults(&descriptorValue);
|
||||
if (FAILED(hr)) {
|
||||
qCDebug(QT_BT_WINRT) << "Could not obtain result for descriptor" << descHandle;
|
||||
qCDebug(QT_BT_WINDOWS) << "Could not obtain result for descriptor" << descHandle;
|
||||
service->setError(QLowEnergyService::DescriptorReadError);
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -1190,8 +1190,8 @@ void QLowEnergyControllerPrivateWinRT::writeCharacteristic(
|
|||
const QByteArray &newValue,
|
||||
QLowEnergyService::WriteMode mode)
|
||||
{
|
||||
qCDebug(QT_BT_WINRT) << __FUNCTION__ << service << charHandle << newValue << mode;
|
||||
qCDebug(QT_BT_WINRT_SERVICE_THREAD) << __FUNCTION__ << "Changing service pointer from thread"
|
||||
qCDebug(QT_BT_WINDOWS) << __FUNCTION__ << service << charHandle << newValue << mode;
|
||||
qCDebug(QT_BT_WINDOWS_SERVICE_THREAD) << __FUNCTION__ << "Changing service pointer from thread"
|
||||
<< QThread::currentThread();
|
||||
Q_ASSERT(!service.isNull());
|
||||
if (role == QLowEnergyController::PeripheralRole) {
|
||||
|
@ -1200,7 +1200,7 @@ void QLowEnergyControllerPrivateWinRT::writeCharacteristic(
|
|||
return;
|
||||
}
|
||||
if (!service->characteristicList.contains(charHandle)) {
|
||||
qCDebug(QT_BT_WINRT) << "Characteristic" << charHandle << "cannot be found in service"
|
||||
qCDebug(QT_BT_WINDOWS) << "Characteristic" << charHandle << "cannot be found in service"
|
||||
<< service->uuid;
|
||||
service->setError(QLowEnergyService::CharacteristicWriteError);
|
||||
return;
|
||||
|
@ -1210,12 +1210,12 @@ void QLowEnergyControllerPrivateWinRT::writeCharacteristic(
|
|||
const bool writeWithResponse = mode == QLowEnergyService::WriteWithResponse;
|
||||
if (!(charData.properties & (writeWithResponse ? QLowEnergyCharacteristic::Write
|
||||
: QLowEnergyCharacteristic::WriteNoResponse)))
|
||||
qCDebug(QT_BT_WINRT) << "Write flag is not set for characteristic" << charHandle;
|
||||
qCDebug(QT_BT_WINDOWS) << "Write flag is not set for characteristic" << charHandle;
|
||||
|
||||
ComPtr<IGattCharacteristic> characteristic = getNativeCharacteristic(service->uuid,
|
||||
charData.uuid);
|
||||
if (!characteristic) {
|
||||
qCDebug(QT_BT_WINRT) << "Could not obtain native characteristic" << charData.uuid
|
||||
qCDebug(QT_BT_WINDOWS) << "Could not obtain native characteristic" << charData.uuid
|
||||
<< "from service" << service->uuid;
|
||||
service->setError(QLowEnergyService::CharacteristicWriteError);
|
||||
return;
|
||||
|
@ -1254,7 +1254,7 @@ void QLowEnergyControllerPrivateWinRT::writeCharacteristic(
|
|||
(IAsyncOperation<GattCommunicationStatus> *op, AsyncStatus status)
|
||||
{
|
||||
if (status == AsyncStatus::Canceled || status == AsyncStatus::Error) {
|
||||
qCDebug(QT_BT_WINRT) << "Characteristic" << charHandle << "write operation failed";
|
||||
qCDebug(QT_BT_WINDOWS) << "Characteristic" << charHandle << "write operation failed";
|
||||
service->setError(QLowEnergyService::CharacteristicWriteError);
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -1262,7 +1262,7 @@ void QLowEnergyControllerPrivateWinRT::writeCharacteristic(
|
|||
HRESULT hr;
|
||||
hr = op->GetResults(&result);
|
||||
if (hr == E_BLUETOOTH_ATT_INVALID_ATTRIBUTE_VALUE_LENGTH) {
|
||||
qCDebug(QT_BT_WINRT) << "Characteristic" << charHandle
|
||||
qCDebug(QT_BT_WINDOWS) << "Characteristic" << charHandle
|
||||
<< "write operation was tried with invalid value length";
|
||||
service->setError(QLowEnergyService::CharacteristicWriteError);
|
||||
return S_OK;
|
||||
|
@ -1270,7 +1270,7 @@ void QLowEnergyControllerPrivateWinRT::writeCharacteristic(
|
|||
CHECK_HR_AND_SET_SERVICE_ERROR(hr, "Could not obtain characteristic write result",
|
||||
service, QLowEnergyService::CharacteristicWriteError, return S_OK)
|
||||
if (result != GattCommunicationStatus_Success) {
|
||||
qCDebug(QT_BT_WINRT) << "Characteristic" << charHandle << "write operation failed";
|
||||
qCDebug(QT_BT_WINDOWS) << "Characteristic" << charHandle << "write operation failed";
|
||||
service->setError(QLowEnergyService::CharacteristicWriteError);
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -1296,8 +1296,8 @@ void QLowEnergyControllerPrivateWinRT::writeDescriptor(
|
|||
const QLowEnergyHandle descHandle,
|
||||
const QByteArray &newValue)
|
||||
{
|
||||
qCDebug(QT_BT_WINRT) << __FUNCTION__ << service << charHandle << descHandle << newValue;
|
||||
qCDebug(QT_BT_WINRT_SERVICE_THREAD) << __FUNCTION__ << "Changing service pointer from thread"
|
||||
qCDebug(QT_BT_WINDOWS) << __FUNCTION__ << service << charHandle << descHandle << newValue;
|
||||
qCDebug(QT_BT_WINDOWS_SERVICE_THREAD) << __FUNCTION__ << "Changing service pointer from thread"
|
||||
<< QThread::currentThread();
|
||||
Q_ASSERT(!service.isNull());
|
||||
if (role == QLowEnergyController::PeripheralRole) {
|
||||
|
@ -1307,7 +1307,7 @@ void QLowEnergyControllerPrivateWinRT::writeDescriptor(
|
|||
}
|
||||
|
||||
if (!service->characteristicList.contains(charHandle)) {
|
||||
qCDebug(QT_BT_WINRT) << "Descriptor" << descHandle << "in characteristic" << charHandle
|
||||
qCDebug(QT_BT_WINDOWS) << "Descriptor" << descHandle << "in characteristic" << charHandle
|
||||
<< "could not be found in service" << service->uuid;
|
||||
service->setError(QLowEnergyService::DescriptorWriteError);
|
||||
return;
|
||||
|
@ -1316,7 +1316,7 @@ void QLowEnergyControllerPrivateWinRT::writeDescriptor(
|
|||
const QLowEnergyServicePrivate::CharData charData = service->characteristicList.value(charHandle);
|
||||
ComPtr<IGattCharacteristic> characteristic = getNativeCharacteristic(service->uuid, charData.uuid);
|
||||
if (!characteristic) {
|
||||
qCDebug(QT_BT_WINRT) << "Could not obtain native characteristic" << charData.uuid
|
||||
qCDebug(QT_BT_WINDOWS) << "Could not obtain native characteristic" << charData.uuid
|
||||
<< "from service" << service->uuid;
|
||||
service->setError(QLowEnergyService::DescriptorWriteError);
|
||||
return;
|
||||
|
@ -1324,7 +1324,7 @@ void QLowEnergyControllerPrivateWinRT::writeDescriptor(
|
|||
|
||||
// Get native descriptor
|
||||
if (!charData.descriptorList.contains(descHandle))
|
||||
qCDebug(QT_BT_WINRT) << "Descriptor" << descHandle << "could not be found in Characteristic"
|
||||
qCDebug(QT_BT_WINDOWS) << "Descriptor" << descHandle << "could not be found in Characteristic"
|
||||
<< charHandle;
|
||||
|
||||
QLowEnergyServicePrivate::DescData descData = charData.descriptorList.value(descHandle);
|
||||
|
@ -1333,7 +1333,7 @@ void QLowEnergyControllerPrivateWinRT::writeDescriptor(
|
|||
quint16 intValue = qFromLittleEndian<quint16>(newValue);
|
||||
if (intValue & GattClientCharacteristicConfigurationDescriptorValue_Indicate
|
||||
&& intValue & GattClientCharacteristicConfigurationDescriptorValue_Notify) {
|
||||
qCWarning(QT_BT_WINRT) << "Setting both Indicate and Notify is not supported on WinRT";
|
||||
qCWarning(QT_BT_WINDOWS) << "Setting both Indicate and Notify is not supported on WinRT";
|
||||
value = GattClientCharacteristicConfigurationDescriptorValue(
|
||||
(GattClientCharacteristicConfigurationDescriptorValue_Indicate
|
||||
| GattClientCharacteristicConfigurationDescriptorValue_Notify));
|
||||
|
@ -1344,7 +1344,7 @@ void QLowEnergyControllerPrivateWinRT::writeDescriptor(
|
|||
} else if (intValue == 0) {
|
||||
value = GattClientCharacteristicConfigurationDescriptorValue_None;
|
||||
} else {
|
||||
qCDebug(QT_BT_WINRT) << "Descriptor" << descHandle
|
||||
qCDebug(QT_BT_WINDOWS) << "Descriptor" << descHandle
|
||||
<< "write operation failed: Invalid value";
|
||||
service->setError(QLowEnergyService::DescriptorWriteError);
|
||||
return;
|
||||
|
@ -1358,7 +1358,7 @@ void QLowEnergyControllerPrivateWinRT::writeDescriptor(
|
|||
(IAsyncOperation<GattCommunicationStatus> *op, AsyncStatus status)
|
||||
{
|
||||
if (status == AsyncStatus::Canceled || status == AsyncStatus::Error) {
|
||||
qCDebug(QT_BT_WINRT) << "Descriptor" << descHandle << "write operation failed";
|
||||
qCDebug(QT_BT_WINDOWS) << "Descriptor" << descHandle << "write operation failed";
|
||||
service->setError(QLowEnergyService::DescriptorWriteError);
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -1368,7 +1368,7 @@ void QLowEnergyControllerPrivateWinRT::writeDescriptor(
|
|||
CHECK_HR_AND_SET_SERVICE_ERROR(hr, "Could not obtain result for descriptor",
|
||||
service, QLowEnergyService::DescriptorWriteError, return S_OK)
|
||||
if (result != GattCommunicationStatus_Success) {
|
||||
qCWarning(QT_BT_WINRT) << "Descriptor" << descHandle << "write operation failed";
|
||||
qCWarning(QT_BT_WINDOWS) << "Descriptor" << descHandle << "write operation failed";
|
||||
service->setError(QLowEnergyService::DescriptorWriteError);
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -1400,7 +1400,7 @@ void QLowEnergyControllerPrivateWinRT::writeDescriptor(
|
|||
GattCommunicationStatus commStatus;
|
||||
hr = result->get_Status(&commStatus);
|
||||
if (FAILED(hr) || commStatus != GattCommunicationStatus_Success) {
|
||||
qCWarning(QT_BT_WINRT) << "Descriptor operation failed";
|
||||
qCWarning(QT_BT_WINDOWS) << "Descriptor operation failed";
|
||||
service->setError(QLowEnergyService::DescriptorWriteError);
|
||||
return;
|
||||
}
|
||||
|
@ -1413,10 +1413,10 @@ void QLowEnergyControllerPrivateWinRT::writeDescriptor(
|
|||
CHECK_HR_AND_SET_SERVICE_ERROR(hr, "Could not obtain list of descriptors' size",
|
||||
service, QLowEnergyService::DescriptorWriteError, return)
|
||||
if (size == 0) {
|
||||
qCWarning(QT_BT_WINRT) << "No descriptor with uuid" << descData.uuid << "was found.";
|
||||
qCWarning(QT_BT_WINDOWS) << "No descriptor with uuid" << descData.uuid << "was found.";
|
||||
return;
|
||||
} else if (size > 1) {
|
||||
qCWarning(QT_BT_WINRT) << "There is more than 1 descriptor with uuid" << descData.uuid;
|
||||
qCWarning(QT_BT_WINDOWS) << "There is more than 1 descriptor with uuid" << descData.uuid;
|
||||
}
|
||||
ComPtr<IGattDescriptor> descriptor;
|
||||
hr = descriptors->GetAt(0, &descriptor);
|
||||
|
@ -1454,7 +1454,7 @@ void QLowEnergyControllerPrivateWinRT::writeDescriptor(
|
|||
(IAsyncOperation<GattCommunicationStatus> *op, AsyncStatus status)
|
||||
{
|
||||
if (status == AsyncStatus::Canceled || status == AsyncStatus::Error) {
|
||||
qCDebug(QT_BT_WINRT) << "Descriptor" << descHandle << "write operation failed";
|
||||
qCDebug(QT_BT_WINDOWS) << "Descriptor" << descHandle << "write operation failed";
|
||||
service->setError(QLowEnergyService::DescriptorWriteError);
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -1464,7 +1464,7 @@ void QLowEnergyControllerPrivateWinRT::writeDescriptor(
|
|||
CHECK_HR_AND_SET_SERVICE_ERROR(hr, "Could not obtain result for descriptor",
|
||||
service, QLowEnergyService::DescriptorWriteError, return S_OK)
|
||||
if (result != GattCommunicationStatus_Success) {
|
||||
qCDebug(QT_BT_WINRT) << "Descriptor" << descHandle << "write operation failed";
|
||||
qCDebug(QT_BT_WINDOWS) << "Descriptor" << descHandle << "write operation failed";
|
||||
service->setError(QLowEnergyService::DescriptorWriteError);
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -1490,20 +1490,20 @@ void QLowEnergyControllerPrivateWinRT::addToGenericAttributeList(const QLowEnerg
|
|||
void QLowEnergyControllerPrivateWinRT::handleCharacteristicChanged(
|
||||
quint16 charHandle, const QByteArray &data)
|
||||
{
|
||||
qCDebug(QT_BT_WINRT) << __FUNCTION__ << charHandle << data;
|
||||
qCDebug(QT_BT_WINRT_SERVICE_THREAD) << __FUNCTION__ << "Changing service pointer from thread"
|
||||
qCDebug(QT_BT_WINDOWS) << __FUNCTION__ << charHandle << data;
|
||||
qCDebug(QT_BT_WINDOWS_SERVICE_THREAD) << __FUNCTION__ << "Changing service pointer from thread"
|
||||
<< QThread::currentThread();
|
||||
QSharedPointer<QLowEnergyServicePrivate> service =
|
||||
serviceForHandle(charHandle);
|
||||
if (service.isNull())
|
||||
return;
|
||||
|
||||
qCDebug(QT_BT_WINRT) << "Characteristic change notification" << service->uuid
|
||||
qCDebug(QT_BT_WINDOWS) << "Characteristic change notification" << service->uuid
|
||||
<< charHandle << data.toHex();
|
||||
|
||||
QLowEnergyCharacteristic characteristic = characteristicForHandle(charHandle);
|
||||
if (!characteristic.isValid()) {
|
||||
qCWarning(QT_BT_WINRT) << "characteristicChanged: Cannot find characteristic";
|
||||
qCWarning(QT_BT_WINDOWS) << "characteristicChanged: Cannot find characteristic";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1520,7 +1520,7 @@ void QLowEnergyControllerPrivateWinRT::handleServiceHandlerError(const QString &
|
|||
if (state != QLowEnergyController::DiscoveringState)
|
||||
return;
|
||||
|
||||
qCWarning(QT_BT_WINRT) << "Error while discovering services:" << error;
|
||||
qCWarning(QT_BT_WINDOWS) << "Error while discovering services:" << error;
|
||||
setState(QLowEnergyController::UnconnectedState);
|
||||
setError(QLowEnergyController::ConnectionError);
|
||||
}
|
||||
|
@ -1543,7 +1543,7 @@ void QLowEnergyControllerPrivateWinRT::connectToPairedDevice()
|
|||
GattCommunicationStatus commStatus;
|
||||
hr = deviceServicesResult->get_Status(&commStatus);
|
||||
if (FAILED(hr) || commStatus != GattCommunicationStatus_Success) {
|
||||
qCWarning(QT_BT_WINRT()) << "Service operation failed";
|
||||
qCWarning(QT_BT_WINDOWS()) << "Service operation failed";
|
||||
setError(QLowEnergyController::ConnectionError);
|
||||
setState(QLowEnergyController::UnconnectedState);
|
||||
unregisterFromStatusChanges();
|
||||
|
@ -1558,7 +1558,7 @@ void QLowEnergyControllerPrivateWinRT::connectToPairedDevice()
|
|||
CHECK_FOR_DEVICE_CONNECTION_ERROR(hr, "Could not obtain service count", return)
|
||||
|
||||
if (serviceCount == 0) {
|
||||
qCWarning(QT_BT_WINRT()) << "Found devices without services";
|
||||
qCWarning(QT_BT_WINDOWS()) << "Found devices without services";
|
||||
setError(QLowEnergyController::ConnectionError);
|
||||
setState(QLowEnergyController::UnconnectedState);
|
||||
unregisterFromStatusChanges();
|
||||
|
@ -1584,7 +1584,7 @@ void QLowEnergyControllerPrivateWinRT::connectToPairedDevice()
|
|||
GattCommunicationStatus commStatus;
|
||||
hr = characteristicsResult->get_Status(&commStatus);
|
||||
if (FAILED(hr) || commStatus != GattCommunicationStatus_Success) {
|
||||
qCWarning(QT_BT_WINRT) << "Characteristic operation failed";
|
||||
qCWarning(QT_BT_WINDOWS) << "Characteristic operation failed";
|
||||
break;
|
||||
}
|
||||
ComPtr<IVectorView<GattCharacteristic *>> characteristics;
|
||||
|
@ -1592,7 +1592,7 @@ void QLowEnergyControllerPrivateWinRT::connectToPairedDevice()
|
|||
if (hr == E_ACCESSDENIED) {
|
||||
// Everything will work as expected up until this point if the manifest capabilties
|
||||
// for bluetooth LE are not set.
|
||||
qCWarning(QT_BT_WINRT) << "Could not obtain characteristic list. Please check your "
|
||||
qCWarning(QT_BT_WINDOWS) << "Could not obtain characteristic list. Please check your "
|
||||
"manifest capabilities";
|
||||
setState(QLowEnergyController::UnconnectedState);
|
||||
setError(QLowEnergyController::ConnectionError);
|
||||
|
@ -1626,7 +1626,7 @@ void QLowEnergyControllerPrivateWinRT::connectToPairedDevice()
|
|||
hr = result->get_Value(&buffer);
|
||||
CHECK_FOR_DEVICE_CONNECTION_ERROR(hr, "Could not obtain characteristic value", return);
|
||||
if (!buffer) {
|
||||
qCDebug(QT_BT_WINRT) << "Problem reading value";
|
||||
qCDebug(QT_BT_WINDOWS) << "Problem reading value";
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1668,7 +1668,7 @@ void QLowEnergyControllerPrivateWinRT::connectToUnpairedDevice()
|
|||
continue;
|
||||
|
||||
if (FAILED(hr) || commStatus != GattCommunicationStatus_Success) {
|
||||
qCWarning(QT_BT_WINRT()) << "Service operation failed";
|
||||
qCWarning(QT_BT_WINDOWS()) << "Service operation failed";
|
||||
setError(QLowEnergyController::ConnectionError);
|
||||
setState(QLowEnergyController::UnconnectedState);
|
||||
unregisterFromStatusChanges();
|
||||
|
|
Loading…
Reference in New Issue