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 #ifndef RRLP_MESSAGE_BASE_H |
|
22 #define RRLP_MESSAGE_BASE_H |
|
23 |
|
24 #include "suplpospayload.h" |
|
25 #include <lbs/lbsassistancedatabuilderset.h> |
|
26 #include <lbs/lbsassistancereferencelocation.h> |
|
27 #include <lbs/lbsassistancereferencetime.h> |
|
28 #include <lbs/lbsassistancenavigationmodel.h> |
|
29 #include <lbs/lbsassistanceionosphericmodel.h> |
|
30 #include <lbs/lbsassistanceutcmodel.h> |
|
31 #include <lbs/lbsassistancealmanac.h> |
|
32 #include <lbs/lbsassistanceaquisitionassistance.h> |
|
33 #include <lbs/lbsassistancebadsatlist.h> |
|
34 |
|
35 // forward declarations |
|
36 class ASN1T_PDU; |
|
37 class ASN1C_PDU; |
|
38 class ASN1PEREncodeBuffer; |
|
39 class ASN1T_ControlHeader; |
|
40 class ASN1T_NavModelElement; |
|
41 class ASN1T_UncompressedEphemeris; |
|
42 class ASN1T_AlmanacElement; |
|
43 class ASN1T_AcquisElement; |
|
44 |
|
45 /** |
|
46 Highest valid value for RRLP Reference Number session identifier |
|
47 |
|
48 @internalTechnology |
|
49 */ |
|
50 const TInt KMaxRrlpReferenceNumber = 7; |
|
51 |
|
52 |
|
53 /** |
|
54 Constant for adjustment for zero offset differences. |
|
55 |
|
56 For ASN1 "CHOICE" types, the ASN1 compiler generates type defines with a +1 |
|
57 offset to more easily access union elements describing the choice content. |
|
58 This is not an issue programatically, however must be adjusted when the CHOICE |
|
59 type is directly stored as a datum, for example SatStatus in the Navigation |
|
60 Model assistance data element. |
|
61 |
|
62 @internalTechnology |
|
63 */ |
|
64 const TInt EZeroOffsetAdjust = 1; |
|
65 |
|
66 /** |
|
67 RRLP Session Reference. |
|
68 |
|
69 Extended in RRLP Release 5 to contain optional extension parameters. |
|
70 These are populated if and only if the initial message sent by the SLP |
|
71 contains the extension parameters. |
|
72 |
|
73 @internalTechnology |
|
74 */ |
|
75 NONSHARABLE_CLASS(TRrlpReference) |
|
76 { |
|
77 public: |
|
78 TInt aRefNum; // 0..7 |
|
79 TBool aRel5EntendedRefPresent; |
|
80 TInt aRel5SmlcCode; // 0..63 |
|
81 TInt aRel5TransactionId; // 0..262143 |
|
82 }; |
|
83 |
|
84 |
|
85 /** |
|
86 RRLP Message Base Class |
|
87 |
|
88 @internalTechnology |
|
89 |
|
90 */ |
|
91 NONSHARABLE_CLASS(CRrlpMessageBase) : public CSuplPosPayload |
|
92 { |
|
93 protected: |
|
94 CRrlpMessageBase(TSuplPosPayloadType aType, TBool aIsOutgoingMsg); |
|
95 void ConstructL(); |
|
96 |
|
97 public: |
|
98 virtual ~CRrlpMessageBase(); |
|
99 |
|
100 public: |
|
101 /** Set the reference component (for outgoing messages) */ |
|
102 IMPORT_C TInt SetReference(const TRrlpReference& aRrlpRef); |
|
103 |
|
104 /** Populates aRrlpRef with the received reference component (for received messages) */ |
|
105 IMPORT_C TInt GetReference(TRrlpReference& aRrlpRef); |
|
106 |
|
107 /** Encode a populated (outgoing) RRLP message */ |
|
108 IMPORT_C TInt EncodeToL(TPtr8& aBuf); |
|
109 |
|
110 public: |
|
111 /** Assign decoded ASN1 data, for received messages. |
|
112 Not intended for DLL export */ |
|
113 void SetDecodedData(ASN1T_PDU* aData, ASN1C_PDU* aControl); |
|
114 |
|
115 /** Prints the content payload data structure to the logger */ |
|
116 void LogMessageContent(); |
|
117 |
|
118 private: |
|
119 /** Prohibit copy constructor */ |
|
120 CRrlpMessageBase(const CRrlpMessageBase&); |
|
121 |
|
122 /** Prohibit assigment operator */ |
|
123 CRrlpMessageBase& operator= (const CRrlpMessageBase&); |
|
124 |
|
125 protected: |
|
126 /** Methods for delivering received assistance data */ |
|
127 TInt BuildAssistanceData(TLbsAsistanceDataGroup& aDataMask, RLbsAssistanceDataBuilderSet& aAssistanceDataBuilderSet, ASN1T_ControlHeader& aGpsData); |
|
128 void WriteReferenceLocationData(RReferenceLocationBuilder* aReferenceLocationBuilder, ASN1T_ControlHeader& aGpsData); |
|
129 void WriteReferenceTimeData(RUEPositioningGpsReferenceTimeBuilder* aReferenceTimeBuilder, ASN1T_ControlHeader& aGpsData); |
|
130 void WriteNavigationModelData(RUEPositioningGpsNavigationModelBuilder* aGpsNavigationModelBuilder, ASN1T_ControlHeader& aGpsData); |
|
131 void WriteNavigationModelSatInfo(RNavigationModelSatInfoBuilder* aNavigationModelSatInfoBuilder, ASN1T_NavModelElement& aSatInfo); |
|
132 void WriteSatInfoEphemeris(RNavigationModelSatInfoBuilder* aNavigationModelSatInfoBuilder, ASN1T_UncompressedEphemeris& aSatEphemeris); |
|
133 void WriteIonosphericModelData(RUEPositioningGpsIonosphericModelBuilder* aGpsIonosphericModelBuilder, ASN1T_ControlHeader& aGpsData); |
|
134 void WriteUtcModelData(RUEPositioningGpsUtcModelBuilder* aGpsUtcModelBuilder, ASN1T_ControlHeader& aGpsData); |
|
135 void WriteAlmanacData(RUEPositioningGpsAlmanacBuilder* aGpsAlmanacBuilder, ASN1T_ControlHeader& aGpsData); |
|
136 void WriteAlmanacSatInfo(RAlmanacSatInfoBuilder* aAlmanacSatInfoBuilder, ASN1T_AlmanacElement& aAlmanacElement); |
|
137 void WriteAcquisitionAssistanceData(RUEPositioningGpsAcquisitionAssistanceBuilder* aGpsAcquisitionAssistanceBuilder, ASN1T_ControlHeader& aGpsData); |
|
138 void WriteAcquisAssistSatInfo(RAcquisitionSatInfoBuilder* aAcquisitionSatInfoBuilder, ASN1T_AcquisElement& aAcquisAssistElement); |
|
139 void WriteRealTimeIntegrityData(RBadSatListBuilder* aBadSatListBuilder, ASN1T_ControlHeader& aGpsData); |
|
140 |
|
141 /** virtual methods for setting/getting extended reference fields |
|
142 Default implementation is empty */ |
|
143 virtual TInt SetExtendedReference(const TRrlpReference& aRrlpRef); |
|
144 virtual TInt GetExtendedReference(TRrlpReference& aRrlpRef); |
|
145 |
|
146 /** Checks control structure for error, and leaves if one has occurred */ |
|
147 void LeaveIfAllocErrorL(); |
|
148 |
|
149 /** Translates errors returned by the ASN1 runtime library */ |
|
150 TInt ProcessAsn1Error(TInt aError); |
|
151 |
|
152 protected: |
|
153 |
|
154 /** Message data content */ |
|
155 ASN1T_PDU* iData; |
|
156 ASN1C_PDU* iControl; |
|
157 |
|
158 // Buffer management object for encoding ASN.1 PER data stream |
|
159 ASN1PEREncodeBuffer* iEncodeBuffer; |
|
160 |
|
161 }; |
|
162 |
|
163 #endif //RRLP_MESSAGE_BASE_H |
|
164 |
|
165 |
|