summaryrefslogtreecommitdiff
path: root/gatoconnectionparameters.cpp
blob: c8270c8757cc42f796f54bb6e8043a8c712aba34 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include "gatoconnectionparameters.h"
#include <QSharedData>

struct GatoConnectionParametersPrivate : public QSharedData
{
	int connIntervalMin;
	int connIntervalMax;
	int slaveLatency;
	int supervisionTimeout;
};

GatoConnectionParameters::GatoConnectionParameters()
	: d(new GatoConnectionParametersPrivate)
{
	// Set a connection scan interval between 10 and 320 ms.
	d->connIntervalMin = 10000;
	d->connIntervalMax = 320000;
	d->slaveLatency = 0;
	d->supervisionTimeout = 10000; // 10 seconds
}

GatoConnectionParameters::GatoConnectionParameters(const GatoConnectionParameters &o)
	: d(o.d)
{
}

GatoConnectionParameters::~GatoConnectionParameters()
{
}

int GatoConnectionParameters::connectionIntervalMin() const
{
	return d->connIntervalMin;
}

void GatoConnectionParameters::setConnectionIntervalMin(int interval)
{
	d->connIntervalMin = interval;
}

int GatoConnectionParameters::connectionIntervalMax() const
{
	return d->connIntervalMax;
}

void GatoConnectionParameters::setConnectionIntervalMax(int interval)
{
	d->connIntervalMax = interval;
}

void GatoConnectionParameters::setConnectionInterval(int min, int max)
{
	d->connIntervalMin = min;
	d->connIntervalMax = max;
}

int GatoConnectionParameters::slaveLatency() const
{
	return d->slaveLatency;
}

void GatoConnectionParameters::setSlaveLatency(int latency)
{
	d->slaveLatency = latency;
}

int GatoConnectionParameters::supervisionTimeout() const
{
	return d->supervisionTimeout;
}

void GatoConnectionParameters::setSupervisionTimeout(int timeout)
{
	d->supervisionTimeout = timeout;
}

GatoConnectionParameters &GatoConnectionParameters::operator=(const GatoConnectionParameters &o)
{
	if (this != &o)
		d.operator=(o.d);
	return *this;
}