equal
deleted
inserted
replaced
26 |
26 |
27 /** |
27 /** |
28 * Default constructor |
28 * Default constructor |
29 */ |
29 */ |
30 |
30 |
31 LocationInterfaceCB ::LocationInterfaceCB() |
31 LocationInterfaceCB ::LocationInterfaceCB():iCallBack(NULL), |
32 { |
32 iOutParmList(NULL), |
33 iCallBack = NULL ; |
33 iInParmList(NULL), |
34 iOutParmList = NULL ; |
34 iTransactionId(0) |
35 iInParmList = NULL ; |
35 { |
36 iTransactionId = 0 ; |
36 |
37 } |
37 } |
38 |
38 |
39 /** |
39 /** |
40 * OverLoaded constructor which accepts the callback adderss |
40 * OverLoaded constructor which accepts the callback adderss |
41 * and registers it |
41 * and registers it |
42 */ |
42 */ |
47 TInt32 aTransactionId ) : iCallBack(aCallBack), |
47 TInt32 aTransactionId ) : iCallBack(aCallBack), |
48 iTransactionId(aTransactionId) |
48 iTransactionId(aTransactionId) |
49 { |
49 { |
50 iModuleInfo = aPositionModuleInfo ; |
50 iModuleInfo = aPositionModuleInfo ; |
51 |
51 |
52 //Store the outparam and in param list |
|
53 |
|
54 iOutParmList = CLiwGenericParamList :: NewL(); //(*aOutParmList) ; |
|
55 |
|
56 |
|
57 //Currently we dont use inputparam list, but when need it has to be |
|
58 //initalised as done above for iOutParamList |
|
59 iInParmList = iOutParmList ; |
|
60 //Extract the location info category from inputparamlist |
52 //Extract the location info category from inputparamlist |
61 TInt index = 0; |
53 TInt index = 0; |
62 const TLiwGenericParam *smapparam = aInParmList->FindFirst(index , KLocationInfoCategory) ; |
54 const TLiwGenericParam *smapparam = aInParmList->FindFirst(index , KLocationInfoCategory) ; |
63 TPtrC argposInfoCategory(KLocationBasicinfo) ; |
55 TPtrC argposInfoCategory(KLocationBasicinfo) ; |
64 |
56 |
75 { |
67 { |
76 iLocinfoCategory = EGenericInfo; |
68 iLocinfoCategory = EGenericInfo; |
77 } |
69 } |
78 } |
70 } |
79 |
71 |
|
72 /** |
|
73 * Default destructor |
|
74 */ |
|
75 LocationInterfaceCB :: ~LocationInterfaceCB() |
|
76 { |
|
77 |
|
78 delete iOutParmList; |
|
79 |
|
80 } |
80 /** |
81 /** |
81 * overloaded NewL function for creating local call back objects |
82 * overloaded NewL function for creating local call back objects |
82 * as required by locationinterface.cpp |
83 * as required by locationinterface.cpp |
83 */ |
84 */ |
84 |
85 |
87 TPositionModuleInfo* aPositionModuleInfo, |
88 TPositionModuleInfo* aPositionModuleInfo, |
88 TInt32 aTransactionid ) |
89 TInt32 aTransactionid ) |
89 { |
90 { |
90 LocationInterfaceCB *self = new(ELeave) LocationInterfaceCB(aCallBack , aInParmList , |
91 LocationInterfaceCB *self = new(ELeave) LocationInterfaceCB(aCallBack , aInParmList , |
91 aPositionModuleInfo, aTransactionid) ; |
92 aPositionModuleInfo, aTransactionid) ; |
92 |
93 CleanupStack::PushL(self); |
|
94 |
|
95 //Store the outparam and in param list |
|
96 |
|
97 self->iOutParmList = CLiwGenericParamList::NewL(); |
|
98 |
|
99 //Currently we dont use inputparam list, but when need it has to be |
|
100 //initalised as done above for iOutParamList |
|
101 self->iInParmList = self->iOutParmList; |
|
102 |
|
103 CleanupStack::Pop(self); |
93 return self ; |
104 return self ; |
94 } |
105 } |
95 |
106 |
96 /** |
107 /** |
97 * implementation of HandleNotifyL function derived from LocationInterfaceCB |
108 * implementation of HandleNotifyL function derived from LocationInterfaceCB |
108 |
119 |
109 if(aError) //if Error then return the error code to user |
120 if(aError) //if Error then return the error code to user |
110 { |
121 { |
111 |
122 |
112 iCallBack->HandleNotifyL(iTransactionId , KLiwEventError , *iOutParmList , *iInParmList) ; |
123 iCallBack->HandleNotifyL(iTransactionId , KLiwEventError , *iOutParmList , *iInParmList) ; |
113 iOutParmList = NULL ; |
|
114 //delete this ; |
124 //delete this ; |
115 return KErrGeneral ; |
125 return KErrGeneral ; |
116 } |
126 } |
117 |
127 |
118 |
128 |
119 TRAPD(error , HandleL(aGenericInfo , aError)) |
129 TRAPD(error , HandleL(aGenericInfo , aError)) |
120 |
130 |
121 if(error != KErrNone) |
131 if(error != KErrNone) |
122 { |
132 { |
123 iCallBack->HandleNotifyL(iTransactionId , KLiwEventError , *iOutParmList , *iInParmList) ; |
133 iCallBack->HandleNotifyL(iTransactionId , KLiwEventError , *iOutParmList , *iInParmList) ; |
124 iOutParmList = NULL ; |
|
125 //delete this ; |
134 //delete this ; |
126 return KErrGeneral ; |
135 return KErrGeneral ; |
127 } |
136 } |
128 |
137 |
129 |
138 |
165 |
174 |
166 Val = pos.Latitude() ; |
175 Val = pos.Latitude() ; |
167 result->InsertL(KLatitudeKey , TLiwVariant((TReal)Val)) ; //Inserting latitude into map |
176 result->InsertL(KLatitudeKey , TLiwVariant((TReal)Val)) ; //Inserting latitude into map |
168 |
177 |
169 Val = pos.Altitude() ; |
178 Val = pos.Altitude() ; |
170 |
179 if (!(Math::IsNaN(Val))) |
171 result->InsertL(KAltitudeKey , TLiwVariant((TReal)Val)) ; //Inserting altitude into map |
180 { |
|
181 result->InsertL(KAltitudeKey , TLiwVariant((TReal)Val)) ; //Inserting altitude into map |
|
182 } |
172 //TLiwVariant resVar(result) ; |
183 //TLiwVariant resVar(result) ; |
173 |
184 TReal32 Val1; |
|
185 Val1 = pos.HorizontalAccuracy(); |
|
186 if (!(Math::IsNaN(Val1))) |
|
187 { |
|
188 result->InsertL(KHorAccuracy, TLiwVariant((TReal)Val1)) ; |
|
189 } |
|
190 |
|
191 Val1 = pos.VerticalAccuracy(); |
|
192 if (!(Math::IsNaN(Val1))) |
|
193 { |
|
194 result->InsertL(KVerAccuracy, TLiwVariant((TReal)Val1)) ; |
|
195 } |
174 |
196 |
175 TPositionModuleInfo :: TCapabilities currCapability = iModuleInfo->Capabilities() ; |
197 TPositionModuleInfo :: TCapabilities currCapability = iModuleInfo->Capabilities() ; |
176 |
198 |
177 if ( iLocinfoCategory == EGenericInfo ) |
199 if ( iLocinfoCategory == EGenericInfo ) |
178 { |
200 { |
308 result->DecRef() ; |
330 result->DecRef() ; |
309 |
331 |
310 |
332 |
311 } |
333 } |
312 |
334 |
313 /** |
335 |
314 * Default destructor |
336 |
315 */ |
|
316 |
|
317 LocationInterfaceCB :: ~LocationInterfaceCB() |
|
318 { |
|
319 |
|
320 delete iOutParmList; |
|
321 |
|
322 } |
|