diff options
Diffstat (limited to 'src/imports/bluetooth/qdeclarativebluetoothservice.cpp')
-rw-r--r-- | src/imports/bluetooth/qdeclarativebluetoothservice.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/imports/bluetooth/qdeclarativebluetoothservice.cpp b/src/imports/bluetooth/qdeclarativebluetoothservice.cpp index be8f90c0..6d4e3dc0 100644 --- a/src/imports/bluetooth/qdeclarativebluetoothservice.cpp +++ b/src/imports/bluetooth/qdeclarativebluetoothservice.cpp @@ -41,7 +41,9 @@ #include "qdeclarativebluetoothservice_p.h" -#include <qbluetoothdeviceinfo.h> +#include <QtCore/QLoggingCategory> + +#include <QtBluetooth/QBluetoothDeviceInfo> #include <QtBluetooth/QBluetoothSocket> #include <QtBluetooth/QBluetoothAddress> #include <QtBluetooth/QBluetoothServer> @@ -80,6 +82,8 @@ \endlist */ +Q_DECLARE_LOGGING_CATEGORY(QT_BT_QML) + class QDeclarativeBluetoothServicePrivate { public: @@ -269,16 +273,14 @@ bool QDeclarativeBluetoothService::isRegistered() const int QDeclarativeBluetoothServicePrivate::listen() { if (m_service->socketProtocol() == QBluetoothServiceInfo::UnknownProtocol) { - qWarning() << "Unknown protocol, can't make service" << m_protocol; + qCWarning(QT_BT_QML) << "Unknown protocol, can't make service" << m_protocol; return -1; } - QBluetoothServiceInfo::Protocol serverType; - if (m_service->socketProtocol() == QBluetoothServiceInfo::L2capProtocol) { + QBluetoothServiceInfo::Protocol serverType = QBluetoothServiceInfo::UnknownProtocol; + if (m_service->socketProtocol() == QBluetoothServiceInfo::L2capProtocol) serverType = QBluetoothServiceInfo::L2capProtocol; - } - else if (m_service->socketProtocol() == QBluetoothServiceInfo::RfcommProtocol) { + else if (m_service->socketProtocol() == QBluetoothServiceInfo::RfcommProtocol) serverType = QBluetoothServiceInfo::RfcommProtocol; - } QBluetoothServer *server = new QBluetoothServer(serverType); server->setMaxPendingConnections(1); @@ -333,7 +335,7 @@ void QDeclarativeBluetoothService::setRegistered(bool registered) protocolDescriptorList.append(QVariant::fromValue(protocol)); } else { - qWarning() << "No protocol specified for bluetooth service"; + qCWarning(QT_BT_QML) << "No protocol specified for bluetooth service"; } d->m_service->setAttribute(QBluetoothServiceInfo::ProtocolDescriptorList, protocolDescriptorList); @@ -342,7 +344,7 @@ void QDeclarativeBluetoothService::setRegistered(bool registered) emit registeredChanged(); } else { - qWarning() << "Register service failed"; + qCWarning(QT_BT_QML) << "Register service failed"; //TODO propaget this error to the user } } @@ -366,7 +368,7 @@ QDeclarativeBluetoothSocket *QDeclarativeBluetoothService::nextClient() return new QDeclarativeBluetoothSocket(socket, this, 0); } else { - qWarning() << "Socket has no pending connection, failing"; + qCWarning(QT_BT_QML) << "Socket has no pending connection, failing"; return 0; } } @@ -383,7 +385,7 @@ void QDeclarativeBluetoothService::assignNextClient(QDeclarativeBluetoothSocket return; } else { - qWarning() << "Socket has no pending connection, failing"; + qCWarning(QT_BT_QML) << "Socket has no pending connection, failing"; return; } } |