summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qlowenergyconnectionparameters.h
blob: 8a30e82adb4e995b7657c90e69bedd18004f6181 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef QLOWENERGYCONNECTIONPARAMETERS_H
#define QLOWENERGYCONNECTIONPARAMETERS_H

#include <QtBluetooth/qtbluetoothglobal.h>
#include <QtCore/qmetatype.h>
#include <QtCore/qshareddata.h>

QT_BEGIN_NAMESPACE

class QLowEnergyConnectionParametersPrivate;

class Q_BLUETOOTH_EXPORT QLowEnergyConnectionParameters
{
public:
    QLowEnergyConnectionParameters();
    QLowEnergyConnectionParameters(const QLowEnergyConnectionParameters &other);
    ~QLowEnergyConnectionParameters();

    QLowEnergyConnectionParameters &operator=(const QLowEnergyConnectionParameters &other);
    friend bool operator==(const QLowEnergyConnectionParameters &a,
                           const QLowEnergyConnectionParameters &b)
    {
        return equals(a, b);
    }
    friend bool operator!=(const QLowEnergyConnectionParameters &a,
                           const QLowEnergyConnectionParameters &b)
    {
        return !equals(a, b);
    }

    void setIntervalRange(double minimum, double maximum);
    double minimumInterval() const;
    double maximumInterval() const;

    void setLatency(int latency);
    int latency() const;

    void setSupervisionTimeout(int timeout);
    int supervisionTimeout() const;

    void swap(QLowEnergyConnectionParameters &other) noexcept { d.swap(other.d); }

private:
    static bool equals(const QLowEnergyConnectionParameters &a,
                       const QLowEnergyConnectionParameters &b);
    QSharedDataPointer<QLowEnergyConnectionParametersPrivate> d;
};

Q_DECLARE_SHARED(QLowEnergyConnectionParameters)

QT_END_NAMESPACE

QT_DECL_METATYPE_EXTERN(QLowEnergyConnectionParameters, Q_BLUETOOTH_EXPORT)

#endif // Include guard