summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/osx
diff options
context:
space:
mode:
Diffstat (limited to 'src/bluetooth/osx')
-rw-r--r--src/bluetooth/osx/osxbtcentralmanager.mm104
-rw-r--r--src/bluetooth/osx/osxbtdeviceinquiry.mm8
-rw-r--r--src/bluetooth/osx/osxbtdevicepair.mm4
-rw-r--r--src/bluetooth/osx/osxbtgcdtimer.mm2
-rw-r--r--src/bluetooth/osx/osxbtl2capchannel.mm8
-rw-r--r--src/bluetooth/osx/osxbtledeviceinquiry.mm4
-rw-r--r--src/bluetooth/osx/osxbtobexsession.mm40
-rw-r--r--src/bluetooth/osx/osxbtperipheralmanager.mm68
-rw-r--r--src/bluetooth/osx/osxbtrfcommchannel.mm8
-rw-r--r--src/bluetooth/osx/osxbtsdpinquiry.mm8
-rw-r--r--src/bluetooth/osx/osxbtutility.mm26
-rw-r--r--src/bluetooth/osx/osxbtutility_p.h3
12 files changed, 135 insertions, 148 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