|
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 #ifndef CXESENSOREVENTHANDLER_H_ |
|
18 #define CXESENSOREVENTHANDLER_H_ |
|
19 |
|
20 #include <QObject> |
|
21 #include <QMetaType> |
|
22 |
|
23 #include "cxenamespace.h" |
|
24 |
|
25 |
|
26 /** |
|
27 * Sensor Event Handler implements basic sensor's events handling. It |
|
28 * automatically updates the clients intersted in knowing the sensor events |
|
29 * that is currently supported and used by camera app. |
|
30 * |
|
31 * All the supported sensor types are defined by enum "SensorType" |
|
32 * This class provides one signal which basically carries out corresponding sensor data for |
|
33 * the given sensor type. |
|
34 */ |
|
35 class CxeSensorEventHandler : public QObject |
|
36 { |
|
37 Q_OBJECT |
|
38 |
|
39 public: |
|
40 |
|
41 // ! Sensor types handled and supported in cxengine. |
|
42 enum SensorType |
|
43 { |
|
44 //! Listening to orientation sensor events |
|
45 OrientationSensor |
|
46 }; |
|
47 |
|
48 /** |
|
49 * Data read from sensor. The "type" of data embedded in QVariant is specific to sensor type. |
|
50 */ |
|
51 virtual QVariant sensorData(CxeSensorEventHandler::SensorType type) = 0; |
|
52 |
|
53 public slots: |
|
54 /*! |
|
55 init sensors |
|
56 */ |
|
57 virtual void init() = 0; |
|
58 |
|
59 /*! |
|
60 de-init sensors |
|
61 */ |
|
62 virtual void deinit() = 0; |
|
63 |
|
64 signals: |
|
65 /* |
|
66 * A signal indicating that there is new sensor event data available. |
|
67 */ |
|
68 void sensorEvent(CxeSensorEventHandler::SensorType type,QVariant data); |
|
69 |
|
70 protected: |
|
71 CxeSensorEventHandler() {} // protected empty contructor so that derived class construction works |
|
72 |
|
73 private: |
|
74 Q_DISABLE_COPY( CxeSensorEventHandler ) |
|
75 }; |
|
76 |
|
77 Q_DECLARE_METATYPE(Cxe::DeviceOrientation) |
|
78 |
|
79 #endif /* CXESENSOREVENTHANDLER_H_ */ |