|
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 { |
|
57 GetLoctionCancel MyUpdates ; |
|
58 |
|
59 CActiveScheduler *Scheduler = CActiveScheduler :: Current() ; |
|
60 |
|
61 if(!Scheduler) |
|
62 { |
|
63 Scheduler = new CActiveScheduler ; |
|
64 } |
|
65 |
|
66 |
|
67 CActiveScheduler :: Install(Scheduler) ; |
|
68 |
|
69 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
70 |
|
71 // Input and output parameter list |
|
72 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
73 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); |
|
79 |
|
80 |
|
81 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
82 |
|
83 RCriteriaArray a; |
|
84 a.AppendL(crit); |
|
85 |
|
86 ServiceHandler->AttachL(a) ; |
|
87 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 TInt pos = 0; |
|
93 |
|
94 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
|
95 |
|
96 if(!errorprm) |
|
97 { |
|
98 return KErrGeneral ; |
|
99 } |
|
100 |
|
101 pos = 0 ; |
|
102 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); |
|
103 |
|
104 if(!genericparm) |
|
105 { |
|
106 |
|
107 return KErrGeneral ; |
|
108 } |
|
109 |
|
110 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; |
|
116 CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; |
|
117 TBuf8<20>CmdBuf(KGetLocation) ; |
|
118 |
|
119 |
|
120 locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList ,KLiwOptASyncronous , &MyUpdates); |
|
121 |
|
122 _LIT8(KCancell , "CancelNotification") ; |
|
123 _LIT8( KType ,"CancelRequestType") ; |
|
124 _LIT( KGetLocCancel ,"GetLocCancel") ; |
|
125 |
|
126 InputList->AppendL(TLiwGenericParam (KType , TLiwVariant (KGetLocCancel))) ; |
|
127 CmdBuf = KCancell ; |
|
128 locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList ,0 , &MyUpdates); |
|
129 |
|
130 pos = 0; |
|
131 |
|
132 const TLiwGenericParam *errprm = OutParmList->FindFirst(pos , KErrCode) ; |
|
133 |
|
134 TInt ret = (errprm->Value()).AsTInt32() ; |
|
135 |
|
136 delete Scheduler ; |
|
137 |
|
138 locinterface->Close(); |
|
139 delete InputList ; |
|
140 delete OutParmList ; |
|
141 |
|
142 return ret ; |
|
143 } |
|
144 |
|
145 |
|
146 |
|
147 |
|
148 TInt GetLocCancel(TAny * /*Arg*/) |
|
149 { |
|
150 // __UHEAP_MARK; |
|
151 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
152 TInt val ; |
|
153 TRAPD(err , (val = GetLocCancelL() ) ) ; |
|
154 delete cleanup ; |
|
155 // __UHEAP_MARKEND; |
|
156 |
|
157 return val ; |
|
158 |
|
159 } |