1 /* |
|
2 * Copyright (c) 2006-2007 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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <s32strm.h> |
|
20 |
|
21 #include "irdebug.h" |
|
22 #include "irotaupdate.h" |
|
23 |
|
24 // ======== LOCAL FUNCTIONS ======== |
|
25 |
|
26 // ======== MEMBER FUNCTIONS ======== |
|
27 |
|
28 //---------------------------------------------------------------------------- |
|
29 // Function : NewLC |
|
30 // Function returns an instance of CIROTAUpdate |
|
31 // Two phase constructor |
|
32 //---------------------------------------------------------------------------- |
|
33 // |
|
34 EXPORT_C CIROTAUpdate* CIROTAUpdate::NewLC() |
|
35 { |
|
36 IRLOG_DEBUG( "CIROTAUpdate::NewLC - Entering" ); |
|
37 CIROTAUpdate* self = new (ELeave) CIROTAUpdate; |
|
38 CleanupStack::PushL(self); |
|
39 self->ConstructL(); |
|
40 IRLOG_DEBUG( "CIROTAUpdate::NewLC - Exiting." ); |
|
41 return self; |
|
42 } |
|
43 |
|
44 |
|
45 //---------------------------------------------------------------------------- |
|
46 // Function : NewL |
|
47 // Function returns an instance of CIROTAUpdate |
|
48 // Two phase constructor |
|
49 //---------------------------------------------------------------------------- |
|
50 // |
|
51 EXPORT_C CIROTAUpdate* CIROTAUpdate::NewL() |
|
52 { |
|
53 IRLOG_DEBUG( "CIROTAUpdate::NewL - Entering" ); |
|
54 CIROTAUpdate* self = CIROTAUpdate::NewLC(); |
|
55 CleanupStack::Pop(self); |
|
56 IRLOG_DEBUG( "CIROTAUpdate::NewL - Exiting." ); |
|
57 return self; |
|
58 } |
|
59 |
|
60 |
|
61 //---------------------------------------------------------------------------- |
|
62 //CIROTAUpdate::ConstructL() |
|
63 //standard second phase constructor |
|
64 //---------------------------------------------------------------------------- |
|
65 // |
|
66 EXPORT_C void CIROTAUpdate::ConstructL() |
|
67 { |
|
68 IRLOG_DEBUG( "CIROTAUpdate::ConstructL" ); |
|
69 return; |
|
70 } |
|
71 |
|
72 |
|
73 //---------------------------------------------------------------------------- |
|
74 //CIROTAUpdate::~CIROTAUpdate() |
|
75 //standard C++ destructor |
|
76 //---------------------------------------------------------------------------- |
|
77 // |
|
78 CIROTAUpdate::~CIROTAUpdate() |
|
79 { |
|
80 IRLOG_DEBUG( "CIROTAUpdate::~CIROTAUpdate - Entering" ); |
|
81 delete iUpdateMethod; |
|
82 delete iVersion; |
|
83 delete iOTAUrl; |
|
84 IRLOG_DEBUG( "CIROTAUpdate::~CIROTAUpdate - Exiting." ); |
|
85 } |
|
86 |
|
87 |
|
88 //---------------------------------------------------------------------------- |
|
89 //CIROTAUpdate::SetUpdateMethod() |
|
90 //Function to set update method |
|
91 //---------------------------------------------------------------------------- |
|
92 // |
|
93 EXPORT_C void CIROTAUpdate::SetUpdateMethod(const TDesC& aUpdateMethod) |
|
94 { |
|
95 IRLOG_DEBUG( "CIROTAUpdate::SetUpdateMethod - Entering" ); |
|
96 iUpdateMethod=aUpdateMethod.Alloc(); |
|
97 IRLOG_DEBUG( "CIROTAUpdate::SetUpdateMethod - Exiting." ); |
|
98 } |
|
99 |
|
100 |
|
101 //---------------------------------------------------------------------------- |
|
102 //CIROTAUpdate::SetVersion() |
|
103 //Function to set version |
|
104 //---------------------------------------------------------------------------- |
|
105 // |
|
106 EXPORT_C void CIROTAUpdate::SetVersion(const TDesC& aVersion) |
|
107 { |
|
108 IRLOG_DEBUG( "CIROTAUpdate::SetVersion - Entering" ); |
|
109 iVersion=aVersion.Alloc(); |
|
110 IRLOG_DEBUG( "CIROTAUpdate::SetVersion - Exiting." ); |
|
111 } |
|
112 |
|
113 |
|
114 //---------------------------------------------------------------------------- |
|
115 //CIROTAUpdate::SetUpdateInterval() |
|
116 //Function to set update interval |
|
117 //---------------------------------------------------------------------------- |
|
118 // |
|
119 EXPORT_C void CIROTAUpdate::SetUpdateInterval(const TDesC& aUpdateInterval) |
|
120 { |
|
121 IRLOG_DEBUG( "CIROTAUpdate::SetUpdateInterval - Entering" ); |
|
122 TLex var(aUpdateInterval); |
|
123 var.Val(iUpdateInterval); |
|
124 IRLOG_DEBUG( "CIROTAUpdate::SetUpdateInterval - Exiting." ); |
|
125 } |
|
126 |
|
127 |
|
128 //---------------------------------------------------------------------------- |
|
129 //CIROTAUpdate::SetOTAUrl() |
|
130 //Function to set OTA Url |
|
131 //---------------------------------------------------------------------------- |
|
132 // |
|
133 EXPORT_C void CIROTAUpdate::SetOTAUrl(const TDesC& aOTAUrl) |
|
134 { |
|
135 IRLOG_DEBUG( "CIROTAUpdate::SetOTAUrl - Entering" ); |
|
136 iOTAUrl=aOTAUrl.Alloc(); |
|
137 IRLOG_DEBUG( "CIROTAUpdate::SetOTAUrl - Exiting." ); |
|
138 } |
|
139 // --------------------------------------------------------------------------- |
|
140 //CIROTAUpdate::ExternalizeL() |
|
141 //externalizes the data |
|
142 // --------------------------------------------------------------------------- |
|
143 // |
|
144 EXPORT_C void CIROTAUpdate::ExternalizeL(RWriteStream& aStream) const |
|
145 { |
|
146 IRLOG_DEBUG( "CIROTAUpdate::ExternalizeL - Entering" ); |
|
147 aStream.WriteInt32L(iUpdateInterval); |
|
148 TInt length; |
|
149 if(iVersion) |
|
150 { |
|
151 length = iVersion->Length(); |
|
152 aStream.WriteInt32L(length); |
|
153 aStream << *iVersion; |
|
154 } |
|
155 else |
|
156 { |
|
157 length = 0; |
|
158 aStream.WriteInt32L(length); |
|
159 } |
|
160 |
|
161 if(iOTAUrl) |
|
162 { |
|
163 length = iOTAUrl->Length(); |
|
164 aStream.WriteInt32L(length); |
|
165 aStream << *iOTAUrl; |
|
166 } |
|
167 else |
|
168 { |
|
169 length = 0; |
|
170 aStream.WriteInt32L(length); |
|
171 } |
|
172 |
|
173 if(iUpdateMethod) |
|
174 { |
|
175 length = iUpdateMethod->Length(); |
|
176 aStream.WriteInt32L(length); |
|
177 aStream << *iUpdateMethod; |
|
178 } |
|
179 else |
|
180 { |
|
181 length = 0; |
|
182 aStream.WriteInt32L(length); |
|
183 } |
|
184 IRLOG_DEBUG( "CIROTAUpdate::ExternalizeL - Exiting." ); |
|
185 } |
|
186 |
|
187 |
|
188 // --------------------------------------------------------------------------- |
|
189 //CIROTAUpdate::InternalizeL() |
|
190 //internalizes the data. |
|
191 // --------------------------------------------------------------------------- |
|
192 // |
|
193 EXPORT_C void CIROTAUpdate::InternalizeL(RReadStream& aStream) |
|
194 { |
|
195 IRLOG_DEBUG( "CIROTAUpdate::InternalizeL - Entering" ); |
|
196 TInt length; |
|
197 iUpdateInterval=aStream.ReadInt32L(); |
|
198 length = aStream.ReadInt32L(); |
|
199 |
|
200 if(length) |
|
201 { |
|
202 iVersion = HBufC::NewL(aStream,length); |
|
203 } |
|
204 |
|
205 length = aStream.ReadInt32L(); |
|
206 if(length) |
|
207 { |
|
208 iOTAUrl = HBufC::NewL(aStream,length); |
|
209 } |
|
210 |
|
211 length = aStream.ReadInt32L(); |
|
212 if(length) |
|
213 { |
|
214 iUpdateMethod = HBufC::NewL(aStream,length); |
|
215 } |
|
216 IRLOG_DEBUG( "CIRBrowseCatagoryItems::InternalizeL - Exiting." ); |
|
217 } |
|
218 |
|
219 |
|