author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 18 Jan 2010 21:02:57 +0200 | |
changeset 27 | 02682e02e51f |
parent 26 | 5d0ec8b709be |
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: Provides interface between the Liw FrameWork and Service Provider. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
//system include |
|
23
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
19 |
#include <liwvariant.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
20 |
#include <liwgenericparam.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
21 |
#include <liwcommon.h> |
5 | 22 |
#include <sensrvchannelinfo.h> |
23 |
#include <sensrvtypes.h> |
|
26
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
24 |
#include<e32math.h> |
5 | 25 |
// User Includes |
26 |
#include "sensorservice.h" |
|
27 |
#include "sensorinterface.h" |
|
28 |
#include "sensorservice.hrh" |
|
29 |
#include "sensorcallback.h" |
|
30 |
#include "storeasyncinfo.h" |
|
31 |
||
32 |
inline void CSensorInterface::CheckInputTypeL |
|
33 |
( const TLiwVariant* aSource, |
|
34 |
LIW::TVariantTypeId aExpectedtype, |
|
35 |
const TDesC8* aErrorArgument ) |
|
36 |
{ |
|
37 |
if( aSource->TypeId() != aExpectedtype ) |
|
38 |
{ |
|
39 |
iErrorString = HBufC::NewL(KMaxMsgSize); |
|
40 |
TPtr ptr(iErrorString->Des()); |
|
41 |
TBuf<KMaxKeySize> buf; |
|
42 |
buf.Copy( *aErrorArgument ); |
|
43 |
ptr.Append(buf); |
|
44 |
ptr.Append( KTypeErr.operator()()); |
|
45 |
ptr.Append( KInvalid.operator()()); |
|
46 |
User::Leave( KErrArgument ); |
|
47 |
} |
|
48 |
} |
|
49 |
||
50 |
inline void CSensorInterface::MissingValueL( const TDesC8* aErrorArgument ) |
|
51 |
{ |
|
52 |
iErrorString = HBufC::NewL(KMaxMsgSize); |
|
53 |
TPtr ptr(iErrorString->Des()); |
|
54 |
TBuf<KMaxKeySize> buf; |
|
55 |
buf.Copy( *aErrorArgument ); |
|
56 |
ptr.Append(buf); |
|
57 |
ptr.Append( KMissing.operator()()); |
|
58 |
User::Leave( SErrMissingArgument ); |
|
59 |
} |
|
60 |
||
61 |
||
62 |
/* |
|
63 |
----------------------------------------------------------------------------- |
|
64 |
CSensorInterface::CSensorInterface() |
|
65 |
Description : Constructor |
|
66 |
Return values : N/A |
|
67 |
----------------------------------------------------------------------------- |
|
68 |
*/ |
|
69 |
CSensorInterface::CSensorInterface() |
|
70 |
: iSensorService( NULL ) |
|
71 |
{ |
|
72 |
} |
|
73 |
||
74 |
/* |
|
75 |
----------------------------------------------------------------------------- |
|
76 |
void CSensorInterface::ConstructL() |
|
77 |
Description : Symbian 2nd phase constructor can leave. |
|
78 |
Return values : N/A |
|
79 |
----------------------------------------------------------------------------- |
|
80 |
*/ |
|
81 |
void CSensorInterface::ConstructL() |
|
82 |
{ |
|
83 |
iSensorService = CSensorService::NewL(); |
|
84 |
} |
|
85 |
||
86 |
||
87 |
/* |
|
88 |
----------------------------------------------------------------------------- |
|
89 |
CSensorInterface::ExecuteServiceCommandL() |
|
90 |
Description : This is called by the consumer with command to execute. |
|
91 |
Return values : N/A |
|
92 |
----------------------------------------------------------------------------- |
|
93 |
*/ |
|
94 |
void CSensorInterface::ExecuteServiceCommandL |
|
95 |
( const TDesC8& aCmdName, |
|
96 |
const CLiwGenericParamList& aInParamList, |
|
97 |
CLiwGenericParamList& aOutParamList, |
|
98 |
TUint aCmdOptions, |
|
99 |
MLiwNotifyCallback* aCallback ) |
|
100 |
{ |
|
101 |
||
102 |
aOutParamList.Reset(); |
|
103 |
||
104 |
TInt position = 0; |
|
105 |
TInt32 transId = 0; |
|
106 |
||
107 |
// Start of FindSensorChannel |
|
108 |
if ( (aCmdName.CompareF( KCmdFindChannel ) == 0) ) |
|
109 |
{ |
|
110 |
if( aCallback ) |
|
111 |
{ |
|
112 |
iErrorString = KErrSensorInvalidReq.operator()().Alloc(); |
|
113 |
User::Leave( SErrInvalidServiceArgument ); |
|
114 |
} |
|
115 |
||
116 |
TPtrC searchString; |
|
117 |
const TLiwGenericParam* findString = NULL; |
|
118 |
findString = aInParamList.FindFirst( position, KSearchCriterion ); |
|
119 |
||
120 |
if ( !findString ) |
|
121 |
{ |
|
122 |
//Position based parsing |
|
123 |
if( aInParamList.Count() != 0 ) |
|
124 |
{ |
|
125 |
findString = &aInParamList[EParamIndex0]; |
|
126 |
} |
|
127 |
else |
|
128 |
{ |
|
129 |
iErrorString = KErrFindSensorChannelMissingSearchCrit.operator()().Alloc(); |
|
130 |
User::Leave( SErrMissingArgument ); |
|
131 |
} |
|
132 |
} |
|
133 |
||
134 |
TInt searchCriterion = 0; |
|
135 |
||
136 |
CheckInputTypeL( &findString->Value(), |
|
137 |
LIW::EVariantTypeDesC, |
|
138 |
KErrFindSensorChannelBadSrchType.operator&() ); |
|
139 |
||
140 |
// Retrieve channel search condition specified in input parameter list |
|
141 |
findString->Value().Get( searchString ); |
|
142 |
||
143 |
if ( searchString == KAll ) |
|
144 |
searchCriterion = EFindAll; |
|
145 |
else if ( searchString == KAcclmtrAxis ) |
|
146 |
searchCriterion = EFindAccelerometerXYZAxisData; |
|
147 |
else if ( searchString == KAcclmtrDoubleTapping ) |
|
148 |
searchCriterion = EFindAccelerometerDoubleTappingData; |
|
149 |
else if ( searchString == KOrientation ) |
|
150 |
searchCriterion = EFindOrientationData; |
|
151 |
else if ( searchString == KRotation ) |
|
152 |
searchCriterion = EFindRotationData; |
|
153 |
else |
|
154 |
{ |
|
155 |
iErrorString = KErrFindSensorChannelInvalidSrch.operator()().Alloc(); |
|
156 |
User::Leave( SErrInvalidServiceArgument ); |
|
157 |
} |
|
158 |
||
159 |
// channelInfoList will be populated by core class API |
|
160 |
RSensrvChannelInfoList channelInfoList; |
|
161 |
CleanupClosePushL( channelInfoList ); |
|
162 |
||
163 |
iSensorService->FindSensorChannelsL( searchCriterion , |
|
164 |
channelInfoList ); |
|
165 |
||
166 |
// Create list instance |
|
167 |
CLiwDefaultList* chnlList = CLiwDefaultList::NewL(); |
|
168 |
CleanupStack::PushL( chnlList ); |
|
169 |
// Obtain channel info list |
|
170 |
||
171 |
AppendChannelInfoL( channelInfoList ,chnlList ); |
|
172 |
||
173 |
// Appending result to the output parameter list |
|
174 |
aOutParamList.AppendL( TLiwGenericParam( KReturnValue, |
|
175 |
TLiwVariant( chnlList ) ) ); |
|
176 |
||
177 |
CleanupStack::Pop( chnlList ); |
|
178 |
CleanupStack::PopAndDestroy( &channelInfoList ); |
|
179 |
chnlList->DecRef(); |
|
180 |
||
181 |
}//end of FindSensorChannel |
|
182 |
//Start of RegisterForNotification |
|
183 |
else if ( ( aCmdName.CompareF( KCmdRegisterForNotification ) == 0 ) ) |
|
184 |
{ |
|
185 |
||
186 |
if( ( aCallback && ( KLiwOptASyncronous & aCmdOptions ) ) ) |
|
187 |
{ |
|
188 |
||
189 |
transId = aCallback->GetTransactionID(); |
|
190 |
||
191 |
TPtrC listeningStrPtr; |
|
192 |
const TLiwGenericParam* listeningString = NULL; |
|
193 |
const TLiwGenericParam* chnlInfoParam = NULL; |
|
194 |
CStoreAsyncInfo* info = NULL; |
|
195 |
TSensrvChannelInfo channelInfo; |
|
196 |
||
197 |
if( aInParamList.Count() < 2 ) |
|
198 |
{ |
|
199 |
iErrorString = KErrRegNotEnoughParams.operator()().Alloc(); |
|
200 |
User::Leave( SErrMissingArgument ); |
|
201 |
} |
|
202 |
||
203 |
position = 0; |
|
204 |
listeningString = aInParamList.FindFirst( position, KListeningType ); |
|
205 |
position = 0; |
|
206 |
chnlInfoParam = aInParamList.FindFirst( position, KChnlInfoMap ); |
|
207 |
if( !listeningString ) |
|
208 |
{ |
|
209 |
//position based parsing |
|
210 |
listeningString = &aInParamList[EParamIndex0]; |
|
211 |
if ( ( !listeningString ) ) |
|
212 |
{ |
|
213 |
iErrorString = KErrRegNotifyMissingListening.operator()().Alloc(); |
|
214 |
User::Leave( SErrMissingArgument ); |
|
215 |
} |
|
216 |
||
217 |
chnlInfoParam = &aInParamList[EParamIndex1]; |
|
218 |
if ( ( !chnlInfoParam ) ) |
|
219 |
{ |
|
220 |
iErrorString = KErrMissingChnlMap.operator()().Alloc(); |
|
221 |
User::Leave( SErrMissingArgument ); |
|
222 |
} |
|
223 |
} |
|
224 |
||
225 |
CheckInputTypeL( &listeningString->Value(), |
|
226 |
LIW::EVariantTypeDesC, |
|
227 |
KErrRegNotifyInvalidListeningType.operator&() ); |
|
228 |
||
229 |
CheckInputTypeL( &chnlInfoParam->Value(), |
|
230 |
LIW::EVariantTypeMap, |
|
231 |
KChnlInfoMap.operator&() ); |
|
232 |
||
233 |
// Retrieve Listening Type |
|
234 |
listeningString->Value().Get( listeningStrPtr ); |
|
235 |
||
236 |
//Leave if there is no listening type or is invalid |
|
237 |
if( listeningStrPtr != KChnlData ) |
|
238 |
{ |
|
239 |
iErrorString = KErrRegNotifyInvalidListening.operator()().Alloc(); |
|
240 |
User::Leave( SErrInvalidServiceArgument ); |
|
241 |
} |
|
242 |
||
243 |
const CLiwMap* chnlInfoMap = ( chnlInfoParam->Value() ).AsMap(); |
|
244 |
//Retrieve channel information from input List |
|
245 |
GetChannelInfoL( channelInfo ,chnlInfoMap ); |
|
246 |
||
247 |
//Create CallBack |
|
248 |
CSensorCallback* callBack = CSensorCallback::NewL( aCallback, |
|
249 |
transId ); |
|
250 |
CleanupStack::PushL( callBack ); |
|
251 |
TAsyncType asyncType(EInvalid); |
|
252 |
TInt notificationErr(0); |
|
253 |
//Data notification |
|
254 |
if ( listeningStrPtr == KChnlData ) |
|
255 |
{ |
|
256 |
TRAP( notificationErr, iSensorService->GetDataNotificationL |
|
257 |
( channelInfo, |
|
258 |
callBack ) ); |
|
259 |
||
260 |
if( notificationErr != KErrNone ) |
|
261 |
{ |
|
262 |
iErrorString = KErrInvalidNotif.operator()().Alloc(); |
|
263 |
User::Leave( KErrInUse ); |
|
264 |
} |
|
265 |
||
266 |
asyncType = EData; |
|
267 |
} |
|
268 |
else |
|
269 |
{ |
|
270 |
iErrorString = KErrRegNotifyInvalidListening.operator()().Alloc(); |
|
271 |
User::Leave( SErrInvalidServiceArgument ); |
|
272 |
} |
|
273 |
||
274 |
// Store information about this async call |
|
275 |
info = CStoreAsyncInfo::NewL( asyncType, |
|
276 |
transId, |
|
277 |
callBack, |
|
278 |
channelInfo.iChannelId ); |
|
279 |
iAsyncInfo.Append( info ); |
|
280 |
||
281 |
//Appending trans id to the output parameter list |
|
282 |
aOutParamList.AppendL( TLiwGenericParam( KTransactionId , |
|
283 |
TLiwVariant ( ( TInt32 )transId ) ) ); |
|
284 |
||
285 |
CleanupStack::Pop( callBack ); |
|
286 |
||
287 |
} |
|
288 |
else |
|
289 |
{ |
|
290 |
iErrorString = KErrRegNotifyAsyncbit.operator()().Alloc(); |
|
291 |
User::Leave( SErrMissingArgument ); |
|
292 |
} |
|
293 |
||
294 |
}//End of RegisterForNotification |
|
295 |
// Start of StopNotification |
|
296 |
else if ( ( aCmdName.CompareF( KStopNotification ) == 0 ) ) |
|
297 |
{ |
|
298 |
||
299 |
if( aCallback ) |
|
300 |
{ |
|
301 |
iErrorString = KErrSensorInvalidReq.operator()().Alloc(); |
|
302 |
User::Leave( SErrInvalidServiceArgument ); |
|
303 |
} |
|
304 |
||
305 |
if( ! ( KLiwOptCancel & aCmdOptions) ) |
|
306 |
{ |
|
307 |
iErrorString = KErrStopNotifCancelBit.operator()().Alloc(); |
|
308 |
User::Leave( SErrMissingArgument ); |
|
309 |
} |
|
310 |
||
311 |
TInt32 transId = 0; |
|
312 |
const TLiwGenericParam* transIdParam = NULL; |
|
313 |
TAsyncType asyncType; |
|
314 |
TUint chnlId = 0; |
|
315 |
TInt asyncCount = 0; |
|
316 |
CStoreAsyncInfo* info = NULL; |
|
317 |
TInt i = 0; |
|
318 |
TBool transFound = FALSE; |
|
319 |
||
320 |
position = 0; |
|
321 |
transIdParam = aInParamList.FindFirst( position , KTransactionId ); |
|
322 |
position = 0; |
|
323 |
||
324 |
if ( !transIdParam ) |
|
325 |
{ |
|
326 |
if( aInParamList.Count() != 0 ) |
|
327 |
{ |
|
328 |
transIdParam = &aInParamList[EParamIndex0]; |
|
329 |
} |
|
330 |
else |
|
331 |
{ |
|
332 |
iErrorString = KErrStopNotifMissingTransId.operator()().Alloc(); |
|
333 |
User::Leave( SErrMissingArgument ); |
|
334 |
} |
|
335 |
} |
|
336 |
||
337 |
CheckInputTypeL( &transIdParam->Value(), |
|
338 |
LIW::EVariantTypeTInt32, |
|
339 |
KTransactionId.operator&() ); |
|
340 |
||
341 |
// Obtain transaction id from input list |
|
342 |
transIdParam->Value().Get( transId ); |
|
343 |
||
344 |
// Get count of async calls |
|
345 |
asyncCount = iAsyncInfo.Count(); |
|
346 |
||
347 |
// Search within the async call list for the transaction ID |
|
348 |
for( i = 0; i < asyncCount; i++ ) |
|
349 |
{ |
|
350 |
info = iAsyncInfo[i]; |
|
351 |
if( transId == ( info->iTransactionId ) ) |
|
352 |
{ |
|
353 |
// Transaction id is found |
|
354 |
transFound = TRUE; |
|
355 |
break; |
|
356 |
} |
|
357 |
} |
|
358 |
// If found then cancel the request for notification on service class |
|
359 |
if( transFound ) |
|
360 |
{ |
|
361 |
asyncType = info->iAsyncType; |
|
362 |
chnlId = info->ichnlId; |
|
363 |
||
364 |
switch( asyncType ) |
|
365 |
{ |
|
366 |
case EData: // To stop data notification |
|
367 |
iSensorService->StopNotificationL( EStopData,chnlId ); |
|
368 |
break; |
|
369 |
} |
|
370 |
||
371 |
//Remove this from the store of async functions |
|
372 |
iAsyncInfo.Remove( i ); |
|
373 |
delete info->iCallback; |
|
374 |
delete info; |
|
375 |
info = NULL; |
|
376 |
} |
|
377 |
else |
|
378 |
{ |
|
379 |
// Incorrect transaction id |
|
380 |
iErrorString = KErrStopNotifInvalidTransId.operator()().Alloc(); |
|
381 |
User::Leave( SErrInvalidServiceArgument ); |
|
382 |
} |
|
383 |
||
384 |
}//End of command StopNotification |
|
385 |
// Start of GetChannelProperty |
|
386 |
else if ( ( aCmdName.CompareF( KCmdGetChnlProperty ) == 0 ) ) |
|
387 |
{ |
|
388 |
||
389 |
if( aCallback ) |
|
390 |
{ |
|
391 |
iErrorString = KErrSensorInvalidReq.operator()().Alloc(); |
|
392 |
User::Leave( SErrInvalidServiceArgument ); |
|
393 |
} |
|
394 |
||
395 |
const TLiwGenericParam* channelParam = NULL; |
|
396 |
const TLiwGenericParam* propertyIdParam= NULL; |
|
397 |
//Retreive property id for filling output map |
|
398 |
TSensrvPropertyId propertyId = 0; |
|
399 |
TPtrC propertyIdStr; |
|
400 |
||
401 |
if( aInParamList.Count() < 2) |
|
402 |
{ |
|
403 |
iErrorString = KErrRegNotEnoughParams.operator()().Alloc(); |
|
404 |
User::Leave( SErrMissingArgument ); |
|
405 |
} |
|
406 |
||
407 |
channelParam = aInParamList.FindFirst( position, KChnlInfoMap ); |
|
408 |
position = 0; |
|
409 |
propertyIdParam = aInParamList.FindFirst( position, KPropId ); |
|
410 |
||
411 |
if ( !channelParam ) |
|
412 |
{ |
|
413 |
channelParam = &aInParamList[EParamIndex0]; |
|
414 |
if ( !channelParam ) |
|
415 |
{ |
|
416 |
iErrorString = KErrMissingChnlMap.operator()().Alloc(); |
|
417 |
User::Leave( SErrMissingArgument ); |
|
418 |
} |
|
419 |
propertyIdParam = &aInParamList[EParamIndex1]; |
|
420 |
if ( !propertyIdParam ) |
|
421 |
{ |
|
422 |
iErrorString = KErrMissingPropId.operator()().Alloc(); |
|
423 |
User::Leave( SErrMissingArgument ); |
|
424 |
} |
|
425 |
} |
|
426 |
||
427 |
// Obtain channel info from input map |
|
428 |
CheckInputTypeL( &channelParam->Value(), |
|
429 |
LIW::EVariantTypeMap, |
|
430 |
KChnlInfoMap.operator&() ); |
|
431 |
||
432 |
CheckInputTypeL( &propertyIdParam->Value(), |
|
433 |
LIW::EVariantTypeDesC, |
|
434 |
KPropId.operator&() ); |
|
435 |
||
436 |
TSensrvChannelInfo channelInfo; |
|
437 |
const CLiwMap* chnlInfoMap = ( channelParam->Value() ).AsMap(); |
|
438 |
//Retreive Channel Info |
|
439 |
GetChannelInfoL( channelInfo , chnlInfoMap ); |
|
440 |
||
441 |
propertyIdParam->Value().Get( propertyIdStr ); |
|
442 |
propertyId = PropertyIdInfoL( propertyIdStr ); |
|
443 |
||
444 |
// Obtain property list from service class |
|
445 |
RSensrvPropertyList propertyList; |
|
446 |
CleanupClosePushL( propertyList ); |
|
447 |
TRAPD( getPropErr, iSensorService->GetChannelPropertyL |
|
448 |
( channelInfo, |
|
449 |
propertyList ) ); |
|
450 |
||
451 |
if( getPropErr != KErrNone ) |
|
452 |
{ |
|
453 |
CleanupStack::PopAndDestroy( &propertyList ); |
|
454 |
iErrorString = KErrInvalidChnlMap.operator()().Alloc(); |
|
455 |
User::Leave(KErrArgument); |
|
456 |
} |
|
457 |
||
458 |
// Create output map |
|
459 |
CLiwDefaultMap* outMap = CLiwDefaultMap::NewL(); |
|
460 |
CleanupStack::PushL( outMap ); |
|
461 |
||
462 |
// Append property from list to output map |
|
463 |
TRAPD( findPropErr ,AppendPropertyToMapL( propertyList, |
|
464 |
outMap, |
|
465 |
propertyId ) ); |
|
466 |
||
467 |
if( findPropErr != KErrNone ) |
|
468 |
{ |
|
469 |
iErrorString = KErrPropNotSupported.operator()().Alloc(); |
|
470 |
CleanupStack::Pop( outMap ); |
|
471 |
CleanupStack::PopAndDestroy( &propertyList ); |
|
472 |
outMap->DecRef(); |
|
473 |
User::Leave(KErrNotFound); |
|
474 |
} |
|
475 |
||
476 |
//Appending result to the output parameter list |
|
477 |
aOutParamList.AppendL( TLiwGenericParam( KReturnValue , |
|
478 |
TLiwVariant( outMap ) ) ); |
|
479 |
||
480 |
CleanupStack::Pop( outMap ); |
|
481 |
CleanupStack::PopAndDestroy( &propertyList ); |
|
482 |
outMap->DecRef(); |
|
483 |
||
484 |
}//end of GetChannelProperty |
|
26
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
485 |
else if( ( aCmdName.CompareF( KCmdGetScaleFactor ) == 0 ) ) |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
486 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
487 |
if( aCallback ) |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
488 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
489 |
iErrorString = KErrSensorInvalidReq.operator()().Alloc(); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
490 |
User::Leave( SErrInvalidServiceArgument ); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
491 |
} |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
492 |
const TLiwGenericParam* channelInfoParam = NULL; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
493 |
channelInfoParam = aInParamList.FindFirst( position, KChnlInfoMap ); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
494 |
if ( !channelInfoParam ) |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
495 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
496 |
//Position based parsing |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
497 |
if( aInParamList.Count() != 0 ) |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
498 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
499 |
channelInfoParam = &aInParamList[EParamIndex0]; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
500 |
} |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
501 |
else |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
502 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
503 |
iErrorString = KErrMissingChnlMap.operator()().Alloc(); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
504 |
User::Leave( SErrMissingArgument ); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
505 |
} |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
506 |
} |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
507 |
CheckInputTypeL( &channelInfoParam->Value(), |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
508 |
LIW::EVariantTypeMap, |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
509 |
KChnlInfoMap.operator&() ); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
510 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
511 |
TSensrvChannelInfo channelInfo; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
512 |
const CLiwMap* chnlInfoMap = ( channelInfoParam->Value() ).AsMap(); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
513 |
//Retreive Channel Info |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
514 |
GetChannelInfoL( channelInfo , chnlInfoMap ); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
515 |
|
27
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
516 |
RSensrvPropertyList propertyList; |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
517 |
CleanupClosePushL( propertyList ); |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
518 |
TRAPD( anErr, iSensorService->GetChannelPropertyL( channelInfo, |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
519 |
propertyList ) ); |
26
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
520 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
521 |
if( anErr != KErrNone ) |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
522 |
{ |
27
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
523 |
CleanupStack::PopAndDestroy( &propertyList ); |
26
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
524 |
iErrorString = KErrInvalidChnlMap.operator()().Alloc(); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
525 |
User::Leave(KErrArgument); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
526 |
} |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
527 |
TReal scaleFactor ; |
27
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
528 |
TInt measureValue; |
26
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
529 |
TInt scaleValue; |
27
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
530 |
TInt propCount = propertyList.Count(); |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
531 |
TInt j=0; |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
532 |
TInt k=0; |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
533 |
// If no properties listed then leave with error - Not found |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
534 |
if( propCount == 0 ) |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
535 |
{ |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
536 |
User::Leave( KErrNotFound ); |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
537 |
} |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
538 |
|
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
539 |
for (TInt i = 0; i < propCount; i++ ) |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
540 |
{ |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
541 |
if(propertyList[i].GetPropertyId()== KSensrvPropIdMeasureRange) |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
542 |
{ |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
543 |
if(j<1) |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
544 |
{ |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
545 |
propertyList[i].GetValue( measureValue ); |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
546 |
j++; |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
547 |
} |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
548 |
} |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
549 |
if(propertyList[i].GetPropertyId()== KSensrvPropIdScaledRange) |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
550 |
{ |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
551 |
if(k<1) |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
552 |
{ |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
553 |
propertyList[i].GetValue( scaleValue ); |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
554 |
} |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
555 |
} |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
556 |
|
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
557 |
} |
02682e02e51f
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
558 |
CleanupStack::PopAndDestroy( &propertyList ); |
26
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
559 |
TReal outputValue; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
560 |
TInt errPow; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
561 |
errPow = Math::Pow(outputValue,2,scaleValue-1); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
562 |
if( errPow == KErrNone ) |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
563 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
564 |
if( measureValue == 0 ) |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
565 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
566 |
scaleFactor = (2*9.8)/outputValue; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
567 |
aOutParamList.AppendL( TLiwGenericParam( KReturnValue , |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
568 |
TLiwVariant( scaleFactor ) ) ); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
569 |
} |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
570 |
else if(measureValue == 1) |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
571 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
572 |
scaleFactor = (8*9.8)/outputValue; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
573 |
aOutParamList.AppendL( TLiwGenericParam( KReturnValue , |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
574 |
TLiwVariant( scaleFactor ) ) ); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
575 |
} |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
576 |
else |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
577 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
578 |
iErrorString = KErrInvalidMeasureRange.operator()().Alloc(); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
579 |
User::Leave(KErrArgument); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
580 |
} |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
581 |
} |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
582 |
else |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
583 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
584 |
iErrorString = KErrInvalidPowValue.operator()().Alloc(); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
585 |
User::Leave(KErrArgument); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
586 |
} |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
587 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
588 |
}//end of GetScaleFactor |
5 | 589 |
else |
590 |
{ |
|
591 |
iErrorString = KErrSensorInvalidCmd.operator()().Alloc(); |
|
592 |
User::Leave( KErrNotSupported ); |
|
593 |
} |
|
594 |
} |
|
595 |
||
596 |
/* |
|
597 |
----------------------------------------------------------------------------- |
|
598 |
CSensorInterface* CSensorInterface::NewL() |
|
599 |
Description : Two-phased constructor. |
|
600 |
Return values : CSensorInterface object pointer |
|
601 |
||
602 |
----------------------------------------------------------------------------- |
|
603 |
*/ |
|
604 |
CSensorInterface* CSensorInterface::NewL() |
|
605 |
{ |
|
606 |
CSensorInterface* self = new ( ELeave ) CSensorInterface(); |
|
607 |
CleanupStack::PushL( self ); |
|
608 |
self->ConstructL(); |
|
609 |
CleanupStack::Pop( self ); |
|
610 |
return self; |
|
611 |
} |
|
612 |
/* |
|
613 |
----------------------------------------------------------------------------- |
|
614 |
CSensorInterface::~CSensorInterface() |
|
615 |
Description : Destructor, free allocated resources |
|
616 |
Return values : N/A |
|
617 |
----------------------------------------------------------------------------- |
|
618 |
*/ |
|
619 |
CSensorInterface::~CSensorInterface() |
|
620 |
{ |
|
621 |
||
622 |
TInt count = iAsyncInfo.Count(); |
|
623 |
CStoreAsyncInfo* info = NULL; |
|
624 |
||
625 |
TAsyncType asyncType = EInvalid; |
|
626 |
TInt stopErr; |
|
627 |
TUint chnlId = 0; |
|
628 |
||
629 |
//Cleanup async info store |
|
630 |
for( TInt i = 0; i< count; i++) |
|
631 |
{ |
|
632 |
info = iAsyncInfo[i]; |
|
633 |
if( info ) |
|
634 |
{ |
|
635 |
asyncType = info->iAsyncType; |
|
636 |
chnlId = info->ichnlId; |
|
637 |
} |
|
638 |
||
639 |
switch( asyncType ) |
|
640 |
{ |
|
641 |
case EData: // To stop data notification |
|
642 |
{ |
|
643 |
if( iSensorService ) |
|
644 |
{ |
|
645 |
TRAP( stopErr, |
|
646 |
iSensorService->StopNotificationL( EStopData, |
|
647 |
chnlId ) ); |
|
648 |
} |
|
649 |
break; |
|
650 |
} |
|
651 |
} |
|
652 |
||
653 |
if( info->iCallback ) |
|
654 |
{ |
|
655 |
delete info->iCallback; |
|
656 |
info->iCallback = NULL; |
|
657 |
} |
|
658 |
||
659 |
||
660 |
if( info ) |
|
661 |
{ |
|
662 |
delete info; |
|
663 |
info = NULL; |
|
664 |
} |
|
665 |
} |
|
666 |
||
667 |
iAsyncInfo.Reset(); |
|
668 |
||
669 |
if( iSensorService ) |
|
670 |
delete iSensorService; |
|
671 |
||
672 |
if( iErrorString ) |
|
673 |
delete iErrorString; |
|
674 |
||
675 |
} |
|
676 |
||
677 |
/* |
|
678 |
----------------------------------------------------------------------------- |
|
679 |
CSensorInterface::GetSapiErrorCode() |
|
680 |
Description : Returns the Sapi Error Code. |
|
681 |
Return values : SapiErrors |
|
682 |
----------------------------------------------------------------------------- |
|
683 |
*/ |
|
684 |
SapiErrors CSensorInterface:: GetSapiErrorCode( TInt aError ) |
|
685 |
{ |
|
686 |
SapiErrors sapiErr = SErrNone; |
|
687 |
switch ( aError ) |
|
688 |
{ |
|
689 |
case KErrArgument: |
|
690 |
{ |
|
691 |
sapiErr = SErrBadArgumentType; |
|
692 |
break; |
|
693 |
} |
|
694 |
case KErrNotSupported: |
|
695 |
{ |
|
696 |
sapiErr = SErrServiceNotSupported; |
|
697 |
break; |
|
698 |
} |
|
699 |
case KErrNone: |
|
700 |
{ |
|
701 |
sapiErr= SErrNone; |
|
702 |
break; |
|
703 |
} |
|
704 |
case KErrNotFound: |
|
705 |
{ |
|
706 |
sapiErr= SErrNotFound; |
|
707 |
break; |
|
708 |
} |
|
709 |
case SErrMissingArgument: |
|
710 |
{ |
|
711 |
sapiErr = SErrMissingArgument; |
|
712 |
break; |
|
713 |
} |
|
714 |
case SErrInvalidServiceArgument: |
|
715 |
{ |
|
716 |
sapiErr = SErrInvalidServiceArgument; |
|
717 |
break; |
|
718 |
} |
|
719 |
case KErrInUse: |
|
720 |
{ |
|
721 |
sapiErr = SErrServiceInUse; |
|
722 |
break; |
|
723 |
} |
|
724 |
} |
|
725 |
return sapiErr; |
|
726 |
} |
|
727 |
||
728 |
/* |
|
729 |
----------------------------------------------------------------------------- |
|
730 |
CSensorInterface::ExecuteCmdL() |
|
731 |
Description : This is called by the consumer with command to execute. |
|
732 |
Return values : N/A |
|
733 |
----------------------------------------------------------------------------- |
|
734 |
*/ |
|
735 |
void CSensorInterface::ExecuteCmdL( const TDesC8& aCmdName, |
|
736 |
const CLiwGenericParamList& aInParamList, |
|
737 |
CLiwGenericParamList& aOutParamList, |
|
738 |
TUint aCmdOptions, |
|
739 |
MLiwNotifyCallback* aCallback ) |
|
740 |
{ |
|
741 |
TRAPD( err, ExecuteServiceCommandL( aCmdName, |
|
742 |
aInParamList, |
|
743 |
aOutParamList, |
|
744 |
aCmdOptions, |
|
745 |
aCallback ) ); |
|
746 |
if( err != KErrNone ) |
|
747 |
{ |
|
748 |
||
749 |
if( iErrorString ) |
|
750 |
{ |
|
751 |
TBuf<KErrMessageLen> errorMessage; |
|
752 |
errorMessage.Append( KMsgErr.operator()() ); |
|
753 |
TBuf<KCmdLen> commandName; |
|
754 |
commandName.Copy( aCmdName ); |
|
755 |
errorMessage.Append( commandName ); |
|
756 |
errorMessage.Append( KColon.operator()()); |
|
757 |
errorMessage.Append( iErrorString->Des() ); |
|
758 |
||
759 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMessage, |
|
760 |
TLiwVariant( errorMessage ))); |
|
761 |
} |
|
762 |
} |
|
763 |
||
764 |
TInt32 returnCode = CSensorInterface::GetSapiErrorCode( err ); |
|
765 |
aOutParamList.AppendL( TLiwGenericParam( KErrorCode, |
|
766 |
TLiwVariant( ( TInt32 ) returnCode ) ) ); |
|
767 |
||
768 |
} |
|
769 |
||
770 |
/* |
|
771 |
----------------------------------------------------------------------------- |
|
772 |
CSensorInterface::Close() |
|
773 |
Description : This is called by the consumer to delete the handle. |
|
774 |
Return values : N/A |
|
775 |
----------------------------------------------------------------------------- |
|
776 |
*/ |
|
777 |
void CSensorInterface::Close() |
|
778 |
{ |
|
779 |
delete this; |
|
780 |
} |
|
781 |
||
782 |
/* |
|
783 |
----------------------------------------------------------------------------- |
|
784 |
CSensorInterface::AppendChannelInfoL() |
|
785 |
Description : Internal function used to append result of found sensor |
|
786 |
channel to the outputlist |
|
787 |
Return values : N/A |
|
788 |
----------------------------------------------------------------------------- |
|
789 |
*/ |
|
790 |
void CSensorInterface::AppendChannelInfoL |
|
791 |
( const RSensrvChannelInfoList& aChannelInfoList, |
|
792 |
CLiwDefaultList* aList) |
|
793 |
{ |
|
794 |
// Obtain channel count |
|
795 |
TInt channelCount = aChannelInfoList.Count(); |
|
796 |
||
797 |
for(TInt i = 0; i < channelCount; i++) |
|
798 |
{ |
|
799 |
||
800 |
TInt32 chnlType = (TInt32)aChannelInfoList[i].iChannelType; |
|
801 |
||
802 |
switch(chnlType) |
|
803 |
{ |
|
804 |
case EFindAccelerometerXYZAxisData: |
|
805 |
case EFindAccelerometerDoubleTappingData: |
|
806 |
case EFindOrientationData: |
|
807 |
case EFindRotationData: |
|
808 |
{ |
|
809 |
// Map to be appended to the list |
|
810 |
CLiwDefaultMap* chnlMap = CLiwDefaultMap::NewL() ; |
|
811 |
CleanupStack::PushL( chnlMap ); |
|
812 |
||
813 |
//Retreive channel information |
|
814 |
TInt32 chnlId = (TInt32)aChannelInfoList[i].iChannelId; |
|
815 |
TInt32 contextType = aChannelInfoList[i].iContextType; |
|
816 |
TInt32 quantity = aChannelInfoList[i].iQuantity; |
|
817 |
TBuf8<KSensrvLocationLength> location( aChannelInfoList[i].iLocation ); |
|
818 |
TBuf8<KSensrvVendorIdLength> vendorId( aChannelInfoList[i].iVendorId ); |
|
819 |
TInt32 dataItemSize = aChannelInfoList[i].iDataItemSize; |
|
820 |
TInt32 chnlDataTypeId = (TInt32)aChannelInfoList[i].iChannelDataTypeId; |
|
821 |
||
822 |
_LIT( KDummyLoc, "Unknown" ); |
|
823 |
TBufC<KSensrvLocationLength> dummyLoc( KDummyLoc ); |
|
824 |
TPtr location16 = dummyLoc.Des(); |
|
825 |
CnvUtfConverter::ConvertToUnicodeFromUtf8( location16, location ); |
|
826 |
||
827 |
_LIT( KDummyVen, "Unknown" ); |
|
828 |
TBufC<KSensrvVendorIdLength> dummyVen( KDummyVen ); |
|
829 |
TPtr vendor16 = dummyVen.Des(); |
|
830 |
CnvUtfConverter::ConvertToUnicodeFromUtf8( vendor16, vendorId ); |
|
831 |
||
832 |
// Insert channel info to the map |
|
833 |
chnlMap->InsertL( KChnlId ,TLiwVariant( (TInt32)chnlId ) ); |
|
834 |
chnlMap->InsertL( KContextType ,TLiwVariant( (TInt32)contextType ) ); |
|
835 |
chnlMap->InsertL( KQuantity ,TLiwVariant( (TInt32)quantity ) ); |
|
836 |
chnlMap->InsertL( KChannelType ,TLiwVariant( (TInt32)chnlType ) ); |
|
837 |
chnlMap->InsertL( KLocation , TLiwVariant( location16 ) ); |
|
838 |
chnlMap->InsertL( KVendorId , TLiwVariant( vendor16 ) ); |
|
839 |
chnlMap->InsertL( KDataItemSize ,TLiwVariant( (TInt32)dataItemSize ) ); |
|
840 |
chnlMap->InsertL( KChnlDataTypeId ,TLiwVariant( (TInt32)chnlDataTypeId ) ); |
|
841 |
||
842 |
//Append it to the list |
|
843 |
aList->AppendL( TLiwVariant( chnlMap ) ); |
|
844 |
CleanupStack::Pop( chnlMap ); |
|
845 |
||
846 |
//done with the map |
|
847 |
chnlMap->DecRef(); |
|
848 |
break; |
|
849 |
} |
|
850 |
default: |
|
851 |
break; |
|
852 |
||
853 |
} |
|
854 |
} |
|
855 |
} |
|
856 |
||
857 |
/* |
|
858 |
----------------------------------------------------------------------------- |
|
859 |
CSensorInterface::AppendPropertyToMapL() |
|
860 |
Description : Internal function used to append result of get property |
|
861 |
to the output map |
|
862 |
Return values : N/A |
|
863 |
----------------------------------------------------------------------------- |
|
864 |
*/ |
|
865 |
void CSensorInterface::AppendPropertyToMapL |
|
866 |
( const RSensrvPropertyList& aPropertyList, |
|
867 |
CLiwDefaultMap* aMap, |
|
868 |
const TUint aPropertyId) |
|
869 |
{ |
|
870 |
// Obtain property count |
|
871 |
TInt propCount = aPropertyList.Count(); |
|
872 |
||
873 |
// If no properties listed then leave with error - Not found |
|
874 |
if( propCount == 0 ) |
|
875 |
{ |
|
876 |
User::Leave( KErrNotFound ); |
|
877 |
} |
|
878 |
||
879 |
TInt i = 0; // Loop variable |
|
880 |
TSensrvProperty tempProperty; // Property for copy from property list |
|
881 |
TSensrvProperty tempProperty1;// Property for obtaining value in array |
|
882 |
||
883 |
TBool found = FALSE; |
|
884 |
||
885 |
TInt propType = 0; |
|
886 |
TInt intVal; |
|
887 |
TReal rValue; |
|
888 |
TBuf8<KBufSize> bufValue; |
|
889 |
TInt32 itemIndex; |
|
890 |
||
891 |
// Search within property list and fill output map |
|
892 |
for ( i = 0; i < propCount; i++ ) |
|
893 |
{ |
|
894 |
tempProperty = aPropertyList[i]; |
|
895 |
||
896 |
if( aPropertyId == ( tempProperty.GetPropertyId() ) ) |
|
897 |
{ |
|
898 |
// Property has been found |
|
899 |
found = TRUE; |
|
900 |
TPtrC propertyStr = PropertyStrL( aPropertyId ); |
|
901 |
aMap->InsertL( KPropId ,TLiwVariant( propertyStr ) ); |
|
902 |
||
903 |
// Obtain item index,property type and read only |
|
904 |
itemIndex = tempProperty.PropertyItemIndex(); |
|
905 |
propType = tempProperty.PropertyType(); |
|
906 |
||
907 |
// Insert item index,property type and read only into output map |
|
908 |
aMap->InsertL( KPropertyDataType ,TLiwVariant( (TInt32) ( propType - 1 ) ) ); |
|
909 |
aMap->InsertL( KItemIndex ,TLiwVariant( (TInt32) itemIndex ) ); |
|
910 |
aMap->InsertL( KReadOnly ,TLiwVariant(1) ); |
|
911 |
||
912 |
// For single property,just fill the actual values |
|
913 |
if( ESensrvSingleProperty == ( tempProperty.GetArrayIndex() ) ) |
|
914 |
{ |
|
915 |
||
916 |
// Obtain values for integer property |
|
917 |
if( propType == ESensrvIntProperty ) |
|
918 |
{ |
|
919 |
tempProperty.GetValue( intVal ); |
|
920 |
aMap->InsertL( KPropertyValue ,TLiwVariant( (TInt32) intVal ) ); |
|
921 |
} |
|
922 |
// Obtain values for real property |
|
923 |
else if( propType == ESensrvRealProperty ) |
|
924 |
{ |
|
925 |
tempProperty.GetValue( rValue ); |
|
926 |
aMap->InsertL( KPropertyValue ,TLiwVariant( rValue ) ); |
|
927 |
} |
|
928 |
// Obtain values for string property |
|
929 |
else if( propType == ESensrvBufferProperty ) |
|
930 |
{ |
|
931 |
tempProperty.GetValue( bufValue ); |
|
932 |
_LIT( KDummyDesc, "Unknown" ); |
|
933 |
TBufC<KSensrvLocationLength> dummyDesc( KDummyDesc ); |
|
934 |
TPtr description16 = dummyDesc.Des(); |
|
935 |
CnvUtfConverter::ConvertToUnicodeFromUtf8( description16, bufValue ); |
|
936 |
||
937 |
aMap->InsertL( KPropertyValue ,TLiwVariant( description16 ) ); |
|
938 |
} |
|
939 |
break; |
|
940 |
} |
|
941 |
// If array property then get values from the actual listed props |
|
942 |
else if( ESensrvArrayPropertyInfo == ( tempProperty.GetArrayIndex() ) ) |
|
943 |
{ |
|
944 |
// For integer property |
|
945 |
if( propType == ESensrvIntProperty ) |
|
946 |
{ |
|
947 |
TInt indexVal; |
|
948 |
tempProperty.GetValue( indexVal ); |
|
949 |
tempProperty1 = aPropertyList[ i + indexVal ]; |
|
950 |
tempProperty1.GetValue( intVal ); |
|
951 |
aMap->InsertL( KPropertyValue ,TLiwVariant( (TInt32) intVal ) ); |
|
952 |
} |
|
953 |
// For real property |
|
954 |
else if( propType == ESensrvRealProperty ) |
|
955 |
{ |
|
956 |
TReal indexVal; |
|
957 |
tempProperty.GetValue( indexVal ); |
|
958 |
tempProperty1 = aPropertyList[ i + indexVal ]; |
|
959 |
tempProperty1.GetValue( rValue ); |
|
960 |
aMap->InsertL( KPropertyValue ,TLiwVariant( rValue ) ); |
|
961 |
} |
|
962 |
break; |
|
963 |
} |
|
964 |
||
965 |
} |
|
966 |
else |
|
967 |
continue; |
|
968 |
} |
|
969 |
||
970 |
// If property not found then leave with error - not found |
|
971 |
if( found == FALSE ) |
|
972 |
{ |
|
973 |
User::Leave( KErrNotFound ); |
|
974 |
} |
|
975 |
||
976 |
} |
|
977 |
||
978 |
||
979 |
/* |
|
980 |
----------------------------------------------------------------------------- |
|
981 |
CSensorInterface::GetChannelInfoL() |
|
982 |
Description : Internal function used to extract channel info from the |
|
983 |
: Input |
|
984 |
Return values : N/A |
|
985 |
----------------------------------------------------------------------------- |
|
986 |
*/ |
|
987 |
void CSensorInterface::GetChannelInfoL( TSensrvChannelInfo& aChannelInfo, |
|
988 |
const CLiwMap* aChnlInfoMap ) |
|
989 |
{ |
|
990 |
TLiwVariant infoVariant; |
|
991 |
||
992 |
if( aChnlInfoMap->FindL( KChnlId , infoVariant ) ) |
|
993 |
{ |
|
994 |
CheckInputTypeL( &infoVariant, |
|
995 |
LIW::EVariantTypeTInt32, |
|
996 |
KChnlId.operator&() ); |
|
997 |
||
998 |
aChannelInfo.iChannelId = infoVariant.AsTInt32(); |
|
999 |
} |
|
1000 |
else |
|
1001 |
{ |
|
1002 |
infoVariant.Reset(); |
|
1003 |
MissingValueL( KChnlId.operator&() ); |
|
1004 |
} |
|
1005 |
||
1006 |
if( aChnlInfoMap->FindL( KContextType , infoVariant ) ) |
|
1007 |
{ |
|
1008 |
CheckInputTypeL( &infoVariant, |
|
1009 |
LIW::EVariantTypeTInt32, |
|
1010 |
KContextType.operator&() ); |
|
1011 |
||
1012 |
aChannelInfo.iContextType = infoVariant.AsTInt32(); |
|
1013 |
} |
|
1014 |
else |
|
1015 |
{ |
|
1016 |
infoVariant.Reset(); |
|
1017 |
MissingValueL( KContextType.operator&() ); |
|
1018 |
} |
|
1019 |
||
1020 |
if( aChnlInfoMap->FindL( KQuantity , infoVariant ) ) |
|
1021 |
{ |
|
1022 |
CheckInputTypeL( &infoVariant, |
|
1023 |
LIW::EVariantTypeTInt32, |
|
1024 |
KQuantity.operator&() ); |
|
1025 |
||
1026 |
aChannelInfo.iQuantity = infoVariant.AsTInt32(); |
|
1027 |
} |
|
1028 |
else |
|
1029 |
{ |
|
1030 |
infoVariant.Reset(); |
|
1031 |
MissingValueL( KQuantity.operator&() ); |
|
1032 |
} |
|
1033 |
||
1034 |
if( aChnlInfoMap->FindL( KChannelType , infoVariant ) ) |
|
1035 |
{ |
|
1036 |
CheckInputTypeL( &infoVariant, |
|
1037 |
LIW::EVariantTypeTInt32, |
|
1038 |
KChannelType.operator&() ); |
|
1039 |
||
1040 |
aChannelInfo.iChannelType = infoVariant.AsTInt32(); |
|
1041 |
} |
|
1042 |
else |
|
1043 |
{ |
|
1044 |
infoVariant.Reset(); |
|
1045 |
MissingValueL( KChannelType.operator&() ); |
|
1046 |
} |
|
1047 |
||
1048 |
if( aChnlInfoMap->FindL( KLocation , infoVariant ) ) |
|
1049 |
{ |
|
1050 |
CheckInputTypeL( &infoVariant, |
|
1051 |
LIW::EVariantTypeDesC, |
|
1052 |
KLocation.operator&() ); |
|
1053 |
||
1054 |
TPtrC location16 = infoVariant.AsDes(); |
|
1055 |
TBuf8<KSensrvLocationLength> location8; |
|
1056 |
CnvUtfConverter::ConvertFromUnicodeToUtf8( location8, location16 ); |
|
1057 |
||
1058 |
aChannelInfo.iLocation = location8; |
|
1059 |
} |
|
1060 |
else |
|
1061 |
{ |
|
1062 |
infoVariant.Reset(); |
|
1063 |
MissingValueL( KLocation.operator&() ); |
|
1064 |
} |
|
1065 |
||
1066 |
if( aChnlInfoMap->FindL( KVendorId , infoVariant ) ) |
|
1067 |
{ |
|
1068 |
CheckInputTypeL( &infoVariant, |
|
1069 |
LIW::EVariantTypeDesC, |
|
1070 |
KVendorId.operator&() ); |
|
1071 |
||
1072 |
TPtrC vendorId16 = infoVariant.AsDes(); |
|
1073 |
TBuf8<KSensrvVendorIdLength> vendorId8; |
|
1074 |
CnvUtfConverter::ConvertFromUnicodeToUtf8( vendorId8, vendorId16 ); |
|
1075 |
||
1076 |
aChannelInfo.iVendorId = vendorId8; |
|
1077 |
} |
|
1078 |
else |
|
1079 |
{ |
|
1080 |
infoVariant.Reset(); |
|
1081 |
MissingValueL( KVendorId.operator&() ); |
|
1082 |
} |
|
1083 |
||
1084 |
if( aChnlInfoMap->FindL( KDataItemSize , infoVariant ) ) |
|
1085 |
{ |
|
1086 |
CheckInputTypeL( &infoVariant, |
|
1087 |
LIW::EVariantTypeTInt32, |
|
1088 |
KDataItemSize.operator&() ); |
|
1089 |
||
1090 |
aChannelInfo.iDataItemSize = infoVariant.AsTInt32(); |
|
1091 |
} |
|
1092 |
else |
|
1093 |
{ |
|
1094 |
infoVariant.Reset(); |
|
1095 |
MissingValueL( KDataItemSize.operator&() ); |
|
1096 |
} |
|
1097 |
||
1098 |
if( aChnlInfoMap->FindL( KChnlDataTypeId , infoVariant ) ) |
|
1099 |
{ |
|
1100 |
CheckInputTypeL( &infoVariant, |
|
1101 |
LIW::EVariantTypeTInt32, |
|
1102 |
KChnlDataTypeId.operator&() ); |
|
1103 |
||
1104 |
aChannelInfo.iChannelDataTypeId = infoVariant.AsTInt32(); |
|
1105 |
} |
|
1106 |
else |
|
1107 |
{ |
|
1108 |
infoVariant.Reset(); |
|
1109 |
MissingValueL( KChnlDataTypeId.operator&() ); |
|
1110 |
} |
|
1111 |
infoVariant.Reset(); |
|
1112 |
} |
|
1113 |
||
1114 |
/* |
|
1115 |
----------------------------------------------------------------------------- |
|
1116 |
CSensorInterface::PropertyStr() |
|
1117 |
Description : Internal function used to extract property string from |
|
1118 |
: the input property id |
|
1119 |
Return values : N/A |
|
1120 |
----------------------------------------------------------------------------- |
|
1121 |
*/ |
|
1122 |
TPtrC CSensorInterface::PropertyStrL( TSensrvPropertyId aPropertyId ) |
|
1123 |
{ |
|
1124 |
||
1125 |
TPtrC ptr; |
|
1126 |
||
1127 |
switch( aPropertyId ) |
|
1128 |
{ |
|
1129 |
case KSensrvPropIdDataRate: |
|
1130 |
ptr.Set( KDataRate ); |
|
1131 |
break; |
|
1132 |
||
1133 |
case KSensrvPropIdAvailability: |
|
1134 |
ptr.Set( KAvailability ); |
|
1135 |
break; |
|
1136 |
||
1137 |
case KSensrvPropIdMeasureRange: |
|
1138 |
ptr.Set( KMeasureRange ); |
|
1139 |
break; |
|
1140 |
||
1141 |
case KSensrvPropIdChannelDataFormat: |
|
1142 |
ptr.Set( KChannelDataFormat ); |
|
1143 |
break; |
|
1144 |
||
1145 |
case KSensrvPropIdChannelAccuracy: |
|
1146 |
ptr.Set( KChannelAccuracy ); |
|
1147 |
break; |
|
1148 |
||
1149 |
case KSensrvPropIdChannelScale: |
|
1150 |
ptr.Set( KChannelScale ); |
|
1151 |
break; |
|
1152 |
||
1153 |
case KSensrvPropIdScaledRange: |
|
1154 |
ptr.Set( KScaledRange ); |
|
1155 |
break; |
|
1156 |
||
1157 |
case KSensrvPropIdChannelUnit: |
|
1158 |
ptr.Set( KChannelUnit ); |
|
1159 |
break; |
|
1160 |
||
1161 |
case KSensrvSensorModel: |
|
1162 |
ptr.Set( KSensorModel ); |
|
1163 |
break; |
|
1164 |
||
1165 |
case KSensrvSensorConnectionType: |
|
1166 |
ptr.Set( KConnectionType ); |
|
1167 |
break; |
|
1168 |
||
1169 |
case KSensrvSensorDescription: |
|
1170 |
ptr.Set( KSensorDescription ); |
|
1171 |
break; |
|
1172 |
||
1173 |
default: |
|
1174 |
User::Leave( KErrNotSupported ); |
|
1175 |
} |
|
1176 |
return ptr; |
|
1177 |
} |
|
1178 |
||
1179 |
/* |
|
1180 |
----------------------------------------------------------------------------- |
|
1181 |
CSensorInterface::PropertyIdInfoL() |
|
1182 |
Description : Internal function used to extract property id info from |
|
1183 |
: the Input |
|
1184 |
Return values : N/A |
|
1185 |
----------------------------------------------------------------------------- |
|
1186 |
*/ |
|
1187 |
TSensrvPropertyId CSensorInterface::PropertyIdInfoL( const TDesC& aPropertyIdStr ) |
|
1188 |
{ |
|
1189 |
TSensrvPropertyId propId = 0; |
|
1190 |
||
1191 |
if( aPropertyIdStr == KDataRate ) |
|
1192 |
propId = KSensrvPropIdDataRate; |
|
1193 |
else if( aPropertyIdStr == KAvailability ) |
|
1194 |
propId = KSensrvPropIdAvailability; |
|
1195 |
else if( aPropertyIdStr == KMeasureRange ) |
|
1196 |
propId = KSensrvPropIdMeasureRange; |
|
1197 |
else if( aPropertyIdStr == KChannelDataFormat ) |
|
1198 |
propId = KSensrvPropIdChannelDataFormat; |
|
1199 |
else if( aPropertyIdStr == KChannelAccuracy ) |
|
1200 |
propId = KSensrvPropIdChannelAccuracy; |
|
1201 |
else if( aPropertyIdStr == KChannelScale ) |
|
1202 |
propId = KSensrvPropIdChannelScale; |
|
1203 |
else if( aPropertyIdStr == KScaledRange ) |
|
1204 |
propId = KSensrvPropIdScaledRange; |
|
1205 |
else if( aPropertyIdStr == KChannelUnit ) |
|
1206 |
propId = KSensrvPropIdChannelUnit; |
|
1207 |
else if( aPropertyIdStr == KSensorModel ) |
|
1208 |
propId = KSensrvSensorModel; |
|
1209 |
else if( aPropertyIdStr == KConnectionType ) |
|
1210 |
propId = KSensrvSensorConnectionType; |
|
1211 |
else if( aPropertyIdStr == KSensorDescription ) |
|
1212 |
propId = KSensrvSensorDescription; |
|
1213 |
else |
|
1214 |
{ |
|
1215 |
iErrorString = KErrPropInvalidPropId.operator()().Alloc(); |
|
1216 |
User::Leave( SErrInvalidServiceArgument ); |
|
1217 |
} |
|
1218 |
return propId; |
|
1219 |
} |