1
/****************************************************************************
3
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
4
** Contact: http://www.qt-project.org/legal
6
** This file is part of the QtBluetooth module of the Qt Toolkit.
8
** $QT_BEGIN_LICENSE:LGPL$
9
** Commercial License Usage
10
** Licensees holding valid commercial Qt licenses may use this file in
11
** accordance with the commercial license agreement provided with the
12
** Software or, alternatively, in accordance with the terms contained in
13
** a written agreement between you and Digia. For licensing terms and
14
** conditions see http://qt.digia.com/licensing. For further information
15
** use the contact form at http://qt.digia.com/contact-us.
17
** GNU Lesser General Public License Usage
18
** Alternatively, this file may be used under the terms of the GNU Lesser
19
** General Public License version 2.1 as published by the Free Software
20
** Foundation and appearing in the file LICENSE.LGPL included in the
21
** packaging of this file. Please review the following information to
22
** ensure the GNU Lesser General Public License version 2.1 requirements
23
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25
** In addition, as a special exception, Digia gives you certain additional
26
** rights. These rights are described in the Digia Qt LGPL Exception
27
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29
** GNU General Public License Usage
30
** Alternatively, this file may be used under the terms of the GNU
31
** General Public License version 3.0 as published by the Free Software
32
** Foundation and appearing in the file LICENSE.GPL included in the
33
** packaging of this file. Please review the following information to
34
** ensure the GNU General Public License version 3.0 requirements will be
35
** met: http://www.gnu.org/copyleft/gpl.html.
40
****************************************************************************/
42
#include "qbluetoothtransferrequest.h"
43
#include "qbluetoothaddress.h"
44
#include "qbluetoothtransferrequest_p.h"
47
QT_BEGIN_NAMESPACE_BLUETOOTH
50
\class QBluetoothTransferRequest
52
\brief The QBluetoothTransferRequest class stores information about a
53
data transfer request.
55
QBluetoothTransferRequest is part of the Bluetooth Transfer API and is the class holding the
56
information necessary to initiate a transfer over Bluetooth.
58
\sa QBluetoothTransferReply, QBluetoothTransferManager
62
\enum QBluetoothTransferRequest::Attribute
64
Attribute codes for QBluetoothTransferRequest and QBluetoothTransferReply.
66
\value DescriptionAttribute A textual description of the object being transferred.
67
May be displayed in the UI of the remote device.
68
\value TimeAttribute Time attribute of the object being transferred.
69
\value TypeAttribute MIME type of the object being transferred.
70
\value LengthAttribute Length in bytes of the object being transferred.
71
\value NameAttribute Name of the object being transferred. May be displayed in the UI of
76
Constructs a new Bluetooth transfer request to the device with \a address.
78
QBluetoothTransferRequest::QBluetoothTransferRequest(const QBluetoothAddress &address)
79
:d_ptr(new QBluetoothTransferRequestPrivate)
81
Q_D(QBluetoothTransferRequest);
83
d->m_address = address;
87
Constructs a new Bluetooth transfer request that is a copy of \a other.
89
QBluetoothTransferRequest::QBluetoothTransferRequest(const QBluetoothTransferRequest &other)
90
:d_ptr(new QBluetoothTransferRequestPrivate)
96
Destorys the Bluetooth transfer request.
98
QBluetoothTransferRequest::~QBluetoothTransferRequest()
104
Returns the attribute associated with \a code. If the attribute has not been set, it
105
returns \a defaultValue.
107
\sa setAttribute(), QBluetoothTransferRequest::Attribute
109
QVariant QBluetoothTransferRequest::attribute(Attribute code, const QVariant &defaultValue) const
111
Q_D(const QBluetoothTransferRequest);
113
if (d->m_parameters.contains((int)code)) {
114
return d->m_parameters.value((int)code);
121
Sets the attribute associated with \a code to \a value. If the attribute is
122
already set, the previous value is discarded. If \a value is an invalid QVariant, the attribute
125
\sa attribute(), QBluetoothTransferRequest::Attribute
127
void QBluetoothTransferRequest::setAttribute(Attribute code, const QVariant &value)
129
Q_D(QBluetoothTransferRequest);
131
d->m_parameters.insert((int)code, value);
135
Returns the address associated with the Bluetooth transfer request.
137
QBluetoothAddress QBluetoothTransferRequest::address() const
139
Q_D(const QBluetoothTransferRequest);
146
Returns true if this object is not the same as \a other.
150
bool QBluetoothTransferRequest::operator!=(const QBluetoothTransferRequest &other) const
152
return !(*this == other);
156
Creates a copy of \a other.
158
QBluetoothTransferRequest &QBluetoothTransferRequest::operator=(const QBluetoothTransferRequest &other)
160
Q_D(QBluetoothTransferRequest);
162
d->m_address = other.d_func()->m_address;
163
d->m_parameters = other.d_func()->m_parameters;
169
Returns true if this object is the same as \a other.
171
bool QBluetoothTransferRequest::operator==(const QBluetoothTransferRequest &other) const
173
Q_D(const QBluetoothTransferRequest);
174
if (d->m_address == other.d_func()->m_address && d->m_parameters == other.d_func()->m_parameters) {
180
QBluetoothTransferRequestPrivate::QBluetoothTransferRequestPrivate()
184
QT_END_NAMESPACE_BLUETOOTH