|
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 #include "tcomplugin.h" |
|
26 |
|
27 _LIT(LogFileName , "C:\\Notifications.txt") ; |
|
28 |
|
29 class WrongNotificationGetLoc : public MLiwNotifyCallback |
|
30 { |
|
31 |
|
32 public : |
|
33 TInt iRetStatus ; |
|
34 |
|
35 TInt HandleNotifyL( |
|
36 TInt aCmdId, |
|
37 TInt aEventId, |
|
38 CLiwGenericParamList& aEventParamList, |
|
39 const CLiwGenericParamList& aInParamList) |
|
40 { |
|
41 |
|
42 } |
|
43 |
|
44 WrongNotificationGetLoc() : iRetStatus(KErrGeneral) //Default constructor |
|
45 { |
|
46 ; |
|
47 } |
|
48 |
|
49 }; |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 TInt GetLocWrongCancelL() |
|
55 { |
|
56 WrongNotificationGetLoc MyUpdates ; |
|
57 |
|
58 CActiveScheduler *Scheduler = CActiveScheduler :: Current() ; |
|
59 |
|
60 if(!Scheduler) |
|
61 { |
|
62 Scheduler = new CActiveScheduler ; |
|
63 } |
|
64 |
|
65 |
|
66 CActiveScheduler :: Install(Scheduler) ; |
|
67 |
|
68 CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
69 |
|
70 // Input and output parameter list |
|
71 CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
72 CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); |
|
78 |
|
79 |
|
80 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
81 |
|
82 RCriteriaArray a; |
|
83 a.AppendL(crit); |
|
84 |
|
85 ServiceHandler->AttachL(a) ; |
|
86 ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 TInt pos = 0; |
|
92 |
|
93 const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; |
|
94 |
|
95 if(!errorprm) |
|
96 { |
|
97 return KErrGeneral ; |
|
98 } |
|
99 |
|
100 pos = 0 ; |
|
101 const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); |
|
102 |
|
103 if(!genericparm) |
|
104 { |
|
105 |
|
106 return KErrGeneral ; |
|
107 } |
|
108 |
|
109 MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); |
|
110 |
|
111 CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; |
|
112 CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; |
|
113 TBuf8<20>CmdBuf(KCmdGetLocation) ; |
|
114 |
|
115 |
|
116 locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList ,KLiwOptASyncronous , &MyUpdates); |
|
117 |
|
118 _LIT8(KCancell , "CancelNotification") ; |
|
119 _LIT8( KType ,"CancelRequestType") ; |
|
120 _LIT( KTraceCancel ,"TraceCancel") ; |
|
121 |
|
122 InputList->AppendL(TLiwGenericParam (KType , TLiwVariant (KTraceCancel))) ; |
|
123 CmdBuf = KCancell ; |
|
124 locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList ,0 , &MyUpdates); |
|
125 |
|
126 pos = 0; |
|
127 |
|
128 const TLiwGenericParam *errprm = OutParmList->FindFirst(pos , KErrCode) ; |
|
129 |
|
130 TInt ret = (errprm->Value()).AsTInt32() ; |
|
131 |
|
132 delete Scheduler ; |
|
133 |
|
134 locinterface->Close(); |
|
135 delete InputList ; |
|
136 delete OutParmList ; |
|
137 |
|
138 if ( SErrNotFound == ret ) |
|
139 { |
|
140 return KErrNone; |
|
141 } |
|
142 else |
|
143 |
|
144 return ret ; |
|
145 } |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 TInt GetLocWrongCancel(TAny * /*Arg*/) |
|
151 { |
|
152 // __UHEAP_MARK; |
|
153 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
154 TInt val ; |
|
155 TRAPD(err , (val = GetLocWrongCancelL() ) ) ; |
|
156 delete cleanup ; |
|
157 // __UHEAP_MARKEND; |
|
158 |
|
159 return val ; |
|
160 |
|
161 } |