kdeconnect-kde/core/backends/pairinghandler.h

55 lines
1.1 KiB
C
Raw Permalink Normal View History

2015-07-05 14:23:53 +01:00
/**
* SPDX-FileCopyrightText: 2015 Vineet Garg <grg.vineet@gmail.com>
2015-07-05 14:23:53 +01:00
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
2015-07-05 14:23:53 +01:00
*/
#ifndef KDECONNECT_PAIRINGHANDLER_H
#define KDECONNECT_PAIRINGHANDLER_H
#include "device.h"
#include "networkpacket.h"
#include "pairstate.h"
2015-07-05 14:23:53 +01:00
#include <QTimer>
class KDECONNECTCORE_EXPORT PairingHandler : public QObject
{
Q_OBJECT
2015-11-30 18:36:01 +00:00
public:
const static int pairingTimeoutMsec = 30 * 1000; // 30 seconds of timeout
PairingHandler(Device *parent, PairState initialState);
2015-07-05 14:23:53 +01:00
void packetReceived(const NetworkPacket &np);
2015-07-27 16:28:58 +01:00
2023-07-16 15:20:34 +01:00
PairState pairState()
{
return m_pairState;
}
public Q_SLOTS:
bool requestPairing();
bool acceptPairing();
void cancelPairing();
void unpair();
2015-07-27 16:28:58 +01:00
2015-11-30 18:36:01 +00:00
Q_SIGNALS:
void incomingPairRequest();
void pairingFailed(const QString &errorMessage);
void pairingSuccessful();
void unpaired();
2015-07-27 16:28:58 +01:00
private:
void pairingDone();
QTimer m_pairingTimeout;
Device *m_device;
PairState m_pairState;
private Q_SLOTS:
void pairingTimeout();
2015-07-05 14:23:53 +01:00
};
#endif // KDECONNECT_PAIRINGHANDLER_H