From bc9bc3400ccecd9d7bcbbe5eee1fc49070874b4c Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 25 Jun 2012 13:53:08 +1000 Subject: Split QBluetoothHostInfo from QBluetoothLocalDevice Change-Id: I8bd9de956c62f93b509e877128b1822ebfef69bd Reviewed-by: Michael Zanetti Reviewed-by: Andrew Stanley-Jones --- src/bluetooth/bluetooth.pro | 3 + src/bluetooth/qbluetoothhostinfo.cpp | 122 ++++++++++++++++++++++++++++++++++ src/bluetooth/qbluetoothhostinfo.h | 75 +++++++++++++++++++++ src/bluetooth/qbluetoothhostinfo_p.h | 64 ++++++++++++++++++ src/bluetooth/qbluetoothlocaldevice.h | 24 +------ 5 files changed, 265 insertions(+), 23 deletions(-) create mode 100644 src/bluetooth/qbluetoothhostinfo.cpp create mode 100644 src/bluetooth/qbluetoothhostinfo.h create mode 100644 src/bluetooth/qbluetoothhostinfo_p.h (limited to 'src') diff --git a/src/bluetooth/bluetooth.pro b/src/bluetooth/bluetooth.pro index 48bd05f7..59d4b70f 100644 --- a/src/bluetooth/bluetooth.pro +++ b/src/bluetooth/bluetooth.pro @@ -10,6 +10,7 @@ QT += concurrent PUBLIC_HEADERS += \ qbluetoothaddress.h\ + qbluetoothhostinfo.h \ qbluetoothuuid.h\ qbluetoothdeviceinfo.h\ qbluetoothserviceinfo.h\ @@ -28,6 +29,7 @@ PUBLIC_HEADERS += \ PRIVATE_HEADERS += \ qbluetoothaddress_p.h\ + qbluetoothhostinfo_p.h \ qbluetoothdeviceinfo_p.h\ qbluetoothserviceinfo_p.h\ qbluetoothdevicediscoveryagent_p.h\ @@ -41,6 +43,7 @@ PRIVATE_HEADERS += \ SOURCES += \ qbluetoothaddress.cpp\ + qbluetoothhostinfo.cpp \ qbluetoothuuid.cpp\ qbluetoothdeviceinfo.cpp\ qbluetoothserviceinfo.cpp\ diff --git a/src/bluetooth/qbluetoothhostinfo.cpp b/src/bluetooth/qbluetoothhostinfo.cpp new file mode 100644 index 00000000..d85f87c3 --- /dev/null +++ b/src/bluetooth/qbluetoothhostinfo.cpp @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** 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 "qbluetoothhostinfo.h" +#include "qbluetoothhostinfo_p.h" + +QTBLUETOOTH_BEGIN_NAMESPACE + +/*! + \class QBluetoothHostInfo + \brief The QBluetoothHostInfo class encapsulates the details of a local + QBluetooth device. + + \ingroup connectivity-bluetooth + \inmodule QtBluetooth + + This class holds the name and address of a local Bluetooth device. +*/ + +/*! + Constrcuts a null QBluetoothHostInfo object. +*/ +QBluetoothHostInfo::QBluetoothHostInfo() + : d_ptr(new QBluetoothHostInfoPrivate) +{ +} + +/*! + Constrcuts a new QBluetoothHostInfo which is a copy of \a other. +*/ +QBluetoothHostInfo::QBluetoothHostInfo(const QBluetoothHostInfo &other) + : d_ptr(new QBluetoothHostInfoPrivate) +{ + Q_D(QBluetoothHostInfo); + + d->m_address = other.d_func()->m_address; + d->m_name = other.d_func()->m_name; +} + +/*! + Destroys the QBluetoothHostInfo. +*/ +QBluetoothHostInfo::~QBluetoothHostInfo() +{ + delete d_ptr; +} + +/*! + Returns the Bluetooth address as a QBluetoothAddress. +*/ +QBluetoothAddress QBluetoothHostInfo::getAddress() const +{ + Q_D(const QBluetoothHostInfo); + return d->m_address; +} + +/*! + Sets the Bluetooth \a address for this Bluetooth host info object. +*/ +void QBluetoothHostInfo::setAddress(const QBluetoothAddress &address) +{ + Q_D(QBluetoothHostInfo); + d->m_address = address; +} + +/*! + Returns the name of the host info object. +*/ +QString QBluetoothHostInfo::getName() const +{ + Q_D(const QBluetoothHostInfo); + return d->m_name; +} + +/*! + Sets the name of the host info object. +*/ +void QBluetoothHostInfo::setName(const QString &name) +{ + Q_D(QBluetoothHostInfo); + d->m_name = name; +} + +QTBLUETOOTH_END_NAMESPACE diff --git a/src/bluetooth/qbluetoothhostinfo.h b/src/bluetooth/qbluetoothhostinfo.h new file mode 100644 index 00000000..8124d7c8 --- /dev/null +++ b/src/bluetooth/qbluetoothhostinfo.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** 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 QBLUETOOTHHOSTINFO_H +#define QBLUETOOTHHOSTINFO_H + +#include "qbluetoothaddress.h" + +QT_BEGIN_HEADER + +QTBLUETOOTH_BEGIN_NAMESPACE + +class QBluetoothHostInfoPrivate; +class Q_BLUETOOTH_EXPORT QBluetoothHostInfo +{ +public: + QBluetoothHostInfo(); + QBluetoothHostInfo(const QBluetoothHostInfo &other); + ~QBluetoothHostInfo(); + + QBluetoothAddress getAddress() const; + void setAddress(const QBluetoothAddress &address); + + QString getName() const; + void setName(const QString &name); + +private: + Q_DECLARE_PRIVATE(QBluetoothHostInfo) + QBluetoothHostInfoPrivate *d_ptr; +}; + + +QTBLUETOOTH_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/bluetooth/qbluetoothhostinfo_p.h b/src/bluetooth/qbluetoothhostinfo_p.h new file mode 100644 index 00000000..0a079f00 --- /dev/null +++ b/src/bluetooth/qbluetoothhostinfo_p.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** 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 QBLUETOOTHHOSTINFO_P_H +#define QBLUETOOTHHOSTINFO_P_H + +#include "qbluetoothhostinfo.h" + +QT_BEGIN_HEADER + +QTBLUETOOTH_BEGIN_NAMESPACE + +class QBluetoothHostInfoPrivate +{ +public: + QBluetoothHostInfoPrivate() {} + + QBluetoothAddress m_address; + QString m_name; +}; + +QTBLUETOOTH_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/bluetooth/qbluetoothlocaldevice.h b/src/bluetooth/qbluetoothlocaldevice.h index 701dd85e..b1cc9da3 100644 --- a/src/bluetooth/qbluetoothlocaldevice.h +++ b/src/bluetooth/qbluetoothlocaldevice.h @@ -49,7 +49,7 @@ #include #include -#include "qbluetoothaddress.h" +#include "qbluetoothhostinfo.h" QT_BEGIN_HEADER @@ -57,28 +57,6 @@ QTBLUETOOTH_BEGIN_NAMESPACE class QBluetoothLocalDevicePrivate; -class Q_BLUETOOTH_EXPORT QBluetoothHostInfo -{ -public: - QBluetoothHostInfo() { } - QBluetoothHostInfo(const QBluetoothHostInfo &other) { - m_address = other.m_address; - m_name = other.m_name; - } - - QBluetoothAddress getAddress() const { return m_address; } - void setAddress(const QBluetoothAddress &address) { m_address = address; } - - QString getName() const { return m_name; } - void setName(const QString &name){ m_name = name; } - -private: - QBluetoothAddress m_address; - QString m_name; - -}; - - class Q_BLUETOOTH_EXPORT QBluetoothLocalDevice : public QObject { Q_OBJECT -- cgit v1.2.3