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