1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the QtBluetooth module of the Qt Toolkit.
7**
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 The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
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 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#include "qbluetoothtransferreply.h"
41#include "qbluetoothtransferreply_p.h"
42#include "qbluetoothaddress.h"
43
44QT_BEGIN_NAMESPACE
45
46/*!
47 \class QBluetoothTransferReply
48 \inmodule QtBluetooth
49 \brief The QBluetoothTransferReply class stores the response for a data
50 transfer request.
51
52 \since 5.2
53
54 In additional to a copy of the QBluetoothTransferRequest object used to create the request,
55 QBluetoothTransferReply contains the contents of the reply itself.
56
57 After the file transfer has started, QBluetoothTransferReply emits the transferProgress() signal,
58 which indicates the progress of the file transfer.
59*/
60
61/*!
62 \enum QBluetoothTransferReply::TransferError
63
64 This enum describes the type of error that occurred
65
66 \value NoError No error.
67 \value UnknownError Unknown error, no better enum available.
68 \value FileNotFoundError Unable to open the file specified.
69 \value HostNotFoundError Unable to connect to the target host.
70 \value UserCanceledTransferError User terminated the transfer.
71 \value IODeviceNotReadableError File was not open before initiating the sending command.
72 \value ResourceBusyError Unable to access the resource..
73 \value SessionError An error occurred during the handling of the session. This enum was
74 introduced by Qt 5.4.
75*/
76
77
78
79/*!
80 \fn QBluetoothTransferReply::abort()
81
82 Aborts this reply.
83*/
84void QBluetoothTransferReply::abort()
85{
86}
87
88/*!
89 \fn void QBluetoothTransferReply::finished(QBluetoothTransferReply *reply)
90
91 This signal is emitted when the transfer is complete for \a reply.
92
93 To avoid the loss of signal emissions it is recommend to immidiately connect
94 to this signal once a \c QBluetoothTransferReply instance has been created.
95*/
96
97/*!
98 \fn void QBluetoothTransferReply::transferProgress(qint64 bytesTransferred, qint64 bytesTotal)
99
100 This signal is emitted whenever data is transferred. The \a bytesTransferred parameter contains the total
101 number of bytes transferred so far out of \a bytesTotal.
102
103
104 To avoid the loss of signal emissions it is recommend to immidiately connect
105 to this signal once a QBluetoothTransferReply instance has been created.
106*/
107
108/*!
109 \fn void QBluetoothTransferReply::error(QBluetoothTransferReply::TransferError errorType)
110 \since 5.4
111
112 This signal is emitted whenever an error has occurred. The \a errorType
113 parameter indicates the type of error.
114
115 To avoid the loss of signal emissions it is recommend to immidiately connect
116 to this signal once a QBluetoothTransferReply instance has been created.
117
118 \sa error(), errorString()
119*/
120
121/*!
122 Constructs a new QBluetoothTransferReply with \a parent.
123*/
124QBluetoothTransferReply::QBluetoothTransferReply(QObject *parent)
125 : QObject(parent), d_ptr(new QBluetoothTransferReplyPrivate())
126{
127}
128
129/*!
130 Destroys the QBluetoothTransferReply object.
131*/
132QBluetoothTransferReply::~QBluetoothTransferReply()
133{
134 delete d_ptr;
135}
136
137/*!
138 \fn bool QBluetoothTransferReply::isFinished() const
139
140 Returns true if this reply has finished, otherwise false.
141*/
142
143/*!
144 \fn bool QBluetoothTransferReply::isRunning() const
145
146 Returns true if this reply is running, otherwise false.
147*/
148
149/*!
150 Returns the QBluetoothTransferManager that was used to create this QBluetoothTransferReply
151 object. Initially, it is also the parent object.
152*/
153QBluetoothTransferManager *QBluetoothTransferReply::manager() const
154{
155 Q_D(const QBluetoothTransferReply);
156 return d->m_manager;
157}
158
159/*!
160 Returns the QBluetoothTransferRequest that was used to create this QBluetoothTransferReply
161 object.
162*/
163QBluetoothTransferRequest QBluetoothTransferReply::request() const
164{
165 Q_D(const QBluetoothTransferReply);
166 return d->m_request;
167}
168
169/*!
170 \fn QBluetoothTransferReply::setManager(QBluetoothTransferManager *manager)
171
172 Set the reply's manager to the \a manager.
173*/
174
175void QBluetoothTransferReply::setManager(QBluetoothTransferManager *manager)
176{
177 Q_D(QBluetoothTransferReply);
178 d->m_manager = manager;
179}
180
181/*!
182 \fn QBluetoothTransferReply::setRequest(const QBluetoothTransferRequest &request)
183
184 Set the reply's request to \a request.
185*/
186void QBluetoothTransferReply::setRequest(const QBluetoothTransferRequest &request)
187{
188 Q_D(QBluetoothTransferReply);
189 d->m_request = request;
190}
191
192/*!
193 \fn TransferError QBluetoothTransferReply::error() const
194
195 The error code of the error that occurred.
196
197 \sa errorString()
198*/
199
200/*!
201 \fn QString QBluetoothTransferReply::errorString() const
202
203 String describing the error. Can be displayed to the user.
204
205 \sa error()
206*/
207
208QBluetoothTransferReplyPrivate::QBluetoothTransferReplyPrivate()
209{
210}
211
212QT_END_NAMESPACE
213
214#include "moc_qbluetoothtransferreply.cpp"
215

source code of qtconnectivity/src/bluetooth/qbluetoothtransferreply.cpp