|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-B046D3DF-8BD2-48C2-A347-D6F74FE30F6D" xml:lang="en"><title>Sensor |
|
13 Channel Declaration</title><shortdesc>This document provides details about the sensor channel declarations.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <section id="GUID-A168B467-2AEC-4A96-8E34-5FE683086672"><title>Channel |
|
15 type declarations</title><p>All the supported sensor channels |
|
16 are declared in the Sensor definitions API headers and classes. For details, |
|
17 see <filepath>Symbian Developer Library > Symbian Developer Library > Symbian |
|
18 OS Reference > S60 C++ Reference > os > Sf Sensor_definitions_API</filepath>. |
|
19 For details about the types of Sensor Channels, see <xref href="GUID-F1935106-C730-4C64-A19A-0FC04F0E7121.dita">Types |
|
20 of Sensor Channels</xref>.</p>The number of implemented channels can vary |
|
21 between products. For information on supported sensor channels on different |
|
22 devices, see <xref href="http://www.forum.nokia.com/devices/matrix_s60_5ed_1.html" scope="external">Device specifications</xref> on Forum Nokia.<p>Every channel |
|
23 is defined by its unique channel type ID constant and a short description. </p><p>For |
|
24 example, a double tapping channel declaration is as shown in the following |
|
25 code snippet:</p><codeblock xml:space="preserve"> /** |
|
26 * - Name: Double tapping event channel type |
|
27 * - Type: Event |
|
28 * - Datatype: TSensrvTappingData |
|
29 * - Description: Double tapping events |
|
30 */ |
|
31 const TSensrvChannelTypeId KSensrvChannelTypeIdAccelerometerDoubleTappingData = 0x10205081;</codeblock> |
|
32 </section> |
|
33 <section id="GUID-8701672A-9CCB-458E-8364-65C21179F833"><title>Channel |
|
34 data type declarations</title><p>Sensor Channels can be classified based on |
|
35 the type of data that they provide. The classification is as follows:<ul> |
|
36 <li><p>Continuous Data Channel: A channel that outputs continuous data at |
|
37 regular intervals. For example, Accelerometer XYZ, Rotation and Magnetometer |
|
38 XYZ.</p></li> |
|
39 <li><p>Event Channel: A channel that signals a client when an appropriate |
|
40 event occurs. For example, Single Tap and Double Tap.</p></li> |
|
41 <li><p>State channel: A channel that signals a client when its state has |
|
42 changed. For example, Proximity Monitor.</p></li> |
|
43 </ul></p><p> The channel data types are declared in each sensor's header file. |
|
44 For example, a double tapping channel data type declaration is as shown in |
|
45 the following code snippet:</p><codeblock xml:space="preserve"> class TSensrvTappingData |
|
46 { |
|
47 public: |
|
48 /** |
|
49 * Channel data type Id number |
|
50 */ |
|
51 static const TSensrvChannelDataTypeId KDataTypeId = 0x1020507F; |
|
52 /** |
|
53 * Channel data type enumerations |
|
54 */ |
|
55 enum TSensrvAccelerometerAxisDataIndexes |
|
56 { |
|
57 iTimeStamp = 0, |
|
58 iDirection |
|
59 }; |
|
60 }; |
|
61 public: |
|
62 /** |
|
63 * - Item name: Sampling time. |
|
64 * - Item Index: 0 |
|
65 * - Conditions: None |
|
66 * - Description: Timestamp for a sample. |
|
67 */ |
|
68 TTime iTimeStamp; |
|
69 /** |
|
70 * - Item name: Tapping direction bitmask |
|
71 * - Item Index: 1 |
|
72 * - Conditions: Binary |
|
73 * - Description: Direction bitmask of the tapping event. |
|
74 * See constant definitions above. |
|
75 */ |
|
76 TUint32 iDirection; |
|
77 };</codeblock><p>The channel data type ID (for example, <xref href="GUID-5770EEF9-C7C8-36A0-B152-132D043FD4F3.dita#GUID-5770EEF9-C7C8-36A0-B152-132D043FD4F3/GUID-686A106F-3CC4-35C4-850D-93ABEE49DAC9"><apiname>TSensrvTappingData::KDataTypeId</apiname></xref>) |
|
78 is a unique ID for each data type, enabling the separation of data types from |
|
79 each other. The data type ID is used in <codeph>TSensrvChannelInfo</codeph> to |
|
80 define the data type used in a channel. </p><p>The channel data type index |
|
81 (for example, <codeph>TSensrvTappingData::iDirection</codeph>) is used to |
|
82 point to an attribute inside a data type. Attributes of the <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classTSensrvTappingData.html" format="application/java-archive"><codeph>TSensrvTappingData</codeph></xref> class are <codeph>iTimeStamp</codeph> and <codeph>iDirection</codeph>. </p><p>The |
|
83 channel data type index is used in:<ul> |
|
84 <li>properties (<codeph>TSensrvProperty</codeph>) if a property scope is a |
|
85 channel item</li> |
|
86 <li>conditions (<codeph>CSensrvChannelCondition</codeph>) to identify which |
|
87 attribute is used as a condition</li> |
|
88 </ul></p></section> |
|
89 <section id="GUID-BFC1DE84-96C8-40E2-94FA-4C315FC2B19C"><title>Channel property |
|
90 declarations</title><p>Channel properties are declared in <codeph>sensrvgeneralproperties.h</codeph> and |
|
91 sensor specific files. For example, general properties for all channel types |
|
92 are declared in the <codeph>sensrvgeneralproperties.h</codeph> file and accelerometer |
|
93 specific properties are declared in the <codeph>sensrvaccelerometersensor.h</codeph> file. </p><p>Each |
|
94 channel property is defined by its unique property ID constant and a short |
|
95 description. The property type specifies the type of the value the property |
|
96 contains. It can be <codeph>TInt</codeph>, <codeph>TReal</codeph> or <codeph>TBuf</codeph>. |
|
97 Property scope can be defined for a: </p><ul> |
|
98 <li>channel</li> |
|
99 <li>specific attribute inside channel data</li> |
|
100 <li>sensor related to a channel.</li> |
|
101 </ul><p>For example, accuracy property is declared as shown in the following |
|
102 code snippet:</p><codeblock xml:space="preserve"> /** |
|
103 * - Name: Accuracy of the channel data |
|
104 * - Type: TReal |
|
105 * - Scope: Channel item property |
|
106 * - Mandatory: No |
|
107 * - Capability: None |
|
108 * - Description: Returns the accuracy of this channel of the sensor as a |
|
109 * percentage of reading (=data value). |
|
110 */ |
|
111 const TSensrvPropertyId KSensrvPropIdChannelAccuracy = 0x000000008; |
|
112 </codeblock><p>A mandatory section specifies if the property is required for |
|
113 all channels. Capability section specifies the required capabilities to change |
|
114 value of the property. </p><p>The example content of the accuracy property |
|
115 is shown in the following code snippet. </p><codeblock xml:space="preserve"> iPropertyId = KSensrvPropIdChannelAccuracy |
|
116 iItemIndex = KSensrvItemIndexNone |
|
117 iArrayIndex = ESensrvSingleProperty |
|
118 iRealValue = 10.0 |
|
119 iReadOnly = ETrue |
|
120 iRealValueMax = n/a |
|
121 iRealValueMin = n/a |
|
122 iPropertyType = ESensrvRealProperty |
|
123 iSecurityInfo = n/a</codeblock><p>The array index is explained in <xref href="GUID-8DCBAA05-9741-48C8-A831-966D37FBC05A.dita">Array Properties</xref>.</p></section> |
|
124 </conbody></concept> |