diff options
author | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2019-09-25 11:37:30 +0200 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2019-09-26 14:38:42 +0200 |
commit | 2be747ece1872d9d4652f82734d782320cf833ac (patch) | |
tree | b2ebcd8ee9ad2879dccd8306f16af0c153db6fcb | |
parent | a843b2c536ecc15f80e8654a2c3f2a5b335b8ad5 (diff) |
Rename the Darwin-specific logging category
QT_BT_OSX -> QT_BT_DARWIN. Merge two previous definitions
into one, no need to differentiate between tvOS/watchOS/iOS/macOS
- they are all Darwin-based.
Change-Id: I024d36c798292ffa14f8a9f3def242a5ae7b1e56
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
20 files changed, 261 insertions, 274 deletions
diff --git a/src/bluetooth/osx/osxbtcentralmanager.mm b/src/bluetooth/osx/osxbtcentralmanager.mm index 13437961..d6a7cf70 100644 --- a/src/bluetooth/osx/osxbtcentralmanager.mm +++ b/src/bluetooth/osx/osxbtcentralmanager.mm @@ -287,31 +287,31 @@ QT_USE_NAMESPACE const ObjCStrongReference<NSError> nsError(qt_timeoutNSError(type)); switch (type) { case OperationTimeout::serviceDiscovery: - qCWarning(QT_BT_OSX, "Timeout in services discovery"); + qCWarning(QT_BT_DARWIN, "Timeout in services discovery"); [self peripheral:peripheral didDiscoverServices:nsError]; break; case OperationTimeout::includedServicesDiscovery: - qCWarning(QT_BT_OSX, "Timeout in included services discovery"); + qCWarning(QT_BT_DARWIN, "Timeout in included services discovery"); [self peripheral:peripheral didDiscoverIncludedServicesForService:cbObject error:nsError]; break; case OperationTimeout::characteristicsDiscovery: - qCWarning(QT_BT_OSX, "Timeout in characteristics discovery"); + qCWarning(QT_BT_DARWIN, "Timeout in characteristics discovery"); [self peripheral:peripheral didDiscoverCharacteristicsForService:cbObject error:nsError]; break; case OperationTimeout::characteristicRead: - qCWarning(QT_BT_OSX, "Timeout while reading a characteristic"); + qCWarning(QT_BT_DARWIN, "Timeout while reading a characteristic"); [self peripheral:peripheral didUpdateValueForCharacteristic:cbObject error:nsError]; break; case OperationTimeout::descriptorsDiscovery: - qCWarning(QT_BT_OSX, "Timeout in descriptors discovery"); + qCWarning(QT_BT_DARWIN, "Timeout in descriptors discovery"); [self peripheral:peripheral didDiscoverDescriptorsForCharacteristic:cbObject error:nsError]; break; case OperationTimeout::descriptorRead: - qCWarning(QT_BT_OSX, "Timeout while reading a descriptor"); + qCWarning(QT_BT_DARWIN, "Timeout while reading a descriptor"); [self peripheral:peripheral didUpdateValueForDescriptor:cbObject error:nsError]; break; case OperationTimeout::characteristicWrite: - qCWarning(QT_BT_OSX, "Timeout while writing a characteristic with response"); + qCWarning(QT_BT_DARWIN, "Timeout while writing a characteristic with response"); [self peripheral:peripheral didWriteValueForCharacteristic:cbObject error:nsError]; default:; } @@ -332,7 +332,7 @@ QT_USE_NAMESPACE if (!manager) { managerState = DarwinBluetooth::CentralManagerIdle; - qCWarning(QT_BT_OSX) << "failed to allocate a central manager"; + qCWarning(QT_BT_DARWIN) << "failed to allocate a central manager"; if (notifier) emit notifier->CBManagerError(QLowEnergyController::ConnectionError); } @@ -348,7 +348,7 @@ QT_USE_NAMESPACE Q_FUNC_INFO, "invalid state"); if ([self isConnected]) { - qCDebug(QT_BT_OSX) << "already connected"; + qCDebug(QT_BT_DARWIN) << "already connected"; if (notifier) emit notifier->connected(); return; @@ -364,7 +364,7 @@ QT_USE_NAMESPACE // Retrieve a peripheral first ... ObjCScopedPointer<NSMutableArray> uuids([[NSMutableArray alloc] init]); if (!uuids) { - qCWarning(QT_BT_OSX) << "failed to allocate identifiers"; + qCWarning(QT_BT_DARWIN) << "failed to allocate identifiers"; if (notifier) emit notifier->CBManagerError(QLowEnergyController::ConnectionError); return; @@ -376,7 +376,7 @@ QT_USE_NAMESPACE std::copy(qtUuidData.data, qtUuidData.data + 16, uuidData); const ObjCScopedPointer<NSUUID> nsUuid([[NSUUID alloc] initWithUUIDBytes:uuidData]); if (!nsUuid) { - qCWarning(QT_BT_OSX) << "failed to allocate NSUUID identifier"; + qCWarning(QT_BT_DARWIN) << "failed to allocate NSUUID identifier"; if (notifier) emit notifier->CBManagerError(QLowEnergyController::ConnectionError); return; @@ -387,7 +387,7 @@ QT_USE_NAMESPACE QT_BT_MAC_AUTORELEASEPOOL; NSArray *const peripherals = [manager retrievePeripheralsWithIdentifiers:uuids]; if (!peripherals || peripherals.count != 1) { - qCWarning(QT_BT_OSX) << "failed to retrive a peripheral"; + qCWarning(QT_BT_DARWIN) << "failed to retrive a peripheral"; if (notifier) emit notifier->CBManagerError(QLowEnergyController::UnknownRemoteDeviceError); return; @@ -407,11 +407,11 @@ QT_USE_NAMESPACE // The state is still the same - connecting. if ([self isConnected]) { - qCDebug(QT_BT_OSX) << "already connected"; + qCDebug(QT_BT_DARWIN) << "already connected"; if (notifier) emit notifier->connected(); } else { - qCDebug(QT_BT_OSX) << "trying to connect"; + qCDebug(QT_BT_DARWIN) << "trying to connect"; managerState = CentralManagerConnecting; [manager connectPeripheral:peripheral options:nil]; } @@ -518,8 +518,8 @@ QT_USE_NAMESPACE Q_ASSERT_X(peripheral, Q_FUNC_INFO, "invalid peripheral (nil)"); if (servicesToDiscoverDetails.contains(serviceUuid)) { - qCWarning(QT_BT_OSX) << "already discovering for" - << serviceUuid; + qCWarning(QT_BT_DARWIN) << "already discovering for" + << serviceUuid; return; } @@ -532,8 +532,8 @@ QT_USE_NAMESPACE return; } - qCWarning(QT_BT_OSX) << "unknown service uuid" - << serviceUuid; + qCWarning(QT_BT_DARWIN) << "unknown service uuid" + << serviceUuid; if (notifier) emit notifier->CBManagerError(serviceUuid, QLowEnergyService::UnknownError); @@ -635,7 +635,7 @@ QT_USE_NAMESPACE const QLowEnergyHandle maxHandle = std::numeric_limits<QLowEnergyHandle>::max(); if (nHandles >= maxHandle || lastValidHandle > maxHandle - nHandles) { // Well, that's unlikely :) But we must be sure. - qCWarning(QT_BT_OSX) << "can not allocate more handles"; + qCWarning(QT_BT_DARWIN) << "can not allocate more handles"; if (notifier) notifier->CBManagerError(serviceUuid, QLowEnergyService::OperationError); return; @@ -739,8 +739,8 @@ QT_USE_NAMESPACE const LERequest request(requests.dequeue()); if (request.type == LERequest::CharRead) { if (!charMap.contains(request.handle)) { - qCWarning(QT_BT_OSX) << "characteristic with handle" - << request.handle << "not found"; + qCWarning(QT_BT_DARWIN) << "characteristic with handle" + << request.handle << "not found"; return [self performNextRequest]; } @@ -751,8 +751,8 @@ QT_USE_NAMESPACE [peripheral readValueForCharacteristic:charMap[request.handle]]; } else { if (!descMap.contains(request.handle)) { - qCWarning(QT_BT_OSX) << "descriptor with handle" - << request.handle << "not found"; + qCWarning(QT_BT_DARWIN) << "descriptor with handle" + << request.handle << "not found"; return [self performNextRequest]; } @@ -779,8 +779,8 @@ QT_USE_NAMESPACE if (request.type == LERequest::DescWrite) { if (!descMap.contains(request.handle)) { - qCWarning(QT_BT_OSX) << "handle:" << request.handle - << "not found"; + qCWarning(QT_BT_DARWIN) << "handle:" << request.handle + << "not found"; return [self performNextRequest]; } @@ -788,7 +788,7 @@ QT_USE_NAMESPACE ObjCStrongReference<NSData> data(data_from_bytearray(request.value)); if (!data) { // Even if qtData.size() == 0, we still need NSData object. - qCWarning(QT_BT_OSX) << "failed to allocate an NSData object"; + qCWarning(QT_BT_DARWIN) << "failed to allocate an NSData object"; return [self performNextRequest]; } @@ -799,8 +799,8 @@ QT_USE_NAMESPACE return [peripheral writeValue:data.data() forDescriptor:descriptor]; } else { if (!charMap.contains(request.handle)) { - qCWarning(QT_BT_OSX) << "characteristic with handle:" - << request.handle << "not found"; + qCWarning(QT_BT_DARWIN) << "characteristic with handle:" + << request.handle << "not found"; return [self performNextRequest]; } @@ -825,7 +825,7 @@ QT_USE_NAMESPACE ObjCStrongReference<NSData> data(data_from_bytearray(request.value)); if (!data) { // Even if qtData.size() == 0, we still need NSData object. - qCWarning(QT_BT_OSX) << "failed to allocate NSData object"; + qCWarning(QT_BT_DARWIN) << "failed to allocate NSData object"; return [self performNextRequest]; } @@ -856,8 +856,8 @@ QT_USE_NAMESPACE Q_ASSERT_X(charHandle, Q_FUNC_INFO, "invalid characteristic handle (0)"); if (!charMap.contains(charHandle)) { - qCWarning(QT_BT_OSX) << "unknown characteristic handle" - << charHandle; + qCWarning(QT_BT_DARWIN) << "unknown characteristic handle" + << charHandle; if (notifier) { emit notifier->CBManagerError(serviceUuid, QLowEnergyService::DescriptorWriteError); @@ -870,7 +870,7 @@ QT_USE_NAMESPACE // it back, so check _now_ that we really have this descriptor. const QBluetoothUuid qtUuid(QBluetoothUuid::ClientCharacteristicConfiguration); if (![self descriptor:qtUuid forCharacteristic:charMap[charHandle]]) { - qCWarning(QT_BT_OSX) << "no client characteristic configuration found"; + qCWarning(QT_BT_DARWIN) << "no client characteristic configuration found"; if (notifier) { emit notifier->CBManagerError(serviceUuid, QLowEnergyService::DescriptorWriteError); @@ -897,7 +897,7 @@ QT_USE_NAMESPACE QT_BT_MAC_AUTORELEASEPOOL; if (!charMap.contains(charHandle)) { - qCWarning(QT_BT_OSX) << "characteristic:" << charHandle << "not found"; + qCWarning(QT_BT_DARWIN) << "characteristic:" << charHandle << "not found"; if (notifier) { emit notifier->CBManagerError(serviceUuid, QLowEnergyService::CharacteristicReadError); @@ -926,7 +926,7 @@ QT_USE_NAMESPACE QT_BT_MAC_AUTORELEASEPOOL; if (!charMap.contains(charHandle)) { - qCWarning(QT_BT_OSX) << "characteristic:" << charHandle << "not found"; + qCWarning(QT_BT_DARWIN) << "characteristic:" << charHandle << "not found"; if (notifier) { emit notifier->CBManagerError(serviceUuid, QLowEnergyService::CharacteristicWriteError); @@ -952,7 +952,7 @@ QT_USE_NAMESPACE Q_ASSERT_X(descHandle, Q_FUNC_INFO, "invalid descriptor handle (0)"); if (!descMap.contains(descHandle)) { - qCWarning(QT_BT_OSX) << "handle:" << descHandle << "not found"; + qCWarning(QT_BT_DARWIN) << "handle:" << descHandle << "not found"; if (notifier) { emit notifier->CBManagerError(serviceUuid, QLowEnergyService::DescriptorReadError); @@ -977,7 +977,7 @@ QT_USE_NAMESPACE Q_ASSERT_X(descHandle, Q_FUNC_INFO, "invalid descriptor handle (0)"); if (!descMap.contains(descHandle)) { - qCWarning(QT_BT_OSX) << "handle:" << descHandle << "not found"; + qCWarning(QT_BT_DARWIN) << "handle:" << descHandle << "not found"; if (notifier) { emit notifier->CBManagerError(serviceUuid, QLowEnergyService::DescriptorWriteError); @@ -1163,26 +1163,26 @@ QT_USE_NAMESPACE if ([obj isKindOfClass:[CBCharacteristic class]]) { CBCharacteristic *const ch = static_cast<CBCharacteristic *>(obj); if (!charMap.key(ch)) { - qCWarning(QT_BT_OSX) << "unexpected characteristic, no handle found"; + qCWarning(QT_BT_DARWIN) << "unexpected characteristic, no handle found"; return false; } } else if ([obj isKindOfClass:[CBDescriptor class]]) { CBDescriptor *const d = static_cast<CBDescriptor *>(obj); if (!descMap.key(d)) { - qCWarning(QT_BT_OSX) << "unexpected descriptor, no handle found"; + qCWarning(QT_BT_DARWIN) << "unexpected descriptor, no handle found"; return false; } } else { - qCWarning(QT_BT_OSX) << "invalid object, characteristic " - "or descriptor required"; + qCWarning(QT_BT_DARWIN) << "invalid object, characteristic " + "or descriptor required"; return false; } if (valuesToWrite.contains(obj)) { // It can be a result of some previous errors - for example, // we never got a callback from a previous write. - qCWarning(QT_BT_OSX) << "already has a cached value for this " - "object, the value will be replaced"; + qCWarning(QT_BT_DARWIN) << "already has a cached value for this " + "object, the value will be replaced"; } valuesToWrite[obj] = value; @@ -1349,7 +1349,7 @@ QT_USE_NAMESPACE if (error && managerState == DarwinBluetooth::CentralManagerDisconnecting) { managerState = DarwinBluetooth::CentralManagerIdle; - qCWarning(QT_BT_OSX) << "failed to disconnect"; + qCWarning(QT_BT_DARWIN) << "failed to disconnect"; if (notifier) emit notifier->CBManagerError(QLowEnergyController::UnknownRemoteDeviceError); } else { @@ -1397,7 +1397,7 @@ QT_USE_NAMESPACE Q_UNUSED(aPeripheral) Q_UNUSED(invalidatedServices) - qCWarning(QT_BT_OSX) << "The peripheral has modified its services."; + qCWarning(QT_BT_DARWIN) << "The peripheral has modified its services."; // "This method is invoked whenever one or more services of a peripheral have changed. // A peripheral’s services have changed if: // * A service is removed from the peripheral’s database @@ -1585,8 +1585,8 @@ QT_USE_NAMESPACE // updated values ... // TODO: this must be properly tested. if (!chHandle) { - qCCritical(QT_BT_OSX) << "unexpected update notification, " - "no characteristic handle found"; + qCCritical(QT_BT_DARWIN) << "unexpected update notification, " + "no characteristic handle found"; return; } @@ -1713,8 +1713,8 @@ QT_USE_NAMESPACE } } else { if (!dHandle) { - qCCritical(QT_BT_OSX) << "unexpected value update notification, " - "no descriptor handle found"; + qCCritical(QT_BT_DARWIN) << "unexpected value update notification, " + "no descriptor handle found"; return; } @@ -1759,8 +1759,8 @@ QT_USE_NAMESPACE // Error or not, but the cached value has to be deleted ... const QByteArray valueToReport(valuesToWrite.value(characteristic, QByteArray())); if (!valuesToWrite.remove(characteristic)) { - qCWarning(QT_BT_OSX) << "no updated value found " - "for characteristic"; + qCWarning(QT_BT_DARWIN) << "no updated value found " + "for characteristic"; } if (error) { @@ -1796,7 +1796,7 @@ QT_USE_NAMESPACE // Error or not, a value (if any) must be removed. const QByteArray valueToReport(valuesToWrite.value(descriptor, QByteArray())); if (!valuesToWrite.remove(descriptor)) - qCWarning(QT_BT_OSX) << "no updated value found"; + qCWarning(QT_BT_DARWIN) << "no updated value found"; if (error) { NSLog(@"%s failed with error %@", Q_FUNC_INFO, error); @@ -1836,7 +1836,7 @@ QT_USE_NAMESPACE NSLog(@"%s failed with error %@", Q_FUNC_INFO, error); // In Qt's API it's a descriptor write actually. emit notifier->CBManagerError(qt_uuid(characteristic.service.UUID), - QLowEnergyService::DescriptorWriteError); + QLowEnergyService::DescriptorWriteError); } else if (nRemoved) { const QLowEnergyHandle dHandle = descMap.key(descriptor); emit notifier->descriptorWritten(dHandle, valueToReport); diff --git a/src/bluetooth/osx/osxbtdeviceinquiry.mm b/src/bluetooth/osx/osxbtdeviceinquiry.mm index 3a77c1f7..146e8481 100644 --- a/src/bluetooth/osx/osxbtdeviceinquiry.mm +++ b/src/bluetooth/osx/osxbtdeviceinquiry.mm @@ -64,7 +64,7 @@ QT_USE_NAMESPACE [m_inquiry setUpdateNewDeviceNames:NO];//Useless, disable! m_delegate = delegate; } else { - qCCritical(QT_BT_OSX) << "failed to create a device inquiry"; + qCCritical(QT_BT_DARWIN) << "failed to create a device inquiry"; } m_active = false; @@ -103,7 +103,7 @@ QT_USE_NAMESPACE if (result != kIOReturnSuccess) { // QtBluetooth will probably convert an error into UnknownError, // loosing the actual information. - qCWarning(QT_BT_OSX) << "failed with IOKit error code:" << result; + qCWarning(QT_BT_DARWIN) << "failed with IOKit error code:" << result; m_active = false; } @@ -120,7 +120,7 @@ QT_USE_NAMESPACE if (res != kIOReturnSuccess) m_active = true; else - qCDebug(QT_BT_OSX) << "-stop, success (waiting for 'inquiryComplete')"; + qCDebug(QT_BT_DARWIN) << "-stop, success (waiting for 'inquiryComplete')"; return res; } @@ -143,7 +143,7 @@ QT_USE_NAMESPACE if (error != kIOReturnSuccess) { // QtBluetooth has not too many error codes, 'UnknownError' is not really // useful, report the actual error code here: - qCWarning(QT_BT_OSX) << "IOKit error code: " << error; + qCWarning(QT_BT_DARWIN) << "IOKit error code: " << error; m_delegate->error(error); } else { m_delegate->inquiryFinished(); diff --git a/src/bluetooth/osx/osxbtdevicepair.mm b/src/bluetooth/osx/osxbtdevicepair.mm index dc36cac5..00b95dee 100644 --- a/src/bluetooth/osx/osxbtdevicepair.mm +++ b/src/bluetooth/osx/osxbtdevicepair.mm @@ -107,13 +107,13 @@ QT_USE_NAMESPACE // Device is autoreleased. IOBluetoothDevice *const device = [IOBluetoothDevice deviceWithAddress:&iobtAddress]; if (!device) { - qCCritical(QT_BT_OSX) << "failed to create a device to pair with"; + qCCritical(QT_BT_DARWIN) << "failed to create a device to pair with"; return kIOReturnError; } m_pairing = [[IOBluetoothDevicePair pairWithDevice:device] retain]; if (!m_pairing) { - qCCritical(QT_BT_OSX) << "failed to create pair"; + qCCritical(QT_BT_DARWIN) << "failed to create a device pair"; return kIOReturnError; } diff --git a/src/bluetooth/osx/osxbtgcdtimer.mm b/src/bluetooth/osx/osxbtgcdtimer.mm index a3e154f2..b849c9cc 100644 --- a/src/bluetooth/osx/osxbtgcdtimer.mm +++ b/src/bluetooth/osx/osxbtgcdtimer.mm @@ -92,7 +92,7 @@ using namespace DarwinBluetooth; } if (ms <= 0 || stepMS <= 0) { - qCWarning(QT_BT_OSX, "Invalid timeout/step parameters"); + qCWarning(QT_BT_DARWIN, "Invalid timeout/step parameters"); return; } diff --git a/src/bluetooth/osx/osxbtl2capchannel.mm b/src/bluetooth/osx/osxbtl2capchannel.mm index 73364b71..31392c07 100644 --- a/src/bluetooth/osx/osxbtl2capchannel.mm +++ b/src/bluetooth/osx/osxbtl2capchannel.mm @@ -110,13 +110,13 @@ QT_USE_NAMESPACE withPSM:(BluetoothL2CAPChannelID)psm { if (address.isNull()) { - qCCritical(QT_BT_OSX) << "invalid peer address"; + qCCritical(QT_BT_DARWIN) << "invalid peer address"; return kIOReturnNoDevice; } // Can never be called twice. if (connected || device || channel) { - qCCritical(QT_BT_OSX) << "connection is already active"; + qCCritical(QT_BT_DARWIN) << "connection is already active"; return kIOReturnStillOpen; } @@ -125,13 +125,13 @@ QT_USE_NAMESPACE const BluetoothDeviceAddress iobtAddress = DarwinBluetooth::iobluetooth_address(address); device = [IOBluetoothDevice deviceWithAddress:&iobtAddress]; if (!device) { - qCCritical(QT_BT_OSX) << "failed to create a device"; + qCCritical(QT_BT_DARWIN) << "failed to create a device"; return kIOReturnNoDevice; } const IOReturn status = [device openL2CAPChannelAsync:&channel withPSM:psm delegate:self]; if (status != kIOReturnSuccess) { - qCCritical(QT_BT_OSX) << "failed to open L2CAP channel"; + qCCritical(QT_BT_DARWIN) << "failed to open L2CAP channel"; // device is still autoreleased. device = nil; return status; diff --git a/src/bluetooth/osx/osxbtledeviceinquiry.mm b/src/bluetooth/osx/osxbtledeviceinquiry.mm index ba288ae5..e4ec61ce 100644 --- a/src/bluetooth/osx/osxbtledeviceinquiry.mm +++ b/src/bluetooth/osx/osxbtledeviceinquiry.mm @@ -342,14 +342,14 @@ QT_USE_NAMESPACE QBluetoothUuid deviceUuid; if (!peripheral.identifier) { - qCWarning(QT_BT_OSX) << "peripheral without NSUUID"; + qCWarning(QT_BT_DARWIN) << "peripheral without NSUUID"; return; } deviceUuid = DarwinBluetooth::qt_uuid(peripheral.identifier); if (deviceUuid.isNull()) { - qCWarning(QT_BT_OSX) << "no way to address peripheral, QBluetoothUuid is null"; + qCWarning(QT_BT_DARWIN) << "no way to address peripheral, QBluetoothUuid is null"; return; } diff --git a/src/bluetooth/osx/osxbtobexsession.mm b/src/bluetooth/osx/osxbtobexsession.mm index 38c7a477..95c87d11 100644 --- a/src/bluetooth/osx/osxbtobexsession.mm +++ b/src/bluetooth/osx/osxbtobexsession.mm @@ -203,7 +203,7 @@ QList<OBEXHeader> qt_bluetooth_headers(const uint8_t *data, std::size_t length) break; } default: - qCWarning(QT_BT_OSX) << "invalid header format"; + qCWarning(QT_BT_DARWIN) << "invalid header format"; return empty; } @@ -358,7 +358,7 @@ bool check_connect_event(const OBEXSessionEvent *e, OBEXError &error, OBEXOpCode response = e->u.connectCommandResponseData.serverResponseOpCode; return response == kOBEXResponseCodeSuccessWithFinalBit; } else { - qCWarning(QT_BT_OSX) << "unexpected event type"; + qCWarning(QT_BT_DARWIN) << "unexpected event type"; error = kOBEXGeneralError; return false; } @@ -378,7 +378,7 @@ bool check_put_event(const OBEXSessionEvent *e, OBEXError &error, OBEXOpCode &re return response == kOBEXResponseCodeContinueWithFinalBit || response == kOBEXResponseCodeSuccessWithFinalBit; } else { - qCWarning(QT_BT_OSX) << "unexpected event type"; + qCWarning(QT_BT_DARWIN) << "unexpected event type"; error = kOBEXGeneralError; return false; } @@ -395,7 +395,7 @@ bool check_abort_event(const OBEXSessionEvent *e, OBEXError &error, OBEXOpCode & response = e->u.abortCommandResponseData.serverResponseOpCode; return response == kOBEXResponseCodeSuccessWithFinalBit; } else { - qCWarning(QT_BT_OSX) << "unexpected event type"; + qCWarning(QT_BT_DARWIN) << "unexpected event type"; return false; } } @@ -464,13 +464,13 @@ QT_USE_NAMESPACE const BluetoothDeviceAddress addr(DarwinBluetooth::iobluetooth_address(deviceAddress)); device = [[IOBluetoothDevice deviceWithAddress:&addr] retain]; if (!device) { - qCWarning(QT_BT_OSX) << "failed to create an IOBluetoothDevice"; + qCWarning(QT_BT_DARWIN) << "failed to create an IOBluetoothDevice"; return self; } session = [[IOBluetoothOBEXSession alloc] initWithDevice:device channelID:port]; if (!session) { - qCWarning(QT_BT_OSX) << "failed to create an OBEX session"; + qCWarning(QT_BT_DARWIN) << "failed to create an OBEX session"; return self; } @@ -495,7 +495,7 @@ QT_USE_NAMESPACE - (OBEXError)OBEXConnect { if (!session) { - qCWarning(QT_BT_OSX) << "invalid session (nil)"; + qCWarning(QT_BT_DARWIN) << "invalid session (nil)"; return kOBEXGeneralError; } @@ -538,8 +538,8 @@ QT_USE_NAMESPACE } if (currentRequest != OBEXConnect) { - qCWarning(QT_BT_OSX) << "called while there is no " - "active connect request"; + qCWarning(QT_BT_DARWIN) << "called while there is no " + "active connect request"; return; } @@ -617,8 +617,8 @@ QT_USE_NAMESPACE Q_ASSERT_X(session, Q_FUNC_INFO, "invalid OBEX session (nil)"); if (currentRequest != OBEXAbort) { - qCWarning(QT_BT_OSX) << "called while there " - "is no ABORT request"; + qCWarning(QT_BT_DARWIN) << "called while there " + "is no ABORT request"; return; } @@ -649,13 +649,13 @@ QT_USE_NAMESPACE // a payload. const qint64 fileSize = input->size(); if (fileSize <= 0 || fileSize >= std::numeric_limits<uint32_t>::max()) { - qCWarning(QT_BT_OSX) << "invalid input file size"; + qCWarning(QT_BT_DARWIN) << "invalid input file size"; return kOBEXBadArgumentError; } ObjCStrongReference<NSMutableData> headers([[NSMutableData alloc] init], false); if (!headers) { - qCWarning(QT_BT_OSX) << "failed to allocate headers"; + qCWarning(QT_BT_DARWIN) << "failed to allocate headers"; return kOBEXNoResourcesError; } @@ -665,14 +665,14 @@ QT_USE_NAMESPACE if (connectionIDFound) { if (!append_four_byte_header(headers, kOBEXHeaderIDConnectionID, connectionID)) { - qCWarning(QT_BT_OSX) << "failed to append connection ID header"; + qCWarning(QT_BT_DARWIN) << "failed to append connection ID header"; return kOBEXNoResourcesError; } } if (name.length()) { if (!append_unicode_header(headers, kOBEXHeaderIDName, name)) { - qCWarning(QT_BT_OSX) << "failed to append a unicode string"; + qCWarning(QT_BT_DARWIN) << "failed to append a unicode string"; return kOBEXNoResourcesError; } } @@ -685,7 +685,7 @@ QT_USE_NAMESPACE if (!chunk || ![chunk length]) { // We do not support PUT-DELETE (?) // At least the first chunk is expected to be non-empty. - qCWarning(QT_BT_OSX) << "invalid input stream"; + qCWarning(QT_BT_DARWIN) << "invalid input stream"; return kOBEXBadArgumentError; } @@ -732,8 +732,8 @@ QT_USE_NAMESPACE } if (currentRequest != OBEXPut) { - qCWarning(QT_BT_OSX) << "called while the current " - "request is not a put request"; + qCWarning(QT_BT_DARWIN) << "called while the current " + "request is not a put request"; return; } @@ -754,7 +754,7 @@ QT_USE_NAMESPACE // 0 for the headers length, no more headers. ObjCStrongReference<NSMutableData> chunk(next_data_chunk(*inputStream, session, 0, lastChunk)); if (!chunk && !lastChunk) { - qCWarning(QT_BT_OSX) << "failed to allocate the next memory chunk"; + qCWarning(QT_BT_DARWIN) << "failed to allocate the next memory chunk"; return; } @@ -770,7 +770,7 @@ QT_USE_NAMESPACE refCon:nullptr]; if (status != kOBEXSuccess) { - qCWarning(QT_BT_OSX) << "failed to send the next memory chunk"; + qCWarning(QT_BT_DARWIN) << "failed to send the next memory chunk"; currentRequest = OBEXNoop; if (delegate) // Response code is not important here. delegate->OBEXPutError(kOBEXNoResourcesError, 0); diff --git a/src/bluetooth/osx/osxbtperipheralmanager.mm b/src/bluetooth/osx/osxbtperipheralmanager.mm index 204ecb20..515f41fc 100644 --- a/src/bluetooth/osx/osxbtperipheralmanager.mm +++ b/src/bluetooth/osx/osxbtperipheralmanager.mm @@ -107,7 +107,7 @@ ObjCStrongReference<CBMutableDescriptor> create_descriptor(const QLowEnergyDescr if (data.uuid() != QBluetoothUuid::CharacteristicUserDescription && data.uuid() != QBluetoothUuid::CharacteristicPresentationFormat) { - qCWarning(QT_BT_OSX) << "unsupported descriptor" << data.uuid(); + qCWarning(QT_BT_DARWIN) << "unsupported descriptor" << data.uuid(); return {}; } @@ -232,7 +232,7 @@ bool qt_validate_value_range(const QLowEnergyCharacteristicData &data) const auto nEntries = qt_countGATTEntries(data); if (!nEntries || nEntries > std::numeric_limits<QLowEnergyHandle>::max() - lastHandle) { - qCCritical(QT_BT_OSX) << "addService: not enough handles"; + qCCritical(QT_BT_DARWIN) << "addService: not enough handles"; return {}; } @@ -246,7 +246,7 @@ bool qt_validate_value_range(const QLowEnergyCharacteristicData &data) false /*do not retain*/); if (!newCBService) { - qCCritical(QT_BT_OSX) << "addService: failed to create CBMutableService"; + qCCritical(QT_BT_DARWIN) << "addService: failed to create CBMutableService"; return {}; } @@ -294,8 +294,8 @@ bool qt_validate_value_range(const QLowEnergyCharacteristicData &data) advertisementData.reset([[NSMutableDictionary alloc] init]); if (!advertisementData) { - qCWarning(QT_BT_OSX) << "setParameters: failed to allocate " - "NSMutableDictonary (advertisementData)"; + qCWarning(QT_BT_DARWIN) << "setParameters: failed to allocate " + "NSMutableDictonary (advertisementData)"; return; } @@ -313,8 +313,8 @@ bool qt_validate_value_range(const QLowEnergyCharacteristicData &data) const ObjCScopedPointer<NSMutableArray> uuids([[NSMutableArray alloc] init]); if (!uuids) { - qCWarning(QT_BT_OSX) << "setParameters: failed to allocate " - "NSMutableArray (services uuids)"; + qCWarning(QT_BT_DARWIN) << "setParameters: failed to allocate " + "NSMutableArray (services uuids)"; return; } @@ -387,7 +387,7 @@ bool qt_validate_value_range(const QLowEnergyCharacteristicData &data) #else ) { #endif - qCWarning(QT_BT_OSX) << "ignoring value of invalid length" << value.size(); + qCWarning(QT_BT_DARWIN) << "ignoring value of invalid length" << value.size(); return; } @@ -552,14 +552,14 @@ bool qt_validate_value_range(const QLowEnergyCharacteristicData &data) const auto handle = charMap.key(request.characteristic); if (!handle || !charValues.contains(handle)) { - qCWarning(QT_BT_OSX) << "invalid read request, unknown characteristic"; + qCWarning(QT_BT_DARWIN) << "invalid read request, unknown characteristic"; [manager respondToRequest:request withResult:CBATTErrorInvalidHandle]; return; } const auto &value = charValues[handle]; if (request.offset > [value length]) { - qCWarning(QT_BT_OSX) << "invalid offset in a read request"; + qCWarning(QT_BT_DARWIN) << "invalid offset in a read request"; [manager respondToRequest:request withResult:CBATTErrorInvalidOffset]; return; } @@ -670,9 +670,9 @@ bool qt_validate_value_range(const QLowEnergyCharacteristicData &data) if (charMap.contains(request.charHandle)) { if ([connectedCentrals count] && maxNotificationValueLength < [request.value length]) { - qCWarning(QT_BT_OSX) << "value of length" << [request.value length] - << "will possibly be truncated to" - << maxNotificationValueLength; + qCWarning(QT_BT_DARWIN) << "value of length" << [request.value length] + << "will possibly be truncated to" + << maxNotificationValueLength; } const BOOL res = [manager updateValue:request.value forCharacteristic:static_cast<CBMutableCharacteristic *>(charMap[request.charHandle]) @@ -755,8 +755,8 @@ bool qt_validate_value_range(const QLowEnergyCharacteristicData &data) ObjCScopedPointer<NSMutableArray> included([[NSMutableArray alloc] init]); if (!included) { - qCWarning(QT_BT_OSX) << "addIncludedSerivces: failed " - "to allocate NSMutableArray"; + qCWarning(QT_BT_DARWIN) << "addIncludedSerivces: failed " + "to allocate NSMutableArray"; return; } @@ -766,8 +766,8 @@ bool qt_validate_value_range(const QLowEnergyCharacteristicData &data) qtService->includedServices << includedService->serviceUuid(); ++lastHandle; } else { - qCWarning(QT_BT_OSX) << "can not use" << includedService->serviceUuid() - << "as included, it has to be added first"; + qCWarning(QT_BT_DARWIN) << "can not use" << includedService->serviceUuid() + << "as included, it has to be added first"; } } @@ -786,41 +786,41 @@ bool qt_validate_value_range(const QLowEnergyCharacteristicData &data) ObjCScopedPointer<NSMutableArray> newCBChars([[NSMutableArray alloc] init]); if (!newCBChars) { - qCWarning(QT_BT_OSX) << "addCharacteristicsAndDescritptors: " - "failed to allocate NSMutableArray " - "(characteristics)"; + qCWarning(QT_BT_DARWIN) << "addCharacteristicsAndDescritptors: " + "failed to allocate NSMutableArray " + "(characteristics)"; return; } for (const auto &ch : data.characteristics()) { if (!qt_validate_value_range(ch)) { - qCWarning(QT_BT_OSX) << "addCharacteristicsAndDescritptors: " - "invalid value size/min-max length"; + qCWarning(QT_BT_DARWIN) << "addCharacteristicsAndDescritptors: " + "invalid value size/min-max length"; continue; } #ifdef Q_OS_IOS if (ch.value().length() > DarwinBluetooth::maxValueLength) { - qCWarning(QT_BT_OSX) << "addCharacteristicsAndDescritptors: " - "value exceeds the maximal permitted " - "value length (" - << DarwinBluetooth::maxValueLength - << "octets) on the platform"; + qCWarning(QT_BT_DARWIN) << "addCharacteristicsAndDescritptors: " + "value exceeds the maximal permitted " + "value length (" + << DarwinBluetooth::maxValueLength + << "octets) on the platform"; continue; } #endif const auto cbChar(create_characteristic(ch)); if (!cbChar) { - qCWarning(QT_BT_OSX) << "addCharacteristicsAndDescritptors: " - "failed to allocate a characteristic"; + qCWarning(QT_BT_DARWIN) << "addCharacteristicsAndDescritptors: " + "failed to allocate a characteristic"; continue; } const auto nsData(mutable_data_from_bytearray(ch.value())); if (!nsData) { - qCWarning(QT_BT_OSX) << "addCharacteristicsAndDescritptors: " - "addService: failed to allocate NSData (char value)"; + qCWarning(QT_BT_DARWIN) << "addCharacteristicsAndDescritptors: " + "addService: failed to allocate NSData (char value)"; continue; } @@ -840,9 +840,9 @@ bool qt_validate_value_range(const QLowEnergyCharacteristicData &data) const ObjCScopedPointer<NSMutableArray> newCBDescs([[NSMutableArray alloc] init]); if (!newCBDescs) { - qCWarning(QT_BT_OSX) << "addCharacteristicsAndDescritptors: " - "failed to allocate NSMutableArray " - "(descriptors)"; + qCWarning(QT_BT_DARWIN) << "addCharacteristicsAndDescritptors: " + "failed to allocate NSMutableArray " + "(descriptors)"; continue; } diff --git a/src/bluetooth/osx/osxbtrfcommchannel.mm b/src/bluetooth/osx/osxbtrfcommchannel.mm index 8154a842..6ce8c3cd 100644 --- a/src/bluetooth/osx/osxbtrfcommchannel.mm +++ b/src/bluetooth/osx/osxbtrfcommchannel.mm @@ -103,13 +103,13 @@ QT_USE_NAMESPACE withChannelID:(BluetoothRFCOMMChannelID)channelID { if (address.isNull()) { - qCCritical(QT_BT_OSX) << "invalid peer address"; + qCCritical(QT_BT_DARWIN) << "invalid peer address"; return kIOReturnNoDevice; } // Can never be called twice. if (connected || device || channel) { - qCCritical(QT_BT_OSX) << "connection is already active"; + qCCritical(QT_BT_DARWIN) << "connection is already active"; return kIOReturnStillOpen; } @@ -118,14 +118,14 @@ QT_USE_NAMESPACE const BluetoothDeviceAddress iobtAddress = DarwinBluetooth::iobluetooth_address(address); device = [IOBluetoothDevice deviceWithAddress:&iobtAddress]; if (!device) { // TODO: do I always check this BTW??? Apple's docs say nothing about nil. - qCCritical(QT_BT_OSX) << "failed to create a device"; + qCCritical(QT_BT_DARWIN) << "failed to create a device"; return kIOReturnNoDevice; } const IOReturn status = [device openRFCOMMChannelAsync:&channel withChannelID:channelID delegate:self]; if (status != kIOReturnSuccess) { - qCCritical(QT_BT_OSX) << "failed to open L2CAP channel"; + qCCritical(QT_BT_DARWIN) << "failed to open L2CAP channel"; // device is still autoreleased. device = nil; return status; diff --git a/src/bluetooth/osx/osxbtsdpinquiry.mm b/src/bluetooth/osx/osxbtsdpinquiry.mm index 02d03033..ebcca34e 100644 --- a/src/bluetooth/osx/osxbtsdpinquiry.mm +++ b/src/bluetooth/osx/osxbtsdpinquiry.mm @@ -255,7 +255,7 @@ using namespace DarwinBluetooth; if (qtFilters.size()) { array.reset([[NSMutableArray alloc] init]); if (!array) { - qCCritical(QT_BT_OSX) << "failed to allocate an uuid filter"; + qCCritical(QT_BT_DARWIN) << "failed to allocate an uuid filter"; return kIOReturnError; } @@ -266,7 +266,7 @@ using namespace DarwinBluetooth; } if (int([array count]) != qtFilters.size()) { - qCCritical(QT_BT_OSX) << "failed to create an uuid filter"; + qCCritical(QT_BT_DARWIN) << "failed to create an uuid filter"; return kIOReturnError; } } @@ -274,7 +274,7 @@ using namespace DarwinBluetooth; const BluetoothDeviceAddress iobtAddress(iobluetooth_address(address)); ObjCScopedPointer<IOBluetoothDevice> newDevice([[IOBluetoothDevice deviceWithAddress:&iobtAddress] retain]); if (!newDevice) { - qCCritical(QT_BT_OSX) << "failed to create an IOBluetoothDevice object"; + qCCritical(QT_BT_DARWIN) << "failed to create an IOBluetoothDevice object"; return kIOReturnError; } @@ -288,7 +288,7 @@ using namespace DarwinBluetooth; result = [device performSDPQuery:self]; if (result != kIOReturnSuccess) { - qCCritical(QT_BT_OSX) << "failed to start an SDP query"; + qCCritical(QT_BT_DARWIN) << "failed to start an SDP query"; device = oldDevice.take(); } else { isActive = true; diff --git a/src/bluetooth/osx/osxbtutility.mm b/src/bluetooth/osx/osxbtutility.mm index a6cf16c4..3a12553b 100644 --- a/src/bluetooth/osx/osxbtutility.mm +++ b/src/bluetooth/osx/osxbtutility.mm @@ -58,15 +58,7 @@ QT_BEGIN_NAMESPACE -#ifndef QT_IOS_BLUETOOTH - -Q_LOGGING_CATEGORY(QT_BT_OSX, "qt.bluetooth.osx") - -#else - -Q_LOGGING_CATEGORY(QT_BT_OSX, "qt.bluetooth.ios") - -#endif +Q_LOGGING_CATEGORY(QT_BT_DARWIN, "qt.bluetooth.darwin") namespace DarwinBluetooth { @@ -170,7 +162,7 @@ void qt_test_iobluetooth_runloop() // dispatcher would suffice. At the moment of writing we do not have such // event dispatcher, so we only can work on the main thread. if (CFRunLoopGetMain() != CFRunLoopGetCurrent()) { - qCWarning(QT_BT_OSX) << "IOBluetooth works only on the main thread or a" + qCWarning(QT_BT_DARWIN) << "IOBluetooth works only on the main thread or a" << "thread with a running CFRunLoop"; } } @@ -204,15 +196,11 @@ QBluetoothUuid qt_uuid(CBUUID *uuid) std::copy(source, source + 16, qtUuidData.data); return QBluetoothUuid(qtUuidData); - } else { - qCDebug(QT_BT_OSX) << "qt_uuid, invalid CBUUID, 2 or 16 bytes expected, but got " - << uuid.data.length << " bytes length"; - return QBluetoothUuid(); } - if (uuid.data.length != 16) // TODO: warning? - return QBluetoothUuid(); - + qCDebug(QT_BT_DARWIN) << "qt_uuid, invalid CBUUID, 2 or 16 bytes expected, but got " + << uuid.data.length << " bytes length"; + return QBluetoothUuid(); } CFStrongReference<CFUUIDRef> cf_uuid(const QBluetoothUuid &qtUuid) @@ -353,8 +341,8 @@ public: queue = dispatch_queue_create(label, DISPATCH_QUEUE_SERIAL); if (!queue) { - qCCritical(QT_BT_OSX) << "failed to create dispatch queue with label" - << label; + qCCritical(QT_BT_DARWIN) << "failed to create dispatch queue with label" + << label; } } ~SerialDispatchQueue() diff --git a/src/bluetooth/osx/osxbtutility_p.h b/src/bluetooth/osx/osxbtutility_p.h index fb0d6b09..1be7fb82 100644 --- a/src/bluetooth/osx/osxbtutility_p.h +++ b/src/bluetooth/osx/osxbtutility_p.h @@ -309,8 +309,7 @@ extern const int maxValueLength; } // namespace DarwinBluetooth -// Logging category for both OS X and iOS. -Q_DECLARE_LOGGING_CATEGORY(QT_BT_OSX) +Q_DECLARE_LOGGING_CATEGORY(QT_BT_DARWIN) QT_END_NAMESPACE diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_darwin.mm b/src/bluetooth/qbluetoothdevicediscoveryagent_darwin.mm index 1ed74b9f..2a1bb667 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_darwin.mm +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_darwin.mm @@ -110,7 +110,7 @@ QBluetoothDeviceDiscoveryAgentPrivate::QBluetoothDeviceDiscoveryAgentPrivate(con #ifdef Q_OS_MACOS IOBluetoothHostController *hostController = [IOBluetoothHostController defaultController]; if (!hostController || [hostController powerState] != kBluetoothHCIPowerStateON) { - qCCritical(QT_BT_OSX) << "no default host controller or adapter is off"; + qCCritical(QT_BT_DARWIN) << "no default host controller or adapter is off"; return; } controller.reset(hostController, DarwinBluetooth::RetainPolicy::doInitialRetain); @@ -195,7 +195,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::startClassic() DarwinBluetooth::RetainPolicy::noInitialRetain); if (!inquiry) { - qCCritical(QT_BT_OSX) << "failed to initialize an Classic device inquiry"; + qCCritical(QT_BT_DARWIN) << "failed to initialize an Classic device inquiry"; setError(QBluetoothDeviceDiscoveryAgent::UnknownError, QCoreApplication::translate(DEV_DISCOVERY, DD_NOT_STARTED)); emit q_ptr->error(lastError); @@ -277,7 +277,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::stop() if (agentState == ClassicScan) { const IOReturn res = [inquiry.getAs<InquiryObjC>() stop]; if (res != kIOReturnSuccess) { - qCWarning(QT_BT_OSX) << "failed to stop"; + qCWarning(QT_BT_DARWIN) << "failed to stop"; startPending = prevStart; stopPending = false; setError(res, QCoreApplication::translate(DEV_DISCOVERY, DD_NOT_STOPPED)); @@ -352,7 +352,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::classicDeviceFound(void *obj) // Let's collect some info about this device: const QBluetoothAddress deviceAddress(DarwinBluetooth::qt_address([device getAddress])); if (deviceAddress.isNull()) { - qCWarning(QT_BT_OSX) << "invalid Bluetooth address"; + qCWarning(QT_BT_DARWIN) << "invalid Bluetooth address"; return; } @@ -430,7 +430,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::LEinquiryError(QBluetoothDeviceDisco void QBluetoothDeviceDiscoveryAgentPrivate::LEnotSupported() { - qCDebug(QT_BT_OSX) << "no Bluetooth LE support"; + qCDebug(QT_BT_DARWIN) << "no Bluetooth LE support"; #ifdef Q_OS_MACOS if (requestedMethods & QBluetoothDeviceDiscoveryAgent::ClassicMethod) { @@ -486,14 +486,14 @@ void QBluetoothDeviceDiscoveryAgentPrivate::deviceFound(const QBluetoothDeviceIn if (discoveredDevices[i].deviceUuid() == newDeviceInfo.deviceUuid()) { QBluetoothDeviceInfo::Fields updatedFields = QBluetoothDeviceInfo::Field::None; if (discoveredDevices[i].rssi() != newDeviceInfo.rssi()) { - qCDebug(QT_BT_OSX) << "Updating RSSI for" << newDeviceInfo.address() - << newDeviceInfo.rssi(); + qCDebug(QT_BT_DARWIN) << "Updating RSSI for" << newDeviceInfo.address() + << newDeviceInfo.rssi(); discoveredDevices[i].setRssi(newDeviceInfo.rssi()); updatedFields.setFlag(QBluetoothDeviceInfo::Field::RSSI); } if (discoveredDevices[i].manufacturerData() != newDeviceInfo.manufacturerData()) { - qCDebug(QT_BT_OSX) << "Updating manufacturer data for" << newDeviceInfo.address(); + qCDebug(QT_BT_DARWIN) << "Updating manufacturer data for" << newDeviceInfo.address(); const QVector<quint16> keys = newDeviceInfo.manufacturerIds(); for (auto key: keys) discoveredDevices[i].setManufacturerData(key, newDeviceInfo.manufacturerData(key)); diff --git a/src/bluetooth/qbluetoothlocaldevice_macos.mm b/src/bluetooth/qbluetoothlocaldevice_macos.mm index c39ae100..efe76123 100644 --- a/src/bluetooth/qbluetoothlocaldevice_macos.mm +++ b/src/bluetooth/qbluetoothlocaldevice_macos.mm @@ -120,25 +120,25 @@ QBluetoothLocalDevicePrivate::QBluetoothLocalDevicePrivate(QBluetoothLocalDevice HostController defaultController([[IOBluetoothHostController defaultController] retain]); if (!defaultController) { - qCCritical(QT_BT_OSX) << "failed to init a host controller object"; + qCCritical(QT_BT_DARWIN) << "failed to init a host controller object"; return; } if (!address.isNull()) { NSString *const hciAddress = [defaultController addressAsString]; if (!hciAddress) { - qCCritical(QT_BT_OSX) << "failed to obtain an address"; + qCCritical(QT_BT_DARWIN) << "failed to obtain an address"; return; } BluetoothDeviceAddress iobtAddress = {}; if (IOBluetoothNSStringToDeviceAddress(hciAddress, &iobtAddress) != kIOReturnSuccess) { - qCCritical(QT_BT_OSX) << "invalid local device's address"; + qCCritical(QT_BT_DARWIN) << "invalid local device's address"; return; } if (address != DarwinBluetooth::qt_address(&iobtAddress)) { - qCCritical(QT_BT_OSX) << "invalid local device's address"; + qCCritical(QT_BT_DARWIN) << "invalid local device's address"; return; } } @@ -181,7 +181,7 @@ void QBluetoothLocalDevicePrivate::requestPairing(const QBluetoothAddress &addre if ([device isPaired]) { emitPairingFinished(address, pairing, true); } else if ([pos.value() start] != kIOReturnSuccess) { - qCCritical(QT_BT_OSX) << "failed to start a new pairing request"; + qCCritical(QT_BT_DARWIN) << "failed to start a new pairing request"; emitError(QBluetoothLocalDevice::PairingError, true); } return; @@ -192,7 +192,7 @@ void QBluetoothLocalDevicePrivate::requestPairing(const QBluetoothAddress &addre // it'll just finish with success (skipping any intermediate steps). PairingRequest newRequest([[ObjCPairingRequest alloc] initWithTarget:address delegate:this], false); if (!newRequest) { - qCCritical(QT_BT_OSX) << "failed to allocate a new pairing request"; + qCCritical(QT_BT_DARWIN) << "failed to allocate a new pairing request"; emitError(QBluetoothLocalDevice::PairingError, true); return; } @@ -201,7 +201,7 @@ void QBluetoothLocalDevicePrivate::requestPairing(const QBluetoothAddress &addre const IOReturn result = [newRequest start]; if (result != kIOReturnSuccess) { pairingRequests.erase(pos); - qCCritical(QT_BT_OSX) << "failed to start a new pairing request"; + qCCritical(QT_BT_DARWIN) << "failed to start a new pairing request"; emitError(QBluetoothLocalDevice::PairingError, true); } } @@ -363,7 +363,7 @@ QString QBluetoothLocalDevice::name() const if (isValid()) { if (NSString *const nsn = [d_ptr->hostController nameAsString]) return QString::fromNSString(nsn); - qCCritical(QT_BT_OSX) << Q_FUNC_INFO << "failed to obtain a name"; + qCCritical(QT_BT_DARWIN) << Q_FUNC_INFO << "failed to obtain a name"; } return QString(); @@ -377,9 +377,9 @@ QBluetoothAddress QBluetoothLocalDevice::address() const if (NSString *const nsa = [d_ptr->hostController addressAsString]) return QBluetoothAddress(DarwinBluetooth::qt_address(nsa)); - qCCritical(QT_BT_OSX) << Q_FUNC_INFO << "failed to obtain an address"; + qCCritical(QT_BT_DARWIN) << Q_FUNC_INFO << "failed to obtain an address"; } else { - qCWarning(QT_BT_OSX) << Q_FUNC_INFO << "invalid local device"; + qCWarning(QT_BT_DARWIN) << Q_FUNC_INFO << "invalid local device"; } return QBluetoothAddress(); @@ -388,7 +388,7 @@ QBluetoothAddress QBluetoothLocalDevice::address() const void QBluetoothLocalDevice::powerOn() { if (!isValid()) - qCWarning(QT_BT_OSX) << Q_FUNC_INFO << "invalid local device"; + qCWarning(QT_BT_DARWIN) << Q_FUNC_INFO << "invalid local device"; } void QBluetoothLocalDevice::setHostMode(QBluetoothLocalDevice::HostMode mode) @@ -396,7 +396,7 @@ void QBluetoothLocalDevice::setHostMode(QBluetoothLocalDevice::HostMode mode) Q_UNUSED(mode) if (!isValid()) - qCWarning(QT_BT_OSX) << Q_FUNC_INFO << "invalid local device"; + qCWarning(QT_BT_DARWIN) << Q_FUNC_INFO << "invalid local device"; } QBluetoothLocalDevice::HostMode QBluetoothLocalDevice::hostMode() const @@ -441,7 +441,7 @@ QList<QBluetoothHostInfo> QBluetoothLocalDevice::allDevices() QBluetoothLocalDevice defaultAdapter; if (!defaultAdapter.isValid() || defaultAdapter.address().isNull()) { - qCCritical(QT_BT_OSX) << Q_FUNC_INFO <<"no valid device found"; + qCCritical(QT_BT_DARWIN) << Q_FUNC_INFO <<"no valid device found"; return localDevices; } @@ -463,7 +463,7 @@ void QBluetoothLocalDevice::pairingConfirmation(bool confirmation) void QBluetoothLocalDevice::requestPairing(const QBluetoothAddress &address, Pairing pairing) { if (!isValid()) - qCWarning(QT_BT_OSX) << Q_FUNC_INFO << "invalid local device"; + qCWarning(QT_BT_DARWIN) << Q_FUNC_INFO << "invalid local device"; if (!isValid() || address.isNull()) { d_ptr->emitError(PairingError, true); @@ -478,7 +478,7 @@ void QBluetoothLocalDevice::requestPairing(const QBluetoothAddress &address, Pai QBluetoothLocalDevice::Pairing QBluetoothLocalDevice::pairingStatus(const QBluetoothAddress &address) const { if (!isValid()) - qCWarning(QT_BT_OSX) << Q_FUNC_INFO << "invalid local device"; + qCWarning(QT_BT_DARWIN) << Q_FUNC_INFO << "invalid local device"; if (!isValid() || address.isNull()) return Unpaired; diff --git a/src/bluetooth/qbluetoothserver_macos.mm b/src/bluetooth/qbluetoothserver_macos.mm index a9bd3002..1d19f161 100644 --- a/src/bluetooth/qbluetoothserver_macos.mm +++ b/src/bluetooth/qbluetoothserver_macos.mm @@ -98,7 +98,7 @@ QBluetoothServerPrivate::QBluetoothServerPrivate(ServiceInfo::Protocol type, port(0) { if (serverType == ServiceInfo::UnknownProtocol) - qCWarning(QT_BT_OSX) << "unknown protocol"; + qCWarning(QT_BT_DARWIN) << "unknown protocol"; } QBluetoothServerPrivate::~QBluetoothServerPrivate() @@ -112,7 +112,7 @@ bool QBluetoothServerPrivate::startListener(quint16 realPort) Q_ASSERT_X(realPort, Q_FUNC_INFO, "invalid port"); if (serverType == ServiceInfo::UnknownProtocol) { - qCWarning(QT_BT_OSX) << "invalid protocol"; + qCWarning(QT_BT_DARWIN) << "invalid protocol"; return false; } @@ -228,8 +228,8 @@ void QBluetoothServerPrivate::registerServer(QBluetoothServerPrivate *server, qu Q_ASSERT_X(!psmIsBusy(port), Q_FUNC_INFO, "port is busy"); busyPSMs()[port] = server; } else { - qCWarning(QT_BT_OSX) << "can not register a server " - "with unknown protocol type"; + qCWarning(QT_BT_DARWIN) << "can not register a server " + "with unknown protocol type"; } } @@ -245,7 +245,7 @@ QBluetoothServerPrivate *QBluetoothServerPrivate::registeredServer(quint16 port, if (it != busyPSMs().end()) return it.value(); } else { - qCWarning(QT_BT_OSX) << "invalid protocol"; + qCWarning(QT_BT_DARWIN) << "invalid protocol"; } return nullptr; @@ -262,17 +262,17 @@ void QBluetoothServerPrivate::unregisterServer(QBluetoothServerPrivate *server) if (it != busyChannels().end()) { busyChannels().erase(it); } else { - qCWarning(QT_BT_OSX) << "server is not registered"; + qCWarning(QT_BT_DARWIN) << "server is not registered"; } } else if (type == ServiceInfo::L2capProtocol) { ServerMapIterator it = busyPSMs().find(port); if (it != busyPSMs().end()) { busyPSMs().erase(it); } else { - qCWarning(QT_BT_OSX) << "server is not registered"; + qCWarning(QT_BT_DARWIN) << "server is not registered"; } } else { - qCWarning(QT_BT_OSX) << "invalid protocol"; + qCWarning(QT_BT_DARWIN) << "invalid protocol"; } } @@ -291,15 +291,15 @@ bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port) DarwinBluetooth::qt_test_iobluetooth_runloop(); if (d_ptr->listener) { - qCWarning(QT_BT_OSX) << "already in listen mode, close server first"; + qCWarning(QT_BT_DARWIN) << "already in listen mode, close server first"; return false; } const QBluetoothLocalDevice device(address); if (!device.isValid()) { - qCWarning(QT_BT_OSX) << "device does not support Bluetooth or" - << address.toString() - << "is not a valid local adapter"; + qCWarning(QT_BT_DARWIN) << "device does not support Bluetooth or" + << address.toString() + << "is not a valid local adapter"; d_ptr->m_lastError = UnknownError; emit error(UnknownError); return false; @@ -307,7 +307,7 @@ bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port) const QBluetoothLocalDevice::HostMode hostMode = device.hostMode(); if (hostMode == QBluetoothLocalDevice::HostPoweredOff) { - qCWarning(QT_BT_OSX) << "Bluetooth device is powered off"; + qCWarning(QT_BT_DARWIN) << "Bluetooth device is powered off"; d_ptr->m_lastError = PoweredOffError; emit error(PoweredOffError); return false; @@ -316,7 +316,7 @@ bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port) const ServiceInfo::Protocol type = d_ptr->serverType; if (type == ServiceInfo::UnknownProtocol) { - qCWarning(QT_BT_OSX) << "invalid protocol"; + qCWarning(QT_BT_DARWIN) << "invalid protocol"; d_ptr->m_lastError = UnsupportedProtocolError; emit error(d_ptr->m_lastError); return false; @@ -330,14 +330,14 @@ bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port) if (port) { if (type == ServiceInfo::RfcommProtocol) { if (d_ptr->channelIsBusy(port)) { - qCWarning(QT_BT_OSX) << "server port:" << port - << "already registered"; + qCWarning(QT_BT_DARWIN) << "server port:" << port + << "already registered"; d_ptr->m_lastError = ServiceAlreadyRegisteredError; } } else { if (d_ptr->psmIsBusy(port)) { - qCWarning(QT_BT_OSX) << "server port:" << port - << "already registered"; + qCWarning(QT_BT_DARWIN) << "server port:" << port + << "already registered"; d_ptr->m_lastError = ServiceAlreadyRegisteredError; } } @@ -352,7 +352,7 @@ bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port) } if (!port) { - qCWarning(QT_BT_OSX) << "all ports are busy"; + qCWarning(QT_BT_DARWIN) << "all ports are busy"; d_ptr->m_lastError = ServiceAlreadyRegisteredError; emit error(d_ptr->m_lastError); return false; diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_macos.mm b/src/bluetooth/qbluetoothservicediscoveryagent_macos.mm index 6c3ed79d..0bc8bb66 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_macos.mm +++ b/src/bluetooth/qbluetoothservicediscoveryagent_macos.mm @@ -175,7 +175,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::SDPInquiryError(void *device, IORet { Q_UNUSED(device) - qCWarning(QT_BT_OSX) << "inquiry failed with IOKit code:" << int(errorCode); + qCWarning(QT_BT_DARWIN) << "inquiry failed with IOKit code:" << int(errorCode); discoveredDevices.clear(); // TODO: find a better mapping from IOReturn to QBluetoothServiceDiscoveryAgent::Error. diff --git a/src/bluetooth/qbluetoothserviceinfo_macos.mm b/src/bluetooth/qbluetoothserviceinfo_macos.mm index ac8e6b33..a94b0ab5 100644 --- a/src/bluetooth/qbluetoothserviceinfo_macos.mm +++ b/src/bluetooth/qbluetoothserviceinfo_macos.mm @@ -114,7 +114,7 @@ bool QBluetoothServiceInfoPrivate::registerService(const QBluetoothServiceInfo & ObjCStrongReference<NSMutableDictionary> serviceDict(iobluetooth_service_dictionary(info)); if (!serviceDict) { - qCWarning(QT_BT_OSX) << "failed to create a service dictionary"; + qCWarning(QT_BT_DARWIN) << "failed to create a service dictionary"; return false; } @@ -125,14 +125,14 @@ bool QBluetoothServiceInfoPrivate::registerService(const QBluetoothServiceInfo & newRecord.reset([IOBluetoothSDPServiceRecord publishedServiceRecordWithDictionary:serviceDict], RetainPolicy::doInitialRetain); if (!newRecord) { - qCWarning(QT_BT_OSX) << "failed to register a service record"; + qCWarning(QT_BT_DARWIN) << "failed to register a service record"; return false; } BluetoothSDPServiceRecordHandle newRecordHandle = 0; auto *ioSDPRecord = newRecord.getAs<IOBluetoothSDPServiceRecord>(); if ([ioSDPRecord getServiceRecordHandle:&newRecordHandle] != kIOReturnSuccess) { - qCWarning(QT_BT_OSX) << "failed to register a service record"; + qCWarning(QT_BT_DARWIN) << "failed to register a service record"; [ioSDPRecord removeServiceRecord]; return false; } @@ -160,7 +160,7 @@ bool QBluetoothServiceInfoPrivate::registerService(const QBluetoothServiceInfo & if (!configured) { [ioSDPRecord removeServiceRecord]; - qCWarning(QT_BT_OSX) << "failed to register a service record"; + qCWarning(QT_BT_DARWIN) << "failed to register a service record"; return false; } diff --git a/src/bluetooth/qbluetoothsocket_macos.mm b/src/bluetooth/qbluetoothsocket_macos.mm index 4f784fa1..ef2b39f4 100644 --- a/src/bluetooth/qbluetoothsocket_macos.mm +++ b/src/bluetooth/qbluetoothsocket_macos.mm @@ -244,7 +244,7 @@ bool QBluetoothSocketPrivate::setSocketDescriptor(int socketDescriptor, QBluetoo Q_UNUSED(socketState) Q_UNUSED(openMode) - qCWarning(QT_BT_OSX) << "setting a socket descriptor is not supported by IOBluetooth"; + qCWarning(QT_BT_DARWIN) << "setting a socket descriptor is not supported by IOBluetooth"; // Noop on macOS. return true; } @@ -264,7 +264,7 @@ void QBluetoothSocketPrivate::connectToService(const QBluetoothServiceInfo &serv DarwinBluetooth::qt_test_iobluetooth_runloop(); if (state!= QBluetoothSocket::UnconnectedState && state != QBluetoothSocket::ServiceLookupState) { - qCWarning(QT_BT_OSX) << "called on a busy socket"; + qCWarning(QT_BT_DARWIN) << "called on a busy socket"; errorString = QCoreApplication::translate(SOCKET, SOC_CONNECT_IN_PROGRESS); q_ptr->setSocketError(QBluetoothSocket::OperationError); return; @@ -272,7 +272,7 @@ void QBluetoothSocketPrivate::connectToService(const QBluetoothServiceInfo &serv // Report this problem early, potentially avoid device discovery: if (service.socketProtocol() == QBluetoothServiceInfo::UnknownProtocol) { - qCWarning(QT_BT_OSX) << Q_FUNC_INFO << "cannot connect with 'UnknownProtocol' type"; + qCWarning(QT_BT_DARWIN) << Q_FUNC_INFO << "cannot connect with 'UnknownProtocol' type"; errorString = QCoreApplication::translate(SOCKET, SOC_NETWORK_ERROR); q_ptr->setSocketError(QBluetoothSocket::UnsupportedProtocolError); return; @@ -291,8 +291,8 @@ void QBluetoothSocketPrivate::connectToService(const QBluetoothServiceInfo &serv } else { // Try service discovery. if (service.serviceUuid().isNull()) { - qCWarning(QT_BT_OSX) << "No port, no PSM, and no " - "UUID provided, unable to connect"; + qCWarning(QT_BT_DARWIN) << "No port, no PSM, and no " + "UUID provided, unable to connect"; return; } @@ -309,14 +309,14 @@ void QBluetoothSocketPrivate::connectToService(const QBluetoothAddress &address, // Report this problem early, avoid device discovery: if (socketType == QBluetoothServiceInfo::UnknownProtocol) { - qCWarning(QT_BT_OSX) << Q_FUNC_INFO << "cannot connect with 'UnknownProtocol' type"; + qCWarning(QT_BT_DARWIN) << Q_FUNC_INFO << "cannot connect with 'UnknownProtocol' type"; errorString = QCoreApplication::translate(SOCKET, SOC_NETWORK_ERROR); q_ptr->setSocketError(QBluetoothSocket::UnsupportedProtocolError); return; } if (state != QBluetoothSocket::UnconnectedState) { - qCWarning(QT_BT_OSX) << "called on a busy socket"; + qCWarning(QT_BT_DARWIN) << "called on a busy socket"; errorString = QCoreApplication::translate(SOCKET, SOC_CONNECT_IN_PROGRESS); q_ptr->setSocketError(QBluetoothSocket::OperationError); return; @@ -337,7 +337,7 @@ void QBluetoothSocketPrivate::connectToService(const QBluetoothAddress &address, DarwinBluetooth::qt_test_iobluetooth_runloop(); if (socketType == QBluetoothServiceInfo::UnknownProtocol) { - qCWarning(QT_BT_OSX) << Q_FUNC_INFO << "cannot connect with 'UnknownProtocol' type"; + qCWarning(QT_BT_DARWIN) << Q_FUNC_INFO << "cannot connect with 'UnknownProtocol' type"; errorString = QCoreApplication::translate(SOCKET, SOC_NETWORK_ERROR); q_ptr->setSocketError(QBluetoothSocket::UnsupportedProtocolError); return; diff --git a/src/bluetooth/qbluetoothtransferreply_macos.mm b/src/bluetooth/qbluetoothtransferreply_macos.mm index 8ba06c05..fb4f5927 100644 --- a/src/bluetooth/qbluetoothtransferreply_macos.mm +++ b/src/bluetooth/qbluetoothtransferreply_macos.mm @@ -177,7 +177,7 @@ void QBluetoothTransferReplyOSXPrivate::sendConnect(const QBluetoothAddress &dev errorString.clear(); if (device.isNull() || !channelID) { - qCWarning(QT_BT_OSX) << "invalid device address or port"; + qCWarning(QT_BT_DARWIN) << "invalid device address or port"; setReplyError(QBluetoothTransferReply::HostNotFoundError, QCoreApplication::translate(TRANSFER_REPLY, TR_INVAL_TARGET)); return; @@ -186,7 +186,7 @@ void QBluetoothTransferReplyOSXPrivate::sendConnect(const QBluetoothAddress &dev OBEXSession newSession([[ObjCOBEXSession alloc] initWithDelegate:this remoteDevice:device channelID:channelID]); if (!newSession) { - qCWarning(QT_BT_OSX) << "failed to allocate OSXBTOBEXSession object"; + qCWarning(QT_BT_DARWIN) << "failed to allocate OSXBTOBEXSession object"; setReplyError(QBluetoothTransferReply::UnknownError, QCoreApplication::translate(TRANSFER_REPLY, TR_SESSION_NO_START)); @@ -201,7 +201,7 @@ void QBluetoothTransferReplyOSXPrivate::sendConnect(const QBluetoothAddress &dev if ([session isConnected]) sendPut();// Connected, send a PUT request. } else { - qCWarning(QT_BT_OSX) << "OBEXConnect failed"; + qCWarning(QT_BT_DARWIN) << "OBEXConnect failed"; if (error == QBluetoothTransferReply::NoError) { // The error is not set yet. @@ -355,7 +355,7 @@ QBluetoothTransferReplyOSX::QBluetoothTransferReplyOSX(QIODevice *input, if (input) { QMetaObject::invokeMethod(this, "start", Qt::QueuedConnection); } else { - qCWarning(QT_BT_OSX) << "invalid input stream (null)"; + qCWarning(QT_BT_DARWIN) << "invalid input stream (null)"; osx_d_ptr->requestComplete = true; osx_d_ptr->errorString = QCoreApplication::translate(TRANSFER_REPLY, TR_INVALID_DEVICE); osx_d_ptr->error = FileNotFoundError; @@ -416,7 +416,7 @@ bool QBluetoothTransferReplyOSX::start() if (!osx_d_ptr->isActive()) { // Step 0: find a channelID. if (request().address().isNull()) { - qCWarning(QT_BT_OSX) << "invalid device address"; + qCWarning(QT_BT_DARWIN) << "invalid device address"; osx_d_ptr->setReplyError(HostNotFoundError, QCoreApplication::translate(TRANSFER_REPLY, TR_INVAL_TARGET)); return false; diff --git a/src/bluetooth/qlowenergycontroller_darwin.mm b/src/bluetooth/qlowenergycontroller_darwin.mm index 7cdf114c..b715a647 100644 --- a/src/bluetooth/qlowenergycontroller_darwin.mm +++ b/src/bluetooth/qlowenergycontroller_darwin.mm @@ -76,7 +76,7 @@ ServicePrivate qt_createLEService(QLowEnergyControllerPrivateDarwin *controller, CBUUID *const cbUuid = cbService.UUID; if (!cbUuid) { - qCDebug(QT_BT_OSX) << "invalid service, UUID is nil"; + qCDebug(QT_BT_DARWIN) << "invalid service, UUID is nil"; return ServicePrivate(); } @@ -173,24 +173,24 @@ void QLowEnergyControllerPrivateDarwin::init() peripheralManager.reset([[ObjCPeripheralManager alloc] initWith:notifier.data()], DarwinBluetooth::RetainPolicy::noInitialRetain); if (!peripheralManager) { - qCWarning(QT_BT_OSX) << "failed to create a peripheral manager"; + qCWarning(QT_BT_DARWIN) << "failed to create a peripheral manager"; return; } #else - qCWarning(QT_BT_OSX) << "the peripheral role is not supported on your platform"; + qCWarning(QT_BT_DARWIN) << "the peripheral role is not supported on your platform"; return; #endif // Q_OS_TVOS } else { centralManager.reset([[ObjCCentralManager alloc] initWith:notifier.data()], DarwinBluetooth::RetainPolicy::noInitialRetain); if (!centralManager) { - qCWarning(QT_BT_OSX) << "failed to initialize a central manager"; + qCWarning(QT_BT_DARWIN) << "failed to initialize a central manager"; return; } } if (!connectSlots(notifier.data())) - qCWarning(QT_BT_OSX) << "failed to connect to notifier's signal(s)"; + qCWarning(QT_BT_DARWIN) << "failed to connect to notifier's signal(s)"; // Ownership was taken by central manager. notifier.take(); @@ -217,7 +217,7 @@ void QLowEnergyControllerPrivateDarwin::connectToDevice() dispatch_queue_t leQueue(DarwinBluetooth::qt_LE_queue()); if (!leQueue) { - qCWarning(QT_BT_OSX) << "no LE queue found"; + qCWarning(QT_BT_DARWIN) << "no LE queue found"; setErrorDescription(QLowEnergyController::UnknownError); return; } @@ -261,8 +261,8 @@ void QLowEnergyControllerPrivateDarwin::disconnectFromDevice() setState(QLowEnergyController::UnconnectedState); } } else { - qCCritical(QT_BT_OSX) << "qt LE queue is nil, " - "can not dispatch 'disconnect'"; + qCCritical(QT_BT_DARWIN) << "qt LE queue is nil, " + "can not dispatch 'disconnect'"; } } } @@ -288,13 +288,13 @@ void QLowEnergyControllerPrivateDarwin::discoverServices() void QLowEnergyControllerPrivateDarwin::discoverServiceDetails(const QBluetoothUuid &serviceUuid) { if (state != QLowEnergyController::DiscoveredState) { - qCWarning(QT_BT_OSX) << "can not discover service details in the current state, " - "QLowEnergyController::DiscoveredState is expected"; + qCWarning(QT_BT_DARWIN) << "can not discover service details in the current state, " + "QLowEnergyController::DiscoveredState is expected"; return; } if (!serviceList.contains(serviceUuid)) { - qCWarning(QT_BT_OSX) << "unknown service: " << serviceUuid; + qCWarning(QT_BT_DARWIN) << "unknown service: " << serviceUuid; return; } @@ -315,7 +315,7 @@ void QLowEnergyControllerPrivateDarwin::requestConnectionUpdate(const QLowEnergy { Q_UNUSED(params); // TODO: implement this, if possible. - qCWarning(QT_BT_OSX) << "Connection update not implemented on your platform"; + qCWarning(QT_BT_DARWIN) << "Connection update not implemented on your platform"; } void QLowEnergyControllerPrivateDarwin::addToGenericAttributeList(const QLowEnergyServiceData &service, @@ -332,20 +332,20 @@ QLowEnergyService * QLowEnergyControllerPrivateDarwin::addServiceHelper(const QL // Three checks below should be removed, they are done in the q_ptr's class. #ifdef Q_OS_TVOS Q_UNUSED(service); - qCDebug(QT_BT_OSX, "peripheral role is not supported on tvOS"); + qCDebug(QT_BT_DARWIN, "peripheral role is not supported on tvOS"); #else if (role != QLowEnergyController::PeripheralRole) { - qCWarning(QT_BT_OSX) << "not in peripheral role"; + qCWarning(QT_BT_DARWIN) << "not in peripheral role"; return nullptr; } if (state != QLowEnergyController::UnconnectedState) { - qCWarning(QT_BT_OSX) << "invalid state"; + qCWarning(QT_BT_DARWIN) << "invalid state"; return nullptr; } if (!service.isValid()) { - qCWarning(QT_BT_OSX) << "invalid service"; + qCWarning(QT_BT_DARWIN) << "invalid service"; return nullptr; } @@ -405,7 +405,7 @@ void QLowEnergyControllerPrivateDarwin::_q_serviceDiscoveryFinished() continue; if (serviceList.contains(newService->uuid)) { // It's a bit stupid we first created it ... - qCDebug(QT_BT_OSX) << "discovered service with a duplicated UUID" + qCDebug(QT_BT_DARWIN) << "discovered service with a duplicated UUID" << newService->uuid; continue; } @@ -457,7 +457,7 @@ void QLowEnergyControllerPrivateDarwin::_q_serviceDiscoveryFinished() toVisitNext.resetWithoutRetain([[NSMutableArray alloc] init]); } } else { - qCDebug(QT_BT_OSX) << "no services found"; + qCDebug(QT_BT_DARWIN) << "no services found"; } for (ServiceMap::const_iterator it = serviceList.constBegin(); it != serviceList.constEnd(); ++it) @@ -474,8 +474,8 @@ void QLowEnergyControllerPrivateDarwin::_q_serviceDetailsDiscoveryFinished(QShar Q_ASSERT(service); if (!serviceList.contains(service->uuid)) { - qCDebug(QT_BT_OSX) << "unknown service uuid:" - << service->uuid; + qCDebug(QT_BT_DARWIN) << "unknown service uuid:" + << service->uuid; return; } @@ -492,7 +492,7 @@ void QLowEnergyControllerPrivateDarwin::_q_servicesWereModified() { if (!(state == QLowEnergyController::DiscoveringState || state == QLowEnergyController::DiscoveredState)) { - qCWarning(QT_BT_OSX) << "services were modified while controller is not in Discovered/Discovering state"; + qCWarning(QT_BT_DARWIN) << "services were modified while controller is not in Discovered/Discovering state"; return; } @@ -514,7 +514,7 @@ void QLowEnergyControllerPrivateDarwin::_q_characteristicRead(QLowEnergyHandle c QLowEnergyCharacteristic characteristic(characteristicForHandle(charHandle)); if (!characteristic.isValid()) { - qCWarning(QT_BT_OSX) << "unknown characteristic"; + qCWarning(QT_BT_DARWIN) << "unknown characteristic"; return; } @@ -531,14 +531,14 @@ void QLowEnergyControllerPrivateDarwin::_q_characteristicWritten(QLowEnergyHandl ServicePrivate service(serviceForHandle(charHandle)); if (service.isNull()) { - qCWarning(QT_BT_OSX) << "can not find service for characteristic handle" - << charHandle; + qCWarning(QT_BT_DARWIN) << "can not find service for characteristic handle" + << charHandle; return; } QLowEnergyCharacteristic characteristic(characteristicForHandle(charHandle)); if (!characteristic.isValid()) { - qCWarning(QT_BT_OSX) << "unknown characteristic"; + qCWarning(QT_BT_DARWIN) << "unknown characteristic"; return; } @@ -567,7 +567,7 @@ void QLowEnergyControllerPrivateDarwin::_q_characteristicUpdated(QLowEnergyHandl QLowEnergyCharacteristic characteristic(characteristicForHandle(charHandle)); if (!characteristic.isValid()) { - qCWarning(QT_BT_OSX) << "unknown characteristic"; + qCWarning(QT_BT_DARWIN) << "unknown characteristic"; return; } @@ -584,7 +584,7 @@ void QLowEnergyControllerPrivateDarwin::_q_descriptorRead(QLowEnergyHandle dHand const QLowEnergyDescriptor qtDescriptor(descriptorForHandle(dHandle)); if (!qtDescriptor.isValid()) { - qCWarning(QT_BT_OSX) << "unknown descriptor" << dHandle; + qCWarning(QT_BT_DARWIN) << "unknown descriptor" << dHandle; return; } @@ -600,7 +600,7 @@ void QLowEnergyControllerPrivateDarwin::_q_descriptorWritten(QLowEnergyHandle dH const QLowEnergyDescriptor qtDescriptor(descriptorForHandle(dHandle)); if (!qtDescriptor.isValid()) { - qCWarning(QT_BT_OSX) << "unknown descriptor" << dHandle; + qCWarning(QT_BT_DARWIN) << "unknown descriptor" << dHandle; return; } @@ -626,16 +626,16 @@ void QLowEnergyControllerPrivateDarwin::_q_notificationEnabled(QLowEnergyHandle const QLowEnergyCharacteristic qtChar(characteristicForHandle(charHandle)); if (!qtChar.isValid()) { - qCWarning(QT_BT_OSX) << "unknown characteristic" << charHandle; + qCWarning(QT_BT_DARWIN) << "unknown characteristic" << charHandle; return; } const QLowEnergyDescriptor qtDescriptor = qtChar.descriptor(QBluetoothUuid::ClientCharacteristicConfiguration); if (!qtDescriptor.isValid()) { - qCWarning(QT_BT_OSX) << "characteristic" << charHandle - << "does not have a client characteristic " - "descriptor"; + qCWarning(QT_BT_DARWIN) << "characteristic" << charHandle + << "does not have a client characteristic " + "descriptor"; return; } @@ -687,8 +687,8 @@ void QLowEnergyControllerPrivateDarwin::_q_CBManagerError(const QBluetoothUuid & ServicePrivate qtService(serviceList.value(serviceUuid)); qtService->setState(QLowEnergyService::InvalidService); } else { - qCDebug(QT_BT_OSX) << "error reported for unknown service" - << serviceUuid; + qCDebug(QT_BT_DARWIN) << "error reported for unknown service" + << serviceUuid; } } @@ -696,8 +696,8 @@ void QLowEnergyControllerPrivateDarwin::_q_CBManagerError(const QBluetoothUuid & QLowEnergyService::ServiceError errorCode) { if (!serviceList.contains(serviceUuid)) { - qCDebug(QT_BT_OSX) << "unknown service uuid:" - << serviceUuid; + qCDebug(QT_BT_DARWIN) << "unknown service uuid:" + << serviceUuid; return; } @@ -712,7 +712,7 @@ void QLowEnergyControllerPrivateDarwin::setNotifyValue(QSharedPointer<QLowEnergy Q_ASSERT_X(!service.isNull(), Q_FUNC_INFO, "invalid service (null)"); if (role == QLowEnergyController::PeripheralRole) { - qCWarning(QT_BT_OSX) << "invalid role (peripheral)"; + qCWarning(QT_BT_DARWIN) << "invalid role (peripheral)"; service->setError(QLowEnergyService::DescriptorWriteError); return; } @@ -722,20 +722,20 @@ void QLowEnergyControllerPrivateDarwin::setNotifyValue(QSharedPointer<QLowEnergy // With Core Bluetooth we do not write any descriptor, // but instead call a special method. So it's better to // intercept wrong data size here: - qCWarning(QT_BT_OSX) << "client characteristic configuration descriptor" - "is 2 bytes, but value size is: " << newValue.size(); + qCWarning(QT_BT_DARWIN) << "client characteristic configuration descriptor" + "is 2 bytes, but value size is: " << newValue.size(); service->setError(QLowEnergyService::DescriptorWriteError); return; } if (!serviceList.contains(service->uuid)) { - qCWarning(QT_BT_OSX) << "no service with uuid:" << service->uuid << "found"; + qCWarning(QT_BT_DARWIN) << "no service with uuid:" << service->uuid << "found"; return; } if (!service->characteristicList.contains(charHandle)) { - qCDebug(QT_BT_OSX) << "no characteristic with handle:" - << charHandle << "found"; + qCDebug(QT_BT_DARWIN) << "no characteristic with handle:" + << charHandle << "found"; return; } @@ -758,19 +758,19 @@ void QLowEnergyControllerPrivateDarwin::readCharacteristic(const QSharedPointer< Q_ASSERT_X(!service.isNull(), Q_FUNC_INFO, "invalid service (null)"); if (role == QLowEnergyController::PeripheralRole) { - qCWarning(QT_BT_OSX) << "invalid role (peripheral)"; + qCWarning(QT_BT_DARWIN) << "invalid role (peripheral)"; return; } if (!serviceList.contains(service->uuid)) { - qCWarning(QT_BT_OSX) << "no service with uuid:" - << service->uuid << "found"; + qCWarning(QT_BT_DARWIN) << "no service with uuid:" + << service->uuid << "found"; return; } if (!service->characteristicList.contains(charHandle)) { - qCDebug(QT_BT_OSX) << "no characteristic with handle:" - << charHandle << "found"; + qCDebug(QT_BT_DARWIN) << "no characteristic with handle:" + << charHandle << "found"; return; } @@ -795,14 +795,14 @@ void QLowEnergyControllerPrivateDarwin::writeCharacteristic(const QSharedPointer // (== created by the given LE controller). if (!serviceList.contains(service->uuid) && !localServices.contains(service->uuid)) { - qCWarning(QT_BT_OSX) << "no service with uuid:" - << service->uuid << " found"; + qCWarning(QT_BT_DARWIN) << "no service with uuid:" + << service->uuid << " found"; return; } if (!service->characteristicList.contains(charHandle)) { - qCDebug(QT_BT_OSX) << "no characteristic with handle:" - << charHandle << " found"; + qCDebug(QT_BT_DARWIN) << "no characteristic with handle:" + << charHandle << " found"; return; } @@ -826,7 +826,7 @@ void QLowEnergyControllerPrivateDarwin::writeCharacteristic(const QSharedPointer [manager write:newValueCopy charHandle:charHandle]; }); #else - qCWarning(QT_BT_OSX) << "peripheral role is not supported on your platform"; + qCWarning(QT_BT_DARWIN) << "peripheral role is not supported on your platform"; #endif } } @@ -861,19 +861,19 @@ void QLowEnergyControllerPrivateDarwin::readDescriptor(const QSharedPointer<QLow Q_ASSERT_X(!service.isNull(), Q_FUNC_INFO, "invalid service (null)"); if (role == QLowEnergyController::PeripheralRole) { - qCWarning(QT_BT_OSX) << "invalid role (peripheral)"; + qCWarning(QT_BT_DARWIN) << "invalid role (peripheral)"; return; } if (!serviceList.contains(service->uuid)) { - qCWarning(QT_BT_OSX) << "no service with uuid:" - << service->uuid << "found"; + qCWarning(QT_BT_DARWIN) << "no service with uuid:" + << service->uuid << "found"; return; } dispatch_queue_t leQueue(DarwinBluetooth::qt_LE_queue()); if (!leQueue) { - qCWarning(QT_BT_OSX) << "no LE queue found"; + qCWarning(QT_BT_DARWIN) << "no LE queue found"; return; } // Attention! Copy objects! @@ -895,7 +895,7 @@ void QLowEnergyControllerPrivateDarwin::writeDescriptor(const QSharedPointer<QLo Q_ASSERT_X(!service.isNull(), Q_FUNC_INFO, "invalid service (null)"); if (role == QLowEnergyController::PeripheralRole) { - qCWarning(QT_BT_OSX) << "invalid role (peripheral)"; + qCWarning(QT_BT_DARWIN) << "invalid role (peripheral)"; return; } @@ -903,8 +903,8 @@ void QLowEnergyControllerPrivateDarwin::writeDescriptor(const QSharedPointer<QLo // (== created by the given LE controller), // otherwise we can not write anything at all. if (!serviceList.contains(service->uuid)) { - qCWarning(QT_BT_OSX) << "no service with uuid:" - << service->uuid << " found"; + qCWarning(QT_BT_DARWIN) << "no service with uuid:" + << service->uuid << " found"; return; } @@ -1032,25 +1032,25 @@ void QLowEnergyControllerPrivateDarwin::startAdvertising(const QLowEnergyAdverti Q_UNUSED(params) Q_UNUSED(advertisingData) Q_UNUSED(scanResponseData) - qCWarning(QT_BT_OSX) << "advertising is not supported on your platform"; + qCWarning(QT_BT_DARWIN) << "advertising is not supported on your platform"; #else if (!isValid()) return _q_CBManagerError(QLowEnergyController::UnknownError); if (role != QLowEnergyController::PeripheralRole) { - qCWarning(QT_BT_OSX) << "controller is not a peripheral, cannot start advertising"; + qCWarning(QT_BT_DARWIN) << "controller is not a peripheral, cannot start advertising"; return; } if (state != QLowEnergyController::UnconnectedState) { - qCWarning(QT_BT_OSX) << "invalid state" << state; + qCWarning(QT_BT_DARWIN) << "invalid state" << state; return; } auto leQueue(DarwinBluetooth::qt_LE_queue()); if (!leQueue) { - qCWarning(QT_BT_OSX) << "no LE queue found"; + qCWarning(QT_BT_DARWIN) << "no LE queue found"; setErrorDescription(QLowEnergyController::UnknownError); return; } @@ -1069,13 +1069,13 @@ void QLowEnergyControllerPrivateDarwin::startAdvertising(const QLowEnergyAdverti void QLowEnergyControllerPrivateDarwin::stopAdvertising() { #ifdef Q_OS_TVOS - qCWarning(QT_BT_OSX) << "advertising is not supported on your platform"; + qCWarning(QT_BT_DARWIN) << "advertising is not supported on your platform"; #else if (!isValid()) return _q_CBManagerError(QLowEnergyController::UnknownError); if (state != QLowEnergyController::AdvertisingState) { - qCDebug(QT_BT_OSX) << "cannot stop advertising, called in state" << state; + qCDebug(QT_BT_DARWIN) << "cannot stop advertising, called in state" << state; return; } @@ -1087,7 +1087,7 @@ void QLowEnergyControllerPrivateDarwin::stopAdvertising() setState(QLowEnergyController::UnconnectedState); } else { - qCWarning(QT_BT_OSX) << "no LE queue found"; + qCWarning(QT_BT_DARWIN) << "no LE queue found"; setErrorDescription(QLowEnergyController::UnknownError); return; } |