summaryrefslogtreecommitdiff
path: root/gatoconnectionparameters.h
blob: 14410209e9fbf1fce35fd68f6f2b437ed9b0640c (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
#ifndef GATOCONNECTIONPARAMETERS_H
#define GATOCONNECTIONPARAMETERS_H

#include <QtCore/QObject>
#include <QtCore/QSharedDataPointer>

#include "libgato_global.h"

class GatoConnectionParametersPrivate;

/** These parameters determine the effective throughput of a Low Energy link,
 *  enabling custom balancing between power usage, bandwidth, and latency. */

class LIBGATO_EXPORT GatoConnectionParameters
{
	Q_GADGET

public:
	GatoConnectionParameters();
	GatoConnectionParameters(const GatoConnectionParameters &o);
	~GatoConnectionParameters();

	// Units for all of this: milliseconds
	// TODO Need to document

	// Connection interval: generally, lower connection interval increases throughput.
	// Units: microseconds (µs!)

	int connectionIntervalMin() const;
	void setConnectionIntervalMin(int interval);

	int connectionIntervalMax() const;
	void setConnectionIntervalMax(int interval);

	void setConnectionInterval(int min, int max);

	// TODO Document
	// Units: miliseconds (ms!)
	int slaveLatency() const;
	void setSlaveLatency(int latency);

	// Units: miliseconds
	int supervisionTimeout() const;
	void setSupervisionTimeout(int timeout);

	GatoConnectionParameters &operator=(const GatoConnectionParameters &o);

private:
	QSharedDataPointer<GatoConnectionParametersPrivate> d;
};

#endif // GATOCONNECTIONPARAMETERS_H