#ifndef BLUETOOTHOBEXAGENT_H
#define BLUETOOTHOBEXAGENT_H

#include <KF5/BluezQt/bluezqt/obexagent.h>
#include <KF5/BluezQt/bluezqt/obexfiletransfer.h>
#include <KF5/BluezQt/bluezqt/obexfiletransferentry.h>
#include <KF5/BluezQt/bluezqt/obextransfer.h>
#include <KF5/BluezQt/bluezqt/obexsession.h>
#include <KF5/BluezQt/bluezqt/pendingcall.h>
#include <KF5/BluezQt/bluezqt/request.h>

#include <QDBusObjectPath>
#include <QMetaObject>
#include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusAbstractAdaptor>
#include <QtDBus/QDBusInterface>
#include <QtDBus/QDBusReply>
#include <QtDBus/QDBusConnectionInterface>
//#include <QMessageBox>
#include <QDebug>
#include <QMetaEnum>


class BluetoothObexAgent : public BluezQt::ObexAgent
{
    Q_OBJECT
public:
    explicit BluetoothObexAgent(QObject *parent = nullptr);
    void authorizePush (BluezQt::ObexTransferPtr transfer,BluezQt::ObexSessionPtr session, const BluezQt::Request<QString> &request);
    QDBusObjectPath objectPath() const override;
    void cancel ();
    void release ();

    int daemonIsNotRunning();
    QString getTansferDev();
    void receiveDisConnectSignal(QString address);

private slots:
    void replyFileReceivingSignalFunc(bool);
    void clearOldSession();
    void continueRecieveFiles();
    void cancelFileReceivingSignalFunc();
    void transferredChangedSlot(quint64 size);
    void statusChangedSlot(BluezQt::ObexTransfer::Status status);

private:
    BluezQt::ObexTransferPtr _Mtransfer;
    const BluezQt::Request<QString> *_Mrequest;
    BluezQt::ObexSessionPtr _Msession;
    BluezQt::ObexSessionPtr oldSession;
};

#endif // BLUETOOTHOBEXAGENT_H
