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 |
#include "tcomplugin.h" |
|
26 |
||
27 |
_LIT(LogFileName , "C:\\Notifications.txt") ; |
|
28 |
||
29 |
class WrongNotificationTraceLoc : 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 |
WrongNotificationTraceLoc() : iRetStatus(KErrGeneral) //Default constructor |
|
45 |
{ |
|
46 |
; |
|
47 |
} |
|
48 |
||
49 |
}; |
|
50 |
||
51 |
||
52 |
||
53 |
||
54 |
TInt TraceLocWrongCancelL() |
|
55 |
{ |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
56 |
__UHEAP_MARK ; |
5 | 57 |
WrongNotificationTraceLoc MyUpdates ; |
58 |
||
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 |
||
117 |
CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; |
|
118 |
CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; |
|
119 |
TBuf8<20>CmdBuf(KTraceLocation) ; |
|
120 |
||
121 |
||
122 |
locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList ,KLiwOptASyncronous , &MyUpdates); |
|
123 |
||
124 |
_LIT8(KCancell , "CancelNotification") ; |
|
125 |
_LIT8( KType ,"CancelRequestType") ; |
|
126 |
_LIT( KGetLocCancel ,"GetLocCancel") ; |
|
127 |
||
128 |
InputList->AppendL(TLiwGenericParam (KType , TLiwVariant (KGetLocCancel))) ; |
|
129 |
CmdBuf = KCancell ; |
|
130 |
locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList ,0 , &MyUpdates); |
|
131 |
||
132 |
pos = 0; |
|
133 |
||
134 |
const TLiwGenericParam *errprm = OutParmList->FindFirst(pos , KErrCode) ; |
|
135 |
||
136 |
TInt ret = (errprm->Value()).AsTInt32() ; |
|
137 |
||
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
138 |
locinterface->Close(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
139 |
delete Scheduler ; |
5 | 140 |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
141 |
a.ResetAndDestroy(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
142 |
|
5 | 143 |
delete InputList ; |
144 |
delete OutParmList ; |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
145 |
delete ServiceHandler; |
5 | 146 |
if ( SErrNotFound == ret ) |
147 |
{ |
|
148 |
return KErrNone; |
|
149 |
} |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
150 |
__UHEAP_MARKEND ; |
5 | 151 |
return ret ; |
152 |
} |
|
153 |
||
154 |
||
155 |
||
156 |
||
157 |
TInt TraceLocWrongCancel(TAny * /*Arg*/) |
|
158 |
{ |
|
159 |
// __UHEAP_MARK; |
|
160 |
CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
161 |
TInt val ; |
|
162 |
TRAPD(err , (val = TraceLocWrongCancelL() ) ) ; |
|
163 |
delete cleanup ; |
|
164 |
// __UHEAP_MARKEND; |
|
165 |
||
166 |
return val ; |
|
167 |
||
168 |
} |