/
abstractsensor_a.h
182 lines (140 loc) · 5.34 KB
/
abstractsensor_a.h
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/**
@file abstractsensor_a.h
@brief D-Bus adaptor base class for sensors
<p>
Copyright (C) 2009-2010 Nokia Corporation
@author Semi Malinen <semi.malinen@nokia.com
@author Joep van Gassel <joep.van.gassel@nokia.com>
@author Timo Rongas <ext-timo.2.rongas@nokia.com>
@author Antti Virtanen <antti.i.virtanen@nokia.com>
This file is part of Sensord.
Sensord is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License
version 2.1 as published by the Free Software Foundation.
Sensord is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with Sensord. If not, see <http://www.gnu.org/licenses/>.
</p>
*/
#ifndef ABSTRACTSENSORADAPTOR_H
#define ABSTRACTSENSORADAPTOR_H
#include <QtDBus/QtDBus>
#include "abstractsensor.h"
#include "datatypes/datarange.h"
/**
* @brief D-Bus adaptor base class for sensors
*
* Sensor DBus facade for handling remote method invocations. It instance
* has associated AbstractSensorChannel to which this object delegates
* calls.
*/
class AbstractSensorChannelAdaptor : public QDBusAbstractAdaptor
{
Q_OBJECT
Q_DISABLE_COPY(AbstractSensorChannelAdaptor)
Q_PROPERTY(bool isValid READ isValid)
Q_PROPERTY(QString errorString READ errorString)
Q_PROPERTY(QString description READ description)
Q_PROPERTY(QString id READ id)
Q_PROPERTY(unsigned int interval READ interval)
Q_PROPERTY(bool standbyOverride READ standbyOverride)
Q_PROPERTY(unsigned int bufferInterval READ bufferInterval)
Q_PROPERTY(unsigned int bufferSize READ bufferSize)
Q_PROPERTY(QString type READ type)
Q_PROPERTY(int errorCodeInt READ errorCodeInt)
Q_PROPERTY(bool hwBuffering READ hwBuffering)
public:
/**
* Destructor.
*/
virtual ~AbstractSensorChannelAdaptor() {}
protected:
/**
* Constructor.
*
* @param parent parent object.
*/
AbstractSensorChannelAdaptor(QObject *parent);
private:
/**
* Previously occured error code.
*
* @return error code.
*/
int errorCodeInt() const;
/**
* Pointer to parent channel.
*
* @return point to parent channel.
*/
AbstractSensorChannel* node() const;
public Q_SLOTS: // METHODS
/** AbstractSensorChannel::isValid() */
bool isValid() const;
/** AbstractSensorChannel::errorString() */
QString errorString() const;
/** AbstractSensorChannel::description() */
QString description() const;
/** AbstractSensorChannel::id() */
QString id() const;
/** AbstractSensorChannel::interval() */
unsigned int interval() const;
/** AbstractSensorChannel::standbyOverride() */
bool standbyOverride() const;
/** AbstractSensorChannel::bufferInterval() */
unsigned int bufferInterval() const;
/** AbstractSensorChannel::bufferSize() */
unsigned int bufferSize() const;
/** AbstractSensorChannel::type() */
QString type() const;
/** AbstractSensorChannel::start(int) */
void start(int sessionId);
/** AbstractSensorChannel::stop(int) */
void stop(int sessionId);
/** AbstractSensorChannel::setInterval(int, int)
*
* Will also configure interval for the data connection.
*/
void setInterval(int sessionId, int value);
/** AbstractSensorChannel::getAvailableIntervals() */
DataRangeList getAvailableIntervals();
/** AbstractSensorChannel::setDefaultInteval(int) */
bool setDefaultInterval(int sessionId);
/** AbstractSensorChannel::setStandbyOverride(int, bool) */
bool setStandbyOverride(int sessionId, bool value);
/** AbstractSensorChannel::setDownsampling(int, bool) */
void setDownsampling(int sessionId, bool value);
/** AbstractSensorChannel::isValid(int, unsigned int)
*
* Will also configure buffer interval for the data connection.
*/
void setBufferInterval(int sessionId, unsigned int value);
/** AbstractSensorChannel::isValid(int, unsigned int)
*
* Will also configure buffer size for the data connection.
*/
void setBufferSize(int sessionId, unsigned int value);
/** AbstractSensorChannel::getAvailableBufferIntervals() */
IntegerRangeList getAvailableBufferIntervals() const;
/** AbstractSensorChannel::getAvailableBufferSizes() */
IntegerRangeList getAvailableBufferSizes() const;
/** AbstractSensorChannel::getAvailableDataRanges() */
DataRangeList getAvailableDataRanges();
/** AbstractSensorChannel::getCurrentDataRange() */
DataRange getCurrentDataRange();
/** AbstractSensorChannel::requestDataRange(int, DataRange) */
void requestDataRange(int sessionId, DataRange range);
/** AbstractSensorChannel::removeDataRangeRequest(int) */
void removeDataRangeRequest(int sessionId);
/** AbstractSensorChannel::setDataRangeIndex(int, int) */
bool setDataRangeIndex(int sessionId, int rangeIndex);
/** AbstractSensorChannel::hwBuffering() */
bool hwBuffering() const;
Q_SIGNALS:
/** AbstractSensorChannel::propertyChanged(name) */
void propertyChanged(const QString& name);
};
#endif // ABSTRACTSENSORADAPTOR_H