author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Thu, 17 Dec 2009 09:09:50 +0200 | |
changeset 26 | 5d0ec8b709be |
parent 5 | 989d2f495d90 |
child 27 | 02682e02e51f |
permissions | -rw-r--r-- |
5 | 1 |
/* |
2 |
* Copyright (c) 2006-2007 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 the License "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: Header file for sensor service API core class |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
#ifndef CSENSORSERVICE_H |
|
20 |
#define CSENSORSERVICE_H |
|
21 |
||
22 |
//System include |
|
23 |
#include <e32base.h> |
|
24 |
#include <sensrvchannelinfo.h> |
|
25 |
#include <sensrvchannel.h> |
|
26 |
#include <sensrvchannelfinder.h> |
|
27 |
||
28 |
//Constants used in asynchronus calls |
|
29 |
||
30 |
//Desired receiving buffer size defined in a count of the |
|
31 |
//channel data objects |
|
32 |
const TInt KDesiredCount = 1; |
|
33 |
||
34 |
//Maximum receiving buffer size defined in a count of the |
|
35 |
//channel data object |
|
36 |
const TInt KMaxCount = 1; |
|
37 |
||
38 |
//Specifies the maximum time in milliseconds |
|
39 |
//that sensor server waits between updating new data into the |
|
40 |
//receiving buffer |
|
41 |
const TInt KBufferingPeriod = 0; |
|
42 |
||
43 |
/** |
|
44 |
* This class acts as wrapper around functionalities provided by S60 sensor channel |
|
45 |
* API. Provides methods to find sendor channels,access channel data .Also have |
|
46 |
* methods to set and retreive channel propertiesand property change listening. |
|
47 |
* |
|
48 |
* @sensorservice.lib |
|
49 |
* @since S60 v5.0 |
|
50 |
*/ |
|
51 |
class CSensorService : public CBase |
|
52 |
{ |
|
53 |
||
54 |
public: |
|
55 |
||
56 |
/** |
|
57 |
* Symbian Two Phase construction |
|
58 |
*/ |
|
59 |
IMPORT_C static CSensorService* NewL(); |
|
60 |
||
61 |
/** |
|
62 |
* Destructor. |
|
63 |
*/ |
|
64 |
virtual ~CSensorService(); |
|
65 |
||
66 |
/** |
|
67 |
* Find sensor channels based on specified criterion |
|
68 |
* @since S60 v5.0 |
|
69 |
* @param aSearchCriterion : Specifies the search criterion based on which channel |
|
70 |
* will be searched. |
|
71 |
* @param aChannelInfoList this will be populated with channel info of all found |
|
72 |
* channels satisfying the search criterion |
|
73 |
* @return NA |
|
74 |
*/ |
|
75 |
IMPORT_C void FindSensorChannelsL(const TInt aSearchCriterion |
|
76 |
,RSensrvChannelInfoList& aChannelInfoList); |
|
77 |
||
78 |
/** |
|
79 |
* Start the channel data listening. Channel data is received into the |
|
80 |
* receiving buffer and it can be read using the GetData-function. When new |
|
81 |
* data is available in the receiving buffer, a notification is delivered |
|
82 |
* via the data listener callback interface (MSensrvDataListener). |
|
83 |
* @since S60 v5.0 |
|
84 |
* @param aChannelInfo Refers to channel on which listening will be started |
|
85 |
* @param aDataListener Data listener for the channel. Must be valid |
|
86 |
* until data listening is stopped. |
|
87 |
* @return NA |
|
88 |
*/ |
|
89 |
IMPORT_C void GetDataNotificationL(const TSensrvChannelInfo& aChannelInfo |
|
90 |
,MSensrvDataListener* aDataListener); |
|
91 |
||
92 |
/** |
|
93 |
* It stops any previously registered asynchronus request i.e. any previously requested listening will |
|
94 |
* be stopped |
|
95 |
* @since S60 v5.0 |
|
96 |
* @param aNotificationType type of notification to be cancelled |
|
97 |
* see respective enum type in sensorservice.hrh |
|
98 |
* @param in case aNotification type is NOT EStopChannelChange this refers to |
|
99 |
* channel ID on which asynch request is to be stopped otherwise it takes its default |
|
100 |
* value and need not be supplied by the consumer |
|
101 |
* @return NA |
|
102 |
*/ |
|
103 |
IMPORT_C void StopNotificationL(TInt aNotificationType,TUint32 aChannelId=0); |
|
104 |
||
105 |
/** |
|
106 |
* Check if a particular channel is already open |
|
107 |
* @since S60 v5.0 |
|
108 |
* @param achannelId channel Id which will be checked |
|
109 |
* @param In case channel is open this will be filled in with index in iChannelList where |
|
110 |
* this particular channel entry is stored |
|
111 |
* @return True/False depending on whether channel is alredy open or not. |
|
112 |
*/ |
|
113 |
TBool IsChannelOpen(TUint32 achannelId,TInt& aIndex); |
|
114 |
/** |
|
115 |
* Get Channel Property |
|
116 |
* @since S60 v5.0 |
|
117 |
* @param aPropertyId referes to the property whose values are being requested |
|
118 |
* @param aChannelInfo refers to channel whose property will be obtained |
|
119 |
* @param aChannelPropertyList will be populated with obtained channel properties |
|
120 |
* @leave KErrNotFound - No open channel with that id for this client found, |
|
121 |
* or property does not exist. |
|
122 |
*/ |
|
123 |
IMPORT_C void GetChannelPropertyL(const TSensrvChannelInfo& aChannelInfo, |
|
124 |
RSensrvPropertyList& aChannelPropertyList); |
|
26
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
125 |
/** |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
126 |
* Get Scale Factor |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
127 |
* @since S60 v5.0 |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
128 |
* @param aChannelInfo refers to channel whose property will be obtained |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
129 |
* @param aMeasureRange will be populated with obtained channel properties |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
130 |
* @param aScaleRange will be populated with obtained channel properties |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
131 |
* @leave KErrNotFound - No open channel with that id for this client found, |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
132 |
* or property does not exist. |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
133 |
*/ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
134 |
IMPORT_C void GetScaleFactorL(const TSensrvChannelInfo& aChannelInfo, |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
135 |
TSensrvProperty& aMeasureRange, |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
136 |
TSensrvProperty& aScaleRange); |
5 | 137 |
|
138 |
private: |
|
139 |
/** |
|
140 |
* Constructor |
|
141 |
* @since S60 v5.0 |
|
142 |
*/ |
|
143 |
CSensorService(); |
|
144 |
void ConstructL(); |
|
145 |
||
146 |
private: // data |
|
147 |
/** |
|
148 |
* This stores channel information whenever a channel is opened |
|
149 |
*/ |
|
150 |
RPointerArray <CSensrvChannel> iChannelList; |
|
151 |
/** |
|
152 |
* Channel finder object stored for reuse |
|
153 |
*/ |
|
154 |
CSensrvChannelFinder* iChannelFinder; |
|
155 |
||
156 |
}; |
|
157 |
||
158 |
||
159 |
#endif // CSENSORSERVICE_H |