1/*
2 * BluezQt - Asynchronous Bluez wrapper library
3 *
4 * SPDX-FileCopyrightText: 2014 David Rosca <nowrep@gmail.com>
5 *
6 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8
9#include "obexfiletransfer.h"
10#include "pendingcall.h"
11#include "utils.h"
12
13#include "obexfiletransfer1.h"
14
15namespace BluezQt
16{
17typedef org::bluez::obex::FileTransfer1 BluezFileTransfer;
18
19class ObexFileTransferPrivate
20{
21public:
22 ObexFileTransfer *q;
23 BluezFileTransfer *m_bluezFileTransfer;
24};
25
26ObexFileTransfer::ObexFileTransfer(const QDBusObjectPath &path, QObject *parent)
27 : QObject(parent)
28 , d(new ObexFileTransferPrivate)
29{
30 d->m_bluezFileTransfer = new BluezFileTransfer(Strings::orgBluezObex(), path.path(), DBusConnection::orgBluezObex(), this);
31}
32
33ObexFileTransfer::~ObexFileTransfer() = default;
34
35QDBusObjectPath ObexFileTransfer::objectPath() const
36{
37 return QDBusObjectPath(d->m_bluezFileTransfer->path());
38}
39
40PendingCall *ObexFileTransfer::changeFolder(const QString &folder)
41{
42 return new PendingCall(d->m_bluezFileTransfer->ChangeFolder(folder), PendingCall::ReturnVoid, this);
43}
44
45PendingCall *ObexFileTransfer::createFolder(const QString &folder)
46{
47 return new PendingCall(d->m_bluezFileTransfer->CreateFolder(folder), PendingCall::ReturnVoid, this);
48}
49
50PendingCall *ObexFileTransfer::listFolder()
51{
52 return new PendingCall(d->m_bluezFileTransfer->ListFolder(), PendingCall::ReturnFileTransferList, this);
53}
54
55PendingCall *ObexFileTransfer::getFile(const QString &targetFileName, const QString &sourceFileName)
56{
57 return new PendingCall(d->m_bluezFileTransfer->GetFile(targetfile: targetFileName, sourcefile: sourceFileName), PendingCall::ReturnTransferWithProperties, this);
58}
59
60PendingCall *ObexFileTransfer::putFile(const QString &sourceFileName, const QString &targetFileName)
61{
62 return new PendingCall(d->m_bluezFileTransfer->PutFile(sourcefile: sourceFileName, targetfile: targetFileName), PendingCall::ReturnTransferWithProperties, this);
63}
64
65PendingCall *ObexFileTransfer::copyFile(const QString &sourceFileName, const QString &targetFileName)
66{
67 return new PendingCall(d->m_bluezFileTransfer->CopyFile(sourcefile: sourceFileName, targetfile: targetFileName), PendingCall::ReturnVoid, this);
68}
69
70PendingCall *ObexFileTransfer::moveFile(const QString &sourceFileName, const QString &targetFileName)
71{
72 return new PendingCall(d->m_bluezFileTransfer->MoveFile(sourcefile: sourceFileName, targetfile: targetFileName), PendingCall::ReturnVoid, this);
73}
74
75PendingCall *ObexFileTransfer::deleteFile(const QString &fileName)
76{
77 return new PendingCall(d->m_bluezFileTransfer->Delete(file: fileName), PendingCall::ReturnVoid, this);
78}
79
80} // namespace BluezQt
81
82#include "moc_obexfiletransfer.cpp"
83

source code of bluez-qt/src/obexfiletransfer.cpp