kdeconnect-kde/core/backends/bluetooth/bluetoothpairinghandler.h

54 lines
1.3 KiB
C
Raw Normal View History

2016-11-11 14:55:16 +00:00
/**
* SPDX-FileCopyrightText: 2015 Vineet Garg <grg.vineet@gmail.com>
2016-11-11 14:55:16 +00:00
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
2016-11-11 14:55:16 +00:00
*/
#ifndef KDECONNECT_BLUETOOTHPAIRINGHANDLER_H
#define KDECONNECT_BLUETOOTHPAIRINGHANDLER_H
2016-11-11 14:55:16 +00:00
#include "device.h"
#include "../devicelink.h"
#include "../pairinghandler.h"
#include <QTimer>
// This class is used pairing related stuff. It has direct access to links and can directly send packets
2016-11-11 14:55:16 +00:00
class BluetoothPairingHandler
: public PairingHandler
{
public:
enum InternalPairStatus {
NotPaired,
Requested,
RequestedByPeer,
Paired,
};
BluetoothPairingHandler(DeviceLink* deviceLink);
virtual ~BluetoothPairingHandler() { }
2019-05-09 00:03:20 +01:00
void packetReceived(const NetworkPacket& np) override;
bool requestPairing() override;
bool acceptPairing() override;
void rejectPairing() override;
void unpair() override;
2016-11-11 14:55:16 +00:00
bool isPairRequested() const { return m_status == Requested; }
bool isPaired() const { return m_status == Paired; }
private Q_SLOTS:
void pairingTimeout();
protected:
void setInternalPairStatus(InternalPairStatus status);
QTimer m_pairingTimeout;
InternalPairStatus m_status;
};
#endif //KDECONNECT_BLUETOOTHPAIRINGHANDLER_H