author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 11 May 2010 17:01:36 +0300 | |
branch | RCL_3 |
changeset 58 | ea43c23d28d2 |
parent 19 | 989d2f495d90 |
child 65 | 0b68a1b0c15e |
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: tsysinfocellidasync |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
#include "tsysinfonetworktests.h" |
|
21 |
#include "sysinfoservice.h" |
|
22 |
#include "entitykeys.h" |
|
23 |
#include "tsysinfocellidasync.h" |
|
24 |
||
25 |
using namespace SysInfo; |
|
26 |
||
27 |
CCellidAsync* CCellidAsync::NewL(CStifLogger* aLog) |
|
28 |
{ |
|
29 |
CCellidAsync* self = new(ELeave) CCellidAsync(aLog); |
|
30 |
self->ConstructL(); |
|
31 |
return self; |
|
32 |
} |
|
33 |
||
34 |
CCellidAsync::~CCellidAsync() |
|
35 |
{ |
|
36 |
Cancel(); |
|
37 |
||
38 |
if(iWaitSchedular->IsStarted()) |
|
39 |
iWaitSchedular->AsyncStop(); |
|
40 |
||
41 |
delete iSysInfoService; |
|
42 |
delete iWaitSchedular; |
|
43 |
delete iTimer; |
|
44 |
} |
|
45 |
||
46 |
void CCellidAsync::ConstructL() |
|
47 |
{ |
|
48 |
iSysInfoService = CSysInfoService::NewL(); |
|
49 |
iWaitSchedular = new(ELeave) CActiveSchedulerWait(); |
|
50 |
iTimer = CWatchTimer::NewL(EPriorityNormal,this); |
|
51 |
CActiveScheduler::Add(this); |
|
52 |
} |
|
53 |
||
54 |
CCellidAsync::CCellidAsync(CStifLogger* aLog) |
|
55 |
:CActive(EPriorityStandard), |
|
56 |
iLog(aLog) |
|
57 |
{ |
|
58 |
} |
|
59 |
||
60 |
void CCellidAsync::DoCancel() |
|
61 |
{ |
|
62 |
} |
|
63 |
||
64 |
void CCellidAsync::RunL() |
|
65 |
{ |
|
66 |
TestFuncL(); |
|
67 |
} |
|
68 |
||
69 |
void CCellidAsync::Start() |
|
70 |
{ |
|
71 |
SetActive(); |
|
72 |
TRequestStatus* temp = &iStatus; |
|
73 |
User::RequestComplete(temp, KErrNone); |
|
74 |
iWaitSchedular->Start(); |
|
75 |
} |
|
76 |
||
77 |
TInt CCellidAsync::Result() |
|
78 |
{ |
|
79 |
return iResult; |
|
80 |
} |
|
81 |
||
82 |
void CCellidAsync::TestFuncL() |
|
83 |
{ |
|
58
ea43c23d28d2
Revision: 201016
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
84 |
TInt64 x = 6000000000; |
ea43c23d28d2
Revision: 201016
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
85 |
const TTimeIntervalMicroSeconds32 OneMinute = TTimeIntervalMicroSeconds32(x); |
19 | 86 |
iTransId = 333; |
87 |
TRAPD(err ,iSysInfoService->GetInfoL(KNetwork,KCellID,iTransId,this)); |
|
88 |
iResult = err; |
|
89 |
iTimer->After(OneMinute); |
|
90 |
||
91 |
if(iResult == KErrNotFound) |
|
92 |
{ |
|
93 |
iLog->Log(_L("KErrNotFound:")); |
|
94 |
iResult = 0; |
|
95 |
iWaitSchedular->AsyncStop(); |
|
96 |
} |
|
97 |
else |
|
98 |
{ |
|
99 |
iResult = -1; |
|
100 |
} |
|
101 |
||
102 |
||
103 |
} |
|
104 |
||
105 |
void CCellidAsync::HandleResponseL(const TDesC& /*aEntity*/,const TDesC& /*aKey*/, |
|
106 |
CSysData* aOutput, TInt32 aTransID, TSysRequest::TRequestType /*aType*/,TInt aError) |
|
107 |
{ |
|
108 |
iResult =KErrGeneral; |
|
109 |
||
110 |
iWaitSchedular->AsyncStop(); |
|
111 |
} |
|
112 |
||
113 |
void CCellidAsync::HandleTimeOut() |
|
114 |
{ |
|
115 |
iLog->Log(_L("TimeOut reached...")); |
|
116 |
iSysInfoService->Cancel(1); |
|
117 |
iResult = FAIL; |
|
118 |
iWaitSchedular->AsyncStop(); |
|
119 |
} |
|
120 |
||
121 |
||
122 |