|
1 /* |
|
2 * Copyright (c) 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #include "mcecommsrpsink.h" |
|
22 #include "mcecommediastream.h" |
|
23 #include "mcecomsession.h" |
|
24 #include "mcemsrpsink.h" |
|
25 #include "mceserial.h" |
|
26 |
|
27 #ifdef MCE_COMMON_SERVER_SIDE |
|
28 |
|
29 #include <mmccInterface.h> |
|
30 #include "mcesdpsession.h" |
|
31 #include "mcemediamanager.h" |
|
32 |
|
33 #endif//MCE_COMMON_SERVER_SIDE |
|
34 |
|
35 // ============================ MEMBER FUNCTIONS =============================== |
|
36 |
|
37 |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // CMceComAvSink::NewL |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 CMceComMsrpSink* CMceComMsrpSink::NewL() |
|
44 { |
|
45 CMceComMsrpSink* self = NewLC(); |
|
46 CleanupStack::Pop( self ); |
|
47 return self; |
|
48 } |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // CMceComMsrpSink::NewLC |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 CMceComMsrpSink* CMceComMsrpSink::NewLC() |
|
55 { |
|
56 CMceComMsrpSink* self = new (ELeave) CMceComMsrpSink(); |
|
57 CleanupStack::PushL( self ); |
|
58 self->ConstructL(); |
|
59 return self; |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CMceComMsrpSink::~CMceComMsrpSink |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 CMceComMsrpSink::~CMceComMsrpSink() |
|
67 { |
|
68 iPath.ResetAndDestroy(); |
|
69 delete iFileName; |
|
70 delete iSessInfo; |
|
71 delete iFileType; |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CMceComMsrpSink::CMceComMsrpSink |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 CMceComMsrpSink::CMceComMsrpSink() |
|
79 :CMceComMediaSink( KMceMSRPSink), |
|
80 iPath(KMceArrayGranularity), |
|
81 iSessInfo(NULL), |
|
82 iAcceptTypes(KMceArrayGranularity), |
|
83 iAcceptWrappedTypes (KMceAcceptWrappedTypes), |
|
84 iWrappedTypes(EFalse), |
|
85 iFileShare(EFalse), |
|
86 iFileName(NULL) |
|
87 |
|
88 { |
|
89 } |
|
90 |
|
91 void CMceComMsrpSink::ConstructL(CMceComMsrpSink& aSource ) |
|
92 { |
|
93 iPath.ResetAndDestroy(); |
|
94 for(int i=0;i<aSource.iPath.Count();i++) |
|
95 { |
|
96 //TUriParser8 parser; |
|
97 TUriParser8* parser = new (ELeave) TUriParser8; |
|
98 parser->Parse(aSource.iPath[i]->UriDes()); |
|
99 CleanupStack::PushL(parser); |
|
100 iPath.AppendL(parser); |
|
101 CleanupStack::Pop(parser); |
|
102 } |
|
103 if (iSessInfo!=NULL) |
|
104 { |
|
105 delete iSessInfo; |
|
106 iSessInfo = NULL; |
|
107 } |
|
108 if (aSource.iSessInfo!=NULL) |
|
109 { |
|
110 iSessInfo = aSource.iSessInfo->Des().AllocL(); |
|
111 } |
|
112 for(int i=0; i<aSource.iAcceptTypes.MdcaCount();i++) |
|
113 { |
|
114 iAcceptTypes.AppendL(aSource.iAcceptTypes.MdcaPoint(i) ); |
|
115 } |
|
116 iAcceptWrappedTypes = aSource.iAcceptWrappedTypes; |
|
117 iWrappedTypes = aSource.iWrappedTypes; |
|
118 iFileShare = aSource.iFileShare; |
|
119 if (iFileName!=NULL) |
|
120 { |
|
121 delete iFileName; |
|
122 iFileName = NULL; |
|
123 } |
|
124 if (aSource.iFileName!=NULL) |
|
125 { |
|
126 iFileName = aSource.iFileName->Des().AllocL(); |
|
127 } |
|
128 iFileSize = aSource.iFileSize; |
|
129 iFileTransferid = aSource.iFileTransferid; |
|
130 iDispositionValue = aSource.iDispositionValue; |
|
131 iSecureConnection = aSource.iSecureConnection; |
|
132 if (iFileType!=NULL) |
|
133 { |
|
134 delete iFileType; |
|
135 iFileType = NULL; |
|
136 } |
|
137 if (aSource.iFileType!=NULL) |
|
138 { |
|
139 iFileType = aSource.iFileType->Des().AllocL(); |
|
140 } |
|
141 iFTProgressNotification = aSource.iFTProgressNotification; |
|
142 } |
|
143 |
|
144 |
|
145 void CMceComMsrpSink::ConstructL() |
|
146 { |
|
147 iFTProgressNotification = ETrue; |
|
148 } |
|
149 |
|
150 // ----------------------------------------------------------------------------- |
|
151 // CMceComMsrpSink::CloneL |
|
152 // ----------------------------------------------------------------------------- |
|
153 // |
|
154 CMceComMediaSink* CMceComMsrpSink::CloneL() |
|
155 { |
|
156 CMceComMsrpSink* copy = CMceComMsrpSink::NewLC(); |
|
157 copy->ConstructL(*this); |
|
158 CleanupStack::Pop(copy); |
|
159 return copy; |
|
160 } |
|
161 |
|
162 |
|
163 // ----------------------------------------------------------------------------- |
|
164 // CMceComMsrpSink::InternalizeFlatL |
|
165 // ----------------------------------------------------------------------------- |
|
166 // |
|
167 void CMceComMsrpSink::InternalizeFlatL( RReadStream& aReadStream ) |
|
168 { |
|
169 CMceComMediaSink::InternalizeFlatL( aReadStream ); |
|
170 MceSerial::DecodeL(this->iPath, aReadStream); |
|
171 MceSerial::DecodeL(this->iSessInfo, aReadStream); |
|
172 CDesC8Array* array = NULL; |
|
173 MceSerial::DecodeL(array, aReadStream); |
|
174 if (array) |
|
175 { |
|
176 this->iAcceptTypes.Reset(); |
|
177 for (TInt i=0;i<array->MdcaCount();i++) |
|
178 { |
|
179 |
|
180 this->iAcceptTypes.AppendL(array->MdcaPoint(i)); |
|
181 |
|
182 } |
|
183 delete array; // free up the memory |
|
184 } |
|
185 MceSerial::DecodeL(this->iAcceptWrappedTypes, aReadStream); |
|
186 this->iWrappedTypes = aReadStream.ReadInt8L(); |
|
187 this->iFileShare = aReadStream.ReadInt8L(); |
|
188 MceSerial::DecodeL(this->iFileName, aReadStream); |
|
189 this->iFileSize = aReadStream.ReadUint32L(); |
|
190 MceSerial::DecodeL(this->iFileType, aReadStream); |
|
191 MceSerial::DecodeL(this->iFileTransferid, aReadStream); |
|
192 MceSerial::DecodeL(this->iDispositionValue, aReadStream); |
|
193 this->iSecureConnection = aReadStream.ReadInt8L(); |
|
194 MceSerial::DecodeL(this->iFilePath, aReadStream); |
|
195 this->iFTProgressNotification = aReadStream.ReadInt8L(); |
|
196 } |
|
197 |
|
198 // ----------------------------------------------------------------------------- |
|
199 // CMceComMsrpSink::ExternalizeFlatL |
|
200 // ----------------------------------------------------------------------------- |
|
201 // |
|
202 void CMceComMsrpSink::ExternalizeFlatL( RWriteStream& aWriteStream ) |
|
203 { |
|
204 CMceComMediaSink::ExternalizeFlatL( aWriteStream ); |
|
205 |
|
206 MceSerial::EncodeL(this->iPath, aWriteStream); |
|
207 MceSerial::EncodeL(this->iSessInfo, aWriteStream); |
|
208 MceSerial::EncodeL(&(this->iAcceptTypes), aWriteStream); |
|
209 MceSerial::EncodeL(this->iAcceptWrappedTypes, aWriteStream); |
|
210 aWriteStream.WriteInt8L(this->iWrappedTypes); |
|
211 aWriteStream.WriteInt8L(this->iFileShare); |
|
212 MceSerial::EncodeL(this->iFileName, aWriteStream); |
|
213 aWriteStream.WriteUint32L(this->iFileSize); |
|
214 MceSerial::EncodeL(this->iFileType, aWriteStream); |
|
215 MceSerial::EncodeL(this->iFileTransferid, aWriteStream); |
|
216 MceSerial::EncodeL(this->iDispositionValue, aWriteStream); |
|
217 aWriteStream.WriteInt8L(this->iSecureConnection); |
|
218 MceSerial::EncodeL(this->iFilePath, aWriteStream); |
|
219 aWriteStream.WriteInt8L(this->iFTProgressNotification); |
|
220 } |
|
221 |
|
222 // ----------------------------------------------------------------------------- |
|
223 // CMceComMsrpSink::UpdateL |
|
224 // ----------------------------------------------------------------------------- |
|
225 // |
|
226 void CMceComMsrpSink::UpdateL( CMceComMediaSink& aUpdate ) |
|
227 { |
|
228 CMceComMediaSink::UpdateL( aUpdate ); |
|
229 CMceComMsrpSink& update = static_cast<CMceComMsrpSink&>( aUpdate ); |
|
230 |
|
231 //Set MSRP path member |
|
232 |
|
233 if (update.iPath.Count() > 0) |
|
234 { |
|
235 iPath.ResetAndDestroy(); |
|
236 for(int i=0;i<update.iPath.Count();i++) |
|
237 { |
|
238 TUriParser8* parser = new (ELeave) TUriParser8; |
|
239 CleanupStack::PushL(parser); |
|
240 User::LeaveIfError(parser->Parse(update.iPath[i]->UriDes()) ); |
|
241 iPath.AppendL(parser); |
|
242 CleanupStack::Pop(parser); |
|
243 } |
|
244 } |
|
245 |
|
246 //Set Accept-types member |
|
247 if (update.iAcceptTypes.MdcaCount() > 0) |
|
248 { |
|
249 iAcceptTypes.Reset(); |
|
250 for(int i=0; i<update.iAcceptTypes.MdcaCount();i++) |
|
251 { |
|
252 iAcceptTypes.AppendL(update.iAcceptTypes.MdcaPoint(i)); |
|
253 } |
|
254 } |
|
255 |
|
256 //Set secureconneciton member |
|
257 if (iSecureConnection != update.iSecureConnection) |
|
258 { |
|
259 iSecureConnection = update.iSecureConnection; |
|
260 } |
|
261 |
|
262 if (update.iAcceptWrappedTypes.Size()) |
|
263 { |
|
264 iAcceptWrappedTypes = update.iAcceptWrappedTypes; |
|
265 iWrappedTypes = update.iWrappedTypes; |
|
266 } |
|
267 // look for the updaitons for file share attributes |
|
268 this->UpdateFileShareAttrL(update); |
|
269 if (update.iSessInfo != NULL ) |
|
270 { |
|
271 delete iSessInfo ; |
|
272 iSessInfo = NULL; |
|
273 iSessInfo = update.iSessInfo->Des().AllocL() ; |
|
274 } |
|
275 |
|
276 iFTProgressNotification = update.iFTProgressNotification; |
|
277 } |
|
278 |
|
279 void CMceComMsrpSink::UpdateFileShareAttrL(CMceComMsrpSink& aUpdate ) |
|
280 { |
|
281 //Set FileSharing Attributes |
|
282 if(aUpdate.iFileShare || aUpdate.iFileTransferid.Length() || aUpdate.iDispositionValue.Size() ) |
|
283 { |
|
284 iFileShare = aUpdate.iFileShare; |
|
285 if (iFileName!=NULL ) |
|
286 { |
|
287 delete iFileName; |
|
288 iFileName = NULL; |
|
289 } |
|
290 iFileName = aUpdate.iFileName->Des().AllocL(); |
|
291 iFileSize = aUpdate.iFileSize; |
|
292 if (iFileType!=NULL ) |
|
293 { |
|
294 delete iFileType; |
|
295 iFileType = NULL; |
|
296 } |
|
297 iFileType = aUpdate.iFileType->Des().AllocL(); |
|
298 //iFileType = aUpdate.iFileType; |
|
299 iFileTransferid = aUpdate.iFileTransferid; |
|
300 iDispositionValue = aUpdate.iDispositionValue; |
|
301 } |
|
302 } |
|
303 |
|
304 // ----------------------------------------------------------------------------- |
|
305 // CMceComMsrpSink::UseRTCP |
|
306 // ----------------------------------------------------------------------------- |
|
307 // |
|
308 TBool CMceComMsrpSink::UseRTCP() |
|
309 { |
|
310 return EFalse; |
|
311 } |
|
312 |
|
313 #ifdef MCE_COMMON_SERVER_SIDE |
|
314 |
|
315 // ----------------------------------------------------------------------------- |
|
316 // CMceComMsrpSink::MccType |
|
317 // ----------------------------------------------------------------------------- |
|
318 // |
|
319 const TUid CMceComMsrpSink::MccType() |
|
320 { |
|
321 return KUidMccMsrpSink; |
|
322 } |
|
323 |
|
324 // ----------------------------------------------------------------------------- |
|
325 // CMceComMsrpSink::PrepareL |
|
326 // ----------------------------------------------------------------------------- |
|
327 // |
|
328 void CMceComMsrpSink::PrepareL() |
|
329 { |
|
330 //NOP // Not required as the data path for message stream will be handled by applications |
|
331 } |
|
332 |
|
333 #endif//MCE_COMMON_SERVER_SIDE |
|
334 |