author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 24 Nov 2009 08:56:33 +0200 | |
changeset 33 | 50974a8b132e |
parent 19 | 989d2f495d90 |
permissions | -rw-r--r-- |
19 | 1 |
/* |
2 |
* Copyright (c) 2002 - 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: ?Description |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
||
21 |
// INCLUDE FILES |
|
22 |
#include <e32svr.h> |
|
23 |
#include <StifParser.h> |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
24 |
#include <StifTestInterface.h> |
19 | 25 |
#include <e32base.h> |
26 |
#include <sensrvchannelinfo.h> |
|
27 |
#include <sensrvchannel.h> |
|
28 |
#include <sensrvchannelfinder.h> |
|
29 |
#include <sensrvdatalistener.h> |
|
30 |
#include <sensrvgeneralproperties.h> |
|
31 |
#include <sensrvchanneldatatypes.h> |
|
32 |
#include <sensrvtypes.h> |
|
33 |
#include <sensrvdatalistener.h> |
|
34 |
#include <e32cons.h> |
|
35 |
||
36 |
// INCLUDE FILES |
|
37 |
#include "tsensorservice_test.h" |
|
38 |
#include "sensorservice.hrh" |
|
39 |
#include "snrdatacallback.h" |
|
40 |
||
41 |
_LIT(KLogAccDataFound,"Data Notification passed with %d channel having %d:%d:%d data \n"); |
|
42 |
_LIT(KLogDataFound,"Data Notification passed with %d channel having %d data \n"); |
|
43 |
_LIT(KLogChannelFound,"Find channel passed with %d channel having %d channels and error %d \n"); |
|
44 |
_LIT(KLogGetPropErr,"Getproperty %d channel having %d propertyid returns error %d and errn = %d \n "); |
|
45 |
_LIT(KLogExpIntValue,"Expected value : %d \n" ); |
|
46 |
_LIT(KLogExpRealValue,"Expected value : %d \n "); |
|
47 |
_LIT(KLogExpStringValue,"Expected value : %s \n "); |
|
48 |
_LIT(KLogGotIntValue,"Resultant value : %d \n "); |
|
49 |
_LIT(KLogGotRealValue,"Resultant value : %d \n "); |
|
50 |
_LIT(KLogGotStringValue,"Resultant value : %s \n "); |
|
51 |
||
52 |
// ============================ MEMBER FUNCTIONS =============================== |
|
53 |
||
54 |
// ----------------------------------------------------------------------------- |
|
55 |
// Ctsensorservice_test::Delete |
|
56 |
// Delete here all resources allocated and opened from test methods. |
|
57 |
// Called from destructor. |
|
58 |
// ----------------------------------------------------------------------------- |
|
59 |
// |
|
60 |
void Ctsensorservice_test::Delete() |
|
61 |
{ |
|
62 |
||
63 |
} |
|
64 |
||
65 |
// ----------------------------------------------------------------------------- |
|
66 |
// Ctsensorservice_test::RunMethodL |
|
67 |
// Run specified method. Contains also table of test mothods and their names. |
|
68 |
// ----------------------------------------------------------------------------- |
|
69 |
// |
|
70 |
TInt Ctsensorservice_test::RunMethodL( |
|
71 |
CStifItemParser& aItem ) |
|
72 |
{ |
|
73 |
||
74 |
static TStifFunctionInfo const KFunctions[] = |
|
75 |
{ |
|
76 |
// Copy this line for every implemented function. |
|
77 |
// First string is the function name used in TestScripter script file. |
|
78 |
// Second is the actual implementation member function. |
|
79 |
ENTRY( "FindChannels",Ctsensorservice_test::FindSensrChannel ), |
|
80 |
ENTRY( "GetSensrData",Ctsensorservice_test::GetSensrData ), |
|
81 |
ENTRY( "GetProperty",Ctsensorservice_test::GetProperty ), |
|
82 |
ENTRY( "StopChannel",Ctsensorservice_test::StopChannel ), |
|
83 |
ENTRY( "IsChnlOpen",Ctsensorservice_test::IsChnlOpen ), |
|
84 |
||
85 |
}; |
|
86 |
||
87 |
const TInt count = sizeof( KFunctions ) / |
|
88 |
sizeof( TStifFunctionInfo ); |
|
89 |
||
90 |
return RunInternalL( KFunctions, count, aItem ); |
|
91 |
||
92 |
} |
|
93 |
||
94 |
// ----------------------------------------------------------------------------- |
|
95 |
// Ctsensorservice_test::ExampleL |
|
96 |
// Example test method function. |
|
97 |
// (other items were commented in a header). |
|
98 |
// ----------------------------------------------------------------------------- |
|
99 |
// |
|
100 |
||
101 |
TInt flagr = 0; |
|
102 |
RSensrvChannelConditionList iConditionList; |
|
103 |
||
104 |
TInt getchanneltype( TInt valu) |
|
105 |
{ |
|
106 |
TInt vret = 0; |
|
107 |
||
108 |
switch( valu ) |
|
109 |
{ |
|
110 |
case 1 : vret = TSearchCriterion( KSensrvChannelTypeIdUndefined ); |
|
111 |
break; |
|
112 |
||
113 |
case 2 : vret = TSearchCriterion( KSensrvChannelTypeIdAccelerometerXYZAxisData ); |
|
114 |
break; |
|
115 |
||
116 |
case 3 : vret = TSearchCriterion( KSensrvChannelTypeIdAccelerometerWakeupData ); |
|
117 |
break; |
|
118 |
||
119 |
case 4 : vret = TSearchCriterion( KSensrvChannelTypeIdAccelerometerDoubleTappingData ); |
|
120 |
break; |
|
121 |
||
122 |
case 5 : vret = TSearchCriterion( KSensrvChannelTypeIdOrientationData ); |
|
123 |
break; |
|
124 |
||
125 |
case 6 : vret = TSearchCriterion( KSensrvChannelTypeIdRotationData ); |
|
126 |
break; |
|
127 |
||
128 |
default : vret = valu ; |
|
129 |
} |
|
130 |
||
131 |
return vret; |
|
132 |
} |
|
133 |
||
134 |
// ----------------------------------------------------------------------------- |
|
135 |
// ----------------------------------------------------------------------------- |
|
136 |
||
137 |
TInt Ctsensorservice_test::FindSensrChannel( CStifItemParser& aItem ) |
|
138 |
{ |
|
139 |
||
140 |
// __UHEAP_MARK; |
|
141 |
||
142 |
RSensrvChannelInfoList channelInfoList, acceptedChannels; |
|
143 |
TInt i = 0,val = 0,x = 0,ch_val,svalue; |
|
144 |
TBool testFail( EFalse ); |
|
145 |
||
146 |
TInt errv = aItem.GetNextInt( svalue ); |
|
147 |
ch_val = getchanneltype( svalue ); |
|
148 |
||
149 |
CSensorService* sensrChannel = CSensorService::NewL(); |
|
150 |
TRAPD(error, sensrChannel->FindSensorChannelsL( ch_val ,channelInfoList)); |
|
151 |
||
152 |
TInt count = channelInfoList.Count(); |
|
153 |
iLog->Log(KLogChannelFound,svalue,count,error); |
|
154 |
||
155 |
TSensrvChannelInfo channelInfo; |
|
156 |
channelInfo.iChannelType = ch_val; |
|
157 |
||
158 |
for( i=0 ; i<count ; i++) |
|
159 |
{ |
|
160 |
TUint32 type = channelInfoList[i].iChannelType; |
|
161 |
TUint32 data_type = channelInfoList[i].iChannelDataTypeId; |
|
162 |
||
163 |
if( channelInfoList[i].IsMatch( channelInfo ) ) |
|
164 |
{ |
|
165 |
acceptedChannels.Append( channelInfoList[i] ); |
|
166 |
} |
|
167 |
} |
|
168 |
||
169 |
if( acceptedChannels.Count() == channelInfoList.Count() ) |
|
170 |
{ |
|
171 |
val = 1; |
|
172 |
} |
|
173 |
||
174 |
for( i = 0; i < channelInfoList.Count(); i++ ) |
|
175 |
{ |
|
176 |
TBool found( EFalse ); |
|
177 |
for( x = 0; x < acceptedChannels.Count(); x++ ) |
|
178 |
{ |
|
179 |
if( acceptedChannels[x].iChannelId == channelInfoList[i].iChannelId ) |
|
180 |
{ |
|
181 |
found = ETrue; |
|
182 |
break; |
|
183 |
} |
|
184 |
} |
|
185 |
||
186 |
if( !found ) |
|
187 |
{ |
|
188 |
testFail = ETrue; |
|
189 |
} |
|
190 |
} |
|
191 |
||
192 |
||
193 |
channelInfoList.Close(); |
|
194 |
acceptedChannels.Close(); |
|
195 |
delete sensrChannel; |
|
196 |
||
197 |
// __UHEAP_MARKEND; |
|
198 |
||
199 |
if((val == 1) && (!testFail)&&(error==0)) |
|
200 |
return KErrNone; |
|
201 |
else |
|
202 |
return KErrGeneral; |
|
203 |
||
204 |
} |
|
205 |
||
206 |
// ----------------------------------------------------------------------------- |
|
207 |
// ----------------------------------------------------------------------------- |
|
208 |
||
209 |
TInt Ctsensorservice_test::GetSensrData( CStifItemParser& aItem ) |
|
210 |
{ |
|
211 |
||
212 |
TInt val = 0, ch_val, svalue, listen_type ,find ,px ,py ,pz ,ori,err,errr; |
|
213 |
RSensrvChannelInfoList channelInfoList; |
|
214 |
TUint channelid = 0, di; |
|
215 |
CSnrDataCallBack* callbackobj = NULL; |
|
216 |
||
217 |
// __UHEAP_MARK; |
|
218 |
||
219 |
TInt errv = aItem.GetNextInt( svalue ); |
|
220 |
ch_val = getchanneltype( svalue ); |
|
221 |
||
222 |
CSensorService* sensrChannel = CSensorService::NewL(); |
|
223 |
TRAPD(error, sensrChannel->FindSensorChannelsL(ch_val,channelInfoList)); |
|
224 |
||
225 |
if( error != KErrNone ) |
|
226 |
{ |
|
227 |
return -1; |
|
228 |
} |
|
229 |
||
230 |
TInt count = channelInfoList.Count(); |
|
231 |
||
232 |
TInt errv1 = aItem.GetNextInt( val ); |
|
233 |
TInt errv2 = aItem.GetNextInt( listen_type ); |
|
234 |
||
235 |
TInt ret_code = 0; |
|
236 |
aItem.GetNextInt( ret_code ); |
|
237 |
||
238 |
if((val!=9)&&(count!=0)) |
|
239 |
{ |
|
240 |
channelid = channelInfoList[val].iChannelId; |
|
241 |
callbackobj = CSnrDataCallBack::NewL(sensrChannel,channelid); |
|
242 |
||
243 |
TRAPD(errorv, sensrChannel->GetDataNotificationL(channelInfoList[val],callbackobj)); |
|
244 |
if(errorv == 0) |
|
245 |
{ |
|
246 |
CActiveScheduler :: Start() ; |
|
247 |
} |
|
248 |
else |
|
249 |
{ |
|
250 |
return errorv; |
|
251 |
} |
|
252 |
} |
|
253 |
||
254 |
TInt errv3 = aItem.GetNextInt( find ); |
|
255 |
if(find == 1) |
|
256 |
{ |
|
257 |
TRAPD(error1, sensrChannel->FindSensorChannelsL(ch_val,channelInfoList)); |
|
258 |
TInt ct = channelInfoList.Count(); |
|
259 |
iLog->Log(KLogChannelFound,svalue,ct,error1); |
|
260 |
} |
|
261 |
||
262 |
if((svalue == 2) && (val!=9)) |
|
263 |
{ |
|
264 |
px = callbackobj->callback_x; |
|
265 |
py = callbackobj->callback_y; |
|
266 |
pz = callbackobj->callback_z; |
|
267 |
iLog->Log(KLogAccDataFound,svalue,px,py,pz); |
|
268 |
} |
|
269 |
||
270 |
if(svalue == 3) |
|
271 |
{ |
|
272 |
di = callbackobj->callback_wake; |
|
273 |
iLog->Log(KLogDataFound,svalue,di); |
|
274 |
} |
|
275 |
||
276 |
if(svalue == 4) |
|
277 |
{ |
|
278 |
di = callbackobj->callback_dir; |
|
279 |
iLog->Log(KLogDataFound,svalue,di); |
|
280 |
} |
|
281 |
||
282 |
if(svalue == 5) |
|
283 |
{ |
|
284 |
ori = callbackobj->callback_or; |
|
285 |
iLog->Log(KLogDataFound,svalue,ori); |
|
286 |
} |
|
287 |
||
288 |
if(svalue == 6) |
|
289 |
{ |
|
290 |
px = callbackobj->callback_rx; |
|
291 |
py = callbackobj->callback_ry; |
|
292 |
pz = callbackobj->callback_rz; |
|
293 |
iLog->Log(KLogAccDataFound,svalue,px,py,pz); |
|
294 |
} |
|
295 |
||
296 |
if((svalue == 9)||(count!=0)) |
|
297 |
{ |
|
298 |
if(svalue == 9) |
|
299 |
channelid = 99; |
|
300 |
||
301 |
if(val == 9) |
|
302 |
channelid = channelInfoList[0].iChannelId; |
|
303 |
||
304 |
if(listen_type != 3) |
|
305 |
{ |
|
306 |
TRAP(err ,sensrChannel->StopNotificationL(listen_type,channelid)); |
|
307 |
} |
|
308 |
else |
|
309 |
{ |
|
310 |
TRAP(errr ,sensrChannel->StopNotificationL(listen_type)); |
|
311 |
} |
|
312 |
||
313 |
if((svalue != 9) && (val != 9)) |
|
314 |
delete callbackobj; |
|
315 |
} |
|
316 |
||
317 |
channelInfoList.Close(); |
|
318 |
delete sensrChannel; |
|
319 |
||
320 |
// __UHEAP_MARKEND; |
|
321 |
||
322 |
if((err == ret_code) || (errr == ret_code)) |
|
323 |
return KErrNone; |
|
324 |
else |
|
325 |
return KErrGeneral; |
|
326 |
||
327 |
} |
|
328 |
||
329 |
// ----------------------------------------------------------------------------- |
|
330 |
// ----------------------------------------------------------------------------- |
|
331 |
||
332 |
TInt Ctsensorservice_test::GetProperty( CStifItemParser& aItem ) |
|
333 |
{ |
|
334 |
||
335 |
// __UHEAP_MARK; |
|
336 |
||
337 |
CSensorService* sensrChannel = CSensorService::NewL(); |
|
338 |
RSensrvChannelInfoList channelInfoList; |
|
339 |
RSensrvPropertyList propertyList; |
|
340 |
TSensrvProperty property; |
|
341 |
TInt svalue, ch_val, val, errn = KErrGeneral; |
|
342 |
TInt propertyID,index = 0 ; |
|
343 |
TBuf8<50> bpropValue; |
|
344 |
TSensrvProperty iPropDataRate,iPropMeasureRange,iPropSensorDescription,iPropChannelScale; |
|
345 |
TSensrvProperty iPropMisc; |
|
346 |
||
347 |
TInt errv = aItem.GetNextInt( svalue ); |
|
348 |
ch_val = getchanneltype( svalue ); |
|
349 |
||
350 |
sensrChannel->FindSensorChannelsL(ch_val,channelInfoList); |
|
351 |
||
352 |
TInt errv1 = aItem.GetNextInt( val ); |
|
353 |
||
354 |
aItem.GetNextInt( propertyID ); |
|
355 |
aItem.GetNextInt( index ); |
|
356 |
||
357 |
if( propertyID == KSensrvPropIdDataRate ) |
|
358 |
{ |
|
359 |
TInt value(0); |
|
360 |
aItem.GetNextInt( value ); |
|
361 |
iPropDataRate.SetValue( value ); |
|
362 |
iPropDataRate.SetItemIndex( index ); |
|
363 |
} |
|
364 |
else if( propertyID == KSensrvPropIdMeasureRange ) |
|
365 |
{ |
|
366 |
TInt intValue(0); |
|
367 |
aItem.GetNextInt( intValue ); |
|
368 |
TReal value( intValue ); |
|
369 |
iPropMeasureRange.SetValue( value ); |
|
370 |
iPropMeasureRange.SetItemIndex( index ); |
|
371 |
} |
|
372 |
else if( propertyID == KSensrvSensorDescription ) |
|
373 |
{ |
|
374 |
TBuf8<KSensrvPropertyTextBufferSize> value; |
|
375 |
TPtrC16 ptr; |
|
376 |
aItem.GetNextString( ptr ); |
|
377 |
value.Copy( ptr ); |
|
378 |
iPropSensorDescription.SetValue( value ); |
|
379 |
iPropSensorDescription.SetItemIndex( index ); |
|
380 |
} |
|
381 |
||
382 |
TRAPD( errno, sensrChannel->GetChannelPropertyL(channelInfoList[val], propertyList)); |
|
383 |
||
384 |
if( !errno ) |
|
385 |
{ |
|
386 |
if( propertyID == KSensrvPropIdDataRate ) |
|
387 |
{ |
|
388 |
TInt expectedValue; |
|
389 |
TInt value1; |
|
390 |
iPropDataRate.GetValue( expectedValue ); |
|
391 |
iLog->Log(KLogExpIntValue,expectedValue); |
|
392 |
for(TInt i = 0; i<propertyList.Count() ; i++ ) |
|
393 |
{ |
|
394 |
property = propertyList[i]; |
|
395 |
if( ESensrvIntProperty == property.PropertyType()) |
|
396 |
{ |
|
397 |
property.GetValue( value1 ); |
|
398 |
iLog->Log(KLogGotIntValue,value1); |
|
399 |
if( expectedValue != value1 || iPropDataRate.PropertyItemIndex() != property.PropertyItemIndex() ) |
|
400 |
{ |
|
401 |
errn = KErrGeneral; |
|
402 |
} |
|
403 |
else |
|
404 |
{ |
|
405 |
errn = 0; |
|
406 |
} |
|
407 |
} |
|
408 |
if(errn == 0) |
|
409 |
break; |
|
410 |
} |
|
411 |
} |
|
412 |
else if( propertyID == KSensrvPropIdMeasureRange ) |
|
413 |
{ |
|
414 |
TReal expectedValue; |
|
415 |
TReal value2; |
|
416 |
iPropMeasureRange.GetValue( expectedValue ); |
|
417 |
iLog->Log(KLogExpRealValue,expectedValue); |
|
418 |
for(TInt i = 0; i<propertyList.Count() ; i++ ) |
|
419 |
{ |
|
420 |
property = propertyList[i]; |
|
421 |
if( ESensrvRealProperty == property.PropertyType()) |
|
422 |
{ |
|
423 |
property.GetValue( value2 ); |
|
424 |
iLog->Log(KLogGotRealValue,value2); |
|
425 |
if( expectedValue != value2 || iPropMeasureRange.PropertyItemIndex() != property.PropertyItemIndex() ) |
|
426 |
{ |
|
427 |
errn = KErrGeneral; |
|
428 |
} |
|
429 |
else |
|
430 |
{ |
|
431 |
errn = 0; |
|
432 |
} |
|
433 |
} |
|
434 |
if(errn == 0) |
|
435 |
break; |
|
436 |
} |
|
437 |
} |
|
438 |
else if( propertyID == KSensrvSensorDescription ) |
|
439 |
{ |
|
440 |
TBuf8<KSensrvPropertyTextBufferSize> expectedValue; |
|
441 |
TBuf8<KSensrvPropertyTextBufferSize> value; |
|
442 |
iPropSensorDescription.GetValue( expectedValue ); |
|
443 |
iLog->Log(KLogExpStringValue,expectedValue.PtrZ()); |
|
444 |
for(TInt i = 0; i<propertyList.Count() ; i++ ) |
|
445 |
{ |
|
446 |
property = propertyList[i]; |
|
447 |
if( ESensrvBufferProperty == property.PropertyType()) |
|
448 |
{ |
|
449 |
property.GetValue( value ); |
|
450 |
iLog->Log(KLogGotStringValue,value.PtrZ()); |
|
451 |
if( expectedValue.Compare( value ) || iPropSensorDescription.PropertyItemIndex() != property.PropertyItemIndex() ) |
|
452 |
{ |
|
453 |
errn = KErrGeneral; |
|
454 |
} |
|
455 |
else |
|
456 |
{ |
|
457 |
errn = 0; |
|
458 |
} |
|
459 |
} |
|
460 |
if(errn == 0) |
|
461 |
break; |
|
462 |
} |
|
463 |
} |
|
464 |
} |
|
465 |
||
466 |
iLog->Log(KLogGetPropErr,svalue,propertyID,errno,errn); |
|
467 |
||
468 |
channelInfoList.Close(); |
|
469 |
delete sensrChannel; |
|
470 |
||
471 |
// __UHEAP_MARKEND; |
|
472 |
||
473 |
if((errn == 0) && (errno == 0)) |
|
474 |
return KErrNone; |
|
475 |
else |
|
476 |
return KErrGeneral; |
|
477 |
||
478 |
||
479 |
} |
|
480 |
||
481 |
||
482 |
TInt Ctsensorservice_test::StopChannel( CStifItemParser& aItem ) |
|
483 |
{ |
|
484 |
||
485 |
// __UHEAP_MARK; |
|
486 |
||
487 |
TUint channelid = 44 ; |
|
488 |
TInt err = KErrGeneral, errr = KErrGeneral, ret_code = 0; |
|
489 |
||
490 |
CSensorService* sensrChannel = CSensorService::NewL(); |
|
491 |
||
492 |
TInt listen_type = 0; |
|
493 |
aItem.GetNextInt( listen_type ); |
|
494 |
aItem.GetNextInt( ret_code ); |
|
495 |
||
496 |
if(listen_type != 3) |
|
497 |
{ |
|
498 |
TRAP(err ,sensrChannel->StopNotificationL(listen_type,channelid)); |
|
499 |
} |
|
500 |
else |
|
501 |
{ |
|
502 |
TRAP(errr ,sensrChannel->StopNotificationL(listen_type)); |
|
503 |
} |
|
504 |
||
505 |
delete sensrChannel; |
|
506 |
// __UHEAP_MARKEND; |
|
507 |
||
508 |
if(err == ret_code || errr == ret_code) |
|
509 |
return KErrNone; |
|
510 |
else |
|
511 |
return KErrGeneral; |
|
512 |
||
513 |
} |
|
514 |
||
515 |
||
516 |
// ----------------------------------------------------------------------------- |
|
517 |
// ----------------------------------------------------------------------------- |
|
518 |
||
519 |
TInt Ctsensorservice_test::IsChnlOpen( CStifItemParser& aItem ) |
|
520 |
{ |
|
521 |
||
522 |
// __UHEAP_MARK; |
|
523 |
||
524 |
TInt val = 0, ch_val, svalue, flag = 0; |
|
525 |
RSensrvChannelInfoList channelInfoList; |
|
526 |
TUint channelid; |
|
527 |
CSnrDataCallBack* callbackobj; |
|
528 |
TInt errorc1 = -2, errorc2 = -2, errorc3 = -2, errorc4 = -2; |
|
529 |
||
530 |
TInt errv = aItem.GetNextInt( svalue ); |
|
531 |
ch_val = getchanneltype( svalue ); |
|
532 |
||
533 |
CSensorService* sensrChannel = CSensorService::NewL(); |
|
534 |
TRAPD(error, sensrChannel->FindSensorChannelsL(ch_val,channelInfoList)); |
|
535 |
||
536 |
if( error != KErrNone ) |
|
537 |
{ |
|
538 |
return -1; |
|
539 |
} |
|
540 |
||
541 |
TInt count = channelInfoList.Count(); |
|
542 |
||
543 |
TInt errv1 = aItem.GetNextInt( val ); |
|
544 |
TInt errv2 = aItem.GetNextInt( flag ); |
|
545 |
||
546 |
channelid = channelInfoList[val].iChannelId; |
|
547 |
callbackobj = CSnrDataCallBack::NewL(sensrChannel,channelid); |
|
548 |
||
549 |
TRAPD(errorv, sensrChannel->GetDataNotificationL(channelInfoList[val],callbackobj)); |
|
550 |
||
551 |
if(errorv == 0) |
|
552 |
{ |
|
553 |
CActiveScheduler :: Start() ; |
|
554 |
} |
|
555 |
else |
|
556 |
{ |
|
557 |
return errorv; |
|
558 |
} |
|
559 |
||
560 |
if(flag == 2) |
|
561 |
{ |
|
562 |
RSensrvPropertyList propertyList; |
|
563 |
TRAP( errorc2, sensrChannel->GetChannelPropertyL(channelInfoList[val], propertyList)); |
|
564 |
} |
|
565 |
else if(flag == 4) |
|
566 |
{ |
|
567 |
TUint channelid1; |
|
568 |
CSnrDataCallBack* callbackobjct; |
|
569 |
channelid1 = channelInfoList[val].iChannelId; |
|
570 |
callbackobjct = CSnrDataCallBack::NewL(sensrChannel,channelid1); |
|
571 |
TRAP(errorc4, sensrChannel->GetDataNotificationL(channelInfoList[val],callbackobjct)); |
|
572 |
delete callbackobjct; |
|
573 |
} |
|
574 |
||
575 |
delete callbackobj; |
|
576 |
channelInfoList.Close(); |
|
577 |
delete sensrChannel; |
|
578 |
||
579 |
TInt ret_code = 0; |
|
580 |
aItem.GetNextInt( ret_code ); |
|
581 |
||
582 |
// __UHEAP_MARKEND; |
|
583 |
||
584 |
if(errorc1 == ret_code && flag == 1) |
|
585 |
return KErrNone; |
|
586 |
else if(errorc2 == ret_code && flag == 2) |
|
587 |
return KErrNone; |
|
588 |
else if(errorc3 == ret_code && flag == 3) |
|
589 |
return KErrNone; |
|
590 |
else if(errorc4 == ret_code && flag == 4) |
|
591 |
return KErrNone; |
|
592 |
else |
|
593 |
return KErrGeneral; |
|
594 |
||
595 |
} |
|
596 |
||
597 |
||
598 |
// End of File |