author | Pat Downey <patd@symbian.org> |
Wed, 01 Sep 2010 12:28:47 +0100 | |
branch | RCL_3 |
changeset 45 | a9c0808a1095 |
parent 44 | 0b68a1b0c15e |
permissions | -rw-r--r-- |
5 | 1 |
/* |
2 |
* Copyright (c) 2009 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: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include <e32svr.h> |
|
19 |
#include <StifParser.h> |
|
23
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
20 |
#include <StifTestInterface.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
21 |
#include <lbsrequestor.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
22 |
#include <liwservicehandler.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
23 |
#include <liwcommon.h> |
5 | 24 |
#include <lbs.h> |
25 |
||
26 |
#include "tcomplugin.h" |
|
27 |
||
28 |
_LIT(LogFileName , "C:\\Notifications.txt") ; |
|
29 |
||
30 |
class CallBack : public MLiwNotifyCallback |
|
31 |
{ |
|
32 |
||
33 |
public : |
|
34 |
TInt iRetStatus ; |
|
35 |
||
36 |
TInt HandleNotifyL( |
|
37 |
TInt aCmdId, |
|
38 |
TInt aEventId, |
|
39 |
CLiwGenericParamList& aEventParamList, |
|
40 |
const CLiwGenericParamList& aInParamList) ; |
|
41 |
||
42 |
CallBack() : iRetStatus(KErrGeneral) //Default constructor |
|
43 |
{ |
|
44 |
; |
|
45 |
} |
|
46 |
||
47 |
}; |
|
48 |
||
49 |
TInt CallBack :: HandleNotifyL( |
|
50 |
TInt /*aCmdId*/, |
|
51 |
TInt aEventId, |
|
52 |
CLiwGenericParamList& aEventParamList, |
|
53 |
const CLiwGenericParamList& aInParamList) |
|
54 |
{ |
|
55 |
||
56 |
TInt Index = 0 ; |
|
57 |
const TLiwGenericParam *GenericParam = aEventParamList.FindFirst(Index , KErrorCode ); |
|
58 |
||
45 | 59 |
TInt error = 0; |
5 | 60 |
|
61 |
if(GenericParam) |
|
62 |
{ |
|
63 |
TLiwVariant Variant ; |
|
64 |
||
65 |
Variant = GenericParam->Value() ; |
|
66 |
error = Variant.AsTInt32() ; |
|
67 |
iRetStatus = error ; |
|
68 |
CActiveScheduler *Current = CActiveScheduler :: Current() ; |
|
69 |
Current->Stop() ; |
|
70 |
||
71 |
} |
|
72 |
return error ; |
|
73 |
} |
|
74 |
||
75 |
||
76 |
/** |
|
77 |
*@ This call back interface is for testing Service Not available |
|
78 |
*/ |
|
79 |
//--------------------------------------------------------------------------------------------------------- |
|
80 |
||
81 |
||
82 |
TInt ServiceFailedFunctionL() |
|
83 |
{ |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
84 |
__UHEAP_MARK ; |
5 | 85 |
CallBack MyUpdates ; |
86 |
||
87 |
_LIT8(KService, "Service.Location"); |
|
88 |
_LIT8(KIDataSource,"ILocation"); |
|
89 |
||
90 |
||
91 |
||
92 |
CActiveScheduler *Scheduler = CActiveScheduler :: Current() ; |
|
93 |
||
94 |
if(!Scheduler) |
|
95 |
{ |
|
96 |
Scheduler = new CActiveScheduler ; |
|
97 |
} |
|
98 |
||
99 |
||
100 |
CActiveScheduler :: Install(Scheduler) ; |
|
101 |
||
102 |
||
103 |
||
104 |
CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
105 |
||
106 |
// Input and output parameter list |
|
107 |
CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
108 |
CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
109 |
||
110 |
||
111 |
||
112 |
||
113 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KService, KIDataSource); |
|
114 |
||
115 |
||
116 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
117 |
||
118 |
RCriteriaArray a; |
|
119 |
a.AppendL(crit); |
|
120 |
||
121 |
ServiceHandler->AttachL(a) ; |
|
122 |
||
123 |
||
124 |
||
125 |
||
126 |
||
127 |
TInt pos = 0; |
|
128 |
||
129 |
const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
|
130 |
||
131 |
if(!errorprm) |
|
132 |
{ |
|
133 |
return KErrGeneral ; |
|
134 |
} |
|
135 |
||
136 |
||
137 |
_LIT8(KDataSource, "ILocation"); |
|
138 |
||
139 |
const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); |
|
140 |
||
141 |
if(!genericparm) |
|
142 |
{ |
|
143 |
||
144 |
return KErrGeneral ; |
|
145 |
} |
|
146 |
||
147 |
MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
|
148 |
// CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; |
|
149 |
||
150 |
||
151 |
||
152 |
CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; |
|
153 |
CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; |
|
154 |
TBuf8<20>CmdBuf(KCmdTraceLocation) ; |
|
155 |
||
156 |
||
157 |
locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList ,0 , &MyUpdates); |
|
158 |
const TInt KSecond = 1000000; |
|
159 |
const TInt KUpdateTimeOut = 15*KSecond ; // Default timeout value for synchrnous call waits.. |
|
160 |
||
161 |
User :: After((TTimeIntervalMicroSeconds32 )KUpdateTimeOut) ; |
|
162 |
||
163 |
||
164 |
CActiveScheduler :: Start() ; |
|
165 |
delete Scheduler ; |
|
166 |
||
167 |
locinterface->Close(); |
|
168 |
delete InputList ; |
|
169 |
delete OutParmList ; |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
170 |
__UHEAP_MARKEND ; |
5 | 171 |
return MyUpdates.iRetStatus ; |
172 |
||
173 |
||
174 |
||
175 |
} |
|
176 |
||
177 |
TInt ServiceFailedTest(TAny */*Arg*/) |
|
178 |
{ |
|
179 |
CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
180 |
TRAPD(err , ServiceFailedFunctionL()) ; |
|
181 |
delete cleanup ; |
|
182 |
return err ; |
|
183 |
||
184 |
} |