author | Pat Downey <patd@symbian.org> |
Wed, 01 Sep 2010 12:28:47 +0100 | |
branch | RCL_3 |
changeset 66 | a9c0808a1095 |
parent 65 | 0b68a1b0c15e |
permissions | -rw-r--r-- |
19 | 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> |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
20 |
#include <StifTestInterface.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
21 |
#include <lbsrequestor.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
22 |
#include <liwservicehandler.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
23 |
#include <liwcommon.h> |
19 | 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 |
{ |
|
66 | 41 |
return 0; |
19 | 42 |
} |
43 |
||
44 |
WrongNotificationGetLoc() : iRetStatus(KErrGeneral) //Default constructor |
|
45 |
{ |
|
46 |
; |
|
47 |
} |
|
48 |
||
49 |
}; |
|
50 |
||
51 |
||
52 |
||
53 |
||
54 |
TInt GetLocWrongCancelL() |
|
55 |
{ |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
56 |
__UHEAP_MARK ; |
19 | 57 |
WrongNotificationGetLoc 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 |
CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; |
|
113 |
CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; |
|
114 |
TBuf8<20>CmdBuf(KCmdGetLocation) ; |
|
115 |
||
116 |
||
117 |
locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList ,KLiwOptASyncronous , &MyUpdates); |
|
118 |
||
119 |
_LIT8(KCancell , "CancelNotification") ; |
|
120 |
_LIT8( KType ,"CancelRequestType") ; |
|
121 |
_LIT( KTraceCancel ,"TraceCancel") ; |
|
122 |
||
123 |
InputList->AppendL(TLiwGenericParam (KType , TLiwVariant (KTraceCancel))) ; |
|
124 |
CmdBuf = KCancell ; |
|
125 |
locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList ,0 , &MyUpdates); |
|
126 |
||
127 |
pos = 0; |
|
128 |
||
129 |
const TLiwGenericParam *errprm = OutParmList->FindFirst(pos , KErrCode) ; |
|
130 |
||
131 |
TInt ret = (errprm->Value()).AsTInt32() ; |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
132 |
a.ResetAndDestroy() ; |
19 | 133 |
delete Scheduler ; |
134 |
||
135 |
locinterface->Close(); |
|
136 |
delete InputList ; |
|
137 |
delete OutParmList ; |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
138 |
delete ServiceHandler; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
139 |
__UHEAP_MARKEND ; |
19 | 140 |
if ( SErrNotFound == ret ) |
141 |
{ |
|
142 |
return KErrNone; |
|
143 |
} |
|
144 |
else |
|
145 |
||
146 |
return ret ; |
|
147 |
} |
|
148 |
||
149 |
||
150 |
||
151 |
||
152 |
TInt GetLocWrongCancel(TAny * /*Arg*/) |
|
153 |
{ |
|
154 |
// __UHEAP_MARK; |
|
155 |
CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
66 | 156 |
TInt val = 0; |
19 | 157 |
TRAPD(err , (val = GetLocWrongCancelL() ) ) ; |
158 |
delete cleanup ; |
|
159 |
// __UHEAP_MARKEND; |
|
160 |
||
161 |
return val ; |
|
162 |
||
163 |
} |