author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Thu, 27 Aug 2009 07:43:07 +0300 | |
changeset 10 | fc9cf246af83 |
parent 5 | 989d2f495d90 |
child 23 | 50974a8b132e |
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> |
|
20 |
#include <Stiftestinterface.h> |
|
21 |
#include <LbsRequestor.h> |
|
22 |
#include <LiwServiceHandler.h> |
|
23 |
#include <LiwCommon.h> |
|
24 |
||
25 |
||
26 |
#include "tcomplugin.h" |
|
27 |
||
28 |
_LIT(LogFileName , "C:\\Notifications.txt") ; |
|
29 |
||
30 |
class GetLoctionCancel : 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 |
||
43 |
} |
|
44 |
||
45 |
GetLoctionCancel() : iRetStatus(KErrGeneral) //Default constructor |
|
46 |
{ |
|
47 |
; |
|
48 |
} |
|
49 |
||
50 |
}; |
|
51 |
||
52 |
||
53 |
||
54 |
||
55 |
TInt GetLocCancelL() |
|
56 |
{ |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
57 |
__UHEAP_MARK ; |
5 | 58 |
GetLoctionCancel MyUpdates ; |
59 |
||
60 |
CActiveScheduler *Scheduler = CActiveScheduler :: Current() ; |
|
61 |
||
62 |
if(!Scheduler) |
|
63 |
{ |
|
64 |
Scheduler = new CActiveScheduler ; |
|
65 |
} |
|
66 |
||
67 |
||
68 |
CActiveScheduler :: Install(Scheduler) ; |
|
69 |
||
70 |
CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
71 |
||
72 |
// Input and output parameter list |
|
73 |
CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
74 |
CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
75 |
||
76 |
||
77 |
||
78 |
||
79 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); |
|
80 |
||
81 |
||
82 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
83 |
||
84 |
RCriteriaArray a; |
|
85 |
a.AppendL(crit); |
|
86 |
||
87 |
ServiceHandler->AttachL(a) ; |
|
88 |
ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
89 |
||
90 |
||
91 |
||
92 |
||
93 |
TInt pos = 0; |
|
94 |
||
95 |
const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
|
96 |
||
97 |
if(!errorprm) |
|
98 |
{ |
|
99 |
return KErrGeneral ; |
|
100 |
} |
|
101 |
||
102 |
pos = 0 ; |
|
103 |
const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); |
|
104 |
||
105 |
if(!genericparm) |
|
106 |
{ |
|
107 |
||
108 |
return KErrGeneral ; |
|
109 |
} |
|
110 |
||
111 |
MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
|
112 |
||
113 |
||
114 |
||
115 |
||
116 |
CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; |
|
117 |
CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; |
|
118 |
TBuf8<20>CmdBuf(KGetLocation) ; |
|
119 |
||
120 |
||
121 |
locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList ,KLiwOptASyncronous , &MyUpdates); |
|
122 |
||
123 |
_LIT8(KCancell , "CancelNotification") ; |
|
124 |
_LIT8( KType ,"CancelRequestType") ; |
|
125 |
_LIT( KGetLocCancel ,"GetLocCancel") ; |
|
126 |
||
127 |
InputList->AppendL(TLiwGenericParam (KType , TLiwVariant (KGetLocCancel))) ; |
|
128 |
CmdBuf = KCancell ; |
|
129 |
locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList ,0 , &MyUpdates); |
|
130 |
||
131 |
pos = 0; |
|
132 |
||
133 |
const TLiwGenericParam *errprm = OutParmList->FindFirst(pos , KErrCode) ; |
|
134 |
||
135 |
TInt ret = (errprm->Value()).AsTInt32() ; |
|
136 |
||
137 |
delete Scheduler ; |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
138 |
a.ResetAndDestroy(); |
5 | 139 |
locinterface->Close(); |
140 |
delete InputList ; |
|
141 |
delete OutParmList ; |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
142 |
delete ServiceHandler; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
143 |
__UHEAP_MARKEND ; |
5 | 144 |
return ret ; |
145 |
} |
|
146 |
||
147 |
||
148 |
||
149 |
||
150 |
TInt GetLocCancel(TAny * /*Arg*/) |
|
151 |
{ |
|
152 |
// __UHEAP_MARK; |
|
153 |
CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
154 |
TInt val ; |
|
155 |
TRAPD(err , (val = GetLocCancelL() ) ) ; |
|
156 |
delete cleanup ; |
|
157 |
// __UHEAP_MARKEND; |
|
158 |
||
159 |
return val ; |
|
160 |
||
161 |
} |