|
1 /* |
|
2 * Copyright (c) 2002-2005 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 "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: Class for handling SUPL_START message. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <etelmm.h> |
|
21 #include <e32math.h> |
|
22 #include <f32file.h> |
|
23 #include <bautils.h> |
|
24 |
|
25 #include "lbs/epos_tomasuplallowedcapabilities.h" |
|
26 #include "epos_comasupllocationid.h" |
|
27 #include "epos_comasupllocationidver2.h" |
|
28 #include "lbs/epos_comasuplsetcapabilities.h" |
|
29 #include "epos_comasuplsetcapabilitiesver2.h" |
|
30 #include "epos_suplterminal.h" |
|
31 #include "epos_suplterminalconstants.h" |
|
32 #include "epos_suplterminalqop.h" |
|
33 #include "epos_comasuplsessionid.h" |
|
34 #include "epos_comasuplsession2.h" |
|
35 #include "epos_tomasuplqop.h" |
|
36 #include "epos_comasuplasnmessagebase.h" |
|
37 #include "epos_comasuplstartstate.h" |
|
38 #include "epos_comasuplstart.h" |
|
39 #include "epos_comasuplposrequestor.h" |
|
40 #include "epos_omasuplconstants.h" |
|
41 #include "epos_comasupltrace.h" |
|
42 #include "epos_comasuplasnbase.h" |
|
43 |
|
44 |
|
45 _LIT(KTraceFileName,"SUPL_OMA_SESSION::EPos_COMASuplStartState.cpp"); |
|
46 |
|
47 TInt FindK(TReal horAccuracy,TReal C, TReal x) |
|
48 { |
|
49 TReal r = horAccuracy; |
|
50 TReal numerator ; |
|
51 TReal denominator; |
|
52 Math::Log(numerator,( r/C + 1.0 )); |
|
53 Math::Log(denominator,( 1.0 + x )); |
|
54 TReal res = numerator/ denominator; |
|
55 TInt round = res; //To ceil it. |
|
56 TReal decimal = res - round; |
|
57 if(decimal >= 0.5) |
|
58 { |
|
59 res = res + 0.5; |
|
60 } |
|
61 return res; |
|
62 } |
|
63 |
|
64 // ============================ MEMBER FUNCTIONS =============================== |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // COMASuplStartState::COMASuplStartState |
|
68 // C++ constructor can NOT contain any code, that might leave. |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 COMASuplStartState::COMASuplStartState(RMobilePhone& aMobilePhone, |
|
72 TInt aMsgTimeout,COMASuplPOSRequestor* aPosRequestor,COMASuplAsnHandlerBase* aOMASuplAsnHandlerBase): |
|
73 iMobilePhone(aMobilePhone), |
|
74 iPosRequestor(aPosRequestor), |
|
75 iOMASuplAsnHandlerBase(aOMASuplAsnHandlerBase) |
|
76 { |
|
77 iMessageTimeOut = aMsgTimeout * KSecond; |
|
78 iCurrentState = ESUPL_START; |
|
79 iIsQoPPresent = EFalse; |
|
80 } |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // COMASuplStartState::~COMASuplStartState |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 COMASuplStartState::~COMASuplStartState() |
|
87 { |
|
88 if(iTrace) |
|
89 iTrace->Trace(_L("COMASuplStartState::~COMASuplStartState..."), KTraceFileName, __LINE__); |
|
90 |
|
91 delete iLocationIDRequestor; |
|
92 iTrace->Trace(_L("Deleted iLocationIDRequestor..."), KTraceFileName, __LINE__); |
|
93 |
|
94 if(iPosRequestor) |
|
95 { |
|
96 iPosRequestor->DestroyList(); |
|
97 } |
|
98 else |
|
99 { |
|
100 delete iSETCapabilities ; |
|
101 iTrace->Trace(_L("Deleted iSETCapabilities ..."), KTraceFileName, __LINE__); |
|
102 } |
|
103 |
|
104 delete iAllowedCapabilities; |
|
105 iTrace->Trace(_L("Deleted iAllowedCapabilities..."), KTraceFileName, __LINE__); |
|
106 |
|
107 if(iLocationId) |
|
108 { |
|
109 iTrace->Trace(_L("Deleted iLocationId..."), KTraceFileName, __LINE__); |
|
110 delete iLocationId; |
|
111 iLocationId=NULL; |
|
112 } |
|
113 } |
|
114 |
|
115 // ----------------------------------------------------------------------------- |
|
116 // COMASuplStartState::ConstructL |
|
117 // Symbian 2nd phase constructor can leave. |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 void COMASuplStartState::ConstructL(TInt aAllowedCapabilities) |
|
121 { |
|
122 COMASuplState::BaseConstructL(); |
|
123 iTrace->Trace(_L("COMASuplStartState::ConstructL..."), KTraceFileName, __LINE__); |
|
124 iLocationIDRequestor = COMASuplETel::NewL(*this,iMobilePhone); |
|
125 iAllowedCapabilities = COMASuplSETCapabilities::NewL(); |
|
126 |
|
127 if(!iPosRequestor) |
|
128 iSETCapabilities = COMASuplSETCapabilities::NewL(); |
|
129 |
|
130 iSETCapabilities2 = COMASuplSETCapabilitiesVer2::NewL(); |
|
131 FillAllowedCapabilities(aAllowedCapabilities); |
|
132 |
|
133 iLocationId2 = COMASuplLocationIdVer2::NewL(); |
|
134 #ifdef PRINT_MESSAGE |
|
135 if(iECId) |
|
136 { |
|
137 iTrace->Trace(_L("Allowed Capabilities contains Enhance Cell Id."), KTraceFileName, __LINE__); |
|
138 } |
|
139 else |
|
140 { |
|
141 iTrace->Trace(_L("Allowed Capabilities does not contains Enhance Cell Id."), KTraceFileName, __LINE__); |
|
142 } |
|
143 #endif |
|
144 } |
|
145 |
|
146 // ----------------------------------------------------------------------------- |
|
147 // COMASuplStartState::NewL |
|
148 // Two-phased constructor. |
|
149 // ----------------------------------------------------------------------------- |
|
150 // |
|
151 COMASuplStartState* COMASuplStartState::NewL(RMobilePhone& aMobilePhone,TInt aMsgTimeout, |
|
152 COMASuplPOSRequestor* aPosRequestor, |
|
153 COMASuplAsnHandlerBase* aOMASuplAsnHandlerBase,TInt aAllowedCapabilities) |
|
154 { |
|
155 COMASuplStartState* self = new ( ELeave ) COMASuplStartState(aMobilePhone,aMsgTimeout,aPosRequestor,aOMASuplAsnHandlerBase); |
|
156 CleanupStack::PushL( self ); |
|
157 self->ConstructL(aAllowedCapabilities); |
|
158 CleanupStack::Pop(self); |
|
159 return self; |
|
160 } |
|
161 |
|
162 // ----------------------------------------------------------------------------- |
|
163 // COMASuplStartState::GenerateMessage |
|
164 // Generates SUPL_SATART message |
|
165 // (other items were commented in a header). |
|
166 // ----------------------------------------------------------------------------- |
|
167 // |
|
168 TInt COMASuplStartState::GenerateMessageL() |
|
169 { |
|
170 iTrace->Trace(_L("Start of COMASuplStartState::GenerateMessage"), KTraceFileName, __LINE__); |
|
171 iLocationIDRequestor->GetLocationID(); |
|
172 return KErrNone; |
|
173 } |
|
174 |
|
175 // ----------------------------------------------------------------------------- |
|
176 // COMASuplStartState::CancelOperation |
|
177 // Cancels the generation if SUPL START |
|
178 // (other items were commented in a header). |
|
179 // ----------------------------------------------------------------------------- |
|
180 // |
|
181 void COMASuplStartState::CancelOperation() |
|
182 { |
|
183 iTrace->Trace(_L("Cancel of COMASuplStartState::CancelOperation..."), KTraceFileName, __LINE__); |
|
184 COMASuplState::CancelOperation(); |
|
185 iLocationIDRequestor->Cancel(); |
|
186 if(iPosRequestor) |
|
187 { |
|
188 iPosRequestor->Cancel(); |
|
189 } |
|
190 } |
|
191 |
|
192 // ----------------------------------------------------------------------------- |
|
193 // COMASuplStartState::EncodeMessageL |
|
194 // Encodes message ...returns encoded data |
|
195 // (other items were commented in a header). |
|
196 // ----------------------------------------------------------------------------- |
|
197 // |
|
198 HBufC8* COMASuplStartState::EncodeMessageL(TOMASuplVersion &aSuplVersion, |
|
199 COMASuplSessionID* aSessionId,TInt &aError) |
|
200 { |
|
201 iTrace->Trace(_L("Start of COMASuplStartState::EncodeMessageL"), KTraceFileName, __LINE__); |
|
202 iTrace->Trace(_L("*********Values in SUPL START*************"), KTraceFileName, __LINE__); |
|
203 COMASuplState::EncodeMessageL(aSuplVersion,aSessionId,aError); |
|
204 |
|
205 aError = ValidateSetCapabilities(); |
|
206 if(aError != KErrNone) |
|
207 { |
|
208 return NULL; |
|
209 } |
|
210 |
|
211 |
|
212 COMASuplAsnMessageBase* OMASuplMessageBase = iOMASuplAsnHandlerBase->CreateOMASuplMessageL(COMASuplAsnMessageBase::ESUPL_START); |
|
213 CleanupStack::PushL(OMASuplMessageBase); |
|
214 COMASuplStartVer2* OMASuplStart = static_cast<COMASuplStartVer2*>(OMASuplMessageBase); |
|
215 |
|
216 iTrace->Trace(_L("Created OMASuplStart"), KTraceFileName, __LINE__); |
|
217 ComputeCapabilities(); |
|
218 |
|
219 if(iSETCapabilities && iPosRequestor) |
|
220 { |
|
221 iTrace->Trace(_L("Filling capability for POS....."), KTraceFileName, __LINE__); |
|
222 |
|
223 TOMASuplPosTechnology posTech; |
|
224 COMASuplSETCapabilities::TOMASuplPrefMethod prefMethod; |
|
225 TOMASuplPosProtocol posProtocol; |
|
226 |
|
227 iSETCapabilities->GetSETCapabilities(posTech, prefMethod, posProtocol); |
|
228 |
|
229 TBool aGpsSetAssisted, aGpsSetBased, autonomousGps, AFLT, EOTD, OTDOA; |
|
230 posTech.GetPosTechnology(aGpsSetAssisted, aGpsSetBased, autonomousGps, AFLT, EOTD, OTDOA); |
|
231 |
|
232 iAllowedCapabilitiesforPOS.SetAllowedCapabilities(aGpsSetAssisted, aGpsSetBased, autonomousGps, AFLT, EOTD, OTDOA, ETrue, ETrue); |
|
233 |
|
234 iPosRequestor->SetPosMethodAndAllowedCapabilities(iAllowedCapabilitiesforPOS,COMASuplPosSessionBase::EPositionUndefined); |
|
235 TOMASuplPosTechnology2 posTechnology2; |
|
236 COMASuplSETCapabilitiesVer2::TOMASuplPrefMethod2 prefMethod2 = (COMASuplSETCapabilitiesVer2::TOMASuplPrefMethod2)prefMethod; |
|
237 TOMASuplPosProtocol2 posProtocol2; |
|
238 |
|
239 posTechnology2.SetPosTechnology(aGpsSetAssisted, aGpsSetBased, autonomousGps, AFLT, EOTD, OTDOA); |
|
240 |
|
241 TBool tia801, rrlp, rrc; |
|
242 posProtocol.GetPosProtocol(tia801, rrlp, rrc); |
|
243 posProtocol2.SetPosProtocol(tia801, rrlp, rrc); |
|
244 |
|
245 iSETCapabilities2->SetSETCapabilities(posTechnology2, prefMethod2, posProtocol2); |
|
246 } |
|
247 OMASuplStart->SetMessageBase(aSuplVersion,aSessionId); |
|
248 |
|
249 // Add trigger capability to SET Capabilities |
|
250 // Services supported |
|
251 iTrace->Trace(_L("Setting trigger params"), KTraceFileName, __LINE__); |
|
252 TOMASuplServiceSupported servSupport; |
|
253 servSupport.SetPeriodicTrigger(ETrue); |
|
254 servSupport.SetAreaEventTrigger(EFalse); |
|
255 |
|
256 //Reporting mode, only real time is supported |
|
257 TOMASuplReportMode repMode; |
|
258 repMode.SetRealTime(ETrue); |
|
259 repMode.SetQuasiRealTime(EFalse); |
|
260 repMode.SetBatch(EFalse); |
|
261 |
|
262 // Set false all batch reporting params |
|
263 TOMASuplBatchReportMode batchRep; |
|
264 batchRep.SetReportPosition(EFalse); |
|
265 batchRep.SetReportMeasurement(EFalse); |
|
266 batchRep.SetMaxPositions(0); |
|
267 batchRep.SetMaxMeasurements(0); |
|
268 |
|
269 // Set reporting capabilites |
|
270 TOMASuplReportingCap reportCap; |
|
271 reportCap.SetReportMode(repMode); |
|
272 reportCap.SetBatchReportMode(batchRep); |
|
273 |
|
274 // Session capability |
|
275 TOMASuplSessionCapabilities sessionCaps; |
|
276 sessionCaps.SetMaxNumberTotalSessions(5); |
|
277 sessionCaps.SetMaxNumberPeriodicSessions(5); |
|
278 sessionCaps.SetMaxNumberTriggeredSessions(5); |
|
279 |
|
280 // Set service capability |
|
281 TOMAServiceCapabilities serviceCaps; |
|
282 serviceCaps.SetSuplServiceSupported(servSupport); |
|
283 serviceCaps.SetSuplReportingCap(reportCap); |
|
284 serviceCaps.SetSuplSessionCapabilities(sessionCaps); |
|
285 |
|
286 // Set SET Capability extn |
|
287 TOMAVer2SetCapExtn setCapsExtn; |
|
288 setCapsExtn.SetServiceCaps(serviceCaps); |
|
289 iTrace->Trace(_L("SetVer2SetCapExtn"), KTraceFileName, __LINE__); |
|
290 // Set SET Capabilities |
|
291 iSETCapabilities2->SetVer2SetCapExtn(setCapsExtn); |
|
292 //iLocationId ownership will be with SUPL start class |
|
293 OMASuplStart->SetSuplStart(iSETCapabilities2,iLocationId2,iECId); |
|
294 if(iECId) |
|
295 { |
|
296 OMASuplStart->SetECellId(iMmCellInfo); |
|
297 } |
|
298 |
|
299 #ifdef PRINT_MESSAGE |
|
300 // SET Capabilities |
|
301 if(iSETCapabilities) |
|
302 { |
|
303 iTrace->Trace(_L("SET Capabilities ....."), KTraceFileName, __LINE__); |
|
304 |
|
305 TOMASuplPosTechnology posTech; |
|
306 COMASuplSETCapabilities::TOMASuplPrefMethod prefMethod; |
|
307 TOMASuplPosProtocol posProtocol; |
|
308 |
|
309 iSETCapabilities->GetSETCapabilities(posTech, prefMethod, posProtocol); |
|
310 |
|
311 TBuf <200> posTechStr; |
|
312 posTechStr.Append(_L("POS Technologies - ")); |
|
313 TBool aGpsSetAssisted, aGpsSetBased, autonomousGps, AFLT, EOTD, OTDOA; |
|
314 posTech.GetPosTechnology(aGpsSetAssisted, aGpsSetBased, autonomousGps, AFLT, EOTD, OTDOA); |
|
315 if(aGpsSetAssisted) posTechStr.Append(_L("AGPS SET Assisted ")); |
|
316 if(aGpsSetBased) posTechStr.Append(_L("AGPS SET Based ")); |
|
317 if(autonomousGps) posTechStr.Append(_L("Autonomous GPS ")); |
|
318 if(AFLT) posTechStr.Append(_L("AFLT ")); |
|
319 if(EOTD) posTechStr.Append(_L("EOTD ")); |
|
320 if(OTDOA) posTechStr.Append(_L("OTDOA ")); |
|
321 |
|
322 iTrace->Trace(posTechStr, KTraceFileName, __LINE__); |
|
323 |
|
324 TBuf <80> prefMethodStr; |
|
325 prefMethodStr.Append(_L("Preferred Method - ")); |
|
326 |
|
327 switch(prefMethod) |
|
328 { |
|
329 case COMASuplSETCapabilities::EOMAAGpsSETAssitedPreferred: |
|
330 prefMethodStr.Append(_L("AGPS SET Assisted Preferred")); |
|
331 break; |
|
332 case COMASuplSETCapabilities::EOMAAGpsSETBasedPreferred: |
|
333 prefMethodStr.Append(_L("AGPS SET Based Preferred")); |
|
334 break; |
|
335 case COMASuplSETCapabilities::EOMANoPreferred: |
|
336 prefMethodStr.Append(_L("No Preference")); |
|
337 break; |
|
338 } |
|
339 |
|
340 iTrace->Trace(prefMethodStr, KTraceFileName, __LINE__); |
|
341 |
|
342 TBuf <80> posProtocolStr; |
|
343 posProtocolStr.Append(_L("POS Protocol - ")); |
|
344 TBool tia801, rrlp, rrc; |
|
345 |
|
346 posProtocol.GetPosProtocol(tia801, rrlp, rrc); |
|
347 if(tia801) posProtocolStr.Append(_L("TIA 801 ")); |
|
348 if(rrlp) posProtocolStr.Append(_L("RRLP ")); |
|
349 if(rrc) posProtocolStr.Append(_L("RRC ")); |
|
350 } |
|
351 |
|
352 if(iSETCapabilities2) |
|
353 { |
|
354 |
|
355 TBool perTrg, areaEventTrg, relTime, qRelTime, batch, position, measure; |
|
356 TInt totSessn, maxPos, maxMeasure; |
|
357 TInt8 maxPrdSession, maxTrgSession; |
|
358 |
|
359 servSupport.GetPeriodicTrigger(perTrg); |
|
360 servSupport.GetAreaEventTrigger(areaEventTrg); |
|
361 if (perTrg) |
|
362 iTrace->Trace(_L("Periodic Trigger - Supported"), KTraceFileName, __LINE__); |
|
363 else |
|
364 iTrace->Trace(_L("Periodic Trigger - Not Supported"), KTraceFileName, __LINE__); |
|
365 |
|
366 if (areaEventTrg) |
|
367 iTrace->Trace(_L("Area Event Trigger - Supported"), KTraceFileName, __LINE__); |
|
368 else |
|
369 iTrace->Trace(_L("Area Event Trigger - Not Supported"), KTraceFileName, __LINE__); |
|
370 |
|
371 //Reporting mode, only real time is supported |
|
372 repMode.GetRealTime(relTime); |
|
373 repMode.GetQuasiRealTime(qRelTime); |
|
374 repMode.GetBatch(batch); |
|
375 if (relTime) |
|
376 iTrace->Trace(_L("Real Time report - Supported"), KTraceFileName, __LINE__); |
|
377 else |
|
378 iTrace->Trace(_L("Real Time report - Not Supported"), KTraceFileName, __LINE__); |
|
379 |
|
380 if (qRelTime) |
|
381 iTrace->Trace(_L("Quasi Real Time report - Supported"), KTraceFileName, __LINE__); |
|
382 else |
|
383 iTrace->Trace(_L("Quasi Real Time report - Not Supported"), KTraceFileName, __LINE__); |
|
384 |
|
385 if (batch) |
|
386 iTrace->Trace(_L("Batch reporting - Supported"), KTraceFileName, __LINE__); |
|
387 else |
|
388 iTrace->Trace(_L("Batch reporting - Not Supported"), KTraceFileName, __LINE__); |
|
389 |
|
390 |
|
391 // Set false all batch reporting params |
|
392 TBuf <80> trgStr; |
|
393 batchRep.GetReportPosition(position); |
|
394 batchRep.GetReportMeasurement(measure); |
|
395 batchRep.GetMaxPositions(maxPos); |
|
396 batchRep.GetMaxMeasurements(maxMeasure); |
|
397 |
|
398 if (position) |
|
399 iTrace->Trace(_L("Position in batch report - Supported"), KTraceFileName, __LINE__); |
|
400 else |
|
401 iTrace->Trace(_L("Position in batch report - Not Supported"), KTraceFileName, __LINE__); |
|
402 |
|
403 if (measure) |
|
404 iTrace->Trace(_L("Measurement in batch report - Supported"), KTraceFileName, __LINE__); |
|
405 else |
|
406 iTrace->Trace(_L("Measurement in batch report - Not Supported"), KTraceFileName, __LINE__); |
|
407 |
|
408 trgStr.Copy(_L("Max positions ")); |
|
409 trgStr.AppendNum(maxPos); |
|
410 trgStr.Append(_L(" Max Measurement ")); |
|
411 trgStr.AppendNum(maxMeasure); |
|
412 iTrace->Trace(trgStr, KTraceFileName, __LINE__); |
|
413 |
|
414 // Session capability |
|
415 sessionCaps.GetMaxNumberTotalSessions(totSessn); |
|
416 sessionCaps.GetMaxNumberPeriodicSessions(maxPrdSession); |
|
417 sessionCaps.GetMaxNumberTriggeredSessions(maxTrgSession); |
|
418 } |
|
419 |
|
420 // Location ID |
|
421 if(iLocationId) |
|
422 { |
|
423 iTrace->Trace(_L("Location ID ......."), KTraceFileName, __LINE__); |
|
424 |
|
425 TBuf<50> locationIDTypeStr; |
|
426 locationIDTypeStr.Append(_L("Location ID Type - ")); |
|
427 COMASuplLocationId::TOMASuplCellInfoType cellInfoType; |
|
428 COMASuplLocationId::TOMASuplStatus status; |
|
429 TInt refMNC, refMcc, refCI, refLAC; |
|
430 TInt err; |
|
431 |
|
432 cellInfoType = iLocationId->SuplCellInfoType(); |
|
433 switch(cellInfoType) |
|
434 { |
|
435 case COMASuplLocationId::EGSM: |
|
436 locationIDTypeStr.Append(_L("GSM")); |
|
437 iTrace->Trace(locationIDTypeStr, KTraceFileName, __LINE__); |
|
438 |
|
439 COMASuplGSMCellInfo *gsmCellInfo; |
|
440 |
|
441 err = iLocationId->SuplLocationId(gsmCellInfo, status); |
|
442 if(KErrNone == err) |
|
443 { |
|
444 TBuf <100> gsmCellInfoStr; |
|
445 gsmCellInfoStr.Append(_L("GSM Cell Info - ")); |
|
446 gsmCellInfo->SuplGSMCellInfo(refMNC, refMcc, refCI, refLAC); |
|
447 gsmCellInfoStr.Append(_L("MNC - ")); |
|
448 gsmCellInfoStr.AppendNum(refMNC); |
|
449 gsmCellInfoStr.Append(_L(" MCC - ")); |
|
450 gsmCellInfoStr.AppendNum(refMcc); |
|
451 gsmCellInfoStr.Append(_L(" CI - ")); |
|
452 gsmCellInfoStr.AppendNum(refCI); |
|
453 gsmCellInfoStr.Append(_L(" LAC - ")); |
|
454 gsmCellInfoStr.AppendNum(refLAC); |
|
455 |
|
456 iTrace->Trace(gsmCellInfoStr, KTraceFileName, __LINE__); |
|
457 } |
|
458 break; |
|
459 |
|
460 case COMASuplLocationId::EWCDMA: |
|
461 locationIDTypeStr.Append(_L("WCDMA")); |
|
462 iTrace->Trace(locationIDTypeStr, KTraceFileName, __LINE__); |
|
463 |
|
464 COMASuplCellInfo *wcdmaCellInfo; |
|
465 |
|
466 err = iLocationId->SuplLocationId(wcdmaCellInfo, status); |
|
467 if(KErrNone == err) |
|
468 { |
|
469 TBuf <100> wcdmaCellInfoStr; |
|
470 wcdmaCellInfoStr.Append(_L("WCDMA Cell Info - ")); |
|
471 wcdmaCellInfo->SuplCellInfo(refMNC, refMcc, refCI); |
|
472 wcdmaCellInfoStr.Append(_L("MNC - ")); |
|
473 wcdmaCellInfoStr.AppendNum(refMNC); |
|
474 wcdmaCellInfoStr.Append(_L(" MCC - ")); |
|
475 wcdmaCellInfoStr.AppendNum(refMcc); |
|
476 wcdmaCellInfoStr.Append(_L(" CI - ")); |
|
477 wcdmaCellInfoStr.AppendNum(refCI); |
|
478 |
|
479 iTrace->Trace(wcdmaCellInfoStr, KTraceFileName, __LINE__); |
|
480 } |
|
481 |
|
482 break; |
|
483 } |
|
484 TBuf <60> locationIdStatusStr; |
|
485 locationIdStatusStr.Append(_L("Location ID Status - ")); |
|
486 switch(status) |
|
487 { |
|
488 case COMASuplLocationId::EStale: |
|
489 locationIdStatusStr.Append(_L("Stale")); |
|
490 break; |
|
491 case COMASuplLocationId::ECurrent: |
|
492 locationIdStatusStr.Append(_L("Current")); |
|
493 break; |
|
494 case COMASuplLocationId::EUnknown: |
|
495 locationIdStatusStr.Append(_L("Unknown")); |
|
496 break; |
|
497 } |
|
498 iTrace->Trace(locationIdStatusStr, KTraceFileName, __LINE__); |
|
499 } |
|
500 #endif |
|
501 if(iIsQoPPresent) |
|
502 { |
|
503 iTrace->Trace(_L("QoP ....."), KTraceFileName, __LINE__); |
|
504 TOMASuplQop Qop; |
|
505 TReal32 horAccuracy; |
|
506 TReal32 verAccuracy; |
|
507 TInt maxLocationAge; |
|
508 TInt delay; |
|
509 |
|
510 if(iClientQop.GetHorizontalAccuracy(horAccuracy) != KErrNotFound) |
|
511 { |
|
512 TReal C = 10.0; |
|
513 TReal x = 0.1; // From 3GPP GAD |
|
514 Qop.SetSuplQop(FindK(horAccuracy,C,x)); |
|
515 #ifdef PRINT_MESSAGE |
|
516 TBuf <30> horAccStr; |
|
517 horAccStr.Append(_L("Horizontal Accuracy - ")); |
|
518 horAccStr.AppendNum(horAccuracy); |
|
519 iTrace->Trace(horAccStr, KTraceFileName, __LINE__); |
|
520 #endif |
|
521 } |
|
522 |
|
523 if(iClientQop.GetVerticalAccuracy(verAccuracy) != KErrNotFound) |
|
524 { |
|
525 TReal C = 45.0; |
|
526 TReal x = 0.025; // From 3GPP GAD |
|
527 Qop.SetVerticalAccuracy(FindK(verAccuracy,C,x)); |
|
528 #ifdef PRINT_MESSAGE |
|
529 TBuf <32> vertAccStr; |
|
530 vertAccStr.Append(_L("Vertical Accuracy - ")); |
|
531 vertAccStr.AppendNum(verAccuracy); |
|
532 iTrace->Trace(vertAccStr, KTraceFileName, __LINE__); |
|
533 #endif |
|
534 } |
|
535 |
|
536 if(iClientQop.GetMaxLocationAge(maxLocationAge) != KErrNotFound) |
|
537 { |
|
538 Qop.SetMaxLocationAge(maxLocationAge); |
|
539 #ifdef PRINT_MESSAGE |
|
540 TBuf <32> maxAgeStr; |
|
541 maxAgeStr.Append(_L("Maximum Location Age - ")); |
|
542 maxAgeStr.AppendNum(maxLocationAge); |
|
543 iTrace->Trace(maxAgeStr, KTraceFileName, __LINE__); |
|
544 #endif |
|
545 } |
|
546 |
|
547 if(iClientQop.GetDelay(delay) != KErrNotFound) |
|
548 { |
|
549 // Calculate the delay to be sent to SLP from the |
|
550 // delay received from client lib |
|
551 |
|
552 // Client library gives 2^x and we need to send |
|
553 // x to SLP. Therefore, conversion is - |
|
554 // x = (log (2^x) / log 2) |
|
555 |
|
556 TReal clientDelay = delay; |
|
557 TReal slpDelay; |
|
558 TReal logClientDelay; |
|
559 TReal logTwo; |
|
560 |
|
561 const TReal two = 2; |
|
562 |
|
563 TInt err = Math::Log(logClientDelay, clientDelay); |
|
564 if(KErrNone == err) |
|
565 { |
|
566 err = Math::Log(logTwo, two); |
|
567 if(KErrNone == err) |
|
568 { |
|
569 slpDelay = logClientDelay/logTwo; |
|
570 Qop.SetDelay(slpDelay); |
|
571 #ifdef PRINT_MESSAGE |
|
572 TBuf <32> delayStr; |
|
573 delayStr.Append(_L("Delay - ")); |
|
574 delayStr.AppendNum(slpDelay); |
|
575 iTrace->Trace(delayStr, KTraceFileName, __LINE__); |
|
576 #endif |
|
577 } |
|
578 } |
|
579 |
|
580 } |
|
581 |
|
582 OMASuplStart->SetQop(Qop); |
|
583 } |
|
584 |
|
585 iTrace->Trace(_L("Starting Encoding..."), KTraceFileName, __LINE__); |
|
586 |
|
587 HBufC8 *encodedBuffer = NULL; |
|
588 TInt error; |
|
589 |
|
590 TRAPD(err,encodedBuffer = iOMASuplAsnHandlerBase->EncodeL(OMASuplStart,error)); |
|
591 |
|
592 CleanupStack::PopAndDestroy(OMASuplMessageBase); |
|
593 |
|
594 if ( error == KErrNone && err == KErrNone ) |
|
595 { |
|
596 iTrace->Trace(_L("Encoding Done..."), KTraceFileName, __LINE__); |
|
597 aError = KErrNone; |
|
598 SetPrefferedBack(); |
|
599 #ifdef PRINT_MESSAGE |
|
600 RFile file; |
|
601 RFs fs; |
|
602 TInt cErr=fs.Connect(); |
|
603 TInt fErr = file.Open(fs,_L("c:\\logs\\epos\\packet.txt"),EFileWrite|EFileShareAny); |
|
604 if (fErr == KErrNotFound || fErr == KErrPathNotFound) |
|
605 { |
|
606 TBool ret = BaflUtils::FolderExists(fs,_L("c:\\logs\\epos\\")); |
|
607 if(!ret) |
|
608 { |
|
609 fs.MkDirAll(_L("c:\\logs\\epos\\")); |
|
610 } |
|
611 file.Create(fs, _L("c:\\logs\\epos\\packet.txt"), EFileWrite|EFileShareAny); |
|
612 fErr = file.Open(fs,_L("c:\\logs\\epos\\packet.txt"),EFileWrite|EFileShareAny); |
|
613 } |
|
614 TInt aPos; |
|
615 file.Seek(ESeekEnd, aPos); |
|
616 _LIT8(KMsgType, "SUPL START"); |
|
617 file.Write(KMsgType); |
|
618 file.Write(_L8("\r \n")); |
|
619 file.Write(*encodedBuffer); |
|
620 file.Write(_L8("\r \n")); |
|
621 file.Close(); |
|
622 fs.Close(); |
|
623 #endif |
|
624 return encodedBuffer; |
|
625 } |
|
626 else |
|
627 { |
|
628 iTrace->Trace(_L("Encoding Failed."), KTraceFileName, __LINE__); |
|
629 aError = error; |
|
630 delete encodedBuffer; |
|
631 encodedBuffer = NULL; |
|
632 } |
|
633 |
|
634 return NULL; |
|
635 } |
|
636 |
|
637 // ----------------------------------------------------------------------------- |
|
638 // COMASuplStartState::LocationIDRequestCompleted |
|
639 // Gets called when location request completed |
|
640 // (other items were commented in a header). |
|
641 // ----------------------------------------------------------------------------- |
|
642 // |
|
643 void COMASuplStartState::LocationIDRequestCompletedL(COMASuplLocationId* aLocationId, |
|
644 TInt aErrorCode) |
|
645 { |
|
646 iTrace->Trace(_L("COMASuplStartState::LocationIDRequestCompleted..."), KTraceFileName, __LINE__); |
|
647 iGenerationStatus = EFalse; |
|
648 if(aErrorCode!=KErrNone) |
|
649 { |
|
650 iTrace->Trace(_L("COMASuplStartState::LocationRequestFailed"), KTraceFileName, __LINE__); |
|
651 if(iMsgStateObserver) |
|
652 { |
|
653 iMsgStateObserver->OperationCompleteL(aErrorCode); |
|
654 return; |
|
655 } |
|
656 } |
|
657 |
|
658 COMASuplGSMCellInfo* cellInfo; |
|
659 COMASuplLocationId::TOMASuplStatus status; |
|
660 aLocationId->SuplLocationId(cellInfo, status); |
|
661 |
|
662 TInt refMNC,refMCC,refCI,refLac; |
|
663 cellInfo->SuplGSMCellInfo(refMNC,refMCC,refCI,refLac); |
|
664 |
|
665 COMASuplGSMCellInfo* cellInfoClone = COMASuplGSMCellInfo::NewL(); |
|
666 cellInfoClone->SetSuplGSMCellInfo(refMNC,refMCC,refCI,refLac); |
|
667 iLocationId2->SetSuplLocationId(cellInfoClone, status); |
|
668 |
|
669 iLocationId = aLocationId; |
|
670 |
|
671 if(iECId) |
|
672 { |
|
673 iTrace->Trace(_L("COMASuplStartState::LocationIDRequestCompletedL...Retrive E-CellId"), KTraceFileName, __LINE__); |
|
674 iGenerationStatus = ETrue; |
|
675 iLocationIDRequestor->GetECellID(); |
|
676 } |
|
677 else |
|
678 { |
|
679 GetAssistceDataFromPluginL(aErrorCode); |
|
680 } |
|
681 } |
|
682 |
|
683 // ----------------------------------------------------------------------------- |
|
684 // COMASuplStartState::LocationECellIdRequestCompletedL |
|
685 // Gets called when E-Cell Id location request completed |
|
686 // (other items were commented in a header). |
|
687 // ----------------------------------------------------------------------------- |
|
688 // |
|
689 void COMASuplStartState::LocationECellIdRequestCompletedL(TOMASuplECellInfo& aECId,TInt aErrorCode) |
|
690 { |
|
691 |
|
692 iGenerationStatus = EFalse; |
|
693 if(aErrorCode!=KErrNone) |
|
694 { |
|
695 iTrace->Trace(_L("COMASuplStartState::LocationECellIdRequestCompletedL...Failed...still continueing... "), KTraceFileName, __LINE__); |
|
696 iECId = EFalse; //Since getting E-Cell id is failed.... |
|
697 aErrorCode = KErrNone; |
|
698 #if 0 |
|
699 if(iMsgStateObserver) |
|
700 { |
|
701 iMsgStateObserver->OperationCompleteL(aErrorCode); |
|
702 return; |
|
703 } |
|
704 #endif |
|
705 } |
|
706 else |
|
707 { |
|
708 iMmCellInfo = aECId; |
|
709 } |
|
710 |
|
711 GetAssistceDataFromPluginL(aErrorCode); |
|
712 } |
|
713 |
|
714 // ----------------------------------------------------------------------------- |
|
715 // COMASuplStartState::ComparisionLocationIDRequestCompletedL |
|
716 // Gets called when location request for comparision completed |
|
717 // (other items were commented in a header). |
|
718 // ----------------------------------------------------------------------------- |
|
719 // |
|
720 void COMASuplStartState::ComparisionLocationIDRequestCompletedL(COMASuplLocationId* aLocationId, |
|
721 TInt /*aErrorCode*/) |
|
722 { |
|
723 iTrace->Trace(_L("COMASuplStartState::ComparisionLocationIDRequestCompletedL start"), KTraceFileName, __LINE__); |
|
724 if( iLocationId ) |
|
725 { |
|
726 delete iLocationId; |
|
727 iLocationId=NULL; |
|
728 } |
|
729 iLocationId = aLocationId; |
|
730 iTrace->Trace(_L("COMASuplStartState::ComparisionLocationIDRequestCompletedL completed"), KTraceFileName, __LINE__); |
|
731 } |
|
732 |
|
733 // ----------------------------------------------------------------------------- |
|
734 // COMASuplStartState::GetPosParamsL() |
|
735 // Gets called when location request completed |
|
736 // (other items were commented in a header). |
|
737 // ----------------------------------------------------------------------------- |
|
738 // |
|
739 void COMASuplStartState::GetPosParamsL() |
|
740 { |
|
741 iSETCapabilities = COMASuplSETCapabilities::NewL(); |
|
742 iSETCapabilities->SetType(COMASuplInfoRequest::EOMASuplSETCapabilities); |
|
743 |
|
744 iPosRequestor->CreateListL(); |
|
745 iPosRequestor->AppendInfoRequest(iSETCapabilities); //takes ownership |
|
746 iPosRequestor->SetObserver(this); |
|
747 User::LeaveIfError(iPosRequestor->GetSuplInfoL()); |
|
748 } |
|
749 |
|
750 // ----------------------------------------------------------------------------- |
|
751 // COMASuplPosInitState::OperationCompleteL |
|
752 // An observer method that indicates the completion of |
|
753 // data retrieval from POS Message plugin |
|
754 // (other items were commented in a header). |
|
755 // ----------------------------------------------------------------------------- |
|
756 // |
|
757 void COMASuplStartState::OperationCompleteL(TInt aError) |
|
758 { |
|
759 if(iMsgStateObserver) |
|
760 { |
|
761 if(aError == KErrNone) |
|
762 { |
|
763 aError = ValidateSetCapabilities(); |
|
764 } |
|
765 |
|
766 iMsgStateObserver->OperationCompleteL(aError); |
|
767 } |
|
768 } |
|
769 |
|
770 // ----------------------------------------------------------------------------- |
|
771 // COMASuplStartState::Capabilities |
|
772 // Returns iCapabilities |
|
773 // (other items were commented in a header). |
|
774 // ----------------------------------------------------------------------------- |
|
775 // |
|
776 COMASuplSETCapabilities* COMASuplStartState::Capabilities() |
|
777 { |
|
778 return iSETCapabilities; |
|
779 } |
|
780 |
|
781 // ----------------------------------------------------------------------------- |
|
782 // COMASuplStartState::Capabilities |
|
783 // Returns iCapabilities |
|
784 // (other items were commented in a header). |
|
785 // ----------------------------------------------------------------------------- |
|
786 // |
|
787 void COMASuplStartState::GetPositionCompleteL(TInt /* err */) |
|
788 { |
|
789 /* |
|
790 No Body |
|
791 */ |
|
792 } |
|
793 |
|
794 // ----------------------------------------------------------------------------- |
|
795 // COMASuplStartState::InitilizeAllowedCapabilities |
|
796 // Retrives capability from Allowed capabilities & puts into iSETCapabilities |
|
797 // (other items were commented in a header). |
|
798 // ----------------------------------------------------------------------------- |
|
799 // |
|
800 void COMASuplStartState::InitilizeAllowedCapabilities() |
|
801 { |
|
802 |
|
803 iTrace->Trace(_L("Start of COMASuplStartState::InitilizeAllowedCapabilities"), KTraceFileName, __LINE__); |
|
804 |
|
805 TOMASuplPosTechnology posTechnology; |
|
806 COMASuplSETCapabilities::TOMASuplPrefMethod prefMethod; |
|
807 TOMASuplPosProtocol posProtocol; |
|
808 |
|
809 TBool GpsSETAssisted = ETrue; |
|
810 TBool GpsSETBased = ETrue; |
|
811 TBool AutonomousGps = ETrue; |
|
812 TBool FLT = ETrue; |
|
813 |
|
814 TBool eOTD = ETrue; |
|
815 TBool oTDOA = ETrue; |
|
816 |
|
817 TBool TIA801 = ETrue; |
|
818 TBool RRLP = ETrue; |
|
819 TBool RRC = ETrue; |
|
820 |
|
821 posTechnology.SetPosTechnology(GpsSETAssisted,GpsSETBased,AutonomousGps,FLT, |
|
822 eOTD,oTDOA); |
|
823 posProtocol.SetPosProtocol(TIA801,RRLP,RRC); |
|
824 prefMethod = COMASuplSETCapabilities::EOMANoPreferred; |
|
825 |
|
826 iAllowedCapabilities->SetSETCapabilities(posTechnology,prefMethod,posProtocol); |
|
827 |
|
828 iTrace->Trace(_L("End of COMASuplStartState::InitilizeAllowedCapabilities"), KTraceFileName, __LINE__); |
|
829 } |
|
830 |
|
831 // ----------------------------------------------------------------------------- |
|
832 // DoANDOperation |
|
833 // For manipulating SET capabiliites |
|
834 // (other items were commented in a header). |
|
835 // ----------------------------------------------------------------------------- |
|
836 // |
|
837 TBool DoANDOperation(TInt aFlag, TInt aCapability) |
|
838 { |
|
839 if ((aFlag & aCapability) > 0) |
|
840 return ETrue; |
|
841 else |
|
842 return EFalse; |
|
843 } |
|
844 |
|
845 // ----------------------------------------------------------------------------- |
|
846 // COMASuplStartState::FillAllowedCapabilities |
|
847 // Retrives capability from Allowed capabilities & puts into iSETCapabilities |
|
848 // (other items were commented in a header). |
|
849 // ----------------------------------------------------------------------------- |
|
850 // |
|
851 void COMASuplStartState::FillAllowedCapabilities(TInt aAllowedCapabilities) |
|
852 { |
|
853 |
|
854 iTrace->Trace(_L("Start of COMASuplStartState::FillAllowedCapabilities"), KTraceFileName, __LINE__); |
|
855 |
|
856 TOMASuplPosTechnology posTechnology; |
|
857 COMASuplSETCapabilities::TOMASuplPrefMethod prefMethod; |
|
858 TOMASuplPosProtocol posProtocol; |
|
859 |
|
860 TBool GpsSETAssisted = DoANDOperation(aAllowedCapabilities,KGpsSETAssisted); |
|
861 TBool GpsSETBased = DoANDOperation(aAllowedCapabilities,KGpsSETBased); |
|
862 TBool AutonomousGps = DoANDOperation(aAllowedCapabilities,KAutonomousGps); |
|
863 TBool FLT = DoANDOperation(aAllowedCapabilities,KAFLT); |
|
864 iECId = DoANDOperation(aAllowedCapabilities,KECID); |
|
865 TBool eOTD = DoANDOperation(aAllowedCapabilities,KEOTD); |
|
866 TBool oTDOA = DoANDOperation(aAllowedCapabilities,KOTDOA); |
|
867 |
|
868 TBool TIA801 = EFalse; |
|
869 TBool RRLP = EFalse; |
|
870 TBool RRC = EFalse; |
|
871 |
|
872 posTechnology.SetPosTechnology(GpsSETAssisted,GpsSETBased,AutonomousGps,FLT, |
|
873 eOTD,oTDOA); |
|
874 posProtocol.SetPosProtocol(TIA801,RRLP,RRC); |
|
875 prefMethod = COMASuplSETCapabilities::EOMANoPreferred; |
|
876 |
|
877 TBuf<128> msg(_L("COMASuplStartState::FillAllowedCapabilities : ")); |
|
878 msg.AppendNum(GpsSETAssisted); |
|
879 msg.Append(_L(", ")); |
|
880 msg.AppendNum(GpsSETBased); |
|
881 msg.Append(_L(", ")); |
|
882 msg.AppendNum(AutonomousGps); |
|
883 msg.Append(_L(", ")); |
|
884 msg.AppendNum(FLT); |
|
885 msg.Append(_L(", ")); |
|
886 msg.AppendNum(eOTD); |
|
887 msg.Append(_L(", ")); |
|
888 msg.AppendNum(oTDOA); |
|
889 msg.Append(_L(", ")); |
|
890 msg.AppendNum(iECId); |
|
891 msg.Append(_L(", ")); |
|
892 msg.AppendNum(ETrue); |
|
893 |
|
894 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
895 iAllowedCapabilities->SetSETCapabilities(posTechnology,prefMethod,posProtocol); |
|
896 |
|
897 iTrace->Trace(_L("End of COMASuplStartState::FillAllowedCapabilities"), KTraceFileName, __LINE__); |
|
898 |
|
899 if(iPosRequestor) |
|
900 return; |
|
901 |
|
902 //For Time being.... //IF POS is not there |
|
903 { |
|
904 TOMASuplPosTechnology posTechnology; |
|
905 COMASuplSETCapabilities::TOMASuplPrefMethod prefMethod; |
|
906 TOMASuplPosProtocol posProtocol; |
|
907 |
|
908 TBool GpsSETAssisted = EFalse; |
|
909 TBool GpsSETBased = EFalse; |
|
910 TBool AutonomousGps = EFalse; |
|
911 TBool FLT = EFalse; |
|
912 |
|
913 TBool eOTD = EFalse; |
|
914 TBool oTDOA = EFalse; |
|
915 |
|
916 TBool TIA801 = EFalse; |
|
917 TBool RRLP = EFalse; |
|
918 TBool RRC = EFalse; |
|
919 |
|
920 posTechnology.SetPosTechnology(GpsSETAssisted,GpsSETBased,AutonomousGps,FLT, |
|
921 eOTD,oTDOA); |
|
922 posProtocol.SetPosProtocol(TIA801,RRLP,RRC); |
|
923 prefMethod = COMASuplSETCapabilities::EOMANoPreferred; |
|
924 |
|
925 iSETCapabilities->SetSETCapabilities(posTechnology,prefMethod,posProtocol); |
|
926 } |
|
927 |
|
928 } |
|
929 |
|
930 // ----------------------------------------------------------------------------- |
|
931 // COMASuplStartState::ComputeCapabilities |
|
932 // Does ANDing of SETCapabilities with AllowedCapabilities & stores in SETCapabilities |
|
933 // (other items were commented in a header). |
|
934 // ----------------------------------------------------------------------------- |
|
935 // |
|
936 void COMASuplStartState::ComputeCapabilities() |
|
937 { |
|
938 iTrace->Trace(_L("Start of COMASuplStartState::ComputeCapabilities"), KTraceFileName, __LINE__); |
|
939 |
|
940 TOMASuplPosProtocol SETposProtocol; |
|
941 COMASuplSETCapabilities::TOMASuplPrefMethod SETprefMethod; |
|
942 TOMASuplPosTechnology SETposTechnology; |
|
943 |
|
944 TOMASuplPosProtocol AllowedposProtocol; |
|
945 COMASuplSETCapabilities::TOMASuplPrefMethod AllowedprefMethod; |
|
946 TOMASuplPosTechnology AllowedposTechnology; |
|
947 |
|
948 TBool SETGpsSETAssisted,AllowedGpsSETAssisted; |
|
949 TBool SETGpsSETBased,AllowedGpsSETBased; |
|
950 TBool SETAutonomousGps,AllowedAutonomousGps; |
|
951 TBool SETeOTD,AllowedeOTD; |
|
952 TBool SEToTDOA,AllowedoTDOA; |
|
953 TBool SETFLT, AllowedFLT; |
|
954 TBool SETTIA801,AllowedTIA801; |
|
955 TBool SETRRLP,AllowedRRLP; |
|
956 TBool SETRRC,AllowedRRC; |
|
957 |
|
958 iSETCapabilities->GetSETCapabilities(SETposTechnology,SETprefMethod,SETposProtocol); |
|
959 iAllowedCapabilities->GetSETCapabilities(AllowedposTechnology,AllowedprefMethod,AllowedposProtocol); |
|
960 |
|
961 SETposTechnology.GetPosTechnology(SETGpsSETAssisted,SETGpsSETBased,SETAutonomousGps,SETFLT, |
|
962 SETeOTD,SEToTDOA); |
|
963 SETposProtocol.GetPosProtocol(SETTIA801,SETRRLP,SETRRC); |
|
964 |
|
965 AllowedposTechnology.GetPosTechnology(AllowedGpsSETAssisted,AllowedGpsSETBased,AllowedAutonomousGps,AllowedFLT, |
|
966 AllowedeOTD,AllowedoTDOA); |
|
967 SETposProtocol.GetPosProtocol(AllowedTIA801,AllowedRRLP,AllowedRRC); |
|
968 AllowedprefMethod = COMASuplSETCapabilities::EOMANoPreferred; |
|
969 |
|
970 SETGpsSETAssisted &= AllowedGpsSETAssisted; |
|
971 SETGpsSETBased &= AllowedGpsSETBased; |
|
972 SETAutonomousGps &= AllowedAutonomousGps; |
|
973 |
|
974 SETFLT &= AllowedFLT; |
|
975 SETeOTD &=AllowedeOTD; |
|
976 SEToTDOA &=AllowedoTDOA; |
|
977 |
|
978 SETTIA801 &= AllowedTIA801; |
|
979 SETRRLP &= AllowedRRLP; |
|
980 SETRRC &= AllowedRRC; |
|
981 |
|
982 //If client has restricted SETBased and still POS msg plugin sets SETBasedPreferred.....then |
|
983 // it as EOMANoPreferred |
|
984 ///Save this one ...need for next message comparisions.... |
|
985 iPOSMsgSETprefMethod = SETprefMethod; |
|
986 |
|
987 if(SETprefMethod == COMASuplSETCapabilities::EOMAAGpsSETBasedPreferred && (!SETGpsSETBased )) |
|
988 { |
|
989 SETprefMethod = COMASuplSETCapabilities::EOMANoPreferred; |
|
990 } |
|
991 |
|
992 if(SETprefMethod == COMASuplSETCapabilities::EOMAAGpsSETAssitedPreferred && (!SETGpsSETAssisted)) |
|
993 { |
|
994 SETprefMethod = COMASuplSETCapabilities::EOMANoPreferred; |
|
995 } |
|
996 |
|
997 SETposTechnology.SetPosTechnology(SETGpsSETAssisted,SETGpsSETBased,SETAutonomousGps,SETFLT, |
|
998 SETeOTD,SEToTDOA); |
|
999 |
|
1000 SETposProtocol.SetPosProtocol(SETTIA801,SETRRLP,SETRRC); |
|
1001 |
|
1002 iSETCapabilities->SetSETCapabilities(SETposTechnology,SETprefMethod,SETposProtocol); |
|
1003 |
|
1004 iTrace->Trace(_L("End of COMASuplStartState::ComputeCapabilities"), KTraceFileName, __LINE__); |
|
1005 } |
|
1006 |
|
1007 // ----------------------------------------------------------------------------- |
|
1008 // COMASuplStartState::ValidateSetCapabilities |
|
1009 // |
|
1010 // (other items were commented in a header). |
|
1011 // ----------------------------------------------------------------------------- |
|
1012 // |
|
1013 TInt COMASuplStartState::ValidateSetCapabilities() |
|
1014 { |
|
1015 if(!iPosRequestor) //No need to check status if POS is not there |
|
1016 { |
|
1017 return KErrNone; |
|
1018 } |
|
1019 |
|
1020 return iSETCapabilities->Status(); |
|
1021 } |
|
1022 |
|
1023 // ----------------------------------------------------------------------------- |
|
1024 // COMASuplStartState::SetQop |
|
1025 // |
|
1026 // (other items were commented in a header). |
|
1027 // ----------------------------------------------------------------------------- |
|
1028 // |
|
1029 void COMASuplStartState::SetQop(TSuplTerminalQop& aQop) |
|
1030 { |
|
1031 iIsQoPPresent = ETrue; |
|
1032 iClientQop = aQop; |
|
1033 } |
|
1034 |
|
1035 // ----------------------------------------------------------------------------- |
|
1036 // COMASuplStartState::SetPrefferedBack |
|
1037 // |
|
1038 // (other items were commented in a header). |
|
1039 // ----------------------------------------------------------------------------- |
|
1040 // |
|
1041 void COMASuplStartState::SetPrefferedBack() |
|
1042 { |
|
1043 TOMASuplPosProtocol posProtocol; |
|
1044 COMASuplSETCapabilities::TOMASuplPrefMethod prefMethod; |
|
1045 TOMASuplPosTechnology posTechnology; |
|
1046 iSETCapabilities->GetSETCapabilities(posTechnology,prefMethod,posProtocol); |
|
1047 iSETCapabilities->SetSETCapabilities(posTechnology,iPOSMsgSETprefMethod,posProtocol); |
|
1048 |
|
1049 } |
|
1050 |
|
1051 |
|
1052 // ----------------------------------------------------------------------------- |
|
1053 // COMASuplStartState::GetAssistceDataFromPluginL |
|
1054 // |
|
1055 // (other items were commented in a header). |
|
1056 // ----------------------------------------------------------------------------- |
|
1057 // |
|
1058 void COMASuplStartState::GetAssistceDataFromPluginL(TInt aErrorCode) |
|
1059 { |
|
1060 if(iPosRequestor) |
|
1061 { |
|
1062 TRAPD(err,GetPosParamsL()); |
|
1063 |
|
1064 if(err != KErrNone && iMsgStateObserver) |
|
1065 { |
|
1066 iMsgStateObserver->OperationCompleteL(err); |
|
1067 } |
|
1068 } |
|
1069 else |
|
1070 { |
|
1071 if(iMsgStateObserver) |
|
1072 { |
|
1073 iMsgStateObserver->OperationCompleteL(aErrorCode); |
|
1074 } |
|
1075 } |
|
1076 |
|
1077 } |
|
1078 |
|
1079 // ----------------------------------------------------------------------------- |
|
1080 // COMASuplStartState::GetCurrentCellID |
|
1081 // Get Current Cell id |
|
1082 // |
|
1083 // (other items were commented in a header). |
|
1084 // ----------------------------------------------------------------------------- |
|
1085 // |
|
1086 void COMASuplStartState::GetCurrentCellID(TCellIdInfo& aCurrentCellId,TInt& aType) |
|
1087 { |
|
1088 TInt lRefMNC = -1; |
|
1089 TInt lRefMCC = -1; |
|
1090 TInt lRefLAC = -1; |
|
1091 TInt lRefCI = -1; |
|
1092 aType = 0; |
|
1093 if(iLocationId) |
|
1094 { |
|
1095 iTrace->Trace(_L("Location ID ......."), KTraceFileName, __LINE__); |
|
1096 |
|
1097 TBuf<50> locationIDTypeStr; |
|
1098 locationIDTypeStr.Append(_L("Location ID Type - ")); |
|
1099 COMASuplLocationId::TOMASuplCellInfoType cellInfoType; |
|
1100 COMASuplLocationId::TOMASuplStatus status; |
|
1101 TInt err; |
|
1102 |
|
1103 cellInfoType = iLocationId->SuplCellInfoType(); |
|
1104 switch(cellInfoType) |
|
1105 { |
|
1106 case COMASuplLocationId::EGSM: |
|
1107 { |
|
1108 locationIDTypeStr.Append(_L("GSM")); |
|
1109 iTrace->Trace(locationIDTypeStr, KTraceFileName, __LINE__); |
|
1110 COMASuplGSMCellInfo *gsmCellInfo; |
|
1111 err = iLocationId->SuplLocationId(gsmCellInfo, status); |
|
1112 if(KErrNone == err) |
|
1113 { |
|
1114 TBuf <128> gsmCellInfoStr; |
|
1115 gsmCellInfoStr.Append(_L("GSM Cell Info:")); |
|
1116 gsmCellInfo->SuplGSMCellInfo(lRefMNC, lRefMCC, lRefCI, lRefLAC); |
|
1117 gsmCellInfoStr.Append(_L("MNC - ")); |
|
1118 gsmCellInfoStr.AppendNum(lRefMNC); |
|
1119 gsmCellInfoStr.Append(_L(" MCC - ")); |
|
1120 gsmCellInfoStr.AppendNum(lRefMCC); |
|
1121 gsmCellInfoStr.Append(_L(" CI - ")); |
|
1122 gsmCellInfoStr.AppendNum(lRefCI); |
|
1123 gsmCellInfoStr.Append(_L(" LAC - ")); |
|
1124 gsmCellInfoStr.AppendNum(lRefLAC); |
|
1125 iTrace->Trace(gsmCellInfoStr, KTraceFileName, __LINE__); |
|
1126 aType = 0; |
|
1127 } |
|
1128 break; |
|
1129 } |
|
1130 case COMASuplLocationId::EWCDMA: |
|
1131 { |
|
1132 locationIDTypeStr.Append(_L("WCDMA")); |
|
1133 iTrace->Trace(locationIDTypeStr, KTraceFileName, __LINE__); |
|
1134 COMASuplCellInfo *wcdmaCellInfo; |
|
1135 err = iLocationId->SuplLocationId(wcdmaCellInfo, status); |
|
1136 if(KErrNone == err) |
|
1137 { |
|
1138 TBuf <128> wcdmaCellInfoStr; |
|
1139 wcdmaCellInfoStr.Append(_L("WCDMA Cell Info:")); |
|
1140 wcdmaCellInfo->SuplCellInfo(lRefMNC, lRefMCC, lRefCI); |
|
1141 wcdmaCellInfoStr.Append(_L("MNC - ")); |
|
1142 wcdmaCellInfoStr.AppendNum(lRefMNC); |
|
1143 wcdmaCellInfoStr.Append(_L(" MCC - ")); |
|
1144 wcdmaCellInfoStr.AppendNum(lRefMCC); |
|
1145 wcdmaCellInfoStr.Append(_L(" CI - ")); |
|
1146 wcdmaCellInfoStr.AppendNum(lRefCI); |
|
1147 iTrace->Trace(wcdmaCellInfoStr, KTraceFileName, __LINE__); |
|
1148 aType = 1; |
|
1149 } |
|
1150 break; |
|
1151 } |
|
1152 } |
|
1153 |
|
1154 aCurrentCellId.iCid = lRefCI; |
|
1155 aCurrentCellId.iMNC = lRefMNC; |
|
1156 aCurrentCellId.iMCC = lRefMCC; |
|
1157 aCurrentCellId.iLac = lRefLAC; |
|
1158 } |
|
1159 } // End of File |
|
1160 |