|
1 /* |
|
2 * Copyright (c) 2008 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: Accelerometer sensor implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CSENSORPROPERTIES_H |
|
20 #define CSENSORPROPERTIES_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 #include <e32base.h> |
|
25 #include <sensrvaccelerometersensor.h> |
|
26 #include <sensrvgeneralproperties.h> |
|
27 #include <sensrvtypes.h> |
|
28 |
|
29 // CONSTANTS |
|
30 //local data types |
|
31 struct TNameKey |
|
32 { |
|
33 const TText* iName; |
|
34 TInt iKey; |
|
35 }; |
|
36 |
|
37 LOCAL_D TNameKey const KQuantity[] = |
|
38 { |
|
39 {_S("not_defined"), ESensrvQuantityNotdefined }, |
|
40 {_S("acceleration"), ESensrvQuantityAcceleration }, |
|
41 {_S("com.tapping"), ESensrvQuantityTapping }, // not in standard |
|
42 {_S("direction"), ESensrvQuantityOrientation }, //? |
|
43 {_S("angular_velocity"), ESensrvQuantityRotation }, //? |
|
44 {_S("magnetic_field_strength"), ESensrvQuantityMagnetic }, |
|
45 {_S("angle"), ESensrvQuantityAngle }, |
|
46 {_S("proximity"), ESensrvQuantityProximity }, |
|
47 { 0, 0 } |
|
48 }; |
|
49 |
|
50 |
|
51 LOCAL_D TNameKey const KContextType[] = |
|
52 { |
|
53 {_S("not_defined"), ESensrvContextTypeNotDefined }, |
|
54 {_S("ambient"), ESensrvContextTypeAmbient }, |
|
55 {_S("device"), ESensrvContextTypeDevice }, |
|
56 {_S("user"), ESensrvContextTypeUser }, |
|
57 { 0, 0 } |
|
58 }; |
|
59 |
|
60 LOCAL_D TNameKey const KConnectionType[] = |
|
61 { |
|
62 { _S("connectiontype=0"), ESensrvConnectionTypeNotDefined }, |
|
63 { _S("connectiontype=1"), ESensrvConnectionTypeEmbedded }, |
|
64 { _S("connectiontype=8"), ESensrvConnectionTypeWired}, |
|
65 { _S("connectiontype=4"), ESensrvConnectionTypeWireless}, |
|
66 { 0, 0 } |
|
67 }; |
|
68 |
|
69 |
|
70 LOCAL_D TNameKey const KChannelUnit[] = |
|
71 { |
|
72 {_S("none"), ESensrvChannelUnitNotDefined }, |
|
73 {_S("G"), ESensrvChannelUnitGravityConstant }, |
|
74 {_S("m/s^2"), ESensevChannelUnitAcceleration }, // typo in native api |
|
75 { 0, 0 } |
|
76 }; |
|
77 |
|
78 LOCAL_D TNameKey const KAcceleratorChannelName[] = |
|
79 { |
|
80 {_S("axis_x"), TSensrvAccelerometerAxisData::EAxisX }, |
|
81 {_S("axis_y"), TSensrvAccelerometerAxisData::EAxisY }, |
|
82 {_S("axis_z"), TSensrvAccelerometerAxisData::EAxisZ }, |
|
83 { 0, 0 } |
|
84 }; |
|
85 |
|
86 const TInt KOFNChannelPointX = 0; |
|
87 const TInt KOFNChannelPointY = 1; |
|
88 |
|
89 LOCAL_D TNameKey const KOFNChannelName[] = |
|
90 { |
|
91 {_S("point_x"), KOFNChannelPointX }, |
|
92 {_S("point_y"), KOFNChannelPointY }, |
|
93 { 0, 0 } |
|
94 }; |
|
95 |
|
96 enum TSensorDescriptionId |
|
97 { |
|
98 EAccelerometerSensor = 0, |
|
99 EAccelerometerSensorRawData, |
|
100 EBatteryChargeSensor, |
|
101 EChargerStateSensor, |
|
102 ENetworkFieldIntensitySensor, |
|
103 EOFNSensor |
|
104 }; |
|
105 |
|
106 LOCAL_D TNameKey const KSensorDescription[] = |
|
107 { |
|
108 {_S("acceleration"), EAccelerometerSensor }, |
|
109 {_S("acceleration2"), EAccelerometerSensorRawData }, |
|
110 {_S("battery_charge"), EBatteryChargeSensor }, |
|
111 {_S("charger_state"), EChargerStateSensor }, |
|
112 {_S("network_field_intensity"), ENetworkFieldIntensitySensor }, |
|
113 {_S("ofn sensor has two channels that give OFN input devices x,y point location. Always on"), EOFNSensor }, |
|
114 { 0, 0 } |
|
115 }; |
|
116 |
|
117 // CLASS DECLARATION |
|
118 |
|
119 /** |
|
120 * CCSensorProperties |
|
121 * |
|
122 */ |
|
123 class SensorProperties |
|
124 { |
|
125 public: // new methods |
|
126 static const TPtrC GetPropertyString(const TNameKey* aKey, TInt aValue); |
|
127 |
|
128 }; |
|
129 |
|
130 #endif // CSENSORPROPERTIES_H |