Changeset View
Changeset View
Standalone View
Standalone View
core/backends/pairinghandler.h
Show All 15 Lines | |||||
16 | * | 16 | * | ||
17 | * You should have received a copy of the GNU General Public License | 17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #ifndef KDECONNECT_PAIRINGHANDLER_H | 21 | #ifndef KDECONNECT_PAIRINGHANDLER_H | ||
22 | #define KDECONNECT_PAIRINGHANDLER_H | 22 | #define KDECONNECT_PAIRINGHANDLER_H | ||
23 | 23 | | |||
24 | #include "networkpackage.h" | 24 | #include "networkpacket.h" | ||
25 | #include "devicelink.h" | 25 | #include "devicelink.h" | ||
26 | 26 | | |||
27 | /* | 27 | /* | ||
28 | * This class separates the pairing interface for each type of link. | 28 | * This class separates the pairing interface for each type of link. | ||
29 | * Since different links can pair via different methods, like for LanLink certificate and public key should be shared, | 29 | * Since different links can pair via different methods, like for LanLink certificate and public key should be shared, | ||
30 | * for Bluetooth link they should be paired via bluetooth etc. | 30 | * for Bluetooth link they should be paired via bluetooth etc. | ||
31 | * Each "Device" instance maintains a hash map for these pairing handlers so that there can be single pairing handler per | 31 | * Each "Device" instance maintains a hash map for these pairing handlers so that there can be single pairing handler per | ||
32 | * per link type per device. | 32 | * per link type per device. | ||
Show All 9 Lines | |||||
42 | 42 | | |||
43 | public: | 43 | public: | ||
44 | PairingHandler(DeviceLink* parent); | 44 | PairingHandler(DeviceLink* parent); | ||
45 | ~PairingHandler() override = default; | 45 | ~PairingHandler() override = default; | ||
46 | 46 | | |||
47 | DeviceLink* deviceLink() const; | 47 | DeviceLink* deviceLink() const; | ||
48 | void setDeviceLink(DeviceLink* dl); | 48 | void setDeviceLink(DeviceLink* dl); | ||
49 | 49 | | |||
50 | virtual void packageReceived(const NetworkPackage& np) = 0; | 50 | virtual void packetReceived(const NetworkPacket& np) = 0; | ||
51 | virtual void unpair() = 0; | 51 | virtual void unpair() = 0; | ||
52 | static int pairingTimeoutMsec() { return 30 * 1000; } // 30 seconds of timeout (default), subclasses that use different values should override | 52 | static int pairingTimeoutMsec() { return 30 * 1000; } // 30 seconds of timeout (default), subclasses that use different values should override | ||
53 | 53 | | |||
54 | public Q_SLOTS: | 54 | public Q_SLOTS: | ||
55 | virtual bool requestPairing() = 0; | 55 | virtual bool requestPairing() = 0; | ||
56 | virtual bool acceptPairing() = 0; | 56 | virtual bool acceptPairing() = 0; | ||
57 | virtual void rejectPairing() = 0; | 57 | virtual void rejectPairing() = 0; | ||
58 | 58 | | |||
Show All 10 Lines |