1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalTechnology |
|
19 |
|
20 */ |
|
21 |
|
22 #include "RRLP-Messages.h" |
|
23 #include "rrlpmessagebase.h" |
|
24 #include "supldevloggermacros.h" |
|
25 |
|
26 |
|
27 /** |
|
28 Const definition for the 3D location with uncertainty identifier. |
|
29 This is the form of location description allowed in RRLP for the |
|
30 GPS Reference Location element. |
|
31 */ |
|
32 const TUint K3DLocationWithUncertainty = 9; |
|
33 |
|
34 |
|
35 /** |
|
36 Maximun number of assistance data "elements" (be it almanac, |
|
37 acquisition, etc) that can be passed on to LBS. If an RRLP |
|
38 message contains more elements than the maximum, only the |
|
39 first 32 are considered. |
|
40 */ |
|
41 const TUint8 KAsn1RrlpMaxSatNumber = 32; |
|
42 |
|
43 /** |
|
44 Const definition for multiplier to convert 0.08 second resolution to ms.. |
|
45 The Reference Time field of the GPS Assistance Data element contains |
|
46 a GPS Time Of Week (TOW) element, with resolution 0.08seconds. |
|
47 The LBS Assistance Data object stores the TOW in ms. |
|
48 */ |
|
49 const TUint KGpsTowMultiplier = 80; |
|
50 |
|
51 /** |
|
52 Constructor |
|
53 */ |
|
54 CRrlpMessageBase::CRrlpMessageBase(TSuplPosPayloadType aType, TBool aIsOutgoingMsg) |
|
55 : CSuplPosPayload(aType, aIsOutgoingMsg) |
|
56 { |
|
57 } |
|
58 |
|
59 |
|
60 /** |
|
61 Second stage constructor |
|
62 |
|
63 Outgoing messages: constructs the data encapsulation and control objects. |
|
64 Incoming message: no action |
|
65 */ |
|
66 void CRrlpMessageBase::ConstructL() |
|
67 { |
|
68 if (iIsOutgoingMessage) |
|
69 { |
|
70 iData = new (ELeave) ASN1T_PDU(); |
|
71 ASN1Context* context = new (ELeave) ASN1Context; |
|
72 CleanupDeletePushL(context); |
|
73 iControl = new (ELeave) ASN1C_PDU(*context, *iData); |
|
74 // construction of iControl successful, pop context off the cleanup stack |
|
75 CleanupStack::Pop(context); |
|
76 } |
|
77 } |
|
78 |
|
79 |
|
80 /** |
|
81 Destructor |
|
82 */ |
|
83 CRrlpMessageBase::~CRrlpMessageBase() |
|
84 { |
|
85 SUPLLOG(ELogP1, "CRrlpMessageBase::~CRrlpMessageBase() Begin\n"); |
|
86 delete iEncodeBuffer; |
|
87 delete iData; |
|
88 delete iControl; |
|
89 // release the STDLIB resources associated with this thread |
|
90 CloseSTDLIB(); |
|
91 SUPLLOG(ELogP1, "CRrlpMessageBase::~CRrlpMessageBase() End\n"); |
|
92 } |
|
93 |
|
94 |
|
95 /** |
|
96 SetDecodedData() |
|
97 |
|
98 Assign decoded ASN1 data, for received messages. |
|
99 Takes ownership of passed objects. |
|
100 |
|
101 @param aData data structure containing decoded message parameters |
|
102 @param aControl control structure associated with decoded data structure. |
|
103 */ |
|
104 void CRrlpMessageBase::SetDecodedData(ASN1T_PDU* aData, ASN1C_PDU* aControl) |
|
105 { |
|
106 SUPLLOG(ELogP1, "CRrlpMessageBase::SetDecodedData() Begin\n"); |
|
107 __ASSERT_DEBUG(!iIsOutgoingMessage, User::Invariant()); |
|
108 __ASSERT_DEBUG(iData == NULL, User::Invariant()); |
|
109 __ASSERT_DEBUG(iControl == NULL, User::Invariant()); |
|
110 iData = aData; |
|
111 iControl = aControl; |
|
112 SUPLLOG(ELogP1, "CRrlpMessageBase::SetDecodedData() End\n"); |
|
113 } |
|
114 |
|
115 |
|
116 /** |
|
117 SetReference() |
|
118 |
|
119 Sets the RRLP session reference |
|
120 Messages that contain the Rel-5 Extended Reference override the method |
|
121 SetExtendedReference() to populate this content. |
|
122 |
|
123 The RRLP Reference, including the Rel-5 extended reference include the |
|
124 following parameters |
|
125 TInt aRefNum; // 0..7 |
|
126 TBool aRel5EntendedRefPresent; |
|
127 TInt aRel5SmlcCode; // 0..63 |
|
128 TInt aRel5TransactionId; // 0..262143 |
|
129 |
|
130 @param aRrlpRef local copy of the session reference details |
|
131 @return error indication, KErrNone otherwise |
|
132 */ |
|
133 EXPORT_C TInt CRrlpMessageBase::SetReference(const TRrlpReference& aRrlpRef) |
|
134 { |
|
135 SUPLLOG(ELogP1, "CRrlpMessageBase::SetReference() Begin\n"); |
|
136 __ASSERT_DEBUG(iIsOutgoingMessage, User::Invariant()); |
|
137 __ASSERT_DEBUG(iData != NULL, User::Invariant()); |
|
138 |
|
139 iData->referenceNumber = aRrlpRef.aRefNum; |
|
140 |
|
141 TInt err = KErrNone; |
|
142 err = SetExtendedReference(aRrlpRef); |
|
143 if (err == KErrNotFound) |
|
144 { |
|
145 SUPLLOG(ELogP1, "CRrlpMessageBase::SetReference() no extended reference present\n"); |
|
146 } |
|
147 |
|
148 |
|
149 SUPLLOG(ELogP1, "CRrlpMessageBase::SetReference() End\n"); |
|
150 return KErrNone; |
|
151 } |
|
152 |
|
153 |
|
154 /** |
|
155 SetExtendedReference() |
|
156 |
|
157 Overridden by derived classes representing messages that include rel-5 |
|
158 extended reference. |
|
159 |
|
160 @param aRrlpRef local copy of the session reference details |
|
161 @return error indication, KErrNone otherwise |
|
162 */ |
|
163 TInt CRrlpMessageBase::SetExtendedReference(const TRrlpReference& /*aRrlpRef*/) |
|
164 { |
|
165 return KErrNone; |
|
166 } |
|
167 |
|
168 |
|
169 /** |
|
170 Reference() |
|
171 |
|
172 Populates aRrlpRef with the session reference |
|
173 |
|
174 @param aRrlpRef on return, populated with the session reference details |
|
175 @return error indication, KErrNone otherwise |
|
176 */ |
|
177 EXPORT_C TInt CRrlpMessageBase::GetReference(TRrlpReference& aRrlpRef) |
|
178 { |
|
179 SUPLLOG(ELogP1, "CRrlpMessageBase::Reference() Begin\n"); |
|
180 __ASSERT_DEBUG(iData != NULL, User::Invariant()); |
|
181 aRrlpRef.aRefNum = iData->referenceNumber; |
|
182 |
|
183 TInt err = KErrNone; |
|
184 err = GetExtendedReference(aRrlpRef); |
|
185 if (err == KErrNotFound) |
|
186 { |
|
187 SUPLLOG(ELogP1, "CRrlpMessageBase::Reference() no extended reference present\n"); |
|
188 } |
|
189 |
|
190 SUPLLOG(ELogP1, "CRrlpMessageBase::Reference() End\n"); |
|
191 return KErrNone; |
|
192 } |
|
193 |
|
194 |
|
195 /** |
|
196 GetExtendedReference() |
|
197 |
|
198 Overridden by derived classes representing messages that include rel-5 |
|
199 extended reference. |
|
200 |
|
201 @param aRrlpRef local copy of the session reference details |
|
202 @return KErrNotFound if the extended reference parameters are not present, |
|
203 KErrNone otherwise |
|
204 */ |
|
205 TInt CRrlpMessageBase::GetExtendedReference(TRrlpReference& /*aRrlpRef*/) |
|
206 { |
|
207 return KErrNotFound; |
|
208 } |
|
209 |
|
210 |
|
211 /** |
|
212 EncodeToL() |
|
213 |
|
214 Encode a populated outgoing message to the specified buffer. |
|
215 |
|
216 @param aBuf buffer pointer |
|
217 @return error indication, KErrNone otherwise |
|
218 */ |
|
219 EXPORT_C TInt CRrlpMessageBase::EncodeToL(TPtr8& aBuf) |
|
220 { |
|
221 SUPLLOG(ELogP1, "CRrlpMessageBase::EncodeToL() Begin\n"); |
|
222 __ASSERT_DEBUG(iIsOutgoingMessage, User::Invariant()); |
|
223 |
|
224 // buffer pointer, fixed max length |
|
225 TUint8* msgBuf = (TUint8*)aBuf.Ptr(); |
|
226 TInt maxLength = aBuf.MaxLength(); |
|
227 |
|
228 // construct the encode buffer control object |
|
229 iEncodeBuffer = new (ELeave) ASN1PEREncodeBuffer (msgBuf, (unsigned int)maxLength, FALSE, (OSRTContext*)iControl->getContext()); |
|
230 |
|
231 // Encode the message to the buffer |
|
232 TInt stat = KErrNone; |
|
233 stat = iControl->EncodeTo(*iEncodeBuffer); |
|
234 |
|
235 TInt retval = KErrNone; |
|
236 if (stat == 0) |
|
237 { |
|
238 // Set the length according to reported buffer length |
|
239 TInt len = iEncodeBuffer->getMsgLen(); |
|
240 aBuf.SetLength(len); |
|
241 } |
|
242 else |
|
243 { |
|
244 retval = ProcessAsn1Error(stat); |
|
245 } |
|
246 |
|
247 delete iEncodeBuffer; |
|
248 iEncodeBuffer = NULL; |
|
249 |
|
250 SUPLLOG(ELogP1, "CRrlpMessageBase::EncodeToL() End\n"); |
|
251 return retval; |
|
252 } |
|
253 |
|
254 |
|
255 /** |
|
256 BuildAssistanceData() |
|
257 |
|
258 @param aDataMask populated to indicate what assistance data has been received |
|
259 @param aData reference to assistance data builder object to populate with |
|
260 received assistance data |
|
261 @param aGpsData the received/decoded gps assistance data RRLP element |
|
262 @return error indication, KErrNone otherwise |
|
263 */ |
|
264 TInt CRrlpMessageBase::BuildAssistanceData(TLbsAsistanceDataGroup& aDataMask, RLbsAssistanceDataBuilderSet& aAssistanceDataBuilderSet, ASN1T_ControlHeader& aGpsData) |
|
265 { |
|
266 SUPLLOG(ELogP1, "CRrlpMessageBase::BuildAssistanceData() Begin\n"); |
|
267 // clear the data mask |
|
268 aDataMask = EAssistanceDataNone; |
|
269 |
|
270 // Reference Time |
|
271 if (aGpsData.m.referenceTimePresent) |
|
272 { |
|
273 SUPLLOG(ELogP1, " Reference Time received...\n"); |
|
274 aDataMask |= EAssistanceDataReferenceTime; |
|
275 |
|
276 // Fetch a GpsReferenceTime data item. |
|
277 RUEPositioningGpsReferenceTimeBuilder* gpsReferenceTimeBuilder; |
|
278 aAssistanceDataBuilderSet.GetDataBuilder(gpsReferenceTimeBuilder); |
|
279 |
|
280 WriteReferenceTimeData(gpsReferenceTimeBuilder, aGpsData); |
|
281 |
|
282 TTime timeNow; |
|
283 timeNow.UniversalTime(); |
|
284 gpsReferenceTimeBuilder->SetTimeStamp(timeNow); |
|
285 } |
|
286 |
|
287 // Reference Location |
|
288 if (aGpsData.m.refLocationPresent) |
|
289 { |
|
290 SUPLLOG(ELogP1, " Reference Location received...\n"); |
|
291 aDataMask |= EAssistanceDataReferenceLocation; |
|
292 |
|
293 // Fetch a ReferenceLocation data item. |
|
294 RReferenceLocationBuilder* gpsReferenceLocationBuilder; |
|
295 aAssistanceDataBuilderSet.GetDataBuilder(gpsReferenceLocationBuilder); |
|
296 |
|
297 WriteReferenceLocationData(gpsReferenceLocationBuilder, aGpsData); |
|
298 |
|
299 TTime timeNow; |
|
300 timeNow.UniversalTime(); |
|
301 gpsReferenceLocationBuilder->SetTimeStamp(timeNow); |
|
302 } |
|
303 |
|
304 // DGPS Corrections |
|
305 if (aGpsData.m.dgpsCorrectionsPresent) |
|
306 { |
|
307 SUPLLOG(ELogP1, " DGPS Corrections received, ignoring...\n"); |
|
308 // never requested by LBS, no data builder available. Ignore. |
|
309 } |
|
310 |
|
311 // Navigation Model |
|
312 if (aGpsData.m.navigationModelPresent) |
|
313 { |
|
314 SUPLLOG(ELogP1, " Navigation Model received...\n"); |
|
315 aDataMask |= EAssistanceDataNavigationModel; |
|
316 |
|
317 // Fetch a GpsNavigationModel data item. |
|
318 RUEPositioningGpsNavigationModelBuilder* gpsNavigationModelBuilder; |
|
319 aAssistanceDataBuilderSet.GetDataBuilder(gpsNavigationModelBuilder); |
|
320 |
|
321 WriteNavigationModelData(gpsNavigationModelBuilder, aGpsData); |
|
322 |
|
323 TTime timeNow; |
|
324 timeNow.UniversalTime(); |
|
325 gpsNavigationModelBuilder->SetTimeStamp(timeNow); |
|
326 } |
|
327 |
|
328 // Ionospheric Model |
|
329 if (aGpsData.m.ionosphericModelPresent) |
|
330 { |
|
331 SUPLLOG(ELogP1, " Ionospheric Model received...\n"); |
|
332 aDataMask |= EAssistanceDataIonosphericModel; |
|
333 |
|
334 //Fetch a GpsIonosphericModel data item. |
|
335 RUEPositioningGpsIonosphericModelBuilder* gpsIonosphericModelBuilder; |
|
336 aAssistanceDataBuilderSet.GetDataBuilder(gpsIonosphericModelBuilder); |
|
337 |
|
338 WriteIonosphericModelData(gpsIonosphericModelBuilder, aGpsData); |
|
339 |
|
340 TTime timeNow; |
|
341 timeNow.UniversalTime(); |
|
342 gpsIonosphericModelBuilder->SetTimeStamp(timeNow); |
|
343 } |
|
344 |
|
345 // UTC Model |
|
346 if (aGpsData.m.utcModelPresent) |
|
347 { |
|
348 SUPLLOG(ELogP1, " UTC Model received...\n"); |
|
349 aDataMask |= EAssistanceDataPositioningGpsUtcModel; |
|
350 |
|
351 //Fetch a GpsUTCModel data item. |
|
352 RUEPositioningGpsUtcModelBuilder* gpsUtcModelBuilder; |
|
353 aAssistanceDataBuilderSet.GetDataBuilder(gpsUtcModelBuilder); |
|
354 |
|
355 WriteUtcModelData(gpsUtcModelBuilder, aGpsData); |
|
356 |
|
357 TTime timeNow; |
|
358 timeNow.UniversalTime(); |
|
359 gpsUtcModelBuilder->SetTimeStamp(timeNow); |
|
360 } |
|
361 |
|
362 // Almanac |
|
363 if (aGpsData.m.almanacPresent) |
|
364 { |
|
365 SUPLLOG(ELogP1, " Almanac received...\n"); |
|
366 aDataMask |= EAssistanceDataAlmanac; |
|
367 |
|
368 //Fetch a GpsAlmanacBuilder data builder. |
|
369 RUEPositioningGpsAlmanacBuilder* gpsAlmanacBuilder; |
|
370 aAssistanceDataBuilderSet.GetDataBuilder(gpsAlmanacBuilder); |
|
371 |
|
372 WriteAlmanacData(gpsAlmanacBuilder, aGpsData); |
|
373 |
|
374 TTime timeNow; |
|
375 timeNow.UniversalTime(); |
|
376 gpsAlmanacBuilder->SetTimeStamp(timeNow); |
|
377 } |
|
378 |
|
379 // Acquisition Assistance |
|
380 if (aGpsData.m.acquisAssistPresent) |
|
381 { |
|
382 SUPLLOG(ELogP1, " Aquisition Assistance received...\n"); |
|
383 aDataMask |= EAssistanceDataAquisitionAssistance; |
|
384 |
|
385 //Fetch a GpsAcquisitionAssistance data builder. |
|
386 RUEPositioningGpsAcquisitionAssistanceBuilder* gpsAcquisitionAssistanceBuilder; |
|
387 aAssistanceDataBuilderSet.GetDataBuilder(gpsAcquisitionAssistanceBuilder); |
|
388 |
|
389 WriteAcquisitionAssistanceData(gpsAcquisitionAssistanceBuilder, aGpsData); |
|
390 |
|
391 TTime timeNow; |
|
392 timeNow.UniversalTime(); |
|
393 gpsAcquisitionAssistanceBuilder->SetTimeStamp(timeNow); |
|
394 } |
|
395 |
|
396 // Real Time Integrity |
|
397 if (aGpsData.m.realTimeIntegrityPresent) |
|
398 { |
|
399 SUPLLOG(ELogP1, " Real Time Integrity received...\n"); |
|
400 aDataMask |= EAssistanceDataBadSatList; |
|
401 |
|
402 //Fetch a GpsBadSatList data item. |
|
403 RBadSatListBuilder* badSatListBuilder; |
|
404 aAssistanceDataBuilderSet.GetDataBuilder(badSatListBuilder); |
|
405 |
|
406 WriteRealTimeIntegrityData(badSatListBuilder, aGpsData); |
|
407 |
|
408 TTime timeNow; |
|
409 timeNow.UniversalTime(); |
|
410 badSatListBuilder->SetTimeStamp(timeNow); |
|
411 } |
|
412 |
|
413 SUPLLOG(ELogP1, "CRrlpMessageBase::BuildAssistanceData() End\n"); |
|
414 return KErrNone; |
|
415 } |
|
416 |
|
417 |
|
418 /** |
|
419 WriteReferenceTimeData() |
|
420 |
|
421 Writes the recevieved GPS Assistance Data (Reference Time) to the Assistance |
|
422 Data Builder. |
|
423 |
|
424 @param aReferenceTimeBuilder, the LBS assistance data builder |
|
425 @param aGpsData, the received/decoded gps assistance data RRLP element |
|
426 */ |
|
427 void CRrlpMessageBase::WriteReferenceTimeData(RUEPositioningGpsReferenceTimeBuilder* aReferenceTimeBuilder, ASN1T_ControlHeader& aGpsData) |
|
428 { |
|
429 SUPLLOG(ELogP1, "CRrlpMessageBase::WriteReferenceTimeData() Begin\n"); |
|
430 // GPS TIME elements |
|
431 TUint gpsWeek = aGpsData.referenceTime.gpsTime.gpsWeek; |
|
432 TUint gpsTow = aGpsData.referenceTime.gpsTime.gpsTOW23b * KGpsTowMultiplier; |
|
433 aReferenceTimeBuilder->SetField(TUEPositioningGpsReferenceTime::EGpsWeek, gpsWeek); |
|
434 aReferenceTimeBuilder->SetField(TUEPositioningGpsReferenceTime::EGpsTow1Msec, gpsTow); |
|
435 |
|
436 // GSM TIME elements (optional) |
|
437 // Not currently supported by this implementation |
|
438 // LBS assistance data builder support required. |
|
439 |
|
440 // GPS TOW ASSIST elements (optional) |
|
441 if (aGpsData.referenceTime.m.gpsTowAssistPresent != 0) |
|
442 { |
|
443 RGpsTowAssistArrayBuilder towAssistArrayBuilder; |
|
444 aReferenceTimeBuilder->GetArrayBuilder(TUEPositioningGpsReferenceTime::EGpsTowAssistArray, towAssistArrayBuilder); |
|
445 |
|
446 // array accessor |
|
447 ASN1C_GPSTOWAssist towAssistArray(aGpsData.referenceTime.gpsTowAssist); |
|
448 |
|
449 TInt count = aGpsData.referenceTime.gpsTowAssist.count; |
|
450 for (TInt i=0; i<count && i<KAsn1RrlpMaxSatNumber; i++) |
|
451 { |
|
452 RGpsTowAssistBuilder towAssistBuilder; |
|
453 towAssistArrayBuilder.GetFieldBuilder(i, towAssistBuilder); |
|
454 |
|
455 ASN1T_GPSTOWAssistElement* towElement = (ASN1T_GPSTOWAssistElement*)towAssistArray.get(i); |
|
456 TUint satId = towElement->satelliteID; |
|
457 TUint tlmMessage = towElement->tlmWord; |
|
458 TBool alert = (towElement->alert !=0 ? ETrue : EFalse); |
|
459 TBool antiSpoof = (towElement->antiSpoof !=0 ? ETrue : EFalse); |
|
460 |
|
461 towAssistBuilder.SetField(TGpsTowAssist::ESatID, satId); |
|
462 towAssistBuilder.SetField(TGpsTowAssist::ETlmMessage, tlmMessage); |
|
463 towAssistBuilder.SetField(TGpsTowAssist::EAlert, alert); |
|
464 towAssistBuilder.SetField(TGpsTowAssist::EAntiSpoof, antiSpoof); |
|
465 } |
|
466 } |
|
467 SUPLLOG(ELogP1, "CRrlpMessageBase::WriteReferenceTimeData() End\n"); |
|
468 } |
|
469 |
|
470 |
|
471 |
|
472 /** |
|
473 WriteReferenceLocationData() |
|
474 |
|
475 Writes the recevieved GPS Assistance Data (Reference Location) to the Assistance |
|
476 Data Builder. |
|
477 |
|
478 @param aReferenceLocationBuilder, the LBS assistance data builder |
|
479 @param aGpsData, the received/decoded gps assistance data RRLP element |
|
480 */ |
|
481 void CRrlpMessageBase::WriteReferenceLocationData(RReferenceLocationBuilder* aReferenceLocationBuilder, ASN1T_ControlHeader& aGpsData) |
|
482 { |
|
483 SUPLLOG(ELogP1, "CRrlpMessageBase::WriteReferenceLocationData() Begin\n"); |
|
484 // Allowed shape type is ellipsoid point with altitude and uncertainty ellipsoid |
|
485 TUint shapeType = 0; |
|
486 shapeType |= aGpsData.refLocation.threeDLocation.data[0]>>4; |
|
487 |
|
488 // handle latitude and longitude whatever the shape type |
|
489 TUint latitude = 0; |
|
490 latitude |= aGpsData.refLocation.threeDLocation.data[1]; |
|
491 latitude = latitude<<8; |
|
492 latitude |= aGpsData.refLocation.threeDLocation.data[2]; |
|
493 latitude = latitude<<8; |
|
494 latitude |= aGpsData.refLocation.threeDLocation.data[3]; |
|
495 latitude &= 0x7FFFFF; // clear the sign of latitude bit. |
|
496 |
|
497 // latitude sign, 0 == north, 1 == south |
|
498 TEllipsoidPointAltitudeEllipsoide::TLatitudeSign latitudeSign = TEllipsoidPointAltitudeEllipsoide::ENorth; |
|
499 if ((aGpsData.refLocation.threeDLocation.data[1] & 128) != 0) |
|
500 { |
|
501 latitudeSign = TEllipsoidPointAltitudeEllipsoide::ESouth; |
|
502 } |
|
503 |
|
504 TInt longitude = 0; |
|
505 longitude |= aGpsData.refLocation.threeDLocation.data[4]; |
|
506 longitude = longitude<<8; |
|
507 longitude |= aGpsData.refLocation.threeDLocation.data[5]; |
|
508 longitude = longitude<<8; |
|
509 longitude |= aGpsData.refLocation.threeDLocation.data[6]; |
|
510 |
|
511 TUint altitude = 0; |
|
512 altitude |= aGpsData.refLocation.threeDLocation.data[7]; |
|
513 altitude = altitude<<8; |
|
514 altitude |= aGpsData.refLocation.threeDLocation.data[8]; |
|
515 |
|
516 // handling of altitude and uncertainty dependant on shape type. |
|
517 // note that RRLP specifies usage of 3D location with uncertainty, so |
|
518 // no need to handle other types. |
|
519 if (shapeType == K3DLocationWithUncertainty) |
|
520 { |
|
521 // altitude direction, 0 == above, 1 == below WGS84 ellipsoid |
|
522 TEllipsoidPointAltitudeEllipsoide::TAltitudeDirection altitudeDirection = TEllipsoidPointAltitudeEllipsoide::EHeight; |
|
523 if ((aGpsData.refLocation.threeDLocation.data[7] & 128) != 0) |
|
524 { |
|
525 altitudeDirection = TEllipsoidPointAltitudeEllipsoide::EDepth; |
|
526 } |
|
527 |
|
528 // uncertainty etc... |
|
529 TUint uncertSemiMaj = aGpsData.refLocation.threeDLocation.data[9]; |
|
530 TUint uncertSemiMin = aGpsData.refLocation.threeDLocation.data[10]; |
|
531 TUint orientation = aGpsData.refLocation.threeDLocation.data[11]; |
|
532 TUint uncertAltitude = aGpsData.refLocation.threeDLocation.data[12]; |
|
533 TUint confidence = aGpsData.refLocation.threeDLocation.data[13]; |
|
534 |
|
535 REllipsoidPointAltitudeEllipsoideBuilder ellipsoidPointAltBuilder; |
|
536 aReferenceLocationBuilder->GetFieldBuilder(TReferenceLocation::EEllipsoidPointAltitudeEllipsoide, ellipsoidPointAltBuilder); |
|
537 |
|
538 ellipsoidPointAltBuilder.SetField(TEllipsoidPointAltitudeEllipsoide::ELatitudeSign, latitudeSign); |
|
539 ellipsoidPointAltBuilder.SetField(TEllipsoidPointAltitudeEllipsoide::ELatitude, latitude); |
|
540 ellipsoidPointAltBuilder.SetField(TEllipsoidPointAltitudeEllipsoide::ELongitude, longitude); |
|
541 ellipsoidPointAltBuilder.SetField(TEllipsoidPointAltitudeEllipsoide::EAltitudeDirection, altitudeDirection); |
|
542 ellipsoidPointAltBuilder.SetField(TEllipsoidPointAltitudeEllipsoide::EAltitude, altitude); |
|
543 ellipsoidPointAltBuilder.SetField(TEllipsoidPointAltitudeEllipsoide::EUncertaintySemiMajor, uncertSemiMaj); |
|
544 ellipsoidPointAltBuilder.SetField(TEllipsoidPointAltitudeEllipsoide::EUncertaintySemiMinor, uncertSemiMin); |
|
545 ellipsoidPointAltBuilder.SetField(TEllipsoidPointAltitudeEllipsoide::EOrientationMajorAxis, orientation); |
|
546 ellipsoidPointAltBuilder.SetField(TEllipsoidPointAltitudeEllipsoide::EUncertaintyAltitude, uncertAltitude); |
|
547 ellipsoidPointAltBuilder.SetField(TEllipsoidPointAltitudeEllipsoide::EConfidence, confidence); |
|
548 } |
|
549 SUPLLOG(ELogP1, "CRrlpMessageBase::WriteReferenceLocationData() End\n"); |
|
550 } |
|
551 |
|
552 |
|
553 /** |
|
554 WriteNavigationModelData() |
|
555 |
|
556 Writes the recevieved GPS Assistance Data (Navigation Model) to the Assistance |
|
557 Data Builder. |
|
558 |
|
559 @param aGpsNavigationModelBuilder, the LBS assistance data builder |
|
560 @param aGpsData, the received/decoded gps assistance data RRLP element |
|
561 */ |
|
562 void CRrlpMessageBase::WriteNavigationModelData(RUEPositioningGpsNavigationModelBuilder* aGpsNavigationModelBuilder, ASN1T_ControlHeader& aGpsData) |
|
563 { |
|
564 SUPLLOG(ELogP1, "CRrlpMessageBase::WriteNavigationModelData() Begin\n"); |
|
565 // Fetch a GpsNavigationModelSatInfoArray data item. |
|
566 RNavigationModelSatInfoArrayBuilder navigationModelSatInfoArrayBuilder; |
|
567 aGpsNavigationModelBuilder->GetArrayBuilder(TUEPositioningGpsNavigationModel::ENavigationModelSatelliteInfoArray, navigationModelSatInfoArrayBuilder); |
|
568 |
|
569 // array accessor |
|
570 ASN1C_SeqOfNavModelElement satInfoArray(aGpsData.navigationModel.navModelList); |
|
571 |
|
572 TInt count = aGpsData.navigationModel.navModelList.count; |
|
573 for (TInt i=0 ; i<count && i<KAsn1RrlpMaxSatNumber; ++i) |
|
574 { |
|
575 // Fetch a GpsNavigationModelSatInfo data item. |
|
576 RNavigationModelSatInfoBuilder navigationModelSatInfoBuilder; |
|
577 navigationModelSatInfoArrayBuilder.GetFieldBuilder(i, navigationModelSatInfoBuilder); |
|
578 |
|
579 // ASN1T_ControlHeader |
|
580 // Fetch the received satellite info |
|
581 ASN1T_NavModelElement* satInfo = (ASN1T_NavModelElement*)satInfoArray.get(i); |
|
582 |
|
583 WriteNavigationModelSatInfo(&navigationModelSatInfoBuilder, *satInfo); |
|
584 } |
|
585 SUPLLOG(ELogP1, "CRrlpMessageBase::WriteNavigationModelData() End\n"); |
|
586 } |
|
587 |
|
588 |
|
589 /** |
|
590 WriteNavigationModelSatInfo() |
|
591 |
|
592 Writes the recevieved GPS Assistance Data (Navigation Model Satellite Info Array) |
|
593 to the Assistance Data Builder. |
|
594 |
|
595 @param aGpsNavigationModelBuilder, the LBS assistance data builder |
|
596 @param aGpsData, the received/decoded gps assistance data RRLP element |
|
597 */ |
|
598 void CRrlpMessageBase::WriteNavigationModelSatInfo(RNavigationModelSatInfoBuilder* aNavigationModelSatInfoBuilder, ASN1T_NavModelElement& aSatInfo) |
|
599 { |
|
600 SUPLLOG(ELogP1, "CRrlpMessageBase::WriteNavigationModelSatInfo() Begin\n"); |
|
601 // satellite ID, status |
|
602 aNavigationModelSatInfoBuilder->SetField(TNavigationModelSatInfo::ESatId, (TUint)aSatInfo.satelliteID); |
|
603 aNavigationModelSatInfoBuilder->SetField(TNavigationModelSatInfo::ESatelliteStatus, (TSatelliteStatus)(aSatInfo.satStatus.t-EZeroOffsetAdjust)); |
|
604 |
|
605 // ephemeris data if either "new sat, new nav model" OR "existing sat, new nav model" |
|
606 if (aSatInfo.satStatus.t == T_SatStatus_newSatelliteAndModelUC) |
|
607 { |
|
608 WriteSatInfoEphemeris(aNavigationModelSatInfoBuilder, *aSatInfo.satStatus.u.newSatelliteAndModelUC); |
|
609 } |
|
610 else if (aSatInfo.satStatus.t == T_SatStatus_newNaviModelUC) |
|
611 { |
|
612 WriteSatInfoEphemeris(aNavigationModelSatInfoBuilder, *aSatInfo.satStatus.u.newNaviModelUC); |
|
613 } |
|
614 SUPLLOG(ELogP1, "CRrlpMessageBase::WriteNavigationModelSatInfo() End\n"); |
|
615 } |
|
616 |
|
617 |
|
618 /** |
|
619 WriteSatInfoEphemeris() |
|
620 |
|
621 Writes the recevieved GPS Assistance Data (Navigation Model Satellite Info Element) |
|
622 to the Assistance Data Builder. |
|
623 |
|
624 @param aNavigationModelSatInfoBuilder, the LBS assistance data builder |
|
625 @param aGpsData, the received/decoded gps assistance data RRLP element |
|
626 */ |
|
627 void CRrlpMessageBase::WriteSatInfoEphemeris(RNavigationModelSatInfoBuilder* aNavigationModelSatInfoBuilder, ASN1T_UncompressedEphemeris& aSatEphemeris) |
|
628 { |
|
629 SUPLLOG(ELogP1, "CRrlpMessageBase::WriteSatInfoEphemeris() Begin\n"); |
|
630 REphemerisParameterBuilder ephemerisBuilder; |
|
631 aNavigationModelSatInfoBuilder->GetFieldBuilder(TNavigationModelSatInfo::EEphemerisParameter, ephemerisBuilder); |
|
632 |
|
633 TUint value = aSatEphemeris.ephemCodeOnL2; |
|
634 ephemerisBuilder.SetField(TEphemerisParameter::ECodeOnL2, value); |
|
635 |
|
636 value = aSatEphemeris.ephemURA; |
|
637 ephemerisBuilder.SetField(TEphemerisParameter::EUraIndex, value); |
|
638 |
|
639 value = aSatEphemeris.ephemSVhealth; |
|
640 ephemerisBuilder.SetField(TEphemerisParameter::ESatHealth, value); |
|
641 |
|
642 value = aSatEphemeris.ephemIODC; |
|
643 ephemerisBuilder.SetField(TEphemerisParameter::EIodc, value); |
|
644 |
|
645 value = aSatEphemeris.ephemL2Pflag; |
|
646 ephemerisBuilder.SetField(TEphemerisParameter::EL2Pflag, value); |
|
647 |
|
648 value = aSatEphemeris.ephemTgd; |
|
649 ephemerisBuilder.SetField(TEphemerisParameter::ETGD, value); |
|
650 |
|
651 value = aSatEphemeris.ephemToc; |
|
652 ephemerisBuilder.SetField(TEphemerisParameter::EToc, value); |
|
653 |
|
654 value = aSatEphemeris.ephemAF2; |
|
655 ephemerisBuilder.SetField(TEphemerisParameter::EAf2, value); |
|
656 |
|
657 value = aSatEphemeris.ephemAF1; |
|
658 ephemerisBuilder.SetField(TEphemerisParameter::EAf1, value); |
|
659 |
|
660 value = aSatEphemeris.ephemAF0; |
|
661 ephemerisBuilder.SetField(TEphemerisParameter::EAf0, value); |
|
662 |
|
663 value = aSatEphemeris.ephemCrs; |
|
664 ephemerisBuilder.SetField(TEphemerisParameter::ECrs, value); |
|
665 |
|
666 value = aSatEphemeris.ephemDeltaN; |
|
667 ephemerisBuilder.SetField(TEphemerisParameter::EDeltaN, value); |
|
668 |
|
669 value = aSatEphemeris.ephemM0; |
|
670 ephemerisBuilder.SetField(TEphemerisParameter::EM0, value); |
|
671 |
|
672 value = aSatEphemeris.ephemCuc; |
|
673 ephemerisBuilder.SetField(TEphemerisParameter::ECuc, value); |
|
674 |
|
675 value = aSatEphemeris.ephemE; |
|
676 ephemerisBuilder.SetField(TEphemerisParameter::EE, value); |
|
677 |
|
678 value = aSatEphemeris.ephemCus; |
|
679 ephemerisBuilder.SetField(TEphemerisParameter::ECus, value); |
|
680 |
|
681 value = aSatEphemeris.ephemAPowerHalf; |
|
682 ephemerisBuilder.SetField(TEphemerisParameter::EASqrt, value); |
|
683 |
|
684 value = aSatEphemeris.ephemToe; |
|
685 ephemerisBuilder.SetField(TEphemerisParameter::EToe, value); |
|
686 |
|
687 value = aSatEphemeris.ephemFitFlag; |
|
688 ephemerisBuilder.SetField(TEphemerisParameter::EFitInterval, value); |
|
689 |
|
690 value = aSatEphemeris.ephemAODA; |
|
691 ephemerisBuilder.SetField(TEphemerisParameter::EAodo, value); |
|
692 |
|
693 value = aSatEphemeris.ephemCic; |
|
694 ephemerisBuilder.SetField(TEphemerisParameter::ECic, value); |
|
695 |
|
696 value = aSatEphemeris.ephemOmegaA0; |
|
697 ephemerisBuilder.SetField(TEphemerisParameter::EOmega0, value); |
|
698 |
|
699 value = aSatEphemeris.ephemCis; |
|
700 ephemerisBuilder.SetField(TEphemerisParameter::ECis, value); |
|
701 |
|
702 value = aSatEphemeris.ephemI0; |
|
703 ephemerisBuilder.SetField(TEphemerisParameter::EI0, value); |
|
704 |
|
705 value = aSatEphemeris.ephemCrc; |
|
706 ephemerisBuilder.SetField(TEphemerisParameter::ECrc, value); |
|
707 |
|
708 value = aSatEphemeris.ephemW; |
|
709 ephemerisBuilder.SetField(TEphemerisParameter::EOmega, value); |
|
710 |
|
711 value = aSatEphemeris.ephemOmegaADot; |
|
712 ephemerisBuilder.SetField(TEphemerisParameter::EOmegaDot, value); |
|
713 |
|
714 value = aSatEphemeris.ephemIDot; |
|
715 ephemerisBuilder.SetField(TEphemerisParameter::EIDot, value); |
|
716 SUPLLOG(ELogP1, "CRrlpMessageBase::WriteSatInfoEphemeris() End\n"); |
|
717 } |
|
718 |
|
719 |
|
720 /** |
|
721 WriteIonosphericModelData() |
|
722 |
|
723 Writes the recevieved GPS Assistance Data (Ionospheric Model) to the Assistance |
|
724 Data Builder. |
|
725 |
|
726 @param aGpsIonosphericModelBuilder, the LBS assistance data builder |
|
727 @param aGpsData, the received/decoded gps assistance data RRLP element |
|
728 */ |
|
729 void CRrlpMessageBase::WriteIonosphericModelData(RUEPositioningGpsIonosphericModelBuilder* aGpsIonosphericModelBuilder, ASN1T_ControlHeader& aGpsData) |
|
730 { |
|
731 SUPLLOG(ELogP1, "CRrlpMessageBase::WriteIonosphericModelData() Begin\n"); |
|
732 // Ionospheric Model Data |
|
733 aGpsIonosphericModelBuilder->SetField(TUEPositioningGpsIonosphericModel::EAlfa0, (TUint)aGpsData.ionosphericModel.alfa0); |
|
734 aGpsIonosphericModelBuilder->SetField(TUEPositioningGpsIonosphericModel::EAlfa1, (TUint)aGpsData.ionosphericModel.alfa1); |
|
735 aGpsIonosphericModelBuilder->SetField(TUEPositioningGpsIonosphericModel::EAlfa2, (TUint)aGpsData.ionosphericModel.alfa2); |
|
736 aGpsIonosphericModelBuilder->SetField(TUEPositioningGpsIonosphericModel::EAlfa3, (TUint)aGpsData.ionosphericModel.alfa3); |
|
737 aGpsIonosphericModelBuilder->SetField(TUEPositioningGpsIonosphericModel::EBeta0, (TUint)aGpsData.ionosphericModel.beta0); |
|
738 aGpsIonosphericModelBuilder->SetField(TUEPositioningGpsIonosphericModel::EBeta1, (TUint)aGpsData.ionosphericModel.beta1); |
|
739 aGpsIonosphericModelBuilder->SetField(TUEPositioningGpsIonosphericModel::EBeta2, (TUint)aGpsData.ionosphericModel.beta2); |
|
740 aGpsIonosphericModelBuilder->SetField(TUEPositioningGpsIonosphericModel::EBeta3, (TUint)aGpsData.ionosphericModel.beta3); |
|
741 SUPLLOG(ELogP1, "CRrlpMessageBase::WriteIonosphericModelData() End\n"); |
|
742 } |
|
743 |
|
744 |
|
745 /** |
|
746 WriteUtcModelData() |
|
747 |
|
748 Writes the recevieved GPS Assistance Data (UTC Model) to the Assistance |
|
749 Data Builder. |
|
750 |
|
751 @param aGpsUtcModelBuilder, the LBS assistance data builder |
|
752 @param aGpsData, the received/decoded gps assistance data RRLP element |
|
753 */ |
|
754 void CRrlpMessageBase::WriteUtcModelData(RUEPositioningGpsUtcModelBuilder* aGpsUtcModelBuilder, ASN1T_ControlHeader& aGpsData) |
|
755 { |
|
756 SUPLLOG(ELogP1, "CRrlpMessageBase::WriteUtcModelData() Begin\n"); |
|
757 // Universal Time Coordinate Model |
|
758 aGpsUtcModelBuilder->SetField(TUEPositioningGpsUtcModel::EA1, (TUint)aGpsData.utcModel.utcA1); |
|
759 aGpsUtcModelBuilder->SetField(TUEPositioningGpsUtcModel::EA0, (TUint)aGpsData.utcModel.utcA0); |
|
760 aGpsUtcModelBuilder->SetField(TUEPositioningGpsUtcModel::ETot, (TUint)aGpsData.utcModel.utcTot); |
|
761 aGpsUtcModelBuilder->SetField(TUEPositioningGpsUtcModel::EWnt, (TUint)aGpsData.utcModel.utcWNt); |
|
762 aGpsUtcModelBuilder->SetField(TUEPositioningGpsUtcModel::EDeltatLS, (TUint)aGpsData.utcModel.utcDeltaTls); |
|
763 aGpsUtcModelBuilder->SetField(TUEPositioningGpsUtcModel::EWnlsf, (TUint)aGpsData.utcModel.utcWNlsf); |
|
764 aGpsUtcModelBuilder->SetField(TUEPositioningGpsUtcModel::EDn, (TUint)aGpsData.utcModel.utcDN); |
|
765 aGpsUtcModelBuilder->SetField(TUEPositioningGpsUtcModel::EDeltatLSF, (TUint)aGpsData.utcModel.utcDeltaTlsf); |
|
766 SUPLLOG(ELogP1, "CRrlpMessageBase::WriteUtcModelData() End\n"); |
|
767 } |
|
768 |
|
769 |
|
770 /** |
|
771 WriteUtcModelData() |
|
772 |
|
773 Writes the recevieved GPS Assistance Data (UTC Model) to the Assistance |
|
774 Data Builder. |
|
775 |
|
776 @param aGpsUtcModelBuilder, the LBS assistance data builder |
|
777 @param aGpsData, the received/decoded gps assistance data RRLP element |
|
778 */ |
|
779 void CRrlpMessageBase::WriteAlmanacData(RUEPositioningGpsAlmanacBuilder* aGpsAlmanacBuilder, ASN1T_ControlHeader& aGpsData) |
|
780 { |
|
781 SUPLLOG(ELogP1, "CRrlpMessageBase::WriteAlmanacData() Begin\n"); |
|
782 |
|
783 // Almanac |
|
784 aGpsAlmanacBuilder->SetField(TUEPositioningGpsAlmanac::EWnA, (TUint)aGpsData.almanac.alamanacWNa); |
|
785 |
|
786 // source array accessor |
|
787 ASN1C_SeqOfAlmanacElement almanacArray(aGpsData.almanac.almanacList); |
|
788 |
|
789 // Populate almanac satellite info array |
|
790 RAlmanacSatInfoArrayBuilder almanacSatInfoArrayBuilder; |
|
791 aGpsAlmanacBuilder->GetArrayBuilder(TUEPositioningGpsAlmanac::EAlmanacInfoSatArray, almanacSatInfoArrayBuilder); |
|
792 |
|
793 TInt count = aGpsData.almanac.almanacList.count; |
|
794 // Copy assistance data for a maximun of KAsn1RrlpMaxSatNumber |
|
795 // satellites (LBS data structures cannot accomodate more) |
|
796 for (TInt i=0 ; i<count && i<KAsn1RrlpMaxSatNumber; ++i) |
|
797 { |
|
798 RAlmanacSatInfoBuilder almanacSatInfoBuilder; |
|
799 almanacSatInfoArrayBuilder.GetFieldBuilder(i, almanacSatInfoBuilder); |
|
800 |
|
801 ASN1T_AlmanacElement* almanacElement = (ASN1T_AlmanacElement*)almanacArray.get(i); |
|
802 |
|
803 WriteAlmanacSatInfo(&almanacSatInfoBuilder, *almanacElement); |
|
804 } |
|
805 SUPLLOG(ELogP1, "CRrlpMessageBase::WriteAlmanacData() End\n"); |
|
806 } |
|
807 |
|
808 |
|
809 /** |
|
810 WriteAlmanacSatInfo() |
|
811 |
|
812 Writes the recevieved GPS Assistance Data (UTC Model) to the Assistance |
|
813 Data Builder. |
|
814 |
|
815 @param aGpsUtcModelBuilder, the LBS assistance data builder |
|
816 @param aGpsData, the received/decoded gps assistance data RRLP element |
|
817 */ |
|
818 void CRrlpMessageBase::WriteAlmanacSatInfo(RAlmanacSatInfoBuilder* aAlmanacSatInfoBuilder, ASN1T_AlmanacElement& aAlmanacElement) |
|
819 { |
|
820 SUPLLOG(ELogP1, "CRrlpMessageBase::WriteAlmanacSatInfo() Begin\n"); |
|
821 // Almanac |
|
822 |
|
823 // Note: no RRLP data to populate TAlmanacSatInfo::EDataID field |
|
824 aAlmanacSatInfoBuilder->SetField(TAlmanacSatInfo::ESatID, (TUint)aAlmanacElement.satelliteID); |
|
825 aAlmanacSatInfoBuilder->SetField(TAlmanacSatInfo::EE, (TUint)aAlmanacElement.almanacE); |
|
826 aAlmanacSatInfoBuilder->SetField(TAlmanacSatInfo::EToa, (TUint)aAlmanacElement.alamanacToa); |
|
827 aAlmanacSatInfoBuilder->SetField(TAlmanacSatInfo::EDeltaI, (TUint)aAlmanacElement.almanacKsii); |
|
828 aAlmanacSatInfoBuilder->SetField(TAlmanacSatInfo::EOmegaDot, (TUint)aAlmanacElement.almanacOmegaDot); |
|
829 aAlmanacSatInfoBuilder->SetField(TAlmanacSatInfo::ESatHealth, (TUint)aAlmanacElement.almanacSVhealth); |
|
830 aAlmanacSatInfoBuilder->SetField(TAlmanacSatInfo::EASqrt, (TUint)aAlmanacElement.almanacAPowerHalf); |
|
831 aAlmanacSatInfoBuilder->SetField(TAlmanacSatInfo::EOmega0, (TUint)aAlmanacElement.almanacOmega0); |
|
832 aAlmanacSatInfoBuilder->SetField(TAlmanacSatInfo::EM0, (TUint)aAlmanacElement.almanacM0); |
|
833 aAlmanacSatInfoBuilder->SetField(TAlmanacSatInfo::EOmega, (TUint)aAlmanacElement.almanacW); |
|
834 aAlmanacSatInfoBuilder->SetField(TAlmanacSatInfo::EAf0, (TUint)aAlmanacElement.almanacAF0); |
|
835 aAlmanacSatInfoBuilder->SetField(TAlmanacSatInfo::EAf1, (TUint)aAlmanacElement.almanacAF1); |
|
836 SUPLLOG(ELogP1, "CRrlpMessageBase::WriteAlmanacSatInfo() End\n"); |
|
837 } |
|
838 |
|
839 |
|
840 /** |
|
841 WriteAcquisitionAssistanceData() |
|
842 |
|
843 Writes the recevieved GPS Assistance Data (Acquisition Assistance Data) to |
|
844 the Assistance Data Builder. |
|
845 |
|
846 @param aGpsAcquisitionAssistanceBuilder, the LBS assistance data builder |
|
847 @param aGpsData, the received/decoded gps assistance data RRLP element |
|
848 */ |
|
849 void CRrlpMessageBase::WriteAcquisitionAssistanceData(RUEPositioningGpsAcquisitionAssistanceBuilder* aGpsAcquisitionAssistanceBuilder, ASN1T_ControlHeader& aGpsData) |
|
850 { |
|
851 SUPLLOG(ELogP1, "CRrlpMessageBase::WriteAcquisitionAssistanceData() Begin\n"); |
|
852 // Aquisition Assistance |
|
853 |
|
854 // GSM TIME elements (optional) |
|
855 // Not currently supported by this implementation |
|
856 // LBS assistance data builder support required. |
|
857 |
|
858 // source array accessor |
|
859 ASN1C_SeqOfAcquisElement acquisAssistArray(aGpsData.acquisAssist.acquisList); |
|
860 |
|
861 // Populate almanac satellite info array |
|
862 RAcquisitionSatInfoArrayBuilder acquisitionSatInfoArrayBuilder; |
|
863 aGpsAcquisitionAssistanceBuilder->GetArrayBuilder(TUEPositioningGpsAcquisitionAssistance::ESatelliteInformationArray, acquisitionSatInfoArrayBuilder); |
|
864 |
|
865 TInt count = aGpsData.acquisAssist.acquisList.count; |
|
866 for (TInt i=0 ; i<count && i<KAsn1RrlpMaxSatNumber; ++i) |
|
867 { |
|
868 RAcquisitionSatInfoBuilder acquisitionSatInfoBuilder; |
|
869 acquisitionSatInfoArrayBuilder.GetFieldBuilder(i, acquisitionSatInfoBuilder); |
|
870 |
|
871 ASN1T_AcquisElement* acquisAssistElement = (ASN1T_AcquisElement*)acquisAssistArray.get(i); |
|
872 |
|
873 WriteAcquisAssistSatInfo(&acquisitionSatInfoBuilder, *acquisAssistElement); |
|
874 } |
|
875 |
|
876 SUPLLOG(ELogP1, "CRrlpMessageBase::WriteAcquisitionAssistanceData() End\n"); |
|
877 } |
|
878 |
|
879 |
|
880 /** |
|
881 WriteAcquisAssistSatInfo() |
|
882 |
|
883 Writes the recevieved GPS Assistance Data (Acquisition Assistance Satellite Info) |
|
884 to the Assistance Data Builder. |
|
885 |
|
886 @param aAcquisitionSatInfoBuilder, the LBS assistance data builder |
|
887 @param aGpsData, the received/decoded gps assistance data RRLP element |
|
888 */ |
|
889 void CRrlpMessageBase::WriteAcquisAssistSatInfo(RAcquisitionSatInfoBuilder* aAcquisitionSatInfoBuilder, ASN1T_AcquisElement& aAcquisAssistElement) |
|
890 { |
|
891 SUPLLOG(ELogP1, "CRrlpMessageBase::WriteAcquisAssistSatInfo() Begin\n"); |
|
892 aAcquisitionSatInfoBuilder->SetField(TAcquisitionSatInfo::ESatID, (TUint)aAcquisAssistElement.svid); |
|
893 aAcquisitionSatInfoBuilder->SetField(TAcquisitionSatInfo::EDoppler0thOrder, (TInt)aAcquisAssistElement.doppler0); |
|
894 aAcquisitionSatInfoBuilder->SetField(TAcquisitionSatInfo::ECodePhase, (TUint)aAcquisAssistElement.codePhase); |
|
895 aAcquisitionSatInfoBuilder->SetField(TAcquisitionSatInfo::EIntegerCodePhase, (TUint)aAcquisAssistElement.intCodePhase); |
|
896 aAcquisitionSatInfoBuilder->SetField(TAcquisitionSatInfo::EGpsBitNumber, (TUint)aAcquisAssistElement.gpsBitNumber); |
|
897 aAcquisitionSatInfoBuilder->SetField(TAcquisitionSatInfo::ECodePhaseSearchWindow, (TCodePhaseSearchWindow)aAcquisAssistElement.codePhaseSearchWindow); |
|
898 |
|
899 if (aAcquisAssistElement.m.addionalDopplerPresent != 0) |
|
900 { |
|
901 RExtraDopplerInfoBuilder extraDopplerInfoBuilder; |
|
902 aAcquisitionSatInfoBuilder->GetFieldBuilder(TAcquisitionSatInfo::EExtraDopplerInfo, extraDopplerInfoBuilder); |
|
903 extraDopplerInfoBuilder.SetField(TExtraDopplerInfo::EDoppler1stOrder, (TInt)aAcquisAssistElement.addionalDoppler.doppler1); |
|
904 extraDopplerInfoBuilder.SetField(TExtraDopplerInfo::EDopplerUncertainty, (TDopplerUncertainty)aAcquisAssistElement.addionalDoppler.dopplerUncertainty); |
|
905 } |
|
906 |
|
907 if (aAcquisAssistElement.m.addionalAnglePresent) |
|
908 { |
|
909 RTAzimuthAndElevationBuilder azimuthAndElevationBuilder; |
|
910 aAcquisitionSatInfoBuilder->GetFieldBuilder(TAcquisitionSatInfo::EAzimuthAndElevation, azimuthAndElevationBuilder); |
|
911 azimuthAndElevationBuilder.SetField(TAzimuthAndElevation::EAzimuth, (TUint)aAcquisAssistElement.addionalAngle.azimuth); |
|
912 azimuthAndElevationBuilder.SetField(TAzimuthAndElevation::EElevation, (TUint)aAcquisAssistElement.addionalAngle.elevation); |
|
913 } |
|
914 SUPLLOG(ELogP1, "CRrlpMessageBase::WriteAcquisAssistSatInfo() End\n"); |
|
915 } |
|
916 |
|
917 |
|
918 /** |
|
919 WriteRealTimeIntegrityData() |
|
920 |
|
921 Writes the recevieved GPS Assistance Data (Real Time Integrity) to the |
|
922 Assistance Data Builder. |
|
923 |
|
924 @param aBadSatListBuilder, the LBS assistance data builder |
|
925 @param aGpsData, the received/decoded gps assistance data RRLP element |
|
926 */ |
|
927 void CRrlpMessageBase::WriteRealTimeIntegrityData(RBadSatListBuilder* aBadSatListBuilder, ASN1T_ControlHeader& aGpsData) |
|
928 { |
|
929 SUPLLOG(ELogP1, "CRrlpMessageBase::WriteRealTimeIntegrityData() Begin\n"); |
|
930 // Real Time Integrity |
|
931 RBadSatArrayBuilder badSatArrayBuilder; |
|
932 aBadSatListBuilder->GetArrayBuilder(TBadSatList::EBadSatIdArray, badSatArrayBuilder); |
|
933 |
|
934 TInt count = aGpsData.realTimeIntegrity.n; |
|
935 |
|
936 for (TInt i=0 ; i<count && i<KAsn1RrlpMaxSatNumber; ++i) |
|
937 { |
|
938 badSatArrayBuilder.SetElement(i, aGpsData.realTimeIntegrity.elem[i]); |
|
939 } |
|
940 SUPLLOG(ELogP1, "CRrlpMessageBase::WriteRealTimeIntegrityData() End\n"); |
|
941 } |
|
942 |
|
943 |
|
944 /** |
|
945 LeaveIfAllocErrorL() |
|
946 |
|
947 Calls User::Leave(<error code>) if a memory allocation has failed. |
|
948 */ |
|
949 void CRrlpMessageBase::LeaveIfAllocErrorL() |
|
950 { |
|
951 SUPLLOG(ELogP1, "CRrlpMessageBase::LeaveIfAllocErrorL() Begin\n"); |
|
952 if (iControl->getStatus() == RTERR_NOMEM) |
|
953 { |
|
954 User::Leave(KErrNoMemory); |
|
955 } |
|
956 else if (iControl->getStatus() != RT_OK) |
|
957 { |
|
958 User::Leave(KErrGeneral); |
|
959 } |
|
960 SUPLLOG(ELogP1, "CRrlpMessageBase::LeaveIfAllocErrorL() End\n"); |
|
961 } |
|
962 |
|
963 |
|
964 /** |
|
965 Translates error codes returned by the ASN1 runtime library to distinguish |
|
966 from Symbian global error codes. |
|
967 |
|
968 Errors are simply translated to positive error codes. They maintain their |
|
969 meaning as described in rtxErrCodes.h and asn1ErrCodes.h. |
|
970 |
|
971 Exceptions: |
|
972 RTERR_NOMEM is translated to global error code KErrNoMemory |
|
973 |
|
974 @see rtxErrCodes.h |
|
975 @see asn1ErrCodes.h |
|
976 */ |
|
977 TInt CRrlpMessageBase::ProcessAsn1Error(TInt aError) |
|
978 { |
|
979 SUPLLOG(ELogP1, "CRrlpMessageBase::ProcessAsn1Error() Begin\n"); |
|
980 if (aError == RTERR_NOMEM) |
|
981 { |
|
982 SUPLLOG(ELogP1, "CRrlpMessageBase::ProcessAsn1Error() End (Out Of Memory)\n"); |
|
983 return KErrNoMemory; |
|
984 } |
|
985 else |
|
986 { |
|
987 SUPLLOG2(ELogP1, "CRrlpMessageBase::ProcessAsn1Error() End (ASN1Error runtime error %d)\n", aError); |
|
988 return aError * -1; |
|
989 } |
|
990 } |
|
991 |
|
992 /** |
|
993 Prints the content payload data structure to the logger |
|
994 */ |
|
995 void CRrlpMessageBase::LogMessageContent() |
|
996 { |
|
997 SUPLLOG(ELogP9, "RRLP PAYLOAD CONTENT\n"); |
|
998 //SUPLLOG_PDU(iControl); |
|
999 } |
|
1000 |
|