author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 31 Aug 2010 16:06:03 +0300 | |
branch | RCL_3 |
changeset 44 | 0b68a1b0c15e |
parent 38 | ea43c23d28d2 |
child 45 | a9c0808a1095 |
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 |
/* |
|
19 |
* Stray signal test function |
|
20 |
*/ |
|
21 |
||
22 |
#include <e32svr.h> |
|
23 |
#include <StifParser.h> |
|
23
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
24 |
#include <StifTestInterface.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
25 |
#include <lbsrequestor.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
26 |
#include <liwservicehandler.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
27 |
#include <liwcommon.h> |
5 | 28 |
|
29 |
||
30 |
#include "tcomplugin.h" |
|
31 |
||
32 |
#define TRACE 0 |
|
33 |
#define GETLOCATION 1 |
|
34 |
||
35 |
class ConcurrentGetLoc : public MLiwNotifyCallback |
|
36 |
{ |
|
37 |
||
38 |
MLiwInterface *iLocationInterface ; |
|
39 |
CLiwGenericParamList *iInputList ; |
|
40 |
||
41 |
public : |
|
42 |
TInt iRetStatus ; |
|
43 |
||
44 |
TInt HandleNotifyL( |
|
45 |
TInt aCmdId, |
|
46 |
TInt aEventId, |
|
47 |
CLiwGenericParamList& aEventParamList, |
|
48 |
const CLiwGenericParamList& aInParamList) ; |
|
49 |
||
50 |
ConcurrentGetLoc() : iRetStatus(KErrGeneral) //Default constructor |
|
51 |
{ |
|
52 |
; |
|
53 |
} |
|
54 |
ConcurrentGetLoc(TInt aCmd , MLiwInterface *aInterface , CLiwGenericParamList *aInputList) ; |
|
55 |
}; |
|
56 |
||
57 |
||
58 |
ConcurrentGetLoc :: ConcurrentGetLoc(TInt aCmd ,MLiwInterface *aInterface , CLiwGenericParamList *aInputList) |
|
59 |
{ |
|
60 |
||
61 |
iLocationInterface = aInterface ; |
|
62 |
iInputList = aInputList ; |
|
63 |
||
64 |
} |
|
65 |
||
66 |
TInt ConcurrentGetLoc :: HandleNotifyL( |
|
67 |
TInt aCmdId, |
|
68 |
TInt aEventId, |
|
69 |
CLiwGenericParamList& aEventParamList, |
|
70 |
const CLiwGenericParamList& aInParamList) |
|
71 |
{ |
|
72 |
||
73 |
//DeRefrence Allocated Map first |
|
74 |
return 0 ; |
|
75 |
} |
|
76 |
||
77 |
||
78 |
TInt ConcurrentGetLocCallsL() |
|
79 |
{ |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
80 |
__UHEAP_MARK ; |
5 | 81 |
|
82 |
CActiveScheduler *Scheduler = new CActiveScheduler ; |
|
83 |
||
84 |
CActiveScheduler :: Install(Scheduler) ; |
|
85 |
||
86 |
||
87 |
||
88 |
||
89 |
CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
90 |
||
91 |
// Input and output parameter list |
|
92 |
CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
93 |
CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
94 |
||
95 |
||
96 |
||
97 |
||
98 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); |
|
99 |
||
100 |
||
101 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
102 |
||
103 |
RCriteriaArray a; |
|
104 |
a.AppendL(crit); |
|
105 |
||
106 |
ServiceHandler->AttachL(a) ; |
|
107 |
ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
108 |
||
109 |
||
110 |
||
111 |
||
112 |
TInt pos = 0; |
|
113 |
||
114 |
const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
|
115 |
||
116 |
if(!errorprm) |
|
117 |
{ |
|
118 |
return KErrGeneral ; |
|
119 |
} |
|
120 |
||
121 |
pos = 0 ; |
|
122 |
const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); |
|
123 |
||
124 |
if(!genericparm) |
|
125 |
{ |
|
126 |
||
127 |
return KErrGeneral ; |
|
128 |
} |
|
129 |
||
130 |
MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
|
131 |
||
132 |
||
133 |
||
134 |
TBuf8<20>CmdBuf(KGetLocation) ; |
|
135 |
||
136 |
CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; |
|
137 |
CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; |
|
138 |
||
139 |
||
140 |
ConcurrentGetLoc Updates(GETLOCATION , locinterface , InputList) ; |
|
141 |
ConcurrentGetLoc GetLoc(GETLOCATION , locinterface , InputList) ; |
|
142 |
||
143 |
locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList ,KLiwOptASyncronous , &Updates); |
|
144 |
pos = 0 ; |
|
145 |
||
146 |
const TLiwGenericParam *errparam1 = OutParmList->FindFirst(pos , KErrorCode) ; |
|
147 |
||
148 |
||
149 |
locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList ,KLiwOptASyncronous , &GetLoc); |
|
150 |
pos = 0 ; |
|
151 |
||
152 |
const TLiwGenericParam *errparam = OutParmList->FindFirst(pos , KErrorCode) ; |
|
153 |
||
154 |
if(!errparam) |
|
155 |
{ |
|
156 |
return KErrNotFound ; |
|
157 |
} |
|
158 |
||
159 |
TLiwVariant ErrVariant = errparam->Value() ; |
|
160 |
TInt ret = ErrVariant.AsTInt32() ; |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
161 |
a.ResetAndDestroy() ; |
5 | 162 |
locinterface->Close() ; |
163 |
delete ServiceHandler ; |
|
164 |
delete InputList ; |
|
165 |
delete OutParmList ; |
|
166 |
delete Scheduler ; |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
167 |
__UHEAP_MARKEND ; |
5 | 168 |
return ret ; // Controll never reaches here |
169 |
} |
|
170 |
||
171 |
||
172 |
TInt ConcurrentGetLocationCalls(TAny */*Arg*/) |
|
173 |
{ |
|
174 |
||
175 |
CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
44
0b68a1b0c15e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
38
diff
changeset
|
176 |
TInt Val ; |
5 | 177 |
//Install a new active scheduler to this thread |
178 |
TRAPD(err ,( Val = ConcurrentGetLocCallsL()) ); |
|
179 |
delete cleanup ; |
|
180 |
||
181 |
if(err) |
|
182 |
{ |
|
183 |
return err ; |
|
184 |
} |
|
185 |
return Val ; |
|
186 |
} |
|
187 |
||
188 |