diff options
58 files changed, 14 insertions, 4654 deletions
diff --git a/examples/btchat/btchat.pro b/examples/btchat/btchat.pro index 37f4b3ee..28e1692a 100644 --- a/examples/btchat/btchat.pro +++ b/examples/btchat/btchat.pro @@ -21,7 +21,3 @@ HEADERS = \ FORMS = \ chat.ui \ remoteselector.ui - -symbian { - TARGET.CAPABILITY = LocalServices UserEnvironment ReadUserData WriteUserData NetworkServices NetworkControl ReadDeviceData WriteDeviceData SwEvent -} diff --git a/examples/btchat/chat.cpp b/examples/btchat/chat.cpp index fccb7249..97b545c7 100644 --- a/examples/btchat/chat.cpp +++ b/examples/btchat/chat.cpp @@ -61,7 +61,7 @@ Chat::Chat(QWidget *parent) //! [Construct UI] ui->setupUi(this); -#if defined (Q_OS_SYMBIAN) || defined(Q_OS_WINCE) || defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) +#if defined(Q_OS_WINCE) || defined(Q_WS_MAEMO_6) setWindowState(Qt::WindowFullScreen); #endif diff --git a/examples/btchat/main.cpp b/examples/btchat/main.cpp index 19ea4dbd..63b82c42 100644 --- a/examples/btchat/main.cpp +++ b/examples/btchat/main.cpp @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) Chat d; QObject::connect(&d, SIGNAL(accepted()), &app, SLOT(quit())); -#if defined(Q_WS_MAEMO_6) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_MAEMO_6) d.showFullScreen(); #else d.show(); diff --git a/examples/btchat/remoteselector.cpp b/examples/btchat/remoteselector.cpp index 101fb8ab..de44c549 100644 --- a/examples/btchat/remoteselector.cpp +++ b/examples/btchat/remoteselector.cpp @@ -52,7 +52,7 @@ RemoteSelector::RemoteSelector(QWidget *parent) { ui->setupUi(this); -#if defined (Q_OS_SYMBIAN) || defined(Q_OS_WINCE) || defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) +#if defined(Q_OS_WINCE) || defined(Q_WS_MAEMO_6) setWindowState(Qt::WindowFullScreen); #endif diff --git a/examples/btfiletransfer/btfiletransfer.pro b/examples/btfiletransfer/btfiletransfer.pro index 11a4de4b..071941ee 100644 --- a/examples/btfiletransfer/btfiletransfer.pro +++ b/examples/btfiletransfer/btfiletransfer.pro @@ -21,11 +21,6 @@ FORMS = \ progress.ui \ pindisplay.ui - -symbian { - TARGET.CAPABILITY = LocalServices UserEnvironment ReadUserData WriteUserData NetworkServices ReadDeviceData WriteDeviceData -} - OTHER_FILES += \ busy.gif \ pairing.gif diff --git a/examples/btfiletransfer/main.cpp b/examples/btfiletransfer/main.cpp index 058f122a..a3738fde 100644 --- a/examples/btfiletransfer/main.cpp +++ b/examples/btfiletransfer/main.cpp @@ -49,11 +49,7 @@ int main(int argc, char *argv[]) RemoteSelector d; QObject::connect(&d, SIGNAL(accepted()), &app, SLOT(quit())); d.startDiscovery(); -#ifdef Q_OS_SYMBIAN - d.showFullScreen(); -#else d.show(); -#endif app.exec(); diff --git a/examples/btscanner/device.cpp b/examples/btscanner/device.cpp index dc661fac..849aac68 100644 --- a/examples/btscanner/device.cpp +++ b/examples/btscanner/device.cpp @@ -54,7 +54,7 @@ DeviceDiscoveryDialog::DeviceDiscoveryDialog(QWidget *parent) { ui->setupUi(this); -#if defined (Q_OS_SYMBIAN) || defined(Q_OS_WINCE) || defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) +#if defined(Q_OS_WINCE) || defined(Q_WS_MAEMO_6) setWindowState(Qt::WindowFullScreen); #endif diff --git a/examples/btscanner/service.cpp b/examples/btscanner/service.cpp index b8527403..dca65a43 100644 --- a/examples/btscanner/service.cpp +++ b/examples/btscanner/service.cpp @@ -52,7 +52,7 @@ ServiceDiscoveryDialog::ServiceDiscoveryDialog(const QString &name, { ui->setupUi(this); -#if defined (Q_OS_SYMBIAN) || defined(Q_OS_WINCE) || defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) +#if defined(Q_OS_WINCE) || defined(Q_WS_MAEMO_6) setWindowState(Qt::WindowMaximized); #endif diff --git a/examples/bttennis/main.cpp b/examples/bttennis/main.cpp index b35cd9a9..b032eadb 100644 --- a/examples/bttennis/main.cpp +++ b/examples/bttennis/main.cpp @@ -50,7 +50,7 @@ int main(int argc, char *argv[]) Tennis d; QObject::connect(&d, SIGNAL(accepted()), &app, SLOT(quit())); -#if defined(Q_WS_MAEMO_6) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_MAEMO_6) d.showFullScreen(); #else d.show(); diff --git a/examples/bttennis/tennis.cpp b/examples/bttennis/tennis.cpp index 2376f756..eb012f9a 100644 --- a/examples/bttennis/tennis.cpp +++ b/examples/bttennis/tennis.cpp @@ -82,7 +82,7 @@ Tennis::Tennis(QWidget *parent) isConnected = false; quickDiscovery = true; -#if defined (Q_OS_SYMBIAN) || defined(Q_OS_WINCE) || defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) +#if defined(Q_OS_WINCE) || defined(Q_WS_MAEMO_6) setWindowState(Qt::WindowMaximized); #endif diff --git a/examples/scanner/qmlscanner.cpp b/examples/scanner/qmlscanner.cpp index 84397f47..a6b87e90 100644 --- a/examples/scanner/qmlscanner.cpp +++ b/examples/scanner/qmlscanner.cpp @@ -52,13 +52,11 @@ int main(int argc, char *argv[]) // Qt.quit() called in embedded .qml by default only emits // quit() signal, so do this (optionally use Qt.exit()). QObject::connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit())); -#if defined(Q_OS_SYMBIAN) +#if defined(Q_WS_MAEMO_6) view.showFullScreen(); -#elif defined(Q_WS_MAEMO_6) - view.showFullScreen(); -#else // Q_OS_SYMBIAN +#else view.setGeometry(QRect(100, 100, 360, 640)); view.show(); -#endif // Q_OS_SYMBIAN +#endif return application.exec(); } diff --git a/src/bluetooth/bluetooth.pro b/src/bluetooth/bluetooth.pro index 8a8521ac..93e82e71 100644 --- a/src/bluetooth/bluetooth.pro +++ b/src/bluetooth/bluetooth.pro @@ -60,61 +60,7 @@ SOURCES += \ qbluetoothtransferrequest.cpp \ qbluetoothtransferreply.cpp -symbian { - contains(S60_VERSION, 3.1) | contains(S60_VERSION, 3.2) { - DEFINES += DO_NOT_BUILD_BLUETOOTH_SYMBIAN_BACKEND - message("S60 3.1 or 3.2 sdk not supported by bluetooth") - SOURCES += \ - qbluetoothdevicediscoveryagent_p.cpp \ - qbluetoothlocaldevice_p.cpp \ - qbluetoothserviceinfo_p.cpp \ - qbluetoothservicediscoveryagent_p.cpp \ - qbluetoothsocket_p.cpp \ - ql2capserver_p.cpp \ - qrfcommserver_p.cpp \ - qbluetoothtransfermanager_p.cpp - } -} - -symbian { - !contains(DEFINES, DO_NOT_BUILD_BLUETOOTH_SYMBIAN_BACKEND) { - DEFINES += QT_SYMBIAN_BLUETOOTH - INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE - include(symbian/symbian.pri) - - PRIVATE_HEADERS += \ - qbluetoothtransferreply_symbian_p.h \ - qbluetoothlocaldevice_p.h - - SOURCES += \ - qbluetoothserviceinfo_symbian.cpp\ - qbluetoothdevicediscoveryagent_symbian.cpp\ - qbluetoothservicediscoveryagent_symbian.cpp\ - qbluetoothsocket_symbian.cpp\ - qrfcommserver_symbian.cpp \ - qbluetoothlocaldevice_symbian.cpp \ - qbluetoothtransfermanager_symbian.cpp \ - qbluetoothtransferreply_symbian.cpp \ - ql2capserver_symbian.cpp - - contains(S60_VERSION, 5.0) { - message("NOTICE - START") - message("Bluetooth backend needs SDK plugin from Forum Nokia for 5.0 SDK") - message("NOTICE - END") - LIBS *= -lirobex - } else { - LIBS *= -lobex - } - LIBS *= -lesock \ - -lbluetooth \ - -lsdpagent \ - -lsdpdatabase \ - -lestlib \ - -lbtengsettings \ - -lbtmanclient \ - -lbtdevice - } -} else:contains(config_test_bluez, yes):contains(QT_CONFIG, dbus) { +contains(config_test_bluez, yes):contains(QT_CONFIG, dbus) { QT *= dbus DEFINES += QT_BLUEZ_BLUETOOTH @@ -143,7 +89,7 @@ symbian { } else { message("Unsupported bluetooth platform, will not build a working QBluetooth library") - message("Either no Qt dBus found, no bluez headers, or not symbian") + message("Either no Qt dBus found or no Bluez headers") SOURCES += \ qbluetoothdevicediscoveryagent_p.cpp \ qbluetoothlocaldevice_p.cpp \ diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent.h b/src/bluetooth/qbluetoothdevicediscoveryagent.h index 71649d92..63b52976 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent.h +++ b/src/bluetooth/qbluetoothdevicediscoveryagent.h @@ -105,11 +105,6 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_deviceFound(const QString &address, const QVariantMap &dict)); Q_PRIVATE_SLOT(d_func(), void _q_propertyChanged(const QString &name, const QDBusVariant &value)); #endif - -#ifdef QT_SYMBIAN_BLUETOOTH - Q_PRIVATE_SLOT(d_func(), void _q_newDeviceFound(const QBluetoothDeviceInfo &device)) - Q_PRIVATE_SLOT(d_func(), void _q_setError(QBluetoothDeviceDiscoveryAgent::Error errorCode, QString errorDescription)) -#endif // QT_SYMBIAN_BLUETOOTH }; QTBLUETOOTH_END_NAMESPACE diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_p.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_p.cpp index 742dfa22..49ca9059 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_p.cpp +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_p.cpp @@ -85,11 +85,4 @@ void QBluetoothDeviceDiscoveryAgentPrivate::_q_propertyChanged(const QString &na } #endif -#ifdef QT_SYMBIAN_BLUETOOTH -void _q_newDeviceFound(const QBluetoothDeviceInfo &device) -{ - -} -#endif - QTBLUETOOTH_END_NAMESPACE diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_p.h b/src/bluetooth/qbluetoothdevicediscoveryagent_p.h index 68da0478..e9925d77 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_p.h +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_p.h @@ -55,12 +55,6 @@ class QDBusVariant; QT_END_NAMESPACE #endif -#ifdef QT_SYMBIAN_BLUETOOTH -#include "symbian/bluetoothlinkmanagerdevicediscoverer.h" -#include <es_sock.h> -#include <bt_sock.h> -#endif - QT_BEGIN_HEADER QTBLUETOOTH_BEGIN_NAMESPACE @@ -76,24 +70,12 @@ public: void stop(); bool isActive() const; -#ifdef QT_SYMBIAN_BLUETOOTH -// private slots - void _q_newDeviceFound(const QBluetoothDeviceInfo &device); - void _q_setError(QBluetoothDeviceDiscoveryAgent::Error errorCode, - QString errorDescription); -#endif - #ifdef QT_BLUEZ_BLUETOOTH void _q_deviceFound(const QString &address, const QVariantMap &dict); void _q_propertyChanged(const QString &name, const QDBusVariant &value); #endif private: -#ifdef QT_SYMBIAN_BLUETOOTH - void allocate(); - uint inquiryTypeToIAC() const; -#endif - QList<QBluetoothDeviceInfo> discoveredDevices; QBluetoothDeviceDiscoveryAgent::InquiryType inquiryType; @@ -108,14 +90,6 @@ private: OrgBluezAdapterInterface *adapter; #endif -#ifdef QT_SYMBIAN_BLUETOOTH - // shared socket servet among RHostResolvers - RSocketServ m_socketServer; - // active object for device discovery - BluetoothLinkManagerDeviceDiscoverer *m_deviceDiscovery; - -#endif - QBluetoothDeviceDiscoveryAgent *q_ptr; }; diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_symbian.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_symbian.cpp deleted file mode 100644 index 4b76873d..00000000 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_symbian.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtBluetooth module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qbluetoothdevicediscoveryagent_p.h" -#include "qbluetoothaddress.h" - -#include <bttypes.h> - -#include <QDebug> - -QTBLUETOOTH_BEGIN_NAMESPACE - -QBluetoothDeviceDiscoveryAgentPrivate::QBluetoothDeviceDiscoveryAgentPrivate() - : inquiryType(QBluetoothDeviceDiscoveryAgent::GeneralUnlimitedInquiry) - , lastError(QBluetoothDeviceDiscoveryAgent::NoError) - , errorString(QString()) - , m_deviceDiscovery(0) -{ - /* connect to socker server */ - TInt result = m_socketServer.Connect(); - if (result != KErrNone) - _q_setError(QBluetoothDeviceDiscoveryAgent::UnknownError, - QString("RSocketServ.Connect() failed with error")); -} - -QBluetoothDeviceDiscoveryAgentPrivate::~QBluetoothDeviceDiscoveryAgentPrivate() -{ - delete m_deviceDiscovery; - if (m_socketServer.Handle() != NULL) - m_socketServer.Close(); -} - -void QBluetoothDeviceDiscoveryAgentPrivate::allocate() -{ - Q_Q(QBluetoothDeviceDiscoveryAgent); - // create link manager device discoverer - if (m_socketServer.Handle() != NULL) { - // create new active object for querying devices - m_deviceDiscovery = new BluetoothLinkManagerDeviceDiscoverer(m_socketServer); - if (m_deviceDiscovery) { - QObject::connect(m_deviceDiscovery, SIGNAL(deviceDiscoveryComplete()), q, SIGNAL(finished())); - QObject::connect(m_deviceDiscovery, SIGNAL(deviceDiscovered(const QBluetoothDeviceInfo&)), - q, SLOT(_q_newDeviceFound(const QBluetoothDeviceInfo&))); - QObject::connect(m_deviceDiscovery, SIGNAL(linkManagerError(QBluetoothDeviceDiscoveryAgent::Error,QString)), - q, SLOT(_q_setError(QBluetoothDeviceDiscoveryAgent::Error,QString))); - QObject::connect(m_deviceDiscovery, SIGNAL(canceled()), q, SIGNAL(canceled())); - } else { - _q_setError(QBluetoothDeviceDiscoveryAgent::UnknownError, - QString("Cannot allocate BluetoothLinkManagerDeviceDiscoverer: failed with error")); - } - } -} - -void QBluetoothDeviceDiscoveryAgentPrivate::start() -{ - - // clear list of found devices - discoveredDevices.clear(); - if (!m_deviceDiscovery) { - allocate(); - } - m_deviceDiscovery->startDiscovery(inquiryTypeToIAC()); - -} - -void QBluetoothDeviceDiscoveryAgentPrivate::stop() -{ - if (m_deviceDiscovery) - m_deviceDiscovery->stopDiscovery(); -} - -bool QBluetoothDeviceDiscoveryAgentPrivate::isActive() const -{ - if (m_deviceDiscovery) - return m_deviceDiscovery->isReallyActive(); - return false; -} - -void QBluetoothDeviceDiscoveryAgentPrivate::_q_setError(QBluetoothDeviceDiscoveryAgent::Error errorCode, - QString errorDescription) -{ - qDebug() << __PRETTY_FUNCTION__ << errorCode << errorDescription; - if (errorCode == KErrNone) - return; - - Q_Q(QBluetoothDeviceDiscoveryAgent); - - errorString = errorDescription; - emit q->error(errorCode); -} - -void QBluetoothDeviceDiscoveryAgentPrivate::_q_newDeviceFound(const QBluetoothDeviceInfo &device) -{ - // add found device to the list of devices - discoveredDevices.append(device); - Q_Q(QBluetoothDeviceDiscoveryAgent); - emit q->deviceDiscovered(device); -} - -uint QBluetoothDeviceDiscoveryAgentPrivate::inquiryTypeToIAC() const -{ - return inquiryType == QBluetoothDeviceDiscoveryAgent::LimitedInquiry ? KLIAC : KGIAC; -} - -QTBLUETOOTH_END_NAMESPACE diff --git a/src/bluetooth/qbluetoothlocaldevice.h b/src/bluetooth/qbluetoothlocaldevice.h index 56db36a2..701dd85e 100644 --- a/src/bluetooth/qbluetoothlocaldevice.h +++ b/src/bluetooth/qbluetoothlocaldevice.h @@ -137,11 +137,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QBluetoothLocalDevice) QBluetoothLocalDevicePrivate *d_ptr; -#ifdef QT_SYMBIAN_BLUETOOTH - Q_PRIVATE_SLOT(d_func(), void _q_pairingFinished(const QBluetoothAddress &, QBluetoothLocalDevice::Pairing)) - Q_PRIVATE_SLOT(d_func(), void _q_registryError(int error)) - Q_PRIVATE_SLOT(d_func(), void _q_pairingError(int error)) -#endif //QT_SYMBIAN_BLUETOOTH }; QTBLUETOOTH_END_NAMESPACE diff --git a/src/bluetooth/qbluetoothlocaldevice_p.h b/src/bluetooth/qbluetoothlocaldevice_p.h index f289e2b1..0c592612 100644 --- a/src/bluetooth/qbluetoothlocaldevice_p.h +++ b/src/bluetooth/qbluetoothlocaldevice_p.h @@ -46,11 +46,6 @@ #include "qbluetoothlocaldevice.h" -#ifdef QT_SYMBIAN_BLUETOOTH -#include <e32base.h> -#include <btengsettings.h> -#endif - #ifdef QT_BLUEZ_BLUETOOTH #include <QObject> #include <QDBusContext> @@ -109,46 +104,6 @@ private: QBluetoothLocalDevice *q_ptr; }; - -#elif defined(QT_SYMBIAN_BLUETOOTH) - -class QBluetoothLocalDevicePrivate - : public MBTEngSettingsObserver -{ - Q_DECLARE_PUBLIC(QBluetoothLocalDevice) -public: - QBluetoothLocalDevicePrivate(); - ~QBluetoothLocalDevicePrivate(); - - static QString name(); - static QBluetoothAddress address(); - - void powerOn(); - void powerOff(); - void setHostMode(QBluetoothLocalDevice::HostMode mode); - QBluetoothLocalDevice::HostMode hostMode() const; - - void requestPairing(const QBluetoothAddress &address, QBluetoothLocalDevice::Pairing pairing); - QBluetoothLocalDevice::Pairing pairingStatus(const QBluetoothAddress &address) const; - - void pairingConfirmation(bool confirmation); - //slots exposed for the public api. - void _q_pairingFinished(const QBluetoothAddress &address, QBluetoothLocalDevice::Pairing pairing); - void _q_registryError(int error); - void _q_pairingError(int error); - -private: - //From MBTEngSettingsObserver - void PowerStateChanged(TBTPowerStateValue aState); - void VisibilityModeChanged(TBTVisibilityMode aState); - -private: - CBTEngSettings *m_settings; - -protected: - QBluetoothLocalDevice *q_ptr; - -}; #else class QBluetoothLocalDevicePrivate : public QObject { diff --git a/src/bluetooth/qbluetoothlocaldevice_symbian.cpp b/src/bluetooth/qbluetoothlocaldevice_symbian.cpp deleted file mode 100644 index f0a691f4..00000000 --- a/src/bluetooth/qbluetoothlocaldevice_symbian.cpp +++ /dev/null @@ -1,424 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtBluetooth module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qbluetoothlocaldevice_p.h" - -#include "qbluetoothlocaldevice.h" -#include <QtCore/QString> -#include "symbian/utils_symbian_p.h" -#include <bttypes.h> -#include <bt_subscribe.h> -#ifdef USING_BTENGCONNMAN -#include "bluetoothsymbianpairingadapter.h" -#endif //USING_BTENGCONNMAN -#ifdef USING_BTENGDEVMAN -#include "bluetoothsymbianregistryadapter.h" -#endif //USING_BTENGDEVMAN - -QTBLUETOOTH_BEGIN_NAMESPACE - -QBluetoothLocalDevicePrivate::QBluetoothLocalDevicePrivate() - : m_settings(NULL) -{ - TRAPD(err, m_settings = CBTEngSettings::NewL(this)); - if (err != KErrNone) { - Q_Q(QBluetoothLocalDevice); - emit q->error(QBluetoothLocalDevice::UnknownError); - m_settings = NULL; - } -} - -QBluetoothLocalDevicePrivate::~QBluetoothLocalDevicePrivate() -{ - delete m_settings; -} - -QString QBluetoothLocalDevicePrivate::name() -{ - CBTEngSettings *settings = NULL; - TRAPD(err, settings = CBTEngSettings::NewL()); - if (err != KErrNone) - return QString(); - HBufC *localName = NULL; - TRAPD(error, localName = HBufC::NewL(256)); - if (error != KErrNone) { - delete settings; - return QString(); - } - TPtr localPtr = localName->Des(); - TInt errorCode = settings->GetLocalName(localPtr); - QString name; - if (errorCode == KErrNone) - name = s60DescToQString(localPtr); - - delete localName; - delete settings; - return name; -} - -QBluetoothAddress QBluetoothLocalDevicePrivate::address() -{ - TBuf<20> bluetoothAddress; - TPckgBuf<TBTDevAddr> addressPackage; - - TInt error = RProperty::Get(KUidSystemCategory, KPropertyKeyBluetoothGetLocalDeviceAddress, addressPackage); - - if (error != KErrNone) - return QBluetoothAddress(); - - addressPackage().GetReadable(bluetoothAddress, KNullDesC, _L(":"), KNullDesC); - - return QBluetoothAddress(s60DescToQString(bluetoothAddress)); -} - -void QBluetoothLocalDevicePrivate::powerOn() -{ - if (!m_settings) - return; - TBTPowerStateValue powerState; - TInt error = m_settings->GetPowerState(powerState); - if (error == KErrNone && powerState == EBTPowerOff) - m_settings->SetPowerState(EBTPowerOn); - else if (error != KErrNone) { - Q_Q(QBluetoothLocalDevice); - emit q->error(QBluetoothLocalDevice::UnknownError); - } -} -void QBluetoothLocalDevicePrivate::powerOff() -{ - if (!m_settings) - return; - TBTPowerStateValue powerState; - TInt error = m_settings->GetPowerState(powerState); - if (error == KErrNone && powerState == EBTPowerOn) - m_settings->SetPowerState(EBTPowerOff); - else if (error != KErrNone) { - Q_Q(QBluetoothLocalDevice); - emit q->error(QBluetoothLocalDevice::UnknownError); - } -} -void QBluetoothLocalDevicePrivate::setHostMode(QBluetoothLocalDevice::HostMode mode) -{ - if (!m_settings) - return; - - TInt error = KErrNone; - switch (mode) { - case QBluetoothLocalDevice::HostPoweredOff: - powerOff(); - break; - case QBluetoothLocalDevice::HostConnectable: { - TBTPowerStateValue powerState; - error = m_settings->GetPowerState(powerState); - if (error == KErrNone) { - if (powerState == EBTPowerOff) { - error = m_settings->SetPowerState(EBTPowerOn); - } - TBTVisibilityMode visibilityMode; - error = m_settings->GetVisibilityMode(visibilityMode); - if (visibilityMode != EBTVisibilityModeHidden) { - error = m_settings->SetVisibilityMode(EBTVisibilityModeHidden); - } - } - break; - } - case QBluetoothLocalDevice::HostDiscoverable: { - TBTPowerStateValue powerState; - error = m_settings->GetPowerState(powerState); - if (error == KErrNone) { - if (powerState == EBTPowerOff) { - error = m_settings->SetPowerState(EBTPowerOn); - } - TBTVisibilityMode visibilityMode; - error = m_settings->GetVisibilityMode(visibilityMode); - if (visibilityMode != EBTVisibilityModeGeneral) { - error = m_settings->SetVisibilityMode(EBTVisibilityModeGeneral); - } - } - break; - } - } - if (error != KErrNone) { - Q_Q(QBluetoothLocalDevice); - emit q->error(QBluetoothLocalDevice::UnknownError); - } -} - - -QBluetoothLocalDevice::HostMode QBluetoothLocalDevicePrivate::hostMode() const -{ - if (!m_settings) - return QBluetoothLocalDevice::HostPoweredOff; - - TBTVisibilityMode visibilityMode; - TInt error = m_settings->GetVisibilityMode(visibilityMode); - - if (error != KErrNone) - return QBluetoothLocalDevice::HostPoweredOff; - - //If we are powered off then we don't are neither connectable or discoverable - TBTPowerStateValue powerState; - error = m_settings->GetPowerState(powerState); - if (error == KErrNone && powerState == EBTPowerOff) - return QBluetoothLocalDevice::HostPoweredOff; - - switch (visibilityMode) { - case EBTVisibilityModeHidden: - return QBluetoothLocalDevice::HostConnectable; - case EBTVisibilityModeGeneral: - case EBTVisibilityModeTemporary: - return QBluetoothLocalDevice::HostDiscoverable; - default: - // default value, also includes these new values from Symbian^3 onwards - // case EBTVisibilityModeNoScans: - // case EBTVisibilityModeInquiryScanOnly: - return QBluetoothLocalDevice::HostPoweredOff; - } -} - -void QBluetoothLocalDevicePrivate::PowerStateChanged(TBTPowerStateValue aState) -{ - QBluetoothLocalDevice::HostMode hostMode; - switch (aState) { - case EBTPowerOn: - hostMode = this->hostMode(); - break; - case EBTPowerOff: - default: - hostMode = QBluetoothLocalDevice::HostPoweredOff; - break; - } - Q_Q(QBluetoothLocalDevice); - emit q->hostModeStateChanged(hostMode); -} - -void QBluetoothLocalDevicePrivate::VisibilityModeChanged(TBTVisibilityMode aState) -{ - QBluetoothLocalDevice::HostMode hostMode; - switch (aState) { - case EBTVisibilityModeHidden: - hostMode = QBluetoothLocalDevice::HostConnectable; - break; - case EBTVisibilityModeGeneral: - case EBTVisibilityModeTemporary: - hostMode = QBluetoothLocalDevice::HostDiscoverable; - break; - default: - // default value, also includes these new values from Symbian^3 onwards - // case EBTVisibilityModeNoScans: - // case EBTVisibilityModeInquiryScanOnly: - hostMode = QBluetoothLocalDevice::HostPoweredOff; - break; - } - Q_Q(QBluetoothLocalDevice); - emit q->hostModeStateChanged(hostMode); -} - -void QBluetoothLocalDevicePrivate::requestPairing(const QBluetoothAddress &address, QBluetoothLocalDevice::Pairing pairing) -{ -//#ifdef USING_BTENGCONNMAN -#ifdef USING_BTENGDEVMAN - Q_Q(QBluetoothLocalDevice); - - BluetoothSymbianRegistryAdapter *registryAdapter = new BluetoothSymbianRegistryAdapter(address,q); - // do nothing if everything is uptodate. - if (registryAdapter->pairingStatus() == pairing) { - _q_pairingFinished(address, pairing); - return; - } - // pass q pointer so that adapter gets deleted when q object is deleted. Not optimal though. - BluetoothSymbianPairingAdapter *pairingAdapter = new BluetoothSymbianPairingAdapter(address,q); - - // After pairing has completed we emit pairingFinished signal in every case. - // earlier we checked pairing status from Symbian Bluetooth registry at this point but it - // was not updated and the result was that we emitted wrong pairing status. - QObject::connect(pairingAdapter, SIGNAL(pairingFinished(const QBluetoothAddress&,QBluetoothLocalDevice::Pairing)), - q, SLOT(_q_pairingFinished(const QBluetoothAddress&,QBluetoothLocalDevice::Pairing))); - // if pairing status changes then emit pairing finished. - // Currently this is used after removing a paired device from Symbian Bluetooth registry - QObject::connect(registryAdapter, SIGNAL(pairingStatusChanged(const QBluetoothAddress&,QBluetoothLocalDevice::Pairing)), - q, SLOT(_q_pairingFinished(const QBluetoothAddress&,QBluetoothLocalDevice::Pairing))); - // if there are pairing errors, emit them - QObject::connect(registryAdapter, SIGNAL(registryHandlingError(int)), - q, SLOT(_q_registryError(int))); - QObject::connect(pairingAdapter, SIGNAL(pairingError(int)), - q, SLOT(_q_pairingError(int))); - - switch (pairing) { - case QBluetoothLocalDevice::Unpaired: - // this is async method - registryAdapter->removePairing(); - break; - case QBluetoothLocalDevice::Paired: - case QBluetoothLocalDevice::AuthorizedPaired: - // this is async method - // Note: currently Symbian pairing function puts up a user dialog to confirm authorization; - // due to this, we cannot be sure if authorization is done or not, since it depends on user response - pairingAdapter->startPairing(pairing); - break; - default: - ASSERT(0); - break; - } -#endif //USING_BTENGDEVMAN -//#endif USING_BTENGCONNMAN -} - -QBluetoothLocalDevice::Pairing QBluetoothLocalDevicePrivate::pairingStatus(const QBluetoothAddress &address) const -{ -#ifdef USING_BTENGDEVMAN - QScopedPointer<BluetoothSymbianRegistryAdapter> registryAdapter (new BluetoothSymbianRegistryAdapter(address)); - return registryAdapter->pairingStatus(); -#endif //USING_BTENGDEVMAN -} - -void QBluetoothLocalDevicePrivate::pairingConfirmation(bool confirmation) -{ -} - -void QBluetoothLocalDevicePrivate::_q_pairingFinished(const QBluetoothAddress &address,QBluetoothLocalDevice::Pairing pairing) -{ - Q_Q(QBluetoothLocalDevice); - emit q->pairingFinished(address, pairing); -} -void QBluetoothLocalDevicePrivate::_q_registryError(int error) -{ - Q_Q(QBluetoothLocalDevice); - //TODO Add more errorCodes to LocalDevice api and map them to Symbian errorcodes - emit q->error(QBluetoothLocalDevice::UnknownError); -} -void QBluetoothLocalDevicePrivate::_q_pairingError(int error) -{ - Q_Q(QBluetoothLocalDevice); - //TODO Add more errorCodes to LocalDevice api and map them to Symbian errorcodes - emit q->error(QBluetoothLocalDevice::PairingError); -} - -QBluetoothLocalDevice::QBluetoothLocalDevice(QObject *parent) -: QObject(parent), d_ptr(new QBluetoothLocalDevicePrivate()) -{ - d_ptr->q_ptr = this; - if (this->d_ptr->m_settings == NULL) { - delete this->d_ptr; - this->d_ptr = NULL; - } -} - -QBluetoothLocalDevice::QBluetoothLocalDevice(const QBluetoothAddress &address, QObject *parent) -: QObject(parent), d_ptr(new QBluetoothLocalDevicePrivate()) -{ - d_ptr->q_ptr = this; - if (this->d_ptr->m_settings == NULL || address != this->d_ptr->address()) { - delete this->d_ptr; - this->d_ptr = NULL; - } -} - -QString QBluetoothLocalDevice::name() const -{ - if (!d_ptr) - return QString(); - return d_ptr->name(); -} - -QBluetoothAddress QBluetoothLocalDevice::address() const -{ - if (!d_ptr) - return QBluetoothAddress(); - return d_ptr->address(); -} - -void QBluetoothLocalDevice::powerOn() -{ - if (!d_ptr) - return; - d_ptr->powerOn(); -} - -void QBluetoothLocalDevice::setHostMode(QBluetoothLocalDevice::HostMode mode) -{ - if (!d_ptr) - return; - d_ptr->setHostMode(mode); -} - -QBluetoothLocalDevice::HostMode QBluetoothLocalDevice::hostMode() const -{ - if (!d_ptr) - return HostPoweredOff; - return d_ptr->hostMode(); -} - -QList<QBluetoothHostInfo> QBluetoothLocalDevice::allDevices() -{ - QList<QBluetoothHostInfo> localDevices; - QBluetoothHostInfo hostInfo; - hostInfo.setName(QBluetoothLocalDevicePrivate::name()); - hostInfo.setAddress(QBluetoothLocalDevicePrivate::address()); - localDevices.append(hostInfo); - return localDevices; -} - -void QBluetoothLocalDevice::requestPairing(const QBluetoothAddress &address, Pairing pairing) -{ - if (!d_ptr) - return; - - return d_ptr->requestPairing(address, pairing); -} - -QBluetoothLocalDevice::Pairing QBluetoothLocalDevice::pairingStatus(const QBluetoothAddress &address) const -{ - if (!d_ptr) - return QBluetoothLocalDevice::Unpaired; - - return d_ptr->pairingStatus(address); -} - -void QBluetoothLocalDevice::pairingConfirmation(bool confirmation) -{ - if (!d_ptr) - return; - - return d_ptr->pairingConfirmation(confirmation); -} - -QTBLUETOOTH_END_NAMESPACE diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_p.h b/src/bluetooth/qbluetoothservicediscoveryagent_p.h index 29d24807..b67288e5 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_p.h +++ b/src/bluetooth/qbluetoothservicediscoveryagent_p.h @@ -49,10 +49,6 @@ #include <QStack> -#ifdef QT_SYMBIAN_BLUETOOTH -#include <btsdp.h> -#endif - #ifdef QT_BLUEZ_BLUETOOTH class OrgBluezManagerInterface; class OrgBluezAdapterInterface; @@ -70,9 +66,6 @@ QTBLUETOOTH_BEGIN_NAMESPACE class QBluetoothDeviceDiscoveryAgent; class QBluetoothServiceDiscoveryAgentPrivate -#ifdef QT_SYMBIAN_BLUETOOTH -: public MSdpAgentNotifier, public MSdpAttributeValueVisitor -#endif { Q_DECLARE_PUBLIC(QBluetoothServiceDiscoveryAgent) @@ -106,26 +99,11 @@ public: void _q_createdDevice(QDBusPendingCallWatcher *watcher); #endif -#ifdef QT_SYMBIAN_BLUETOOTH - /* MSdpAgentNotifier virtual functions */ - void NextRecordRequestComplete(TInt aError, TSdpServRecordHandle aHandle, TInt aTotalRecordsCount); - void AttributeRequestResult(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, CSdpAttrValue *aAttrValue); - void AttributeRequestComplete(TSdpServRecordHandle, TInt aError); - - /* MSdpAttributeValueVisitor virtual functions */ - void VisitAttributeValueL(CSdpAttrValue &aValue, TSdpElementType aType); - void StartListL(CSdpAttrValueList &); - void EndListL(); -#endif - private: void start(const QBluetoothAddress &address); void stop(); -#ifdef QT_SYMBIAN_BLUETOOTH - void startL(const QBluetoothAddress &address); - void initL(const QBluetoothAddress &address); -#elif defined(QT_BLUEZ_BLUETOOTH) +#ifdef QT_BLUEZ_BLUETOOTH QVariant readAttributeValue(QXmlStreamReader &xml); #endif @@ -147,15 +125,7 @@ private: bool singleDevice; -#ifdef QT_SYMBIAN_BLUETOOTH - CSdpAgent *m_sdpAgent; - CSdpSearchPattern *m_filter; - CSdpAttrIdMatchList *m_attributes; - QBluetoothServiceInfo m_serviceInfo; - TSdpAttributeID m_currentAttributeId; - - QStack<QVariant> m_stack; -#elif defined(QT_BLUEZ_BLUETOOTH) +#ifdef QT_BLUEZ_BLUETOOTH OrgBluezManagerInterface *manager; OrgBluezAdapterInterface *adapter; OrgBluezDeviceInterface *device; diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_symbian.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_symbian.cpp deleted file mode 100644 index f4dbeb59..00000000 --- a/src/bluetooth/qbluetoothservicediscoveryagent_symbian.cpp +++ /dev/null @@ -1,315 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtBluetooth module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qbluetoothservicediscoveryagent_p.h" - -#include <QUrl> -#include <QtEndian> - -#include <arpa/inet.h> -#include <netinet/in.h> - -QTBLUETOOTH_BEGIN_NAMESPACE - -QBluetoothServiceDiscoveryAgentPrivate::QBluetoothServiceDiscoveryAgentPrivate(const QBluetoothAddress &address) - : error(QBluetoothServiceDiscoveryAgent::NoError) - , state(Inactive) - , deviceAddress(address) - , deviceDiscoveryAgent(0) - , mode(QBluetoothServiceDiscoveryAgent::MinimalDiscovery) - , singleDevice(false) - , m_sdpAgent(NULL) - , m_filter(NULL) - , m_attributes(NULL) -{ - -} - -QBluetoothServiceDiscoveryAgentPrivate::~QBluetoothServiceDiscoveryAgentPrivate() -{ - qDebug() << "QBluetoothServiceDiscoveryAgent being destroyed"; - delete m_filter; - delete m_attributes; - delete m_sdpAgent; -} - -void QBluetoothServiceDiscoveryAgentPrivate::start(const QBluetoothAddress &address) -{ - Q_Q(QBluetoothServiceDiscoveryAgent); - TRAPD(err, startL(address)); - if (err != KErrNone && singleDevice) { - qDebug() << "Service discovery start failed" << err; - error = QBluetoothServiceDiscoveryAgent::UnknownError; - emit q->error(error); - } - qDebug() << "Service discovery started"; -} - -void QBluetoothServiceDiscoveryAgentPrivate::startL(const QBluetoothAddress &address) -{ - initL(address); - - if (uuidFilter.isEmpty()) { - m_filter->AddL(QBluetoothUuid::PublicBrowseGroup); - } else { - foreach (const QBluetoothUuid &uuid, uuidFilter) { - if (uuid.minimumSize() == 2) { - TUUID sUuid(uuid.toUInt16()); - m_filter->AddL(sUuid); - } else if (uuid.minimumSize() == 4) { - TUUID sUuid(uuid.toUInt32()); - m_filter->AddL(sUuid); - } else if (uuid.minimumSize() == 16) { - TUint32 *dataPointer = (TUint32*)uuid.toUInt128().data; - TUint32 hH = qToBigEndian<quint32>(*(dataPointer++)); - TUint32 hL = qToBigEndian<quint32>(*(dataPointer++)); - TUint32 lH = qToBigEndian<quint32>(*(dataPointer++)); - TUint32 lL = qToBigEndian<quint32>(*(dataPointer)); - TUUID sUuid(hH, hL, lH, lL); - m_filter->AddL(sUuid); - } else { - // filter size can be 0 on error cases, searching all services - m_filter->AddL(QBluetoothUuid::PublicBrowseGroup); - } - } - } - m_sdpAgent->SetRecordFilterL(*m_filter); - m_sdpAgent->NextRecordRequestL(); - qDebug() << "Service discovery started, in startL"; -} - -void QBluetoothServiceDiscoveryAgentPrivate::stop() -{ - qDebug() << "Stop discovery called"; - delete m_sdpAgent; - m_sdpAgent = NULL; - delete m_filter; - m_filter = NULL; - delete m_attributes; - m_attributes = NULL; - Q_Q(QBluetoothServiceDiscoveryAgent); - emit q->canceled(); -} - -void QBluetoothServiceDiscoveryAgentPrivate::initL(const QBluetoothAddress &address) -{ - TBTDevAddr btAddress(address.toUInt64()); - stop(); - - //Trapped in Start - m_sdpAgent = q_check_ptr(CSdpAgent::NewL(*this, btAddress)); - m_filter = q_check_ptr(CSdpSearchPattern::NewL()); - m_attributes = q_check_ptr(CSdpAttrIdMatchList::NewL()); - m_attributes->AddL(KAttrRangeAll); - -} - -void QBluetoothServiceDiscoveryAgentPrivate::NextRecordRequestComplete(TInt aError, TSdpServRecordHandle aHandle, TInt aTotalRecordsCount) -{ - qDebug() << "NextRecordRequestComplete"; - Q_Q(QBluetoothServiceDiscoveryAgent); - if (aError == KErrNone && aTotalRecordsCount > 0 && m_sdpAgent && m_attributes) { - // request attributes - TRAPD(err, m_sdpAgent->AttributeRequestL(aHandle, *m_attributes)); - if (err && singleDevice) { - error = QBluetoothServiceDiscoveryAgent::UnknownError; - emit q->error(error); - } - } else if (aError == KErrEof) { - _q_serviceDiscoveryFinished(); - } else { - _q_serviceDiscoveryFinished(); - } -} - -void QBluetoothServiceDiscoveryAgentPrivate::AttributeRequestResult(TSdpServRecordHandle, TSdpAttributeID aAttrID, CSdpAttrValue *aAttrValue) -{ - qDebug() << "AttributeRequestResult"; - Q_Q(QBluetoothServiceDiscoveryAgent); - m_currentAttributeId = aAttrID; - TRAPD(err, aAttrValue->AcceptVisitorL(*this)); - if (m_stack.size() != 1) { - if(singleDevice) - { - error = QBluetoothServiceDiscoveryAgent::UnknownError; - emit q->error(error); - } - delete aAttrValue; - return; - } - - m_serviceInfo.setAttribute(aAttrID, m_stack.pop()); - - if (err != KErrNone && singleDevice) { - error = QBluetoothServiceDiscoveryAgent::UnknownError; - emit q->error(error); - } - delete aAttrValue; -} - -void QBluetoothServiceDiscoveryAgentPrivate::AttributeRequestComplete(TSdpServRecordHandle, TInt aError) -{ - qDebug() << "AttributeRequestComplete"; - Q_Q(QBluetoothServiceDiscoveryAgent); - - if (aError == KErrNone && m_sdpAgent) { - m_serviceInfo.setDevice(discoveredDevices.at(0)); - discoveredServices.append(m_serviceInfo); - m_serviceInfo = QBluetoothServiceInfo(); - if (discoveredServices.last().isValid()) - { - emit q->serviceDiscovered(discoveredServices.last()); - } - TRAPD(err, m_sdpAgent->NextRecordRequestL()); - if (err != KErrNone && singleDevice) { - error = QBluetoothServiceDiscoveryAgent::UnknownError; - emit q->error(error); - } - } else if (aError != KErrEof && singleDevice) { - error = QBluetoothServiceDiscoveryAgent::UnknownError; - emit q->error(error); - } - - -} - -void QBluetoothServiceDiscoveryAgentPrivate::VisitAttributeValueL(CSdpAttrValue &aValue, TSdpElementType aType) -{ - qDebug() << "VisitAttributeValueL"; - QVariant var; - TUint datasize = aValue.DataSize(); - - switch (aType) { - case ETypeNil: - break; - case ETypeUint: - if (datasize == 8) { - TUint64 value; - aValue.Uint64(value); - var = QVariant::fromValue(value); - } else - var = QVariant::fromValue(aValue.Uint()); - break; - case ETypeInt: - var = QVariant::fromValue(aValue.Int()); - break; - case ETypeUUID: { - TPtrC8 shortForm(aValue.UUID().ShortestForm()); - if (shortForm.Size() == 2) { - QBluetoothUuid uuid(ntohs(*reinterpret_cast<const quint16 *>(shortForm.Ptr()))); - var = QVariant::fromValue(uuid); - } else if (shortForm.Size() == 4) { - QBluetoothUuid uuid(ntohl(*reinterpret_cast<const quint32 *>(shortForm.Ptr()))); - var = QVariant::fromValue(uuid); - } else if (shortForm.Size() == 16) { - QBluetoothUuid uuid(*reinterpret_cast<const quint128 *>(shortForm.Ptr())); - var = QVariant::fromValue(uuid); - } - break; - } - case ETypeString: { - TPtrC8 stringBuffer = aValue.Des(); - var = QVariant::fromValue(QString::fromLocal8Bit(reinterpret_cast<const char *>(stringBuffer.Ptr()), stringBuffer.Size())); - break; - } - case ETypeBoolean: - var = QVariant::fromValue(static_cast<bool>(aValue.Bool())); - break; - case ETypeDES: - m_stack.push(QVariant::fromValue(QBluetoothServiceInfo::Sequence())); - break; - case ETypeDEA: - m_stack.push(QVariant::fromValue(QBluetoothServiceInfo::Alternative())); - break; - case ETypeURL: { - TPtrC8 stringBuffer = aValue.Des(); - var = QVariant::fromValue(QUrl(QString::fromLocal8Bit(reinterpret_cast<const char *>(stringBuffer.Ptr()), stringBuffer.Size()))); - break; - } - case ETypeEncoded: - qWarning() << "Don't know how to handle encoded type."; - break; - default: - qWarning() << "Don't know how to handle type" << aType; - } - - if (aType != ETypeDES && aType != ETypeDEA) { - if (m_stack.size() == 0) { - // single value attribute, just push onto stack - m_stack.push(var); - } else if (m_stack.size() >= 1) { - // sequence or alternate attribute, add non-DES -DEA values to DES or DEA - if (m_stack.top().canConvert<QBluetoothServiceInfo::Sequence>()) { - QBluetoothServiceInfo::Sequence *sequence = static_cast<QBluetoothServiceInfo::Sequence *>(m_stack.top().data()); - sequence->append(var); - } else if (m_stack.top().canConvert<QBluetoothServiceInfo::Alternative>()) { - QBluetoothServiceInfo::Alternative *alternative = static_cast<QBluetoothServiceInfo::Alternative *>(m_stack.top().data()); - alternative->append(var); - } else { - qWarning("Unknown type in the QVariant, should be either a QBluetoothServiceInfo::Sequence or an QBluetoothServiceInfo::Alternative"); - } - } - } -} - -void QBluetoothServiceDiscoveryAgentPrivate::StartListL(CSdpAttrValueList &) -{ - -} - -void QBluetoothServiceDiscoveryAgentPrivate::EndListL() -{ - if (m_stack.size() > 1) { - // finished a sequence or alternative add it to the parent sequence or alternative - QVariant var = m_stack.pop(); - if (m_stack.top().canConvert<QBluetoothServiceInfo::Sequence>()) { - QBluetoothServiceInfo::Sequence *sequence = static_cast<QBluetoothServiceInfo::Sequence *>(m_stack.top().data()); - sequence->append(var); - } else if (m_stack.top().canConvert<QBluetoothServiceInfo::Alternative>()) { - QBluetoothServiceInfo::Alternative *alternative = static_cast<QBluetoothServiceInfo::Alternative *>(m_stack.top().data()); - alternative->append(var); - } else { - qWarning("Unknown type in the QVariant, should be either a QBluetoothServiceInfo::Sequence or an QBluetoothServiceInfo::Alternative"); - } - } -} - -QTBLUETOOTH_END_NAMESPACE diff --git a/src/bluetooth/qbluetoothserviceinfo_p.h b/src/bluetooth/qbluetoothserviceinfo_p.h index 3ba57710..80aee53e 100644 --- a/src/bluetooth/qbluetoothserviceinfo_p.h +++ b/src/bluetooth/qbluetoothserviceinfo_p.h @@ -48,10 +48,6 @@ #include <QMap> #include <QVariant> -#ifdef QT_SYMBIAN_BLUETOOTH -#include <btsdp.h> -#endif - class OrgBluezServiceInterface; QT_BEGIN_HEADER @@ -79,16 +75,6 @@ public: QBluetoothDeviceInfo deviceInfo; QMap<quint16, QVariant> attributes; -#ifdef QT_SYMBIAN_BLUETOOTH -private: - void setRegisteredAttributeL(quint16 attributeId, const QVariant &value) const; - -public: - mutable RSdp sdpSession; - mutable RSdpDatabase sdpDatabase; - mutable TSdpServRecordHandle serviceRecord; -#endif - #ifdef QT_BLUEZ_BLUETOOTH mutable OrgBluezServiceInterface *service; mutable quint32 serviceRecord; diff --git a/src/bluetooth/qbluetoothserviceinfo_symbian.cpp b/src/bluetooth/qbluetoothserviceinfo_symbian.cpp deleted file mode 100644 index 3978f235..00000000 --- a/src/bluetooth/qbluetoothserviceinfo_symbian.cpp +++ /dev/null @@ -1,305 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtBluetooth module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qbluetoothserviceinfo.h" -#include "qbluetoothserviceinfo_p.h" - -#include <QUrl> -#include <QtEndian> - -#include <QDebug> - -QTBLUETOOTH_BEGIN_NAMESPACE - -QBluetoothServiceInfoPrivate::QBluetoothServiceInfoPrivate() -:serviceRecord(0) -{ -} - -QBluetoothServiceInfoPrivate::~QBluetoothServiceInfoPrivate() -{ - // Closing the database session will cause all - // registered services removed from the SDP database. - if (sdpDatabase.SubSessionHandle() != 0) - sdpDatabase.Close(); - - if (sdpSession.Handle() != 0) - sdpSession.Close(); -} - -static void convertL(MSdpElementBuilder *list, const QList<QVariant> &vList) -{ - list->StartListL(); - - foreach (const QVariant &v, vList) { - switch (v.type()) { - case QMetaType::Void: - list->BuildNilL(); - break; - case QMetaType::UChar: - list->BuildUintL(TSdpIntBuf<unsigned char>(v.toUInt())); - break; - case QMetaType::UShort: - list->BuildUintL(TSdpIntBuf<unsigned short>(v.toUInt())); - break; - case QMetaType::UInt: - list->BuildUintL(TSdpIntBuf<uint>(v.toUInt())); - break; - case QMetaType::Char: - list->BuildIntL(TSdpIntBuf<char>(v.toInt())); - break; - case QMetaType::Short: - list->BuildIntL(TSdpIntBuf<short>(v.toInt())); - break; - case QMetaType::Int: - list->BuildIntL(TSdpIntBuf<int>(v.toInt())); - break; - case QMetaType::QString: - list->BuildStringL(TPtrC8(reinterpret_cast<const quint8*>(v.toString().toLocal8Bit().constData()))); - break; - case QMetaType::Bool: - list->BuildBooleanL(v.toBool()); - break; - case QMetaType::QUrl: - list->BuildURLL(TPtrC8(reinterpret_cast<const quint8*>(v.toUrl().toString().toLocal8Bit().constData()))); - break; - case QVariant::UserType: - if (v.userType() == qMetaTypeId<QBluetoothUuid>()) { - QBluetoothUuid uuid = v.value<QBluetoothUuid>(); - switch (uuid.minimumSize()) { - case 2: - list->BuildUUIDL(uuid.toUInt16()); - break; - case 4: - list->BuildUUIDL(uuid.toUInt32()); - break; - case 16: { - TUint32 *dataPointer = (TUint32*)uuid.toUInt128().data; - TUint32 hH = qToBigEndian<quint32>(*(dataPointer++)); - TUint32 hL = qToBigEndian<quint32>(*(dataPointer++)); - TUint32 lH = qToBigEndian<quint32>(*(dataPointer++)); - TUint32 lL = qToBigEndian<quint32>(*(dataPointer)); - TUUID sUuid(hH, hL, lH, lL); - list->BuildUUIDL(sUuid); - break; - } - } - } else if (v.userType() == qMetaTypeId<QBluetoothServiceInfo::Sequence>()) { - convertL(list->BuildDESL(), v.value<QBluetoothServiceInfo::Sequence>()); - } else if (v.userType() == qMetaTypeId<QBluetoothServiceInfo::Alternative>()) { - convertL(list->BuildDEAL(), v.value<QBluetoothServiceInfo::Alternative>()); - } - break; - default: - qDebug() << __FUNCTION__ << "Don't know how to handle variant type" << v.type(); - } - } - - list->EndListL(); -} - -void QBluetoothServiceInfoPrivate::setRegisteredAttribute(quint16 attributeId, const QVariant &value) const -{ - TRAPD(err, setRegisteredAttributeL(attributeId, value)); - if (err != KErrNone) { - qWarning("Could not set attributes SDP session (error %d).", err); - } -} - -void QBluetoothServiceInfoPrivate::setRegisteredAttributeL(quint16 attributeId, const QVariant &value) const -{ - CSdpAttrValue *sdpValue = 0; - - switch (value.type()) { - case QMetaType::Void: - sdpValue = CSdpAttrValueNil::NewNilL(); - break; - case QMetaType::UChar: - sdpValue = CSdpAttrValueUint::NewUintL(TSdpIntBuf<unsigned char>(value.toUInt())); - break; - case QMetaType::UShort: - sdpValue = CSdpAttrValueUint::NewUintL(TSdpIntBuf<unsigned short>(value.toUInt())); - break; - case QMetaType::UInt: - sdpValue = CSdpAttrValueUint::NewUintL(TSdpIntBuf<uint>(value.toUInt())); - break; - case QMetaType::Char: - sdpValue = CSdpAttrValueInt::NewIntL(TSdpIntBuf<char>(value.toInt())); - break; - case QMetaType::Short: - sdpValue = CSdpAttrValueInt::NewIntL(TSdpIntBuf<short>(value.toInt())); - break; - case QMetaType::Int: - sdpValue = CSdpAttrValueInt::NewIntL(TSdpIntBuf<int>(value.toInt())); - break; - case QMetaType::QString: - sdpValue = CSdpAttrValueString::NewStringL(TPtrC8(reinterpret_cast<const quint8*>(value.toString().toLocal8Bit().constData()))); - break; - case QMetaType::Bool: - sdpValue = CSdpAttrValueBoolean::NewBoolL(value.toBool()); - break; - case QMetaType::QUrl: - sdpValue = CSdpAttrValueURL::NewURLL(TPtrC8(reinterpret_cast<const quint8*>(value.toUrl().toString().toLocal8Bit().constData()))); - break; - case QVariant::UserType: - if (value.userType() == qMetaTypeId<QBluetoothUuid>()) { - QBluetoothUuid uuid = value.value<QBluetoothUuid>(); - switch (uuid.minimumSize()) { - case 2: - sdpValue = CSdpAttrValueUUID::NewUUIDL(uuid.toUInt16()); - break; - case 4: - sdpValue = CSdpAttrValueUUID::NewUUIDL(uuid.toUInt32()); - break; - case 16: { - TUint32 *dataPointer = (TUint32*)uuid.toUInt128().data; - TUint32 hH = qToBigEndian<quint32>(*(dataPointer++)); - TUint32 hL = qToBigEndian<quint32>(*(dataPointer++)); - TUint32 lH = qToBigEndian<quint32>(*(dataPointer++)); - TUint32 lL = qToBigEndian<quint32>(*(dataPointer)); - TUUID sUuid(hH, hL, lH, lL); - sdpValue = CSdpAttrValueUUID::NewUUIDL(sUuid); - break; - } - } - } else if (value.userType() == qMetaTypeId<QBluetoothServiceInfo::Sequence>()) { - CSdpAttrValueDES *sequence = CSdpAttrValueDES::NewDESL(0); - CleanupStack::PushL(sequence); - convertL(sequence, value.value<QBluetoothServiceInfo::Sequence>()); - sdpValue = sequence; - CleanupStack::Pop(sequence); - } else if (value.userType() == qMetaTypeId<QBluetoothServiceInfo::Alternative>()) { - CSdpAttrValueDEA *alternative = CSdpAttrValueDEA::NewDEAL(0); - CleanupStack::PushL(alternative); - convertL(alternative, value.value<QBluetoothServiceInfo::Alternative>()); - sdpValue = alternative; - CleanupStack::Pop(alternative); - } - break; - default: - qDebug() << __FUNCTION__ << "Don't know how to handle variant type" << value.type(); - } - - if (sdpValue) { - CleanupStack::PushL(sdpValue); - sdpDatabase.UpdateAttributeL(serviceRecord, attributeId, *sdpValue); - CleanupStack::PopAndDestroy(sdpValue); - } -} - -void QBluetoothServiceInfoPrivate::removeRegisteredAttribute(quint16 attributeId) const -{ - TRAPD(err, sdpDatabase.DeleteAttributeL(serviceRecord, attributeId)); - if (err != KErrNone) { - qWarning("Could not remove registered attribute (error %d).", err); - } -} - -bool QBluetoothServiceInfoPrivate::ensureSdpConnection() const -{ - if (sdpSession.Handle() == 0) { - int error = sdpSession.Connect(); - if (error != KErrNone) { - qWarning("Could not open connection to SDP session (error %d).", error); - return false; - } - } - - if (sdpDatabase.SubSessionHandle() == 0) { - int error = sdpDatabase.Open(sdpSession); - if (error != KErrNone) { - qWarning("Could not open connection to SDP database (error %d).", error); - return false; - } - } - - return true; -} - -bool QBluetoothServiceInfo::isRegistered() const -{ - Q_D(const QBluetoothServiceInfo); - - return d->serviceRecord != 0; -} - -bool QBluetoothServiceInfo::registerService() const -{ - Q_D(const QBluetoothServiceInfo); - - if (d->serviceRecord != 0) - return false; - - if (!d->ensureSdpConnection()) - return false; - - TRAPD(err, d->sdpDatabase.CreateServiceRecordL(0, d->serviceRecord)); - if (err != KErrNone) - return false; - - foreach (quint16 id, d->attributes.keys()) { - // Changing service record handle causes serious problems - // on Symbian devices. Hence passing the value update. - if (id != ServiceRecordHandle) - d->setRegisteredAttribute(id, d->attributes[id]); - } - - return true; -} - -bool QBluetoothServiceInfo::unregisterService() const -{ - Q_D(const QBluetoothServiceInfo); - if(d->serviceRecord == 0) - return true; - - if (!d->ensureSdpConnection()) - return false; - - TRAPD(err, d->sdpDatabase.DeleteRecordL(d->serviceRecord)); - if (err != KErrNone) - return false; - - d->serviceRecord = 0; - return true; -} - -QTBLUETOOTH_END_NAMESPACE diff --git a/src/bluetooth/qbluetoothsocket.h b/src/bluetooth/qbluetoothsocket.h index d08b68ce..caa85e77 100644 --- a/src/bluetooth/qbluetoothsocket.h +++ b/src/bluetooth/qbluetoothsocket.h @@ -168,9 +168,6 @@ protected: private: Q_PRIVATE_SLOT(d_func(), void _q_readNotify()) Q_PRIVATE_SLOT(d_func(), void _q_writeNotify()) -#ifdef QT_SYMBIAN_BLUETOOTH - Q_PRIVATE_SLOT(d_func(), void _q_startReceive()) -#endif //QT_SYMBIAN_BLUETOOTH }; #ifndef QT_NO_DEBUG_STREAM diff --git a/src/bluetooth/qbluetoothsocket_p.h b/src/bluetooth/qbluetoothsocket_p.h index 37021d4a..81c13c8a 100644 --- a/src/bluetooth/qbluetoothsocket_p.h +++ b/src/bluetooth/qbluetoothsocket_p.h @@ -51,12 +51,6 @@ #include <QtGlobal> -#ifdef QT_SYMBIAN_BLUETOOTH -#include <es_sock.h> -#include <bt_sock.h> -#include <bttypes.h> -#endif - QT_FORWARD_DECLARE_CLASS(QSocketNotifier) QT_BEGIN_HEADER @@ -70,10 +64,6 @@ class QSocketServerPrivate public: QSocketServerPrivate(); ~QSocketServerPrivate(); - -#ifdef QT_SYMBIAN_BLUETOOTH - RSocketServ socketServer; -#endif }; @@ -82,9 +72,6 @@ class QBluetoothSocket; class QBluetoothServiceDiscoveryAgent; class QBluetoothSocketPrivate -#ifdef QT_SYMBIAN_BLUETOOTH -: public MBluetoothSocketNotifier -#endif { Q_DECLARE_PUBLIC(QBluetoothSocket) public: @@ -121,24 +108,6 @@ public: qint64 bytesAvailable() const; -#ifdef QT_SYMBIAN_BLUETOOTH - void _q_startReceive(); - void startReceive(); - void startServerSideReceive(); - void receive(); - bool ensureBlankNativeSocket(QBluetoothSocket::SocketType type); - bool tryToSend(); - - /* MBluetoothSocketNotifier virtual functions */ - void HandleActivateBasebandEventNotifierCompleteL(TInt aErr, TBTBasebandEventNotification& aEventNotification); - void HandleAcceptCompleteL(TInt aErr); - void HandleConnectCompleteL(TInt aErr); - void HandleIoctlCompleteL(TInt aErr); - void HandleReceiveCompleteL(TInt aErr); - void HandleSendCompleteL(TInt aErr); - void HandleShutdownCompleteL(TInt aErr); -#endif - public: QPrivateLinearBuffer buffer; QPrivateLinearBuffer txBuffer; @@ -158,19 +127,6 @@ public: // qint64 rxOffset; QString errorString; -#ifdef QT_SYMBIAN_BLUETOOTH - CBluetoothSocket *iSocket; - TPtr8 rxDescriptor; - TPtrC8 txDescriptor; - QByteArray txArray; - TSockXfrLength rxLength; - TInt recvMTU; - TInt txMTU; - char* bufPtr; - bool transmitting; - quint64 writeSize; -#endif - // private slots void _q_readNotify(); void _q_writeNotify(); diff --git a/src/bluetooth/qbluetoothsocket_symbian.cpp b/src/bluetooth/qbluetoothsocket_symbian.cpp deleted file mode 100644 index 6b417278..00000000 --- a/src/bluetooth/qbluetoothsocket_symbian.cpp +++ /dev/null @@ -1,594 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtBluetooth module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qbluetoothsocket_p.h" -#include "qbluetoothsocket.h" -#include "qbluetoothlocaldevice_p.h" -#include "symbian/utils_symbian_p.h" - -#include <QCoreApplication> - -#include <QDebug> - -#include <limits.h> -#include <bt_sock.h> -#include <es_sock.h> - -QTBLUETOOTH_BEGIN_NAMESPACE - -Q_GLOBAL_STATIC(QSocketServerPrivate, getSocketServer) - -QBluetoothSocketPrivate::QBluetoothSocketPrivate() - : socket(0) - , socketType(QBluetoothSocket::UnknownSocketType) - , state(QBluetoothSocket::UnconnectedState) - , readNotifier(0) - , connectWriteNotifier(0) - , discoveryAgent(0) - , iSocket(0) - , rxDescriptor(0, 0) - , txDescriptor(0, 0) - , recvMTU(0) - , txMTU(0) - , transmitting(false) - , writeSize(0) -{ -} - -QBluetoothSocketPrivate::~QBluetoothSocketPrivate() -{ - delete iSocket; -} - -void QBluetoothSocketPrivate::connectToService(const QBluetoothAddress &address, quint16 port, QIODevice::OpenMode openMode) -{ - Q_Q(QBluetoothSocket); - Q_UNUSED(openMode); - - TBTSockAddr a; - - if(address.isNull()) - { - socketError = QBluetoothSocket::UnknownSocketError; - emit q->error(socketError); - return; - } - TInt err = KErrNone; - a.SetPort(port); - // Trap TBTDevAddr constructor which may panic - TRAP(err, a.SetBTAddr(TBTDevAddr(address.toUInt64()))); - if(err == KErrNone) - err = iSocket->Connect(a); - if (err == KErrNone) { - q->setSocketState(QBluetoothSocket::ConnectingState); - } else { - socketError = QBluetoothSocket::UnknownSocketError; - emit q->error(socketError); - } -} - -bool QBluetoothSocketPrivate::ensureNativeSocket(QBluetoothSocket::SocketType type) -{ - if (iSocket) { - if (socketType == type) - { - return true; - } - else - { - delete iSocket; - iSocket = 0; - } - } - - socketType = type; - - switch (type) { - case QBluetoothSocket::L2capSocket: { - TRAPD(err, iSocket = CBluetoothSocket::NewL(*this, getSocketServer()->socketServer, _L("L2CAP"))); - Q_UNUSED(err); - break; - } - case QBluetoothSocket::RfcommSocket: { - TRAPD(err, iSocket = CBluetoothSocket::NewL(*this, getSocketServer()->socketServer, _L("RFCOMM"))); - Q_UNUSED(err); - break; - } - default: - iSocket = 0; - } - - if (iSocket) - return true; - else - return false; -} - -bool QBluetoothSocketPrivate::ensureBlankNativeSocket(QBluetoothSocket::SocketType type) -{ - if (iSocket) { - delete iSocket; - iSocket = 0; - } - socketType = type; - TRAPD(err, iSocket = CBluetoothSocket::NewL(*this, getSocketServer()->socketServer)); - Q_UNUSED(err); - if(iSocket) - return true; - else - return false; -} - -void QBluetoothSocketPrivate::startReceive() -{ - Q_Q(QBluetoothSocket); - if (!iSocket || state != QBluetoothSocket::ConnectedState) { - emit q->error(QBluetoothSocket::UnknownSocketError); - return; - } - TInt err = iSocket->GetOpt(KL2CAPInboundMTU, KSolBtL2CAP, recvMTU); - if(err != KErrNone) - { - emit q->error(QBluetoothSocket::UnknownSocketError); - return; - } - err = iSocket->GetOpt(KL2CAPNegotiatedOutboundMTU, KSolBtL2CAP, txMTU); - if(err != KErrNone) - { - emit q->error(QBluetoothSocket::UnknownSocketError); - return; - } - bufPtr = buffer.reserve(recvMTU); - // enable automatic power saving mode - iSocket->SetAutomaticSniffMode(ETrue); - // enable link down and link error notifications for proper disconnection - err = iSocket->ActivateBasebandEventNotifier(ENotifyPhysicalLinkDown |ENotifyPhysicalLinkError ); - if(err != KErrNone) - { - emit q->error(QBluetoothSocket::UnknownSocketError); - return; - } - receive(); -} - -void QBluetoothSocketPrivate::receive() -{ - Q_Q(QBluetoothSocket); - TInt err = KErrNone; - - if(!iSocket || bufPtr == 0 || recvMTU == 0 || socketType < 0 || state != QBluetoothSocket::ConnectedState) - { - emit q->error(QBluetoothSocket::UnknownSocketError); - return; - } - - TRAP(err, rxDescriptor.Set(reinterpret_cast<unsigned char *>(bufPtr), 0,recvMTU)); - if(err != KErrNone) - { - emit q->error(QBluetoothSocket::UnknownSocketError); - return; - } - if (socketType == QBluetoothSocket::RfcommSocket) { - // cancel any pending recv operation - iSocket->CancelRecv(); - err = iSocket->RecvOneOrMore(rxDescriptor, 0, rxLength); - if (err != KErrNone) { - socketError = QBluetoothSocket::UnknownSocketError; - emit q->error(socketError); - } - } else if (socketType == QBluetoothSocket::L2capSocket) { - // cancel any pending read operation - iSocket->CancelRead(); - err = iSocket->Read(rxDescriptor); - if (err != KErrNone) { - socketError = QBluetoothSocket::UnknownSocketError; - emit q->error(socketError); - } - } - } - -void QBluetoothSocketPrivate::HandleAcceptCompleteL(TInt aErr) -{ - qDebug() << __PRETTY_FUNCTION__ << ">> aErr=" << aErr; - Q_Q(QBluetoothSocket); - if(aErr != KErrNone) - { - socketError = QBluetoothSocket::UnknownSocketError; - emit q->error(socketError); - return; - } - emit q->connected(); -} - -void QBluetoothSocketPrivate::HandleActivateBasebandEventNotifierCompleteL(TInt aErr, TBTBasebandEventNotification& aEventNotification) -{ - qDebug() << __PRETTY_FUNCTION__; - Q_Q(QBluetoothSocket); - if(aErr != KErrNone) - { - socketError = QBluetoothSocket::UnknownSocketError; - emit q->error(socketError); - } - if(ENotifyPhysicalLinkDown & aEventNotification.EventType() || ENotifyPhysicalLinkError & aEventNotification.EventType()) - { - q->setSocketState(QBluetoothSocket::ClosingState); - emit q->disconnected(); - } -} - -void QBluetoothSocketPrivate::HandleConnectCompleteL(TInt aErr) -{ - qDebug() << __PRETTY_FUNCTION__ << ">> aErr=" << aErr; - Q_Q(QBluetoothSocket); - if (aErr == KErrNone) { - q->setSocketState(QBluetoothSocket::ConnectedState); - - emit q->connected(); - - startReceive(); - } else { - q->setSocketState(QBluetoothSocket::UnconnectedState); - - switch (aErr) { - case KErrCouldNotConnect: - socketError = QBluetoothSocket::ConnectionRefusedError; - break; - default: - qDebug() << __PRETTY_FUNCTION__ << aErr; - socketError = QBluetoothSocket::UnknownSocketError; - } - emit q->error(socketError); - } -} - -void QBluetoothSocketPrivate::HandleIoctlCompleteL(TInt aErr) -{ - qDebug() << __PRETTY_FUNCTION__; - Q_Q(QBluetoothSocket); - if(aErr != KErrNone) - { - socketError = QBluetoothSocket::UnknownSocketError; - emit q->error(socketError); - } -} - -void QBluetoothSocketPrivate::HandleReceiveCompleteL(TInt aErr) -{ - Q_Q(QBluetoothSocket); - if (aErr == KErrNone) { - if(buffer.size() == 0) - bufPtr = buffer.reserve(recvMTU); - if(bufPtr <= 0) - { - socketError = QBluetoothSocket::UnknownSocketError; - emit q->error(socketError); - return; - } - buffer.chop(recvMTU - rxDescriptor.Length()); - emit q->readyRead(); - } else { - // ignore disconnection it will be handled in baseband notification - if(aErr != KErrDisconnected) - { - socketError = QBluetoothSocket::UnknownSocketError; - writeSize = 0; - emit q->error(socketError); - } - } -} - -void QBluetoothSocketPrivate::HandleSendCompleteL(TInt aErr) -{ - Q_Q(QBluetoothSocket); - transmitting = false; - if (aErr == KErrNone) { - txArray.remove(0, writeSize); - emit q->bytesWritten(writeSize); - if (state == QBluetoothSocket::ClosingState) - { - writeSize = 0; - q->close(); - } - else - { - if(!tryToSend()) - { - socketError = QBluetoothSocket::UnknownSocketError; - writeSize = 0; - emit q->error(socketError); - } - } - } else { - socketError = QBluetoothSocket::UnknownSocketError; - writeSize = 0; - emit q->error(socketError); - } -} - -void QBluetoothSocketPrivate::HandleShutdownCompleteL(TInt aErr) -{ - Q_Q(QBluetoothSocket); - // It doesn't matter if aErr is KErrNone or something else - // we consider the socket to be closed. - q->setSocketState(QBluetoothSocket::UnconnectedState); - transmitting = false; - writeSize = 0; - iSocket->AsyncDelete(); - emit q->disconnected(); -} - -QSocketServerPrivate::QSocketServerPrivate() -{ - /* connect to socket server */ - TInt result = socketServer.Connect(); - if (result != KErrNone) { - qWarning("%s: RSocketServ.Connect() failed with error %d", __PRETTY_FUNCTION__, result); - return; - } -} - -QSocketServerPrivate::~QSocketServerPrivate() -{ - if (socketServer.Handle() != 0) - socketServer.Close(); -} - -QString QBluetoothSocketPrivate::localName() const -{ - return QBluetoothLocalDevicePrivate::name(); -} - -QBluetoothAddress QBluetoothSocketPrivate::localAddress() const -{ - TBTSockAddr address; - if(!iSocket) - { - // need to return something anyway - return QBluetoothAddress(); - } - iSocket->LocalName(address); - return qTBTDevAddrToQBluetoothAddress(address.BTAddr()); -} - -quint16 QBluetoothSocketPrivate::localPort() const -{ - if(!iSocket) - { - // need to return something anyway - return 0; - } - return iSocket->LocalPort(); -} - -QString QBluetoothSocketPrivate::peerName() const -{ - RHostResolver resolver; - - if(getSocketServer()->socketServer.Handle()== 0 || !iSocket || state != QBluetoothSocket::ConnectedState ) - { - // need to return something anyway - return QString(); - } - TInt err = resolver.Open(getSocketServer()->socketServer, KBTAddrFamily, KBTLinkManager); - if (err==KErrNone) - { - TNameEntry nameEntry; - TBTSockAddr sockAddr; - iSocket->RemoteName(sockAddr); - TInquirySockAddr address(sockAddr); - address.SetBTAddr(sockAddr.BTAddr()); - address.SetAction(KHostResName|KHostResIgnoreCache); // ignore name stored in cache - err = resolver.GetByAddress(address, nameEntry); - if(err == KErrNone) - { - TNameRecord name = nameEntry(); - QString qString((QChar*)name.iName.Ptr(),name.iName.Length()); - m_peerName = qString; - } - } - resolver.Close(); - - if(err != KErrNone) - { - // What is best? return an empty string or return the MAC address? - // In Symbian if we can't get the remote name we usually replace it with the MAC address - // but since Bluez implementation return an empty string we do the same here. - return QString(); - } - - return m_peerName; -} - -QBluetoothAddress QBluetoothSocketPrivate::peerAddress() const -{ - TBTSockAddr address; - if(!iSocket) - { - // need to return something anyway - return QBluetoothAddress(); - } - iSocket->RemoteName(address); - return qTBTDevAddrToQBluetoothAddress(address.BTAddr()); -} - -quint16 QBluetoothSocketPrivate::peerPort() const -{ - TBTSockAddr address; - if(!iSocket) - { - // need to return something anyway - return 0; - } - iSocket->RemoteName(address); - return address.Port(); -} - -void QBluetoothSocketPrivate::close() -{ - Q_Q(QBluetoothSocket); - if(!iSocket || (state != QBluetoothSocket::ConnectedState && state != QBluetoothSocket::ListeningState)) - { - socketError = QBluetoothSocket::UnknownSocketError; - emit q->error(socketError); - return; - } - iSocket->CancelBasebandEventNotifier(); - q->setSocketState(QBluetoothSocket::ClosingState); - iSocket->Shutdown(RSocket::ENormal); -} - -void QBluetoothSocketPrivate::abort() -{ - Q_Q(QBluetoothSocket); - if(!iSocket) - { - socketError = QBluetoothSocket::UnknownSocketError; - emit q->error(socketError); - return; - } - iSocket->CancelWrite(); - transmitting = false; - writeSize = 0; - iSocket->CancelBasebandEventNotifier(); - iSocket->Shutdown(RSocket::EImmediate); - // force active object to run and shutdown socket. - qApp->processEvents(QEventLoop::ExcludeUserInputEvents); -} - -qint64 QBluetoothSocketPrivate::readData(char *data, qint64 maxSize) -{ - Q_Q(QBluetoothSocket); - if(data == 0 || maxSize <= 0) - { - return -1; - } - qint64 size = buffer.read(data, maxSize); - QMetaObject::invokeMethod(q, "_q_startReceive", Qt::QueuedConnection); - return size; -} - -qint64 QBluetoothSocketPrivate::writeData(const char *data, qint64 maxSize) -{ - if(!iSocket || data == 0 || maxSize <= 0 || txMTU <= 0) { - return -1; - } - if (!txArray.isEmpty()) - { - txArray.append(QByteArray(data, maxSize)); - } - else - { - txArray = QByteArray(data, maxSize); - } - // we try to send the data to the remote device - if(tryToSend()) - { - // Warning : It doesn't mean the data have been sent - // to the remote device, it means that the data was - // at least stored in a local buffer. - return maxSize; - } - else - { - writeSize = 0; - return -1; - } -} - -void QBluetoothSocketPrivate::_q_readNotify() -{ -} - -void QBluetoothSocketPrivate::_q_writeNotify() -{ - -} - -bool QBluetoothSocketPrivate::setSocketDescriptor(int socketDescriptor, QBluetoothSocket::SocketType socketType, - QBluetoothSocket::SocketState socketState, QBluetoothSocket::OpenMode openMode) -{ - Q_UNUSED(socketDescriptor); - Q_UNUSED(socketType); - Q_UNUSED(socketState); - Q_UNUSED(openMode); - return false; -} - -void QBluetoothSocketPrivate::_q_startReceive() -{ - receive(); -} - -qint64 QBluetoothSocketPrivate::bytesAvailable() const -{ - return buffer.size(); -} - -bool QBluetoothSocketPrivate::tryToSend() -{ - if(txArray.isEmpty()) - return true; - - if(transmitting) - return transmitting; - - // we cannot write more than txMTU otherwise the extra data will just be lost - TInt dataLen = qMin(txArray.length(),txMTU); - - TRAPD(err, txDescriptor.Set(reinterpret_cast<const unsigned char *>(txArray.constData()),dataLen)); - if(err != KErrNone) - { - transmitting = false; - } - else - { - err = iSocket->Write(txDescriptor); - if (err != KErrNone) - { - transmitting = false; - } - writeSize = dataLen; - transmitting = true; - } - return transmitting; -} - -QTBLUETOOTH_END_NAMESPACE diff --git a/src/bluetooth/qbluetoothtransfermanager_symbian.cpp b/src/bluetooth/qbluetoothtransfermanager_symbian.cpp deleted file mode 100644 index f7b929f1..00000000 --- a/src/bluetooth/qbluetoothtransfermanager_symbian.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtBluetooth module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qbluetoothtransfermanager.h" -#include "qbluetoothtransferrequest.h" -#include "qbluetoothtransferreply.h" -#include "qbluetoothtransferreply_symbian_p.h" - -QTBLUETOOTH_BEGIN_NAMESPACE - -QBluetoothTransferReply *QBluetoothTransferManager::put(const QBluetoothTransferRequest &request, - QIODevice *data) -{ - QBluetoothTransferReplySymbian *reply = - new QBluetoothTransferReplySymbian(data, QBluetoothTransferManager::PutOperation); - - reply->setAddress(request.address()); - - connect(reply, SIGNAL(finished(QBluetoothTransferReply*)), this, SIGNAL(finished(QBluetoothTransferReply*))); - - reply->start(); - - return reply; -} - -QTBLUETOOTH_END_NAMESPACE diff --git a/src/bluetooth/qbluetoothtransferreply_symbian.cpp b/src/bluetooth/qbluetoothtransferreply_symbian.cpp deleted file mode 100644 index 119bc96f..00000000 --- a/src/bluetooth/qbluetoothtransferreply_symbian.cpp +++ /dev/null @@ -1,319 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtBluetooth module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include "qbluetoothtransferreply_symbian_p.h" -#include "symbian/utils_symbian_p.h" -#include "qbluetoothservicediscoveryagent.h" -#include "qbluetoothserviceinfo.h" -#include "qbluetoothuuid.h" - -#include <QDebug> -#include <QFile> -#include <QFileInfo> -#include <QDir> - -QTBLUETOOTH_BEGIN_NAMESPACE - -QBluetoothTransferReplySymbian::QBluetoothTransferReplySymbian(QIODevice *input, - QBluetoothTransferManager::Operation operation, QObject *parent) - : QBluetoothTransferReply(parent) - , CActive(EPriorityStandard) - , m_source(input) - , m_running(false) - , m_finished(false) - , m_client(NULL) - , m_object(NULL) - , m_error(QBluetoothTransferReply::NoError) - , m_errorStr() - , m_timer(new QTimer(this)) -{ - setOperation(operation); - - //add this active object to scheduler - CActiveScheduler::Add(this); - connect(m_timer, SIGNAL(timeout()), this, SLOT(updateProgress())); - -} - -/*! - Destroys the QBluetoothTransferReply object. -*/ -QBluetoothTransferReplySymbian::~QBluetoothTransferReplySymbian() -{ - Cancel(); - - if (m_timer->isActive()) - m_timer->stop(); - - delete m_object; - m_object = NULL; - - delete m_client; - m_client = NULL; -} - -void QBluetoothTransferReplySymbian::setAddress(const QBluetoothAddress &address) -{ - m_address = address; -} - -void QBluetoothTransferReplySymbian::serviceDiscovered(const QBluetoothServiceInfo &info) -{ - m_port = info.serverChannel(); -} - -void QBluetoothTransferReplySymbian::updateProgress() -{ - if (m_object) { - qint64 sent = m_object->BytesSent(); - emit uploadProgress(sent, m_fileSize); - } -} - -void QBluetoothTransferReplySymbian::serviceDiscoveryFinished() -{ - QMetaObject::invokeMethod(this, "startTransfer", Qt::QueuedConnection); -} - -bool QBluetoothTransferReplySymbian::start() -{ - if (m_address.isNull()) - return false; - - m_running = true; - - m_discoveryAgent = new QBluetoothServiceDiscoveryAgent(m_address); - - connect(m_discoveryAgent, SIGNAL(serviceDiscovered(QBluetoothServiceInfo)), - this, SLOT(serviceDiscovered(QBluetoothServiceInfo))); - connect(m_discoveryAgent, SIGNAL(finished()), this, SLOT(serviceDiscoveryFinished())); - // Automatically delete agent when device discovery finishes. - connect(m_discoveryAgent, SIGNAL(finished()), this, SLOT(deleteLater())); - - m_discoveryAgent->setUuidFilter(QBluetoothUuid(QBluetoothUuid::ObexObjectPush)); - m_discoveryAgent->start(); - - return true; -} - -void QBluetoothTransferReplySymbian::startTransfer() -{ - TObexBluetoothProtocolInfo protocolInfo; - TBTDevAddr deviceAddress(m_address.toUInt64()); - - protocolInfo.iTransport.Copy(KBTSProtocol); - protocolInfo.iAddr.SetBTAddr(deviceAddress); - protocolInfo.iAddr.SetPort(m_port); // TODO: set port if needed - - if ( m_client ) { - delete m_client; - m_client = NULL; - } - - TRAPD( err, m_client = CObexClient::NewL(protocolInfo)); - if (err) { - qDebug() << "Error in" << __FUNCTION__ << err; - m_error = err == KErrNotFound ? HostNotFoundError: UnknownError; - return; - } - - m_state = EConnecting; - m_client->Connect( iStatus ); - - SetActive(); -} - -/*! - Returns true if this reply has finished; otherwise returns false. -*/ -bool QBluetoothTransferReplySymbian::isFinished() const -{ - return m_finished; -} - -/*! - Returns true if this reply is running; otherwise returns false. -*/ -bool QBluetoothTransferReplySymbian::isRunning() const -{ - return m_running; -} - -void QBluetoothTransferReplySymbian::abort() -{ - if (m_timer->isActive()) - m_timer->stop(); - m_state = EIdle; - m_running = false; - // Deleting obexclient is the only way to cancel active requests - delete m_client; - m_client = NULL; - - delete m_object; - m_object = NULL; -} - -QBluetoothTransferReply::TransferError QBluetoothTransferReplySymbian::error() const -{ - return m_error; -} - -QString QBluetoothTransferReplySymbian::errorString() const -{ - return m_errorStr; -} - -void QBluetoothTransferReplySymbian::DoCancel() -{ - m_running = false; - // Deleting obexclient is the only way to cancel active requests - if ( m_client ) { - delete m_client; - m_client = NULL; - m_state = EIdle; - } - if (m_timer->isActive()) - m_timer->stop(); - m_error = UserCanceledTransferError; -} - -void QBluetoothTransferReplySymbian::RunL() -{ - if (iStatus.Int() != KErrNone) { - abort(); - emit finished(this); - } - - switch ( m_state ) { - case EConnecting: { - m_state = ESending; - QFile *file = qobject_cast<QFile *>(m_source); - - QString filename; - if (file) { - QFileInfo info(*file); - m_fileSize = info.size(); - filename = QDir::toNativeSeparators(info.absoluteFilePath()); - } else { - if (copyToTempFile(m_tempfile, m_source)) { - QFileInfo info(*m_tempfile); - m_fileSize = info.size(); - filename = QDir::toNativeSeparators(info.absoluteFilePath()); - } else { - m_state = EDisconnecting; - disconnect(); - } - } - sendObject(filename); - break; - } - case ESending: { - m_state = EDisconnecting; - disconnect(); - break; - } - case EDisconnecting: { - m_state = EIdle; - m_finished = true; - m_running = false; - emit finished(this); - break; - } - case EIdle: - default: - break; - } - -} - -void QBluetoothTransferReplySymbian::sendObject(QString filename) -{ - delete m_object; - m_object = NULL; - TRAPD(err, m_object = CObexFileObject::NewL()); - if (!err) { - TPtrC16 str(reinterpret_cast<const TUint16*>(filename.utf16())); - TRAPD(error, m_object->InitFromFileL( str )); - if (!error) { - m_client->Put( *m_object, iStatus ); - m_timer->start(1000); - emit uploadProgress(0, m_fileSize); - SetActive(); - } else { - qDebug() << "Error in" << __FUNCTION__ << error; - m_error = error == KErrNotFound ? FileNotFoundError: UnknownError; - disconnect(); - emit finished(this); - } - } -} - -void QBluetoothTransferReplySymbian::disconnect() -{ - if ( m_state == EDisconnecting || m_error != NoError) { - if (m_timer->isActive()) - m_timer->stop(); - delete m_object; - m_object = NULL; - m_client->Disconnect( iStatus ); - SetActive(); - } -} - -bool QBluetoothTransferReplySymbian::copyToTempFile(QIODevice *to, QIODevice *from) -{ - char *block = new char[4096]; - - while (!from->atEnd()) { - int size = from->read(block, 4096); - if (size != to->write(block, size)) { - return false; - } - } - - delete[] block; - return true; -} - -QTBLUETOOTH_END_NAMESPACE - -#include "moc_qbluetoothtransferreply_symbian_p.cpp" diff --git a/src/bluetooth/qbluetoothtransferreply_symbian_p.h b/src/bluetooth/qbluetoothtransferreply_symbian_p.h deleted file mode 100644 index 5dfedbde..00000000 --- a/src/bluetooth/qbluetoothtransferreply_symbian_p.h +++ /dev/null @@ -1,145 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtBluetooth module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QBLUETOOTHTRANSFERREPLYSYMBIAN_H -#define QBLUETOOTHTRANSFERREPLYSYMBIAN_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qbluetoothtransferreply.h" -#include <e32base.h> -#include <obex.h> - -#include <QTemporaryFile> -#include <QIODevice> -#include <QTimer> - -QT_BEGIN_HEADER - -QTBLUETOOTH_BEGIN_NAMESPACE - -class QBluetoothServiceDiscoveryAgent; -class QBluetoothServiceInfo; - -_LIT( KBTSProtocol, "RFCOMM" ); // The Bluetooth transport layer - -class QBluetoothTransferReplySymbian : public QBluetoothTransferReply, public CActive -{ - Q_OBJECT - -public: - enum state - { - EIdle, - EConnecting, - ESending, - EDisconnecting - }; - - QBluetoothTransferReplySymbian(QIODevice *input, QBluetoothTransferManager::Operation, QObject *parent = 0); - ~QBluetoothTransferReplySymbian(); - - void abort(); - bool isFinished() const; - bool isRunning() const; - - bool start(); - - void setAddress(const QBluetoothAddress &address); - - QBluetoothTransferReply::TransferError error() const; - QString errorString() const; - -private: - void sendObject(QString filename); - void disconnect(); - - //From CActive - void DoCancel(); - void RunL(); - - static bool copyToTempFile(QIODevice *to, QIODevice *from); - -private slots: - void startTransfer(); - - void serviceDiscovered(const QBluetoothServiceInfo &info); - void serviceDiscoveryFinished(); - - void updateProgress(); - -private: - QIODevice *m_source; - QTemporaryFile *m_tempfile; - - QBluetoothAddress m_address; - QBluetoothServiceDiscoveryAgent* m_discoveryAgent; - - bool m_running; - bool m_finished; - - CObexClient* m_client; - CObexFileObject* m_object; - - QBluetoothTransferReply::TransferError m_error; - QString m_errorStr; - - state m_state; - qint64 m_fileSize; - int m_port; - - QTimer *m_timer; -}; - -QTBLUETOOTH_END_NAMESPACE - -QT_END_HEADER - -#endif // QBLUETOOTHTRANSFERREPLYPRIVATE_H diff --git a/src/bluetooth/ql2capserver.h b/src/bluetooth/ql2capserver.h index 0d0fed66..f1395ed8 100644 --- a/src/bluetooth/ql2capserver.h +++ b/src/bluetooth/ql2capserver.h @@ -91,12 +91,6 @@ protected: private: Q_DECLARE_PRIVATE(QL2capServer) -#ifdef QT_SYMBIAN_BLUETOOTH - Q_PRIVATE_SLOT(d_func(), void _q_connected()) - Q_PRIVATE_SLOT(d_func(), void _q_socketError(QBluetoothSocket::SocketError err)) - Q_PRIVATE_SLOT(d_func(), void _q_disconnected()) -#endif //QT_SYMBIAN_BLUETOOTH - #ifdef QT_BLUEZ_BLUETOOTH Q_PRIVATE_SLOT(d_func(), void _q_newConnection()) #endif diff --git a/src/bluetooth/ql2capserver_p.h b/src/bluetooth/ql2capserver_p.h index 845149b2..3a32fce0 100644 --- a/src/bluetooth/ql2capserver_p.h +++ b/src/bluetooth/ql2capserver_p.h @@ -45,11 +45,6 @@ #include "qbluetoothglobal.h" #include <qbluetoothsocket.h> -#ifdef QT_SYMBIAN_BLUETOOTH -#include <es_sock.h> -#include <bt_sock.h> -#endif //QT_SYMBIAN_BLUETOOTH - #ifdef QT_BLUEZ_BLUETOOTH QT_FORWARD_DECLARE_CLASS(QSocketNotifier) #endif @@ -61,10 +56,6 @@ QTBLUETOOTH_BEGIN_NAMESPACE class QBluetoothAddress; class QBluetoothSocket; -#ifdef QT_SYMBIAN_BLUETOOTH -class QBluetoothSocketPrivate; -#endif - class QL2capServer; class QL2capServerPrivate @@ -75,13 +66,6 @@ public: QL2capServerPrivate(); ~QL2capServerPrivate(); -#ifdef QT_SYMBIAN_BLUETOOTH - // private slots - void _q_connected(); - void _q_socketError(QBluetoothSocket::SocketError err); - void _q_disconnected(); -#endif //QT_SYMBIAN_BLUETOOTH - #ifdef QT_BLUEZ_BLUETOOTH void _q_newConnection(); #endif @@ -94,11 +78,6 @@ public: int maxPendingConnections; QBluetooth::SecurityFlags securityFlags; -#ifdef QT_SYMBIAN_BLUETOOTH - mutable QList<QBluetoothSocket *> activeSockets; - QBluetoothSocketPrivate *ds; -#endif //QT_SYMBIAN_BLUETOOTH - protected: QL2capServer *q_ptr; diff --git a/src/bluetooth/ql2capserver_symbian.cpp b/src/bluetooth/ql2capserver_symbian.cpp deleted file mode 100644 index 8fbfef68..00000000 --- a/src/bluetooth/ql2capserver_symbian.cpp +++ /dev/null @@ -1,289 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtBluetooth module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "ql2capserver.h" -#include "ql2capserver_p.h" -#include "qbluetoothsocket.h" -#include "qbluetoothsocket_p.h" -#include "symbian/utils_symbian_p.h" - -#include <QTimer> -#include <QCoreApplication> - -#include <QDebug> - -QTBLUETOOTH_BEGIN_NAMESPACE - -QL2capServerPrivate::QL2capServerPrivate() -: socket(0),pending(false),maxPendingConnections(1),securityFlags(QBluetooth::NoSecurity) -{ -} - -QL2capServerPrivate::~QL2capServerPrivate() -{ - delete socket; -} - -void QL2capServer::close() -{ - Q_D(QL2capServer); - if(!d->socket) - { - // there is no way to propagate the error to user - // so just ignore the problem. - return; - } - d->socket->setSocketState(QBluetoothSocket::ClosingState); - d->socket->close(); - // force active object (socket) to run and shutdown socket. - qApp->processEvents(QEventLoop::ExcludeUserInputEvents); -} - -bool QL2capServer::listen(const QBluetoothAddress &address, quint16 port) -{ - Q_D(QL2capServer); - // listen has already been called before - if(d->socket) - return true; - - d->socket = new QBluetoothSocket(QBluetoothSocket::L2capSocket,this); - - if(!d->socket) - { - return false; - } - - d->ds = d->socket->d_ptr; - - if(!d->ds) - { - delete d->socket; - d->socket = 0; - return false; - } - - TL2CAPSockAddr addr; - - if(!address.isNull()) - { - // TBTDevAddr constructor may panic - TRAPD(err,addr.SetBTAddr(TBTDevAddr(address.toUInt64()))); - if(err != KErrNone) - { - delete d->socket; - d->socket = 0; - return false; - } - } - - if (port == 0) - addr.SetPort(KL2CAPPassiveAutoBind); - else - addr.SetPort(port); - - TBTServiceSecurity security; - switch (d->securityFlags) { - case QBluetooth::Authentication: - security.SetAuthentication(EMitmDesired); - break; - case QBluetooth::Authorization: - security.SetAuthorisation(ETrue); - break; - case QBluetooth::Encryption: - // "Secure" is BlueZ specific we just make sure the code remain compatible - case QBluetooth::Secure: - // authentication required - security.SetAuthentication(EMitmDesired); - security.SetEncryption(ETrue); - break; - case QBluetooth::NoSecurity: - default: - break; - } - addr.SetSecurity(security); - if(d->ds->iSocket->Bind(addr) == KErrNone) - { - d->socket->setSocketState(QBluetoothSocket::BoundState); - } - else - { - delete d->socket; - d->socket = 0; - return false; - } - - if(d->ds->iSocket->Listen(d->maxPendingConnections) != KErrNone) - { - delete d->socket; - d->socket = 0; - return false; - } - // unknown socket type is used for blank socket - QBluetoothSocket *pendingSocket = new QBluetoothSocket(QBluetoothSocket::UnknownSocketType, this); - if(!pendingSocket) - { - delete d->socket; - d->socket = 0; - return false; - } - QBluetoothSocketPrivate *pd = pendingSocket->d_ptr; - pd->ensureBlankNativeSocket(QBluetoothSocket::L2capSocket); - connect(d->socket, SIGNAL(disconnected()), this, SLOT(disconnected())); - connect(d->socket, SIGNAL(connected()), this, SLOT(connected())); - connect(d->socket, SIGNAL(error(QBluetoothSocket::SocketError)), this, SLOT(socketError(QBluetoothSocket::SocketError))); - if (d->ds->iSocket->Accept(*pd->iSocket) == KErrNone) - { - d->socket->setSocketState(QBluetoothSocket::ListeningState); - d->activeSockets.append(pendingSocket); - return true; - } - else - { - delete d->socket, pendingSocket; - d->socket = 0; - return false; - } -} - -void QL2capServer::setMaxPendingConnections(int numConnections) -{ - Q_D(QL2capServer); - d->maxPendingConnections = numConnections; -} - -bool QL2capServer::hasPendingConnections() const -{ - Q_D(const QL2capServer); - return !d->activeSockets.isEmpty(); -} - -QBluetoothSocket *QL2capServer::nextPendingConnection() -{ - Q_D(QL2capServer); - - if (d->activeSockets.isEmpty()) - return 0; - - QBluetoothSocket *next = d->activeSockets.takeFirst(); - return next; -} - -QBluetoothAddress QL2capServer::serverAddress() const -{ - Q_D(const QL2capServer); - if(d->socket) - return d->socket->localAddress(); - else - return QBluetoothAddress(); -} - -quint16 QL2capServer::serverPort() const -{ - Q_D(const QL2capServer); - if(d->socket) - return d->socket->localPort(); - else - return 0; -} - -void QL2capServerPrivate::_q_connected() -{ - Q_Q(QL2capServer); - if(!activeSockets.isEmpty()) - { - // update state of the pending socket and start receiving - (activeSockets.last())->setSocketState(QBluetoothSocket::ConnectedState); - (activeSockets.last())->d_ptr->startReceive(); - } - else - return; - emit q->newConnection(); - QBluetoothSocket *pendingSocket = new QBluetoothSocket(QBluetoothSocket::UnknownSocketType); - if(!pendingSocket) - { - delete socket; - socket = 0; - return; - } - QBluetoothSocketPrivate *pd = pendingSocket->d_ptr; - pd->ensureBlankNativeSocket(QBluetoothSocket::L2capSocket); - if (ds->iSocket->Accept(*pd->iSocket) == KErrNone) - { - socket->setSocketState(QBluetoothSocket::ListeningState); - activeSockets.append(pendingSocket); - return; - } - else - { - // we might reach this statement if we have reach - // maxPendingConnections - qDebug() << "QL2capServer::connected accept failed"; - delete socket, pendingSocket; - socket = 0; - return; - } -} - -void QL2capServerPrivate::_q_disconnected() -{ - delete socket; - socket = 0; -} - -void QL2capServerPrivate::_q_socketError(QBluetoothSocket::SocketError err) -{ - delete socket; - socket = 0; -} - -void QL2capServer::setSecurityFlags(QBluetooth::SecurityFlags security) -{ - Q_D(QL2capServer); - d->securityFlags = security; -} - -QBluetooth::SecurityFlags QL2capServer::securityFlags() const -{ - Q_D(const QL2capServer); - return d->securityFlags; -} - -QTBLUETOOTH_END_NAMESPACE diff --git a/src/bluetooth/qrfcommserver.h b/src/bluetooth/qrfcommserver.h index d9f91923..4cfad3e9 100644 --- a/src/bluetooth/qrfcommserver.h +++ b/src/bluetooth/qrfcommserver.h @@ -91,12 +91,6 @@ protected: private: Q_DECLARE_PRIVATE(QRfcommServer) -#ifdef QT_SYMBIAN_BLUETOOTH - Q_PRIVATE_SLOT(d_func(), void _q_connected()) - Q_PRIVATE_SLOT(d_func(), void _q_socketError(QBluetoothSocket::SocketError err)) - Q_PRIVATE_SLOT(d_func(), void _q_disconnected()) -#endif //QT_SYMBIAN_BLUETOOTH - #ifdef QT_BLUEZ_BLUETOOTH Q_PRIVATE_SLOT(d_func(), void _q_newConnection()) #endif diff --git a/src/bluetooth/qrfcommserver_p.cpp b/src/bluetooth/qrfcommserver_p.cpp index 81a7c860..f1d22d65 100644 --- a/src/bluetooth/qrfcommserver_p.cpp +++ b/src/bluetooth/qrfcommserver_p.cpp @@ -96,31 +96,6 @@ void QRfcommServerPrivate::_q_newConnection() } #endif - -#ifdef QT_SYMBIAN_BLUETOOTH -void QRfcommServerPrivate::HandleAcceptCompleteL(TInt aErr) -{ -} -void QRfcommServerPrivate::HandleActivateBasebandEventNotifierCompleteL(TInt aErr, TBTBasebandEventNotification &aEventNotification) -{ -} -void QRfcommServerPrivate::HandleConnectCompleteL(TInt aErr) -{ -} -void QRfcommServerPrivate::HandleIoctlCompleteL(TInt aErr) -{ -} -void QRfcommServerPrivate::HandleReceiveCompleteL(TInt aErr) -{ -} -void QRfcommServerPrivate::HandleSendCompleteL(TInt aErr) -{ -} -void QRfcommServerPrivate::HandleShutdownCompleteL(TInt aErr) -{ -} -#endif - void QRfcommServer::setSecurityFlags(QBluetooth::SecurityFlags security) { } diff --git a/src/bluetooth/qrfcommserver_p.h b/src/bluetooth/qrfcommserver_p.h index e8c3d76b..1f0a26aa 100644 --- a/src/bluetooth/qrfcommserver_p.h +++ b/src/bluetooth/qrfcommserver_p.h @@ -46,11 +46,6 @@ #include <QList> #include <qbluetoothsocket.h> -#ifdef QT_SYMBIAN_BLUETOOTH -#include <es_sock.h> -#include <bt_sock.h> -#endif - #ifdef QT_BLUEZ_BLUETOOTH QT_FORWARD_DECLARE_CLASS(QSocketNotifier) #endif @@ -62,10 +57,6 @@ QTBLUETOOTH_BEGIN_NAMESPACE class QBluetoothAddress; class QBluetoothSocket; -#ifdef QT_SYMBIAN_BLUETOOTH -class QBluetoothSocketPrivate; -#endif - class QRfcommServer; class QRfcommServerPrivate @@ -76,13 +67,6 @@ public: QRfcommServerPrivate(); ~QRfcommServerPrivate(); -#ifdef QT_SYMBIAN_BLUETOOTH - // private slots - void _q_connected(); - void _q_socketError(QBluetoothSocket::SocketError err); - void _q_disconnected(); -#endif //QT_SYMBIAN_BLUETOOTH - #ifdef QT_BLUEZ_BLUETOOTH void _q_newConnection(); #endif @@ -90,11 +74,6 @@ public: public: QBluetoothSocket *socket; -#ifdef QT_SYMBIAN_BLUETOOTH - mutable QList<QBluetoothSocket *> activeSockets; - QBluetoothSocketPrivate *ds; -#endif - int maxPendingConnections; QBluetooth::SecurityFlags securityFlags; diff --git a/src/bluetooth/qrfcommserver_symbian.cpp b/src/bluetooth/qrfcommserver_symbian.cpp deleted file mode 100644 index 2dd4a0f1..00000000 --- a/src/bluetooth/qrfcommserver_symbian.cpp +++ /dev/null @@ -1,288 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtBluetooth module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qrfcommserver.h" -#include "qrfcommserver_p.h" -#include "qbluetoothsocket.h" -#include "qbluetoothsocket_p.h" -#include "qbluetoothlocaldevice.h" -#include "symbian/utils_symbian_p.h" - -#include <QTimer> -#include <QCoreApplication> - -#include <QDebug> - -QTBLUETOOTH_BEGIN_NAMESPACE - -QRfcommServerPrivate::QRfcommServerPrivate() -: socket(0),maxPendingConnections(1),securityFlags(QBluetooth::NoSecurity) -{ -} - -QRfcommServerPrivate::~QRfcommServerPrivate() -{ - delete socket; -} - -void QRfcommServer::close() -{ - Q_D(QRfcommServer); - if(!d->socket) - { - // there is no way to propagate the error to user - // so just ignore the problem. - return; - } - d->socket->setSocketState(QBluetoothSocket::ClosingState); - d->socket->close(); - // force active object (socket) to run and shutdown socket. - qApp->processEvents(QEventLoop::ExcludeUserInputEvents); -} - -bool QRfcommServer::listen(const QBluetoothAddress &address, quint16 port) -{ - Q_D(QRfcommServer); - // listen has already been called before - if(d->socket) - return true; - - d->socket = new QBluetoothSocket(QBluetoothSocket::RfcommSocket,this); - - if(!d->socket) - { - return false; - } - - d->ds = d->socket->d_ptr; - - if(!d->ds) - { - delete d->socket; - d->socket = 0; - return false; - } - - d->ds->ensureNativeSocket(QBluetoothSocket::RfcommSocket); - - TRfcommSockAddr addr; - if(!address.isNull()) - { - // TBTDevAddr constructor may panic - TRAPD(err,addr.SetBTAddr(TBTDevAddr(address.toUInt64()))); - if(err != KErrNone) - { - delete d->socket; - d->socket = 0; - return false; - } - } - - if (port == 0) - addr.SetPort(KRfcommPassiveAutoBind); - else - addr.SetPort(port); - - TBTServiceSecurity security; - switch (d->securityFlags) { - case QBluetooth::Authentication: - security.SetAuthentication(EMitmDesired); - break; - case QBluetooth::Authorization: - security.SetAuthorisation(ETrue); - break; - case QBluetooth::Encryption: - // "Secure" is BlueZ specific we just make sure the code remain compatible - case QBluetooth::Secure: - // authentication required - security.SetAuthentication(EMitmDesired); - security.SetEncryption(ETrue); - break; - case QBluetooth::NoSecurity: - default: - break; - } - if(d->ds->iSocket->Bind(addr) == KErrNone) - { - d->socket->setSocketState(QBluetoothSocket::BoundState); - } - else - { - delete d->socket; - d->socket = 0; - return false; - } - - if(d->ds->iSocket->Listen(d->maxPendingConnections) != KErrNone) - { - delete d->socket; - d->socket = 0; - return false; - } - - QBluetoothSocket *pendingSocket = new QBluetoothSocket(QBluetoothSocket::UnknownSocketType, this); - if(!pendingSocket) - { - delete d->socket; - d->socket = 0; - return false; - } - QBluetoothSocketPrivate *pd = pendingSocket->d_ptr; - pd->ensureBlankNativeSocket(QBluetoothSocket::RfcommSocket); - connect(d->socket, SIGNAL(disconnected()), this, SLOT(_q_disconnected())); - connect(d->socket, SIGNAL(connected()), this, SLOT(_q_connected())); - connect(d->socket, SIGNAL(error(QBluetoothSocket::SocketError)), this, SLOT(_q_socketError(QBluetoothSocket::SocketError))); - if (d->ds->iSocket->Accept(*pd->iSocket) == KErrNone) - { - d->socket->setSocketState(QBluetoothSocket::ListeningState); - d->activeSockets.append(pendingSocket); - return true; - } - else - { - delete d->socket, pendingSocket; - d->socket = 0; - return false; - } -} - -void QRfcommServer::setMaxPendingConnections(int numConnections) -{ - Q_D(QRfcommServer); - d->maxPendingConnections = numConnections; -} - -QBluetoothAddress QRfcommServer::serverAddress() const -{ - Q_D(const QRfcommServer); - if(d->socket) - return d->socket->localAddress(); - else - return QBluetoothAddress(); -} - -quint16 QRfcommServer::serverPort() const -{ - Q_D(const QRfcommServer); - if(d->socket) - return d->socket->localPort(); - else - return 0; -} - -bool QRfcommServer::hasPendingConnections() const -{ - Q_D(const QRfcommServer); - return !d->activeSockets.isEmpty(); -} - -QBluetoothSocket *QRfcommServer::nextPendingConnection() -{ - Q_D(QRfcommServer); - if (d->activeSockets.isEmpty()) - return 0; - - QBluetoothSocket *next = d->activeSockets.takeFirst(); - return next; -} - -void QRfcommServerPrivate::_q_connected() -{ - Q_Q(QRfcommServer); - if(!activeSockets.isEmpty()) - { - // update state of the pending socket and start receiving - (activeSockets.last())->setSocketState(QBluetoothSocket::ConnectedState); - (activeSockets.last())->d_ptr->startReceive(); - } - else - return; - emit q->newConnection(); - QBluetoothSocket *pendingSocket = new QBluetoothSocket(QBluetoothSocket::UnknownSocketType); - if(!pendingSocket) - { - delete socket; - socket = 0; - return; - } - QBluetoothSocketPrivate *pd = pendingSocket->d_ptr; - pd->ensureBlankNativeSocket(QBluetoothSocket::RfcommSocket); - if (ds->iSocket->Accept(*pd->iSocket) == KErrNone) - { - socket->setSocketState(QBluetoothSocket::ListeningState); - activeSockets.append(pendingSocket); - return; - } - else - { - // we might reach this statement if we have reach - // maxPendingConnections - delete socket, pendingSocket; - socket = 0; - return; - } -} - -void QRfcommServerPrivate::_q_disconnected() -{ - delete socket; - socket = 0; -} - -void QRfcommServerPrivate::_q_socketError(QBluetoothSocket::SocketError err) -{ - delete socket; - socket = 0; -} - -void QRfcommServer::setSecurityFlags(QBluetooth::SecurityFlags security) -{ - Q_D(QRfcommServer); - d->securityFlags = security; -} - -QBluetooth::SecurityFlags QRfcommServer::securityFlags() const -{ - Q_D(const QRfcommServer); - return d->securityFlags; -} - -QTBLUETOOTH_END_NAMESPACE diff --git a/src/bluetooth/symbian/bluetoothlinkmanagerdevicediscoverer.cpp b/src/bluetooth/symbian/bluetoothlinkmanagerdevicediscoverer.cpp deleted file mode 100644 index b8e9eebb..00000000 --- a/src/bluetooth/symbian/bluetoothlinkmanagerdevicediscoverer.cpp +++ /dev/null @@ -1,386 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// INCLUDE FILES -#include "bluetoothlinkmanagerdevicediscoverer.h" -#include "qbluetoothaddress.h" -#include "qbluetoothdeviceinfo.h" -#include "qbluetoothuuid.h" - -#include <qstring.h> -#ifdef EIR_SUPPORTED -#include <arpa/inet.h> -#include <netinet/in.h> -#endif -#include "utils_symbian_p.h" -#include <qdebug.h> - -/*! \internal - \class BluetoothLinkManagerDeviceDiscoverer - \brief The BluetoothLinkManagerDeviceDiscoverer class searches other bluetooth devices. - - \ingroup connectivity-bluetooth - \inmodule QtBluetooth - \internal - - BluetoothLinkManagerDeviceDiscoverer is an Symbian ActiveObject derived class that discovers - other Bluetooth devices using "BTLinkManager" protocol. - - When Bluetoothdevices are found signal deviceDiscovered(QBluetoothDeviceInfo &) is emitted. When - all devices are found (or none) signal deviceDiscoveryComplete() is emitted. - - In case of an error signal linkManagerError(int error) is emitted. In the case of errorSignal - one should consider deleting this class and creating it again. -*/ - -_LIT(KBTLinkManagerTxt,"BTLinkManager"); - -BluetoothLinkManagerDeviceDiscoverer::BluetoothLinkManagerDeviceDiscoverer(RSocketServ &socketServer,QObject *parent) - : QObject(parent) - , CActive(CActive::EPriorityStandard) - , m_socketServer(socketServer) - , m_pendingCancel(false), m_pendingStart(false), m_discoveryType (0) -{ - TInt result; - - /* find Bluetooth protocol */ - TProtocolDesc protocol; - result = m_socketServer.FindProtocol(KBTLinkManagerTxt(),protocol); - if (result == KErrNone) { - /* Create and initialise an RHostResolver */ - result = m_hostResolver.Open(m_socketServer, protocol.iAddrFamily, protocol.iProtocol); - } - // check possible error - if (result != KErrNone) { - setError(result); - } - - //add this active object to scheduler - CActiveScheduler::Add(this); -} - -BluetoothLinkManagerDeviceDiscoverer::~BluetoothLinkManagerDeviceDiscoverer() -{ - // cancel active object - Cancel(); - m_hostResolver.Close(); -} -/*! - Starts up device discovery. When devices are discovered signal deviceDiscovered is emitted. - After signal deviceDiscoveryComplete() is emitted new discovery request can be made. -*/ -void BluetoothLinkManagerDeviceDiscoverer::startDiscovery(const uint discoveryType) -{ - m_discoveryType = discoveryType; - - if(m_pendingCancel == true) { - m_pendingStart = true; - m_pendingCancel = false; - return; - } - if (!IsActive()) { - m_addr.SetIAC( discoveryType ); -#ifdef EIR_SUPPORTED - m_addr.SetAction(KHostResInquiry | KHostResName | KHostResIgnoreCache | KHostResEir); -#else - m_addr.SetAction(KHostResInquiry | KHostResName | KHostResIgnoreCache); -#endif - m_hostResolver.GetByAddress(m_addr, m_entry, iStatus); - SetActive(); - } -} - -void BluetoothLinkManagerDeviceDiscoverer::stopDiscovery() -{ - m_pendingStart = false; - if (IsActive() && !m_pendingCancel) { - m_pendingCancel = true; - m_hostResolver.Cancel(); - } -} - -/*! - Informs that our request has been prosessed and the data is available to be used. -*/ -void BluetoothLinkManagerDeviceDiscoverer::RunL() -{ - qDebug() << __PRETTY_FUNCTION__ << iStatus.Int(); - switch (iStatus.Int()) { - case KErrNone: // found device - if (m_pendingCancel && !m_pendingStart) { - m_pendingCancel = false; - emit canceled(); - } else { - m_pendingCancel = false; - m_pendingStart = false; - // get next (possible) discovered device - m_hostResolver.Next(m_entry, iStatus); - SetActive(); - emit deviceDiscovered(currentDeviceDataToQBluetoothDeviceInfo()); - } - break; - case KErrHostResNoMoreResults: // done with search - if (m_pendingCancel && !m_pendingStart){ // search was canceled prior to finishing - m_pendingCancel = false; - m_pendingStart = false; - emit canceled(); - } - else if (m_pendingStart){ // search was restarted just prior to finishing - m_pendingStart = false; - m_pendingCancel = false; - startDiscovery(m_discoveryType); - } else { // search completed normally - m_pendingStart = false; - m_pendingCancel = false; - emit deviceDiscoveryComplete(); - } - break; - case KErrCancel: // user canceled search - if (m_pendingStart){ // user activated search after cancel - m_pendingStart = false; - m_pendingCancel = false; - startDiscovery(m_discoveryType); - } else { // standard user cancel case - m_pendingCancel = false; - emit canceled(); - } - break; - default: - m_pendingStart = false; - m_pendingCancel = false; - setError(iStatus.Int()); - } -} -/*! - Cancel current request. -*/ -void BluetoothLinkManagerDeviceDiscoverer::DoCancel() -{ - m_hostResolver.Cancel(); -} - -TInt BluetoothLinkManagerDeviceDiscoverer::RunError(TInt aError) -{ - setError(aError); - return KErrNone; -} - -bool BluetoothLinkManagerDeviceDiscoverer::isReallyActive() const -{ - if(m_pendingStart) - return true; - if(m_pendingCancel) - return false; - return IsActive(); -} - -/*! - Transforms Symbian device name, address and service classes to QBluetootDeviceInfo. -*/ -QBluetoothDeviceInfo BluetoothLinkManagerDeviceDiscoverer::currentDeviceDataToQBluetoothDeviceInfo() const -{ - // extract device information from results and map them to QBluetoothDeviceInfo -#ifdef EIR_SUPPORTED - TBluetoothNameRecordWrapper eir(m_entry()); - TInt bufferlength = 0; - TInt err = KErrNone; - QString deviceName; - bufferlength = eir.GetDeviceNameLength(); - - if (bufferlength > 0) { - TBool nameComplete; - HBufC *deviceNameBuffer = 0; - TRAP(err,deviceNameBuffer = HBufC::NewL(bufferlength)); - if(err) - deviceName = QString(); - else - { - TPtr ptr = deviceNameBuffer->Des(); - err = eir.GetDeviceName(ptr,nameComplete); - if (err == KErrNone /*&& nameComplete*/) - { - if(!nameComplete) - qWarning() << "device name incomplete"; - // isn't it better to get an incomplete name than getting nothing? - deviceName = QString::fromUtf16(ptr.Ptr(), ptr.Length()).toUpper(); - } - else - deviceName = QString(); - delete deviceNameBuffer; - } - } - - QList<QBluetoothUuid> serviceUidList; - RExtendedInquiryResponseUUIDContainer uuidContainer; - QBluetoothDeviceInfo::DataCompleteness completenes = QBluetoothDeviceInfo::DataUnavailable; - - if (eir.GetServiceClassUuids(uuidContainer) == KErrNone) { - TInt uuidCount = uuidContainer.UUIDs().Count(); - if (uuidCount > 0) { - for (int i = 0; i < uuidCount; ++i) { - TPtrC8 shortFormUUid(uuidContainer.UUIDs()[i].ShortestForm()); - if (shortFormUUid.Size() == 2) { - QBluetoothUuid uuid(ntohs(*reinterpret_cast<const quint16 *>(shortFormUUid.Ptr()))); - if (uuidContainer.GetCompleteness(RExtendedInquiryResponseUUIDContainer::EUUID16)) - completenes = QBluetoothDeviceInfo::DataComplete; - else - completenes = QBluetoothDeviceInfo::DataIncomplete; - serviceUidList.append(uuid); - }else if (shortFormUUid.Size() == 4) { - QBluetoothUuid uuid(ntohl(*reinterpret_cast<const quint32 *>(shortFormUUid.Ptr()))); - if (uuidContainer.GetCompleteness(RExtendedInquiryResponseUUIDContainer::EUUID32)) - completenes = QBluetoothDeviceInfo::DataComplete; - else - completenes = QBluetoothDeviceInfo::DataIncomplete; - serviceUidList.append(uuid); - }else if (shortFormUUid.Size() == 16) { - QBluetoothUuid uuid(*reinterpret_cast<const quint128 *>(shortFormUUid.Ptr())); - if (uuidContainer.GetCompleteness(RExtendedInquiryResponseUUIDContainer::EUUID128)) - completenes = QBluetoothDeviceInfo::DataComplete; - else - completenes = QBluetoothDeviceInfo::DataIncomplete; - serviceUidList.append(uuid); - } - } - } - } - uuidContainer.Close(); - - bufferlength = 0; - QByteArray manufacturerData; - bufferlength = eir.GetVendorSpecificDataLength(); - - if (bufferlength > 0) { - HBufC8 *msd = 0; - TRAP(err,msd = HBufC8::NewL(bufferlength)); - if(err) - manufacturerData = QByteArray(); - else - { - TPtr8 temp = msd->Des(); - if (eir.GetVendorSpecificData(temp)) - manufacturerData = s60Desc8ToQByteArray(temp); - else - manufacturerData = QByteArray(); - delete msd; - } - } - - // Get transmission power level - TInt8 transmissionPowerLevel = 0; - eir.GetTxPowerLevel(transmissionPowerLevel); - - // unique address of the device - const TBTDevAddr symbianDeviceAddress = static_cast<TBTSockAddr> (m_entry().iAddr).BTAddr(); - QBluetoothAddress bluetoothAddress = qTBTDevAddrToQBluetoothAddress(symbianDeviceAddress); - - // format symbian major/minor numbers - quint32 deviceClass = qTPackSymbianDeviceClass(m_addr); - - QBluetoothDeviceInfo deviceInfo(bluetoothAddress, deviceName, deviceClass); - - deviceInfo.setRssi(transmissionPowerLevel); - deviceInfo.setServiceUuids(serviceUidList, completenes); - deviceInfo.setManufacturerSpecificData(manufacturerData); -#else - // device name - THostName symbianDeviceName = m_entry().iName; - QString deviceName = QString::fromUtf16(symbianDeviceName.Ptr(), symbianDeviceName.Length()).toUpper(); - - // unique address of the device - const TBTDevAddr symbianDeviceAddress = static_cast<TBTSockAddr> (m_entry().iAddr).BTAddr(); - QBluetoothAddress bluetoothAddress = qTBTDevAddrToQBluetoothAddress(symbianDeviceAddress); - - // format symbian major/minor numbers - quint32 deviceClass = qTPackSymbianDeviceClass(m_addr); - - QBluetoothDeviceInfo deviceInfo(bluetoothAddress, deviceName, deviceClass); - - if (m_addr.Rssi()) - deviceInfo.setRssi(m_addr.Rssi()); -#endif - if (!deviceInfo.rssi()) - deviceInfo.setRssi(1); - - deviceInfo.setCached(false); //TODO cache support missing from devicediscovery API - //qDebug()<< "Discovered device: name="<< deviceName <<", address=" << bluetoothAddress.toString() <<", class=" << deviceClass; - return deviceInfo; -} - -void BluetoothLinkManagerDeviceDiscoverer::setError(int errorCode) -{ - qDebug() << __PRETTY_FUNCTION__ << "errorCode=" << errorCode; - QString errorString; - switch (errorCode) { - case KLinkManagerErrBase: - errorString.append("Link manager base error value or Insufficient baseband resources error value"); - emit linkManagerError(QBluetoothDeviceDiscoveryAgent::UnknownError, errorString); - break; - case KErrProxyWriteNotAvailable: - errorString.append("Proxy write not available error value"); - emit linkManagerError(QBluetoothDeviceDiscoveryAgent::UnknownError, errorString); - break; - case KErrReflexiveBluetoothLink: - errorString.append("Reflexive BT link error value"); - emit linkManagerError(QBluetoothDeviceDiscoveryAgent::UnknownError, errorString); - break; - case KErrPendingPhysicalLink: - errorString.append("Physical link connection already pending when trying to connect the physical link"); - emit linkManagerError(QBluetoothDeviceDiscoveryAgent::UnknownError, errorString); - break; - case KErrNotReady: - errorString.append("KErrNotReady"); - emit linkManagerError(QBluetoothDeviceDiscoveryAgent::UnknownError, errorString); - case KErrCancel: - errorString.append("KErrCancel"); - qDebug() << "emitting canceled"; - emit canceled(); - break; - case KErrNone: - // do nothing - break; - default: - errorString = QString("Symbian errorCode = %1").arg(errorCode); - emit linkManagerError(QBluetoothDeviceDiscoveryAgent::UnknownError, errorString); - break; - } -} -#include "moc_bluetoothlinkmanagerdevicediscoverer.cpp" diff --git a/src/bluetooth/symbian/bluetoothlinkmanagerdevicediscoverer.h b/src/bluetooth/symbian/bluetoothlinkmanagerdevicediscoverer.h deleted file mode 100644 index 0756ffe4..00000000 --- a/src/bluetooth/symbian/bluetoothlinkmanagerdevicediscoverer.h +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtBluetooth module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef BLUETOOTHLINKMANAGERDEVICEDISCOVERER_H -#define BLUETOOTHLINKMANAGERDEVICEDISCOVERER_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <qconnectivityglobal.h> -#include <QtCore/QObject> -#include "qbluetoothdevicediscoveryagent.h" - -#include <es_sock.h> -#include <e32base.h> -#include <btdevice.h> -#include <bt_sock.h> -#include <btsdp.h> - - - -QT_BEGIN_HEADER - -class QBluetoothDeviceInfo; - -class BluetoothLinkManagerDeviceDiscoverer : public QObject, public CActive -{ - Q_OBJECT - -public: - - explicit BluetoothLinkManagerDeviceDiscoverer(RSocketServ& aSocketServ, QObject *parent = 0); - ~BluetoothLinkManagerDeviceDiscoverer(); - - void startDiscovery(const uint discoveryType); - void stopDiscovery(); - bool isReallyActive() const; - -protected: // From CActive - void RunL(); - void DoCancel(); - TInt RunError(TInt aError); - -private: - - void setError(int error); - -private: // private helper functions - - QBluetoothDeviceInfo currentDeviceDataToQBluetoothDeviceInfo() const; - -Q_SIGNALS: // SIGNALS - void deviceDiscoveryComplete(); - void deviceDiscovered(const QBluetoothDeviceInfo &device); - void linkManagerError(QBluetoothDeviceDiscoveryAgent::Error error, QString errorString); - void canceled(); - -private: - - // socket server handle - RSocketServ &m_socketServer; - - RHostResolver m_hostResolver; - TInquirySockAddr m_addr; - TNameEntry m_entry; - - TBool m_LIAC; - bool m_pendingCancel; - bool m_pendingStart; - uint m_discoveryType; -}; - -QT_END_HEADER - -#endif //BLUETOOTHLINKMANAGERDEVICEDISCOVERER_H diff --git a/src/bluetooth/symbian/bluetoothsymbianpairingadapter.cpp b/src/bluetooth/symbian/bluetoothsymbianpairingadapter.cpp deleted file mode 100644 index dae8e7e0..00000000 --- a/src/bluetooth/symbian/bluetoothsymbianpairingadapter.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// INCLUDE FILES -#include "bluetoothsymbianpairingadapter.h" -#include "qbluetoothaddress.h" -#include "qbluetoothdeviceinfo.h" -#include "qbluetoothlocaldevice.h" -#include <qstring.h> -#include <btdevice.h> -#include "utils_symbian_p.h" -#include "bluetoothsymbianregistryadapter.h" -#include <QDebug> - -/*Dedicated bonding attempt failure when the remote device responds with No-Bonding */ -const static TInt BTKErrRemoteDeviceIndicatedNoBonding = KLinkManagerErrBase-4; -/*! \internal - \class BluetoothSymbianPairingAdapter - \brief The BluetoothSymbianPairingAdapter class is an adapter for bluetooth pairing functionality. - - The BluetoothSymbianPairingAdapter is constructed to use for a one QBluetoothAddress. - It uses following Symbian class CBTEngConnMan for native operations. - - \ingroup connectivity-bluetooth - \inmodule QtBluetooth - \internal -*/ - -BluetoothSymbianPairingAdapter::BluetoothSymbianPairingAdapter(const QBluetoothAddress &address, QObject *parent) - : QObject(parent) - , m_pairingEngine(0) - , m_address(address) - , m_pairingOngoing(false) - , m_errorCode(0) - , m_pairingErrorString() -{ - TRAP(m_errorCode, m_pairingEngine = CBTEngConnMan::NewL(this)) - - if (m_errorCode != KErrNone) - emit pairingError(m_errorCode); -} -BluetoothSymbianPairingAdapter::~BluetoothSymbianPairingAdapter() -{ - delete m_pairingEngine; -} - -int BluetoothSymbianPairingAdapter::errorCode() const -{ - return m_errorCode; -} - -QString BluetoothSymbianPairingAdapter::pairingErrorString() const -{ - return m_pairingErrorString; -} - -void BluetoothSymbianPairingAdapter::startPairing(QBluetoothLocalDevice::Pairing pairing) -{ - TBTDevAddr btAddress(m_address.toUInt64()); - // start async pairing process - m_pairingOngoing = true; - int error = KErrBadHandle; - - if (m_pairingEngine) { - error =KErrNone; - error = m_pairingEngine->PairDevice(btAddress); - } - - if (error != KErrNone) { - PairingComplete(btAddress, error); - } -} - -void BluetoothSymbianPairingAdapter::ConnectComplete( TBTDevAddr& aAddr, TInt aErr, - RBTDevAddrArray* aConflicts ) -{ - Q_UNUSED(aAddr); - Q_UNUSED(aErr); - Q_UNUSED(aConflicts); -} - -void BluetoothSymbianPairingAdapter::DisconnectComplete( TBTDevAddr& aAddr, TInt aErr ) -{ - Q_UNUSED(aAddr); - Q_UNUSED(aErr); -} - -void BluetoothSymbianPairingAdapter::PairingComplete( TBTDevAddr& aAddr, TInt aErr ) -{ - m_pairingErrorString.clear(); - m_pairingOngoing = false; - - switch (aErr) { - case KErrNone: { - // need to figure out if authorized or not - QBluetoothLocalDevice::Pairing pairingStatus = QBluetoothLocalDevice::Paired; - BluetoothSymbianRegistryAdapter *registryAdapter = new BluetoothSymbianRegistryAdapter( - qTBTDevAddrToQBluetoothAddress(aAddr),NULL); - if (registryAdapter) { - pairingStatus = registryAdapter->pairingStatus(); - delete registryAdapter; - } - qDebug() << "pairingStatus = " << static_cast<int>(pairingStatus); - emit pairingFinished(qTBTDevAddrToQBluetoothAddress(aAddr),pairingStatus); - } - break; - case BTKErrRemoteDeviceIndicatedNoBonding: - m_pairingErrorString.append("Dedicated bonding attempt failure when the remote device responds with No-Bonding"); - break; - default: - m_pairingErrorString.append("Symbian pairing error=") + aErr; - break; - } - if (aErr != KErrNone) - emit pairingError(aErr); - -} - -#include "moc_bluetoothsymbianpairingadapter.cpp" diff --git a/src/bluetooth/symbian/bluetoothsymbianpairingadapter.h b/src/bluetooth/symbian/bluetoothsymbianpairingadapter.h deleted file mode 100644 index fffc1b4f..00000000 --- a/src/bluetooth/symbian/bluetoothsymbianpairingadapter.h +++ /dev/null @@ -1,105 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtBluetooth module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef BLUETOOTHSYMBIANPAIRINGADAPTER_H -#define BLUETOOTHSYMBIANPAIRINGADAPTER_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <qconnectivityglobal.h> -#include <QtCore/QObject> - -#include <e32base.h> -#include <btdevice.h> -#include <bt_sock.h> -#include <btengconnman.h> -#include "qbluetoothlocaldevice.h" - -QT_BEGIN_HEADER - -class QBluetoothAddress; - -class BluetoothSymbianPairingAdapter : public QObject, public MBTEngConnObserver -{ - Q_OBJECT -public: - - explicit BluetoothSymbianPairingAdapter(const QBluetoothAddress &address, QObject *parent = 0); - ~BluetoothSymbianPairingAdapter(); - - void startPairing(QBluetoothLocalDevice::Pairing pairing); - - int errorCode() const; - QString pairingErrorString() const; - -public: //from MBTEngConnObserver - virtual void ConnectComplete( TBTDevAddr& aAddr, TInt aErr, - RBTDevAddrArray* aConflicts = NULL ); - virtual void DisconnectComplete( TBTDevAddr& aAddr, TInt aErr ); - - virtual void PairingComplete( TBTDevAddr& aAddr, TInt aErr ); - -Q_SIGNALS: // SIGNALS - void pairingFinished(const QBluetoothAddress &address, QBluetoothLocalDevice::Pairing pairing); - void pairingDisplayPinCode(const QBluetoothAddress &address, QString pin); - void pairingError(int errorCode); -private: - - // socket server handle - CBTEngConnMan *m_pairingEngine; - const QBluetoothAddress &m_address; - bool m_pairingOngoing; - int m_errorCode; - QString m_pairingErrorString; -}; - -QT_END_HEADER - -#endif //BLUETOOTHSYMBIANPAIRINGADAPTER_H diff --git a/src/bluetooth/symbian/bluetoothsymbianregistryadapter.cpp b/src/bluetooth/symbian/bluetoothsymbianregistryadapter.cpp deleted file mode 100644 index 0d48c53c..00000000 --- a/src/bluetooth/symbian/bluetoothsymbianregistryadapter.cpp +++ /dev/null @@ -1,200 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// INCLUDE FILES -#include "bluetoothsymbianregistryadapter.h" -#include "qbluetoothaddress.h" -#include "qbluetoothdeviceinfo.h" -#include <qstring.h> -#include <btdevice.h> -#include "utils_symbian_p.h" - -/*! \internal - \class BluetoothSymbianRegistryAdapter - \brief The BluetoothSymbianRegistryAdapter class is an adapter for handling Symbian Bluetooth - Registry. - - The BluetoothSymbianRegistryAdapter is constructed to use for a one QBluetoothAddress. - It uses following Symbian class CBTEngDevMan for native operations. - - \ingroup connectivity-bluetooth - \inmodule QtBluetooth - \internal - - @internalComponent - -*/ - -BluetoothSymbianRegistryAdapter::BluetoothSymbianRegistryAdapter(const QBluetoothAddress &address, QObject *parent) - : QObject(parent) - , m_bluetoothDeviceManager(0) - , m_address(address) - , m_operation(NoOp) -{ - TRAP(m_errorCode, m_bluetoothDeviceManager = CBTEngDevMan::NewL(this)) - if (m_errorCode != KErrNone) - emit registryHandlingError(m_errorCode); -} -BluetoothSymbianRegistryAdapter::~BluetoothSymbianRegistryAdapter() -{ - delete m_bluetoothDeviceManager; -} - -int BluetoothSymbianRegistryAdapter::errorCode() const -{ - return m_errorCode; -} - -QString BluetoothSymbianRegistryAdapter::pairingErrorString() const -{ - return m_pairingErrorString; -} - -QBluetoothLocalDevice::Pairing BluetoothSymbianRegistryAdapter::remoteDevicePairingStatus() -{ - QBluetoothLocalDevice::Pairing returnValue = QBluetoothLocalDevice::Unpaired; - // if the address provided is not valid - if (m_address.isNull()) { - emit registryHandlingError((int)KErrArgument); - return returnValue; - } - int errorCode = 0; - // use Symbian registry to get a current pairing status of a device - // do not pass observer for this method -> use sync version of GetDevices() - CBTEngDevMan *btDeviceManager = NULL; - TRAPD(deviceManagerCreationErr, btDeviceManager = CBTEngDevMan::NewL(NULL)); - if (deviceManagerCreationErr != KErrNone) { - emit registryHandlingError((int)deviceManagerCreationErr); - return returnValue; - } - - // Spesify search criteria - TBTRegistrySearch lSearchCriteria; - TBTDevAddr btAddress(m_address.toUInt64()); - lSearchCriteria.FindAddress(btAddress); - - CBTDeviceArray *listOfDevices = NULL; - TRAPD(arrayCreationErr,listOfDevices = createDeviceArrayL()); - if (arrayCreationErr !=KErrNone) { - emit registryHandlingError((int)arrayCreationErr); - // cleanup manager before returning - delete btDeviceManager; - return returnValue; - } - errorCode = btDeviceManager->GetDevices(lSearchCriteria,listOfDevices); - if (errorCode != KErrNone) { - emit registryHandlingError(errorCode); - return returnValue; - } - if ( listOfDevices->Count() == 1) { - CBTDevice *device= listOfDevices->At(0); - bool isValidDevicePaired = device->IsValidPaired(); - bool isDevicePaired = device->IsPaired(); - //TODO Check whether check is correct? - if (isValidDevicePaired || isDevicePaired) { - if (device->GlobalSecurity().NoAuthorise()) - returnValue = QBluetoothLocalDevice::AuthorizedPaired; - else - returnValue = QBluetoothLocalDevice::Paired; - } - else if (!isValidDevicePaired && !isDevicePaired) { - returnValue = QBluetoothLocalDevice::Unpaired; - } - - } else { - returnValue = QBluetoothLocalDevice::Unpaired; - } - //cleanup - listOfDevices->ResetAndDestroy(); - delete listOfDevices; - delete btDeviceManager; - return returnValue; -} -CBTDeviceArray* BluetoothSymbianRegistryAdapter::createDeviceArrayL() const -{ - return q_check_ptr(new CBTDeviceArray(10)); -} - -void BluetoothSymbianRegistryAdapter::removePairing() -{ - // setup current values - int errorCode = 0; - m_operation = RemovePairing; - // Spesify search criteria - TBTRegistrySearch searchCriteria; - TBTDevAddr btAddress(m_address.toUInt64()); - searchCriteria.FindAddress(btAddress); - errorCode = m_bluetoothDeviceManager->DeleteDevices(searchCriteria); - // if there is error then manually call callback for error routines - if (errorCode != KErrNone) - HandleDevManComplete(errorCode); - -} - -QBluetoothLocalDevice::Pairing BluetoothSymbianRegistryAdapter::pairingStatus() -{ - m_operation = PairingStatus; // only needed for uniformity - QBluetoothLocalDevice::Pairing pairStatus = remoteDevicePairingStatus(); - m_operation = NoOp; - - return pairStatus; -} - -void BluetoothSymbianRegistryAdapter::HandleDevManComplete( TInt aErr ) -{ - m_errorCode = aErr; - if (aErr != KErrNone) { - emit registryHandlingError(aErr); - } - if (m_operation == RemovePairing) { - emit pairingStatusChanged(m_address, QBluetoothLocalDevice::Unpaired); - m_operation = NoOp; - } - -} - -void BluetoothSymbianRegistryAdapter::HandleGetDevicesComplete( TInt aErr,CBTDeviceArray* aDeviceArray ) -{ - Q_UNUSED(aErr); - Q_UNUSED(aDeviceArray); -} - -#include "moc_bluetoothsymbianregistryadapter.cpp" diff --git a/src/bluetooth/symbian/bluetoothsymbianregistryadapter.h b/src/bluetooth/symbian/bluetoothsymbianregistryadapter.h deleted file mode 100644 index dbe5e22d..00000000 --- a/src/bluetooth/symbian/bluetoothsymbianregistryadapter.h +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtBluetooth module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef BLUETOOTHSYMBIANREGISTRYADAPTER_H -#define BLUETOOTHSYMBIANREGISTRYADAPTER_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <qconnectivityglobal.h> -#include <QtCore/QObject> - -#include <e32base.h> -#include <btdevice.h> -#include <bt_sock.h> -#include <btengdevman.h> -#include "qbluetoothlocaldevice.h" - -QT_BEGIN_HEADER - -class QBluetoothDeviceInfo; -class QBluetoothAddress; - -class BluetoothSymbianRegistryAdapter : public QObject, public MBTEngDevManObserver -{ - Q_OBJECT -public: - - explicit BluetoothSymbianRegistryAdapter(const QBluetoothAddress &address, QObject *parent = 0); - ~BluetoothSymbianRegistryAdapter(); - - void removePairing(); - QBluetoothLocalDevice::Pairing pairingStatus(); - int errorCode() const; - QString pairingErrorString() const; - -public: //from MBTEngDevManObserver - virtual void HandleDevManComplete( TInt aErr ); - virtual void HandleGetDevicesComplete( TInt aErr,CBTDeviceArray* aDeviceArray ); - - -private: - QBluetoothLocalDevice::Pairing remoteDevicePairingStatus(); - CBTDeviceArray* createDeviceArrayL() const; - -Q_SIGNALS: // SIGNALS - void registryHandlingError(int errorCode); - void pairingStatusChanged(const QBluetoothAddress &address, QBluetoothLocalDevice::Pairing pairing); - -private: - enum Operation { - NoOp, - PairingStatus, - RemovePairing - }; -private: - // Symbian registry hander - CBTEngDevMan *m_bluetoothDeviceManager; - const QBluetoothAddress &m_address; - Operation m_operation; - - int m_errorCode; - QString m_pairingErrorString; -}; - -QT_END_HEADER - -#endif //BLUETOOTHSYMBIANREGISTRYADAPTER_H diff --git a/src/bluetooth/symbian/symbian.pri b/src/bluetooth/symbian/symbian.pri deleted file mode 100644 index d45ce209..00000000 --- a/src/bluetooth/symbian/symbian.pri +++ /dev/null @@ -1,30 +0,0 @@ - -contains(SYMBIAN_VERSION, Symbian3) { - message("Extended Inquiry Request supported") - DEFINES += EIR_SUPPORTED -} - -PRIVATE_HEADERS += \ - bluetooth/symbian/bluetoothlinkmanagerdevicediscoverer.h \ - bluetooth/symbian/utils_symbian_p.h - -SOURCES += \ - bluetooth/symbian/bluetoothlinkmanagerdevicediscoverer.cpp - -contains(btengconnman_symbian_enabled, yes) { - DEFINES += USING_BTENGCONNMAN - LIBS *=-lbtengconnman - PRIVATE_HEADERS += \ - bluetooth/symbian/bluetoothsymbianpairingadapter.h - SOURCES += \ - bluetooth/symbian/bluetoothsymbianpairingadapter.cpp -} - -contains(btengdevman_symbian_enabled, yes) { - DEFINES += USING_BTENGDEVMAN - LIBS *=-lbtengdevman - PRIVATE_HEADERS += \ - bluetooth/symbian/bluetoothsymbianregistryadapter.h - SOURCES += \ - bluetooth/symbian/bluetoothsymbianregistryadapter.cpp -} diff --git a/src/bluetooth/symbian/utils_symbian_p.h b/src/bluetooth/symbian/utils_symbian_p.h deleted file mode 100644 index 3c0c233e..00000000 --- a/src/bluetooth/symbian/utils_symbian_p.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtBluetooth module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef UTILS_SYMBIAN_P_H -#define UTILS_SYMBIAN_P_H - -#include <bttypes.h> -#include <bt_sock.h> - -QT_BEGIN_HEADER - -inline QBluetoothAddress qTBTDevAddrToQBluetoothAddress(const TBTDevAddr &address) -{ - return QBluetoothAddress(QString(QByteArray((const char *)address.Des().Ptr(), 6).toHex().toUpper())); -} -inline quint32 qTPackSymbianDeviceClass(const TInquirySockAddr &address) -{ - TUint8 minorClass = address.MinorClassOfDevice(); - TUint8 majorClass = address.MajorClassOfDevice(); - TUint16 serviceClass = address.MajorServiceClass(); - quint32 deviceClass = (0 << 2) | (minorClass << 6 ) | (majorClass <<5) | serviceClass; - return deviceClass; -} -inline QString s60DescToQString(const TDesC &desc) -{ - return QString::fromUtf16(desc.Ptr(), desc.Length()); -} -inline QByteArray s60Desc8ToQByteArray(const TDesC8 &desc) -{ - return QByteArray((const char*)desc.Ptr(), desc.Length()); -} - -QT_END_HEADER - -#endif diff --git a/tests/auto/qbluetoothdevicediscoveryagent/qbluetoothdevicediscoveryagent.pro b/tests/auto/qbluetoothdevicediscoveryagent/qbluetoothdevicediscoveryagent.pro index f32c17cd..f02d22b6 100644 --- a/tests/auto/qbluetoothdevicediscoveryagent/qbluetoothdevicediscoveryagent.pro +++ b/tests/auto/qbluetoothdevicediscoveryagent/qbluetoothdevicediscoveryagent.pro @@ -4,6 +4,4 @@ CONFIG += testcase QT = core concurrent bluetooth testlib -symbian: TARGET.CAPABILITY = ReadDeviceData LocalServices WriteDeviceData - CONFIG += insignificant_test # QTBUG-22017 diff --git a/tests/auto/qbluetoothdeviceinfo/qbluetoothdeviceinfo.pro b/tests/auto/qbluetoothdeviceinfo/qbluetoothdeviceinfo.pro index e0bf7ab2..28eecce3 100644 --- a/tests/auto/qbluetoothdeviceinfo/qbluetoothdeviceinfo.pro +++ b/tests/auto/qbluetoothdeviceinfo/qbluetoothdeviceinfo.pro @@ -4,6 +4,4 @@ CONFIG += testcase QT = core concurrent bluetooth testlib -symbian: TARGET.CAPABILITY = ReadDeviceData LocalServices WriteDeviceData - CONFIG += insignificant_test # QTBUG-22017 diff --git a/tests/auto/qbluetoothlocaldevice/qbluetoothlocaldevice.pro b/tests/auto/qbluetoothlocaldevice/qbluetoothlocaldevice.pro index abb1f3da..d35df900 100644 --- a/tests/auto/qbluetoothlocaldevice/qbluetoothlocaldevice.pro +++ b/tests/auto/qbluetoothlocaldevice/qbluetoothlocaldevice.pro @@ -4,6 +4,4 @@ CONFIG += testcase QT = core concurrent bluetooth testlib -symbian: TARGET.CAPABILITY = ReadDeviceData LocalServices WriteDeviceData NetworkControl - CONFIG += insignificant_test # QTBUG-22017 diff --git a/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp b/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp index 0e877ef8..1470567c 100644 --- a/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp +++ b/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp @@ -106,16 +106,6 @@ void tst_QBluetoothLocalDevice::tst_pairDevice_data() QTest::newRow("UnPaired Device: DUMMY") << QBluetoothAddress("11:00:00:00:00:00") << QBluetoothLocalDevice::Unpaired; -#ifdef Q_OS_SYMBIAN - - QTest::newRow("unPAIRED Device: J X6") << QBluetoothAddress("d8:75:33:6a:82:85") - << QBluetoothLocalDevice::Unpaired; - QTest::newRow("AuthPAIRED Device: J X6") << QBluetoothAddress("d8:75:33:6a:82:85") - << QBluetoothLocalDevice::AuthorizedPaired; - QTest::newRow("PAIRED Device: J C-7-1") << QBluetoothAddress("6c:9b:02:0c:91:ca") - << QBluetoothLocalDevice::Paired; - -#endif // Q_OS_SYMBIAN } void tst_QBluetoothLocalDevice::tst_pairingStatus_data() @@ -125,12 +115,6 @@ void tst_QBluetoothLocalDevice::tst_pairingStatus_data() QTest::newRow("UnPaired Device: DUMMY") << QBluetoothAddress("11:00:00:00:00:00") << QBluetoothLocalDevice::Unpaired; -#ifdef Q_OS_SYMBIAN - QTest::newRow("PAIRED Device: J X6") << QBluetoothAddress("d8:75:33:6a:82:85") - << QBluetoothLocalDevice::Paired; - QTest::newRow("AuthPAIRED Device: J C-7-1") << QBluetoothAddress("6c:9b:02:0c:91:ca") - << QBluetoothLocalDevice::AuthorizedPaired; -#endif // Q_OS_SYMBIAN } void tst_QBluetoothLocalDevice::tst_powerOn() diff --git a/tests/auto/qbluetoothservicediscoveryagent/qbluetoothservicediscoveryagent.pro b/tests/auto/qbluetoothservicediscoveryagent/qbluetoothservicediscoveryagent.pro index f53e0db7..9b5c771e 100644 --- a/tests/auto/qbluetoothservicediscoveryagent/qbluetoothservicediscoveryagent.pro +++ b/tests/auto/qbluetoothservicediscoveryagent/qbluetoothservicediscoveryagent.pro @@ -4,6 +4,4 @@ CONFIG += testcase QT = core concurrent bluetooth testlib -symbian: TARGET.CAPABILITY = ReadDeviceData LocalServices WriteDeviceData - CONFIG += insignificant_test # QTBUG-22017 diff --git a/tests/auto/qbluetoothserviceinfo/qbluetoothserviceinfo.pro b/tests/auto/qbluetoothserviceinfo/qbluetoothserviceinfo.pro index c93e4962..f5e0a627 100644 --- a/tests/auto/qbluetoothserviceinfo/qbluetoothserviceinfo.pro +++ b/tests/auto/qbluetoothserviceinfo/qbluetoothserviceinfo.pro @@ -4,6 +4,4 @@ CONFIG += testcase QT = core concurrent bluetooth testlib -symbian: TARGET.CAPABILITY = ReadDeviceData LocalServices WriteDeviceData - CONFIG += insignificant_test # QTBUG-22017 diff --git a/tests/auto/qbluetoothsocket/qbluetoothsocket.pro b/tests/auto/qbluetoothsocket/qbluetoothsocket.pro index b98ecf13..e0ea985a 100644 --- a/tests/auto/qbluetoothsocket/qbluetoothsocket.pro +++ b/tests/auto/qbluetoothsocket/qbluetoothsocket.pro @@ -7,8 +7,6 @@ QT = core concurrent network bluetooth testlib INCLUDEPATH += ../../../tests/btclient DEPENDPATH += ../../../tests/btclient -symbian: TARGET.CAPABILITY = NetworkControl ReadDeviceData LocalServices WriteDeviceData - OTHER_FILES += \ README.txt diff --git a/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp b/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp index 3520d6be..512f4d7d 100644 --- a/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp +++ b/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp @@ -60,9 +60,6 @@ Q_DECLARE_METATYPE(QBluetoothSocket::SocketType) //#define BTADDRESS "00:1A:9F:92:9E:5A" char BTADDRESS[] = "00:00:00:00:00:00"; -#ifdef Q_OS_SYMBIAN -static const QString peerNameSymbian("Patagonia_bluetooth_client"); -#endif // Max time to wait for connection @@ -675,7 +672,6 @@ void tst_QBluetoothSocket::tst_localPeer() QFETCH(quint16, peerPort); Q_UNUSED(peerPort) -#ifndef Q_OS_SYMBIAN QStringList args; args << "name" << peerAddress.toString(); QProcess *hcitool = new QProcess(); @@ -684,7 +680,6 @@ void tst_QBluetoothSocket::tst_localPeer() QString peerNameHCI = hcitool->readLine().trimmed(); hcitool->close(); delete hcitool; -#endif /* Construction */ @@ -729,11 +724,7 @@ void tst_QBluetoothSocket::tst_localPeer() QCOMPARE(socket->localName(), list[2]); QCOMPARE(socket->localAddress(), QBluetoothAddress(list[3])); QCOMPARE(socket->localPort(), list[4].toUShort()); -#ifndef Q_OS_SYMBIAN QCOMPARE(socket->peerName(), peerNameHCI); -#else - QCOMPARE(socket->peerName(), peerNameSymbian); -#endif /* Disconnection */ QSignalSpy disconnectedSpy(socket, SIGNAL(disconnected())); diff --git a/tests/auto/qbluetoothtransfermanager/qbluetoothtransfermanager.pro b/tests/auto/qbluetoothtransfermanager/qbluetoothtransfermanager.pro index cba068be..a2003298 100644 --- a/tests/auto/qbluetoothtransfermanager/qbluetoothtransfermanager.pro +++ b/tests/auto/qbluetoothtransfermanager/qbluetoothtransfermanager.pro @@ -7,6 +7,4 @@ QT = core concurrent bluetooth testlib INCLUDEPATH += ../../../tests/btclient DEPENDPATH += ../../../tests/btclient -symbian: TARGET.CAPABILITY = All-TCB #ReadDeviceData LocalServices WriteDeviceData - CONFIG += insignificant_test # QTBUG-22017 diff --git a/tests/auto/qbluetoothtransfermanager/tst_qbluetoothtransfermanager.cpp b/tests/auto/qbluetoothtransfermanager/tst_qbluetoothtransfermanager.cpp index 7b5f8224..8c2e6346 100644 --- a/tests/auto/qbluetoothtransfermanager/tst_qbluetoothtransfermanager.cpp +++ b/tests/auto/qbluetoothtransfermanager/tst_qbluetoothtransfermanager.cpp @@ -61,12 +61,7 @@ QTBLUETOOTH_USE_NAMESPACE typedef QMap<int,QVariant> tst_QBluetoothTransferManager_QParameterMap; Q_DECLARE_METATYPE(tst_QBluetoothTransferManager_QParameterMap) -#ifdef Q_OS_SYMBIAN -char BTADDRESS[] = "00:09:DD:50:93:DD"; -static const QString testfile("c:\\data\\testdata.txt"); -#else char BTADDRESS[] = "00:00:00:00:00:00"; -#endif static const int MaxConnectTime = 60 * 1000; // 1 minute in ms @@ -121,7 +116,6 @@ void tst_QBluetoothTransferManager::initTestCase() device->powerOn(); delete device; -#ifndef Q_OS_SYMBIAN // Go find an echo server for BTADDRESS QBluetoothServiceDiscoveryAgent *sda = new QBluetoothServiceDiscoveryAgent(this); connect(sda, SIGNAL(serviceDiscovered(QBluetoothServiceInfo)), this, SLOT(serviceDiscovered(QBluetoothServiceInfo))); @@ -144,7 +138,6 @@ void tst_QBluetoothTransferManager::initTestCase() QFAIL("Unable to find test service"); } delete sda; -#endif } void tst_QBluetoothTransferManager::error(QBluetoothServiceDiscoveryAgent::Error error) { @@ -198,42 +191,6 @@ void tst_QBluetoothTransferManager::tst_put() } QBluetoothTransferManager manager; - -#ifdef Q_OS_SYMBIAN - { - QFile fileToWrite(testfile); - if (!fileToWrite.open(QIODevice::WriteOnly | QIODevice::Text)) - return; - - QTextStream out(&fileToWrite); - out << "This_is_testdata!!!"; - fileToWrite.close(); - } - - QFile file(testfile); - if (!file.exists()) - return; - - QBluetoothTransferReply *reply = manager.put(transferRequest, &file); - int connectTime = MaxConnectTime; - - QSignalSpy finishedSpy(&manager, SIGNAL(finished(QBluetoothTransferReply*))); - while (finishedSpy.count() == 0 && connectTime > 0) { - QTest::qWait(1000); - connectTime -= 1000; - } - QCOMPARE(finishedSpy.count(), 1); - - int error = reply->error(); - qDebug()<<"QtBluetoothTester::SendData reply->error ="<<error; - QVERIFY(error == QBluetoothTransferReply::NoError); - - if (error != QBluetoothTransferReply::NoError) { - qDebug() << "Failed to send file"; - } - delete reply; - file.close(); -#endif } void tst_QBluetoothTransferManager::tst_putAbort_data() @@ -261,35 +218,6 @@ void tst_QBluetoothTransferManager::tst_putAbort() } QBluetoothTransferManager manager; - -#ifdef Q_OS_SYMBIAN - { - QFile fileToWrite(testfile); - if (!fileToWrite.open(QIODevice::WriteOnly | QIODevice::Text)) - return; - - QTextStream out(&fileToWrite); - out << "This_is_testdata!!!"; - fileToWrite.close(); - } - - QFile file(testfile); - if (!file.exists()) - return; - - QBluetoothTransferReply *reply = manager.put(transferRequest, &file); - reply->abort(); - - int error = reply->error(); - qDebug()<<"QtBluetoothTester::SendData reply->error ="<<error; - QVERIFY(error == QBluetoothTransferReply::NoError); - - if (error != QBluetoothTransferReply::NoError) { - qDebug() << "Failed to send file"; - } - delete reply; - file.close(); -#endif } void tst_QBluetoothTransferManager::tst_attribute_data() @@ -317,32 +245,6 @@ void tst_QBluetoothTransferManager::tst_attribute() } QBluetoothTransferManager manager; - -#ifdef Q_OS_SYMBIAN - { - QFile fileToWrite(testfile); - if (!fileToWrite.open(QIODevice::WriteOnly | QIODevice::Text)) - return; - - QTextStream out(&fileToWrite); - out << "This_is_testdata!!!"; - fileToWrite.close(); - } - - QFile file(testfile); - if (!file.exists()) - return; - - QBluetoothTransferReply *reply = manager.put(transferRequest, &file); - reply->abort(); - - QVERIFY(reply->attribute(QBluetoothTransferRequest::DescriptionAttribute) == QVariant("Desciption")); - QVERIFY(reply->attribute(QBluetoothTransferRequest::LengthAttribute) == QVariant("1024")); - QVERIFY(reply->attribute(QBluetoothTransferRequest::TypeAttribute) == QVariant("OPP")); - - delete reply; - file.close(); -#endif } void tst_QBluetoothTransferManager::tst_operation_data() @@ -358,28 +260,6 @@ void tst_QBluetoothTransferManager::tst_operation() QBluetoothTransferRequest transferRequest(address); QBluetoothTransferManager manager; -#ifdef Q_OS_SYMBIAN - { - QFile fileToWrite(testfile); - if (!fileToWrite.open(QIODevice::WriteOnly | QIODevice::Text)) - return; - - QTextStream out(&fileToWrite); - out << "This_is_testdata!!!"; - fileToWrite.close(); - } - - QFile file(testfile); - if (!file.exists()) - return; - - QBluetoothTransferReply *reply = manager.put(transferRequest, &file); - - QVERIFY(reply->operation() == QBluetoothTransferManager::PutOperation); - - delete reply; - file.close(); -#endif } void tst_QBluetoothTransferManager::tst_manager_data() @@ -395,28 +275,6 @@ void tst_QBluetoothTransferManager::tst_manager() QBluetoothTransferRequest transferRequest(address); QBluetoothTransferManager manager; -#ifdef Q_OS_SYMBIAN - { - QFile fileToWrite(testfile); - if (!fileToWrite.open(QIODevice::WriteOnly | QIODevice::Text)) - return; - - QTextStream out(&fileToWrite); - out << "This_is_testdata!!!"; - fileToWrite.close(); - } - - QFile file(testfile); - if (!file.exists()) - return; - - QBluetoothTransferReply *reply = manager.put(transferRequest, &file); - - QVERIFY(reply->manager() == &manager); - - delete reply; - file.close(); -#endif } QTEST_MAIN(tst_QBluetoothTransferManager) diff --git a/tests/auto/qbluetoothtransferrequest/qbluetoothtransferrequest.pro b/tests/auto/qbluetoothtransferrequest/qbluetoothtransferrequest.pro index 15296835..0d92458c 100644 --- a/tests/auto/qbluetoothtransferrequest/qbluetoothtransferrequest.pro +++ b/tests/auto/qbluetoothtransferrequest/qbluetoothtransferrequest.pro @@ -4,6 +4,4 @@ CONFIG += testcase QT = core concurrent bluetooth testlib -symbian: TARGET.CAPABILITY = ReadDeviceData LocalServices WriteDeviceData - CONFIG += insignificant_test # QTBUG-22017 diff --git a/tests/auto/qbluetoothuuid/qbluetoothuuid.pro b/tests/auto/qbluetoothuuid/qbluetoothuuid.pro index 7ba965d2..2d81c4af 100644 --- a/tests/auto/qbluetoothuuid/qbluetoothuuid.pro +++ b/tests/auto/qbluetoothuuid/qbluetoothuuid.pro @@ -3,7 +3,3 @@ TARGET = tst_qbluetoothuuid CONFIG += testcase QT = core concurrent bluetooth testlib - -symbian: { - LIBS *= -lbluetooth -} diff --git a/tests/auto/qbluetoothuuid/tst_qbluetoothuuid.cpp b/tests/auto/qbluetoothuuid/tst_qbluetoothuuid.cpp index 28219240..75924464 100644 --- a/tests/auto/qbluetoothuuid/tst_qbluetoothuuid.cpp +++ b/tests/auto/qbluetoothuuid/tst_qbluetoothuuid.cpp @@ -49,9 +49,6 @@ #if defined(Q_OS_UNIX) # include <arpa/inet.h> # include <netinet/in.h> -#elif defined(Q_OS_SYMBIAN) -//needed for symbian uuid conversion test -#include <bttypes.h> #endif QTBLUETOOTH_USE_NAMESPACE @@ -75,10 +72,6 @@ private slots: void tst_conversion(); void tst_comparison_data(); void tst_comparison(); -#ifdef Q_OS_SYMBIAN - void tst_symbian_uuid_tranformation_data(); - void tst_symbian_uuid_tranformation(); -#endif }; tst_QBluetoothUuid::tst_QBluetoothUuid() @@ -390,51 +383,6 @@ void tst_QBluetoothUuid::tst_comparison() } } } -#ifdef Q_OS_SYMBIAN -void tst_QBluetoothUuid::tst_symbian_uuid_tranformation_data() -{ - tst_conversion_data(); -} - -void tst_QBluetoothUuid::tst_symbian_uuid_tranformation() -{ - QFETCH(quint128, uuid128); - - QBluetoothUuid quuid128(uuid128); - - for (int var = 0; var < 16; ++var) { - QVERIFY(quuid128.toUInt128().data[var] == uuid128.data[var]); - } - - if (quuid128.minimumSize() == 2) { - TUUID sUuid(quuid128.toUInt16()); - QBluetoothUuid fromSymbianUuid(ntohs(*reinterpret_cast<const quint16 *>(sUuid.Des().Ptr()))); - QCOMPARE(quuid128, fromSymbianUuid); - //qDebug()<<"sUuid size ="<<sUuid.Des().Length() ; - } else if (quuid128.minimumSize() == 4) { - TUUID sUuid(quuid128.toUInt32()); - QBluetoothUuid fromSymbianUuid(ntohl(*reinterpret_cast<const quint32 *>(sUuid.Des().Ptr()))); - QCOMPARE(quuid128, fromSymbianUuid); - //qDebug()<<"sUuid size ="<<sUuid.Des().Length() ; - } else if (quuid128.minimumSize()==16) { - - TUint32 *dataPointer = (TUint32*)quuid128.toUInt128().data; - TUint32 hH = qToBigEndian<quint32>(*(dataPointer++)); - TUint32 hL = qToBigEndian<quint32>(*(dataPointer++)); - TUint32 lH = qToBigEndian<quint32>(*(dataPointer++)); - TUint32 lL = qToBigEndian<quint32>(*(dataPointer)); - TUUID sUuid(hH, hL, lH, lL); - //qDebug()<<"sUuid size ="<<sUuid.Des().Length() ; - //qDebug()<<"sUuid longsize ="<<sUuid.LongForm().Length() ; - - for (int var = 0; var < sUuid.Des().Length(); ++var) { - //qDebug()<<"sUuid at ="<<var<<"="<<sUuid.Des()[var] ; - //qDebug()<<"quuid128 at ="<<var<<"="<<quuid128.toUInt128().data[var] ; - QVERIFY(quuid128.toUInt128().data[var] == sUuid.Des()[var]); - } - } -} -#endif //Q_OS_SYMBIAN QTEST_MAIN(tst_QBluetoothUuid) #include "tst_qbluetoothuuid.moc" diff --git a/tests/auto/ql2capserver/ql2capserver.pro b/tests/auto/ql2capserver/ql2capserver.pro index 9853e045..453c07fa 100644 --- a/tests/auto/ql2capserver/ql2capserver.pro +++ b/tests/auto/ql2capserver/ql2capserver.pro @@ -5,5 +5,3 @@ TARGET = tst_ql2capserver #CONFIG += testcase QT = core concurrent bluetooth testlib - -symbian: TARGET.CAPABILITY = LocalServices NetworkControl |