diff options
author | Timur Pocheptsov <Timur.Pocheptsov@digia.com> | 2014-12-17 12:11:25 +0100 |
---|---|---|
committer | Timur Pocheptsov <Timur.Pocheptsov@digia.com> | 2014-12-18 11:54:23 +0100 |
commit | 67ec0d836cd67089b5f344544a8998b542411dbc (patch) | |
tree | 1e1bcdcc27cb2fd926d38e4537a05a89d6900f49 /src | |
parent | 95d7d8f941866f980c495ad906731b396f24c55a (diff) |
QBluetoothSocket - cleanup (OS X)
Use Q_FUNC_INFO instead of handwritten 'signatures' in asserts/messages.
Change-Id: I639b4293b86120ddc260d3c9e85fd50340afbf60
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/bluetooth/osx/osxbtl2capchannel.mm | 43 | ||||
-rw-r--r-- | src/bluetooth/osx/osxbtl2capchannel_p.h | 19 | ||||
-rw-r--r-- | src/bluetooth/osx/osxbtrfcommchannel.mm | 47 | ||||
-rw-r--r-- | src/bluetooth/osx/osxbtrfcommchannel_p.h | 13 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothsocket_osx.mm | 48 |
5 files changed, 73 insertions, 97 deletions
diff --git a/src/bluetooth/osx/osxbtl2capchannel.mm b/src/bluetooth/osx/osxbtl2capchannel.mm index e0b38dfe..c62efc50 100644 --- a/src/bluetooth/osx/osxbtl2capchannel.mm +++ b/src/bluetooth/osx/osxbtl2capchannel.mm @@ -55,7 +55,7 @@ using namespace QT_NAMESPACE; - (id)initWithDelegate:(OSXBluetooth::ChannelDelegate *)aDelegate { - Q_ASSERT_X(aDelegate, "-initWithDelegate:", "invalid delegate (null)"); + Q_ASSERT_X(aDelegate, Q_FUNC_INFO, "invalid delegate (null)"); if (self = [super init]) { delegate = aDelegate; @@ -72,8 +72,8 @@ using namespace QT_NAMESPACE; { // This type of channel does not require connect, it's created with // already open channel. - Q_ASSERT_X(aDelegate, "-initWithDelegate:channel:", "invalid delegate (null)"); - Q_ASSERT_X(channel, "-initWithDelegate:channel:", "invalid channel (nil)"); + Q_ASSERT_X(aDelegate, Q_FUNC_INFO, "invalid delegate (null)"); + Q_ASSERT_X(channel, Q_FUNC_INFO, "invalid channel (nil)"); if (self = [super init]) { delegate = aDelegate; @@ -108,15 +108,13 @@ using namespace QT_NAMESPACE; withPSM:(BluetoothL2CAPChannelID)psm { if (address.isNull()) { - qCCritical(QT_BT_OSX) << "-connectAsyncToDevice:withPSM:, " - "invalid peer address"; + qCCritical(QT_BT_OSX) << Q_FUNC_INFO << "invalid peer address"; return kIOReturnNoDevice; } // Can never be called twice. if (connected || device || channel) { - qCCritical(QT_BT_OSX) << "-connectAsyncToDevice:withPSM:, " - "connection is already active"; + qCCritical(QT_BT_OSX) << Q_FUNC_INFO << "connection is already active"; return kIOReturnStillOpen; } @@ -125,15 +123,13 @@ using namespace QT_NAMESPACE; const BluetoothDeviceAddress iobtAddress = OSXBluetooth::iobluetooth_address(address); device = [IOBluetoothDevice deviceWithAddress:&iobtAddress]; if (!device) { - qCCritical(QT_BT_OSX) << "-connectAsyncToDevice:withPSM:, " - "failed to create a device"; + qCCritical(QT_BT_OSX) << Q_FUNC_INFO << "failed to create a device"; return kIOReturnNoDevice; } const IOReturn status = [device openL2CAPChannelAsync:&channel withPSM:psm delegate:self]; if (status != kIOReturnSuccess) { - qCCritical(QT_BT_OSX) << "-connectAsyncToDevice:withPSM:, " - "failed to open L2CAP channel"; + qCCritical(QT_BT_OSX) << Q_FUNC_INFO << "failed to open L2CAP channel"; // device is still autoreleased. device = nil; return status; @@ -152,8 +148,7 @@ using namespace QT_NAMESPACE; { Q_UNUSED(l2capChannel) - Q_ASSERT_X(delegate, "-l2capChannelData:data:length", - "invalid delegate (null)"); + Q_ASSERT_X(delegate, Q_FUNC_INFO, "invalid delegate (null)"); if (dataPointer && dataLength) delegate->readChannelData(dataPointer, dataLength); @@ -164,8 +159,7 @@ using namespace QT_NAMESPACE; { Q_UNUSED(l2capChannel) - Q_ASSERT_X(delegate, "-l2capChannelOpenComplete:status:", - "invalid delegate (null)"); + Q_ASSERT_X(delegate, Q_FUNC_INFO, "invalid delegate (null)"); if (error != kIOReturnSuccess) { delegate->setChannelError(error); @@ -179,7 +173,7 @@ using namespace QT_NAMESPACE; { Q_UNUSED(l2capChannel) - Q_ASSERT_X(delegate, "-l2capChannelClosed:", "invalid delegate (null)"); + Q_ASSERT_X(delegate, Q_FUNC_INFO, "invalid delegate (null)"); delegate->channelClosed(); connected = false; } @@ -195,8 +189,7 @@ using namespace QT_NAMESPACE; Q_UNUSED(l2capChannel) Q_UNUSED(refcon) - Q_ASSERT_X(delegate, "-l2capChannelWriteComplete:refcon:status", - "invalid delegate (null)"); + Q_ASSERT_X(delegate, Q_FUNC_INFO, "invalid delegate (null)"); if (error != kIOReturnSuccess) delegate->setChannelError(error); @@ -243,20 +236,18 @@ using namespace QT_NAMESPACE; - (IOReturn) writeSync:(void*)data length:(UInt16)length { - Q_ASSERT_X(data, "-writeSync:length:", "invalid data (null)"); - Q_ASSERT_X(length, "-writeSync:length:", "invalid data size"); - Q_ASSERT_X(connected && channel, "-writeSync:", - "invalid L2CAP channel"); + Q_ASSERT_X(data, Q_FUNC_INFO, "invalid data (null)"); + Q_ASSERT_X(length, Q_FUNC_INFO, "invalid data size"); + Q_ASSERT_X(connected && channel, Q_FUNC_INFO, "invalid L2CAP channel"); return [channel writeSync:data length:length]; } - (IOReturn) writeAsync:(void*)data length:(UInt16)length { - Q_ASSERT_X(data, "-writeAsync:length:", "invalid data (null)"); - Q_ASSERT_X(length, "-writeAync:length:", "invalid data size"); - Q_ASSERT_X(connected && channel, "-writeAsync:length:", - "invalid L2CAP channel"); + Q_ASSERT_X(data, Q_FUNC_INFO, "invalid data (null)"); + Q_ASSERT_X(length, Q_FUNC_INFO, "invalid data size"); + Q_ASSERT_X(connected && channel, Q_FUNC_INFO, "invalid L2CAP channel"); return [channel writeAsync:data length:length refcon:Q_NULLPTR]; } diff --git a/src/bluetooth/osx/osxbtl2capchannel_p.h b/src/bluetooth/osx/osxbtl2capchannel_p.h index 96ea985e..4888be56 100644 --- a/src/bluetooth/osx/osxbtl2capchannel_p.h +++ b/src/bluetooth/osx/osxbtl2capchannel_p.h @@ -44,10 +44,9 @@ #include <QtCore/qglobal.h> -// Must be imported (Obj-C header, no inclusion guards). -#import <IOBluetooth/objc/IOBluetoothL2CAPChannel.h> - #include <Foundation/Foundation.h> +// Only after Foundation.h: +#include "corebluetoothwrapper_p.h" #include <cstddef> @@ -67,20 +66,20 @@ QT_END_NAMESPACE @interface QT_MANGLE_NAMESPACE(OSXBTL2CAPChannel) : NSObject<IOBluetoothL2CAPChannelDelegate> { - QT_PREPEND_NAMESPACE(OSXBluetooth::ChannelDelegate) *delegate; + QT_PREPEND_NAMESPACE(OSXBluetooth)::ChannelDelegate *delegate; IOBluetoothDevice *device; IOBluetoothL2CAPChannel *channel; bool connected; } -- (id)initWithDelegate:(QT_PREPEND_NAMESPACE(OSXBluetooth::ChannelDelegate) *)aDelegate; -- (id)initWithDelegate:(QT_PREPEND_NAMESPACE(OSXBluetooth::ChannelDelegate) *)aDelegate +- (id)initWithDelegate:(QT_PREPEND_NAMESPACE(OSXBluetooth)::ChannelDelegate *)aDelegate; +- (id)initWithDelegate:(QT_PREPEND_NAMESPACE(OSXBluetooth)::ChannelDelegate *)aDelegate channel:(IOBluetoothL2CAPChannel *)aChannel; - (void)dealloc; -// A single async connection (connect can be called only once). -- (IOReturn)connectAsyncToDevice:(const QBluetoothAddress &)address +// Async. connection (connect can be called only once). +- (IOReturn)connectAsyncToDevice:(const QT_PREPEND_NAMESPACE(QBluetoothAddress) &)address withPSM:(BluetoothL2CAPChannelID)psm; // IOBluetoothL2CAPChannelDelegate: @@ -102,12 +101,12 @@ QT_END_NAMESPACE // Writes the given data synchronously over the target L2CAP channel to the remote // device. -// The length of the data may not exceed the L2CAP channel's ougoing MTU. +// The length of the data may not exceed the L2CAP channel's outgoing MTU. // This method will block until the data has been successfully sent to the // hardware for transmission (or an error occurs). - (IOReturn) writeSync:(void*)data length:(UInt16)length; -// The length of the data may not exceed the L2CAP channel's ougoing MTU. +// The length of the data may not exceed the L2CAP channel's outgoing MTU. // When the data has been successfully passed to the hardware to be transmitted, // the delegate method -l2capChannelWriteComplete:refcon:status: will be called. // Returns kIOReturnSuccess if the data was buffered successfully. diff --git a/src/bluetooth/osx/osxbtrfcommchannel.mm b/src/bluetooth/osx/osxbtrfcommchannel.mm index 996b4ebf..df1fd433 100644 --- a/src/bluetooth/osx/osxbtrfcommchannel.mm +++ b/src/bluetooth/osx/osxbtrfcommchannel.mm @@ -44,10 +44,6 @@ #include "qbluetoothaddress.h" #include "osxbtutility_p.h" -// Import, it's Obj-C header. -#import <IOBluetooth/objc/IOBluetoothDevice.h> - - #ifdef QT_NAMESPACE using namespace QT_NAMESPACE; #endif @@ -56,7 +52,7 @@ using namespace QT_NAMESPACE; - (id)initWithDelegate:(OSXBluetooth::ChannelDelegate *)aDelegate { - Q_ASSERT_X(aDelegate, "-initWithDelegate:", "invalid delegate (null)"); + Q_ASSERT_X(aDelegate, Q_FUNC_INFO, "invalid delegate (null)"); if (self = [super init]) { delegate = aDelegate; @@ -73,8 +69,8 @@ using namespace QT_NAMESPACE; { // This type of channel does not require connect, it's created with // already open channel. - Q_ASSERT_X(aDelegate, "-initWithDelegate:channel:", "invalid delegate (null)"); - Q_ASSERT_X(aChannel, "-initWithDelegate:channel:", "invalid channel (nil)"); + Q_ASSERT_X(aDelegate, Q_FUNC_INFO, "invalid delegate (null)"); + Q_ASSERT_X(aChannel, Q_FUNC_INFO, "invalid channel (nil)"); if (self = [super init]) { delegate = aDelegate; @@ -105,15 +101,13 @@ using namespace QT_NAMESPACE; withChannelID:(BluetoothRFCOMMChannelID)channelID { if (address.isNull()) { - qCCritical(QT_BT_OSX) << "-connectAsyncToDevice:withChannelID:, " - "invalid peer address"; + qCCritical(QT_BT_OSX) << Q_FUNC_INFO << "invalid peer address"; return kIOReturnNoDevice; } // Can never be called twice. if (connected || device || channel) { - qCCritical(QT_BT_OSX) << "-connectAsyncToDevice:withChannelID:, " - "connection is already active"; + qCCritical(QT_BT_OSX) << Q_FUNC_INFO << "connection is already active"; return kIOReturnStillOpen; } @@ -122,16 +116,14 @@ using namespace QT_NAMESPACE; const BluetoothDeviceAddress iobtAddress = OSXBluetooth::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) << "-connectAsyncToDevice:withChannelID:, " - "failed to create a device"; + qCCritical(QT_BT_OSX) << Q_FUNC_INFO << "failed to create a device"; return kIOReturnNoDevice; } const IOReturn status = [device openRFCOMMChannelAsync:&channel withChannelID:channelID delegate:self]; if (status != kIOReturnSuccess) { - qCCritical(QT_BT_OSX) << "-connectAsyncToDevice:withChannelID:, " - "failed to open L2CAP channel"; + qCCritical(QT_BT_OSX) << Q_FUNC_INFO << "failed to open L2CAP channel"; // device is still autoreleased. device = nil; return status; @@ -148,8 +140,7 @@ using namespace QT_NAMESPACE; { Q_UNUSED(rfcommChannel) - Q_ASSERT_X(delegate, "-rfcommChannelData:data:length:", - "invalid delegate (null)"); + Q_ASSERT_X(delegate, Q_FUNC_INFO, "invalid delegate (null)"); // Not sure if it can ever happen and if // assert is better. @@ -164,8 +155,7 @@ using namespace QT_NAMESPACE; { Q_UNUSED(rfcommChannel) - Q_ASSERT_X(delegate, "-rfcommChannelOpenComplete:status:", - "invalid delegate (null)"); + Q_ASSERT_X(delegate, Q_FUNC_INFO, "invalid delegate (null)"); if (error != kIOReturnSuccess) { delegate->setChannelError(error); @@ -179,7 +169,7 @@ using namespace QT_NAMESPACE; { Q_UNUSED(rfcommChannel) - Q_ASSERT_X(delegate, "rfcommChannelClosed:", "invalid delegate (null)"); + Q_ASSERT_X(delegate, Q_FUNC_INFO, "invalid delegate (null)"); delegate->channelClosed(); connected = false; } @@ -200,8 +190,7 @@ using namespace QT_NAMESPACE; Q_UNUSED(rfcommChannel) Q_UNUSED(refcon) - Q_ASSERT_X(delegate, "-rfcommChannelWriteComplete:refcon:status:", - "invalid delegate (null)"); + Q_ASSERT_X(delegate, Q_FUNC_INFO, "invalid delegate (null)"); if (error != kIOReturnSuccess) delegate->setChannelError(error); @@ -250,20 +239,18 @@ using namespace QT_NAMESPACE; - (IOReturn) writeSync:(void*)data length:(UInt16)length { - Q_ASSERT_X(data, "-writeSync:length:", "invalid data (null)"); - Q_ASSERT_X(length, "-writeSync:length:", "invalid data size"); - Q_ASSERT_X(connected && channel, "-writeSync:", - "invalid RFCOMM channel"); + Q_ASSERT_X(data, Q_FUNC_INFO, "invalid data (null)"); + Q_ASSERT_X(length, Q_FUNC_INFO, "invalid data size"); + Q_ASSERT_X(connected && channel, Q_FUNC_INFO, "invalid RFCOMM channel"); return [channel writeSync:data length:length]; } - (IOReturn) writeAsync:(void*)data length:(UInt16)length { - Q_ASSERT_X(data, "-writeAsync:length:", "invalid data (null)"); - Q_ASSERT_X(length, "-writeAync:length:", "invalid data size"); - Q_ASSERT_X(connected && channel, "-writeAsync:length:", - "invalid RFCOMM channel"); + Q_ASSERT_X(data, Q_FUNC_INFO, "invalid data (null)"); + Q_ASSERT_X(length, Q_FUNC_INFO, "invalid data size"); + Q_ASSERT_X(connected && channel, Q_FUNC_INFO, "invalid RFCOMM channel"); return [channel writeAsync:data length:length refcon:Q_NULLPTR]; } diff --git a/src/bluetooth/osx/osxbtrfcommchannel_p.h b/src/bluetooth/osx/osxbtrfcommchannel_p.h index 869c9fb3..21c1711c 100644 --- a/src/bluetooth/osx/osxbtrfcommchannel_p.h +++ b/src/bluetooth/osx/osxbtrfcommchannel_p.h @@ -44,10 +44,9 @@ #include <QtCore/qglobal.h> -// Has to be imported, Obj-C header, no inclusion guards. -#import <IOBluetooth/objc/IOBluetoothRFCOMMChannel.h> - #include <Foundation/Foundation.h> +// Only after Foundation.h: +#include "corebluetoothwrapper_p.h" @class QT_MANGLE_NAMESPACE(OSXBTRFCOMMChannel); @class IOBluetoothDevice; @@ -66,20 +65,20 @@ QT_END_NAMESPACE @interface QT_MANGLE_NAMESPACE(OSXBTRFCOMMChannel) : NSObject<IOBluetoothRFCOMMChannelDelegate> { - QT_PREPEND_NAMESPACE(OSXBluetooth::ChannelDelegate) *delegate; + QT_PREPEND_NAMESPACE(OSXBluetooth)::ChannelDelegate *delegate; IOBluetoothDevice *device; IOBluetoothRFCOMMChannel *channel; bool connected; } -- (id)initWithDelegate:(QT_PREPEND_NAMESPACE(OSXBluetooth::ChannelDelegate) *)aDelegate; -- (id)initWithDelegate:(QT_PREPEND_NAMESPACE(OSXBluetooth::ChannelDelegate) *)aDelegate +- (id)initWithDelegate:(QT_PREPEND_NAMESPACE(OSXBluetooth)::ChannelDelegate *)aDelegate; +- (id)initWithDelegate:(QT_PREPEND_NAMESPACE(OSXBluetooth)::ChannelDelegate *)aDelegate channel:(IOBluetoothRFCOMMChannel *)aChannel; - (void)dealloc; // A single async connection (can connect only once). -- (IOReturn)connectAsyncToDevice:(const QBluetoothAddress &)address +- (IOReturn)connectAsyncToDevice:(const QT_PREPEND_NAMESPACE(QBluetoothAddress) &)address withChannelID:(BluetoothRFCOMMChannelID)channelID; - (void)rfcommChannelData:(IOBluetoothRFCOMMChannel*)rfcommChannel diff --git a/src/bluetooth/qbluetoothsocket_osx.mm b/src/bluetooth/qbluetoothsocket_osx.mm index 027c7e37..2bdd1291 100644 --- a/src/bluetooth/qbluetoothsocket_osx.mm +++ b/src/bluetooth/qbluetoothsocket_osx.mm @@ -85,7 +85,7 @@ void QBluetoothSocketPrivate::connectToService(const QBluetoothAddress &address, Q_ASSERT_X(state == QBluetoothSocket::ServiceLookupState || state == QBluetoothSocket::UnconnectedState, - "connectToService()", "invalid state"); + Q_FUNC_INFO, "invalid state"); socketError = QBluetoothSocket::NoSocketError; errorString.clear(); @@ -157,7 +157,7 @@ void QBluetoothSocketPrivate::connectToService(const QBluetoothAddress &address, void QBluetoothSocketPrivate::close() { // Can never be called while we're in connectToService: - Q_ASSERT_X(!isConnecting, "close()", "internal inconsistency - " + Q_ASSERT_X(!isConnecting, Q_FUNC_INFO, "internal inconsistency - " "still in connectToService()"); // Only go through closing if the socket was fully opened @@ -171,7 +171,7 @@ void QBluetoothSocketPrivate::close() void QBluetoothSocketPrivate::abort() { // Can never be called while we're in connectToService: - Q_ASSERT_X(!isConnecting, "abort()", "internal inconsistency - " + Q_ASSERT_X(!isConnecting, Q_FUNC_INFO, "internal inconsistency - " "still in connectToService()"); if (socketType == QBluetoothServiceInfo::RfcommProtocol) @@ -240,10 +240,10 @@ void QBluetoothSocketPrivate::_q_writeNotify() { Q_ASSERT_X(socketType == QBluetoothServiceInfo::L2capProtocol || socketType == QBluetoothServiceInfo::RfcommProtocol, - "_q_writeNotify()", "invalid socket type"); - Q_ASSERT_X(l2capChannel || rfcommChannel, "_q_writeNotify()", + Q_FUNC_INFO, "invalid socket type"); + Q_ASSERT_X(l2capChannel || rfcommChannel, Q_FUNC_INFO, "invalid socket (no open channel)"); - Q_ASSERT_X(q_ptr, "_q_writeNotify()", "invalid q_ptr (null)"); + Q_ASSERT_X(q_ptr, Q_FUNC_INFO, "invalid q_ptr (null)"); if (txBuffer.size()) { const bool isL2CAP = socketType == QBluetoothServiceInfo::L2capProtocol; @@ -281,7 +281,7 @@ bool QBluetoothSocketPrivate::setChannel(IOBluetoothRFCOMMChannel *channel) // It must be a newborn socket! Q_ASSERT_X(socketError == QBluetoothSocket::NoSocketError && state == QBluetoothSocket::UnconnectedState && !rfcommChannel && !l2capChannel, - "QBluetoothSocketPrivate::setChannel()", "unexpected socket state"); + Q_FUNC_INFO, "unexpected socket state"); openMode = QIODevice::ReadWrite; rfcommChannel.reset([[ObjCRFCOMMChannel alloc] initWithDelegate:this channel:channel]); @@ -305,7 +305,7 @@ bool QBluetoothSocketPrivate::setChannel(IOBluetoothL2CAPChannel *channel) // It must be a newborn socket! Q_ASSERT_X(socketError == QBluetoothSocket::NoSocketError && state == QBluetoothSocket::UnconnectedState && !l2capChannel && !rfcommChannel, - "QBluetoothSocketPrivate::setChannel()", "unexpected socket state"); + Q_FUNC_INFO, "unexpected socket state"); openMode = QIODevice::ReadWrite; l2capChannel.reset([[ObjCL2CAPChannel alloc] initWithDelegate:this channel:channel]); @@ -323,7 +323,7 @@ void QBluetoothSocketPrivate::setChannelError(IOReturn errorCode) { Q_UNUSED(errorCode) - Q_ASSERT_X(q_ptr, "setChannelError()", "invalid q_ptr (null)"); + Q_ASSERT_X(q_ptr, Q_FUNC_INFO, "invalid q_ptr (null)"); if (isConnecting) { // The delegate's method was called while we are still in @@ -336,7 +336,7 @@ void QBluetoothSocketPrivate::setChannelError(IOReturn errorCode) void QBluetoothSocketPrivate::channelOpenComplete() { - Q_ASSERT_X(q_ptr, "channelOpenComplete()", "invalid q_ptr (null)"); + Q_ASSERT_X(q_ptr, Q_FUNC_INFO, "invalid q_ptr (null)"); if (!isConnecting) { q_ptr->setSocketState(QBluetoothSocket::ConnectedState); @@ -351,7 +351,7 @@ void QBluetoothSocketPrivate::channelOpenComplete() void QBluetoothSocketPrivate::channelClosed() { - Q_ASSERT_X(q_ptr, "channelClosed()", "invalid q_ptr (null)"); + Q_ASSERT_X(q_ptr, Q_FUNC_INFO, "invalid q_ptr (null)"); // Channel was closed by IOBluetooth and we can not write any data // (thus close/abort probably will not work). @@ -369,9 +369,9 @@ void QBluetoothSocketPrivate::channelClosed() void QBluetoothSocketPrivate::readChannelData(void *data, std::size_t size) { - Q_ASSERT_X(data, "readChannelData()", "invalid data (null)"); - Q_ASSERT_X(size, "readChannelData()", "invalid data size (0)"); - Q_ASSERT_X(q_ptr, "readChannelData()", "invalid q_ptr (null)"); + Q_ASSERT_X(data, Q_FUNC_INFO, "invalid data (null)"); + Q_ASSERT_X(size, Q_FUNC_INFO, "invalid data size (0)"); + Q_ASSERT_X(q_ptr, Q_FUNC_INFO, "invalid q_ptr (null)"); const char *src = static_cast<char *>(data); char *dst = buffer.reserve(size); @@ -390,8 +390,8 @@ void QBluetoothSocketPrivate::writeComplete() qint64 QBluetoothSocketPrivate::writeData(const char *data, qint64 maxSize) { - Q_ASSERT_X(data, "writeData()", "invalid data (null)"); - Q_ASSERT_X(maxSize > 0, "writeData()", "invalid data size"); + Q_ASSERT_X(data, Q_FUNC_INFO, "invalid data (null)"); + Q_ASSERT_X(maxSize > 0, Q_FUNC_INFO, "invalid data size"); if (state != QBluetoothSocket::ConnectedState) { errorString = tr("Cannot write while not connected"); @@ -403,7 +403,7 @@ qint64 QBluetoothSocketPrivate::writeData(const char *data, qint64 maxSize) // IOBluetoothL2CAPChannel buffered (writeAsync). if (!txBuffer.size()) - QMetaObject::invokeMethod(this, "_q_writeNotify", Qt::QueuedConnection); + QMetaObject::invokeMethod(this, Q_FUNC_INFO, Qt::QueuedConnection); char *dst = txBuffer.reserve(maxSize); std::copy(data, data + maxSize, dst); @@ -452,7 +452,7 @@ qint64 QBluetoothSocket::bytesToWrite() const void QBluetoothSocket::connectToService(const QBluetoothServiceInfo &service, OpenMode openMode) { if (state() != UnconnectedState && state() != ServiceLookupState) { - qCWarning(QT_BT_OSX) << "QBluetoothSocket::connectToService() called on a busy socket"; + qCWarning(QT_BT_OSX) << Q_FUNC_INFO << "called on a busy socket"; d_ptr->errorString = tr("Trying to connect while connection is in progress"); setSocketError(OperationError); return; @@ -468,7 +468,8 @@ void QBluetoothSocket::connectToService(const QBluetoothServiceInfo &service, Op } 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_OSX) << Q_FUNC_INFO << "No port, " + "no PSM, and no UUID provided, unable to connect"; return; } @@ -480,7 +481,7 @@ void QBluetoothSocket::connectToService(const QBluetoothAddress &address, const OpenMode openMode) { if (state() != QBluetoothSocket::UnconnectedState) { - qCWarning(QT_BT_OSX) << "QBluetoothSocket::connectToService() called on a busy socket"; + qCWarning(QT_BT_OSX) << Q_FUNC_INFO << "called on a busy socket"; d_ptr->errorString = tr("Trying to connect while connection is in progress"); setSocketError(QBluetoothSocket::OperationError); return; @@ -497,7 +498,7 @@ void QBluetoothSocket::connectToService(const QBluetoothAddress &address, quint1 OpenMode openMode) { if (state() != QBluetoothSocket::UnconnectedState) { - qCWarning(QT_BT_OSX) << "QBluetoothSocket::connectToService() called on a busy socket"; + qCWarning(QT_BT_OSX) << Q_FUNC_INFO << "called on a busy socket"; d_ptr->errorString = tr("Trying to connect while connection is in progress"); setSocketError(OperationError); return; @@ -538,8 +539,7 @@ void QBluetoothSocket::setSocketState(QBluetoothSocket::SocketState state) // We can register for L2CAP/RFCOMM open notifications, // that's different from 'listen' and is implemented // in QBluetoothServer. - qCWarning(QT_BT_OSX) << "QBluetoothSocket::setSocketState(), " - "listening sockets are not supported"; + qCWarning(QT_BT_OSX) << Q_FUNC_INFO << "listening sockets are not supported"; } } @@ -577,7 +577,7 @@ void QBluetoothSocket::doDeviceDiscovery(const QBluetoothServiceInfo &service, O if (!service.serviceClassUuids().isEmpty()) d_ptr->discoveryAgent->setUuidFilter(service.serviceClassUuids()); - Q_ASSERT_X(!d_ptr->discoveryAgent->uuidFilter().isEmpty(), "doDeviceDiscovery()", + Q_ASSERT_X(!d_ptr->discoveryAgent->uuidFilter().isEmpty(), Q_FUNC_INFO, "invalid service info"); d_ptr->discoveryAgent->start(QBluetoothServiceDiscoveryAgent::FullDiscovery); |