|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 #include "xqsensor.h" |
|
18 #include "xqsensor_p.h" |
|
19 |
|
20 /*! |
|
21 \class XQSensor |
|
22 |
|
23 \brief The XQSensor is a base class for available concrete sensors. |
|
24 */ |
|
25 |
|
26 XQSensor::XQSensor(XQSensorPrivate& dd, QObject* parent): |
|
27 QObject(parent), d(&dd) |
|
28 { |
|
29 } |
|
30 |
|
31 /*! |
|
32 Destroys the XQSensor object. |
|
33 */ |
|
34 XQSensor::~XQSensor() |
|
35 { |
|
36 delete d; |
|
37 } |
|
38 |
|
39 /*! |
|
40 \enum XQSensor::Error |
|
41 |
|
42 This enum defines the possible errors for a XQSensor object. |
|
43 */ |
|
44 /*! \var XQSensor::Error XQSensor::NoError |
|
45 No error occured. |
|
46 */ |
|
47 /*! \var XQSensor::Error XQSensor::OutOfMemoryError |
|
48 Not enough memory. |
|
49 */ |
|
50 /*! \var XQSensor::Error XQSensor::NotFoundError |
|
51 Not found. |
|
52 */ |
|
53 /*! \var XQSensor::Error XQSensor::UnknownError |
|
54 Unknown error. |
|
55 */ |
|
56 |
|
57 /*! |
|
58 Opens the access to a sensor. If the sensor access can't be opened, the error() method |
|
59 returns an error code |
|
60 \sa close(), startReceiving(), stopReceiving(), error() |
|
61 */ |
|
62 void XQSensor::open() |
|
63 { |
|
64 d->open(); |
|
65 } |
|
66 |
|
67 /*! |
|
68 Closes the access to a sensor. |
|
69 \sa open(), startReceiving(), stopReceiving() |
|
70 */ |
|
71 void XQSensor::close() |
|
72 { |
|
73 d->close(); |
|
74 } |
|
75 |
|
76 /*! |
|
77 Starts actively monitoring the sensor and emits signals about changes in |
|
78 sensor data. |
|
79 \sa stopReceiving(), error() |
|
80 */ |
|
81 void XQSensor::startReceiving() |
|
82 { |
|
83 d->startReceiving(); |
|
84 } |
|
85 |
|
86 /*! |
|
87 Stops monitoring the sensor. |
|
88 \sa startReceiving() |
|
89 */ |
|
90 void XQSensor::stopReceiving() |
|
91 { |
|
92 d->stopReceiving(); |
|
93 } |
|
94 |
|
95 /*! |
|
96 \return The current error code or Error XQSensor::NoError if there is no error. |
|
97 */ |
|
98 XQSensor::Error XQSensor::error() const |
|
99 { |
|
100 return d->error(); |
|
101 } |
|
102 |
|
103 // End of file |