|
1 // Copyright (c) 1999-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 // GsmuMsgAdditionalAttributes.cpp |
|
15 // |
|
16 // |
|
17 |
|
18 #include "gsmumsgadditionalattributes.h" |
|
19 #include "smsstacklog.h" |
|
20 |
|
21 |
|
22 CSmsMessageAdditionalAttributes* CSmsMessageAdditionalAttributes::NewL() |
|
23 { |
|
24 LOGGSMU1("CSmsMessageAdditionalAttributes::NewL()"); |
|
25 |
|
26 CSmsMessageAdditionalAttributes* additionalAttributes=new(ELeave) CSmsMessageAdditionalAttributes(); |
|
27 CleanupStack::PushL(additionalAttributes); |
|
28 additionalAttributes->ConstructL(); |
|
29 CleanupStack::Pop(); |
|
30 return additionalAttributes; |
|
31 } // CSmsMessageAdditionalAttributes::NewL |
|
32 |
|
33 |
|
34 CSmsMessageAdditionalAttributes::CSmsMessageAdditionalAttributes() |
|
35 { |
|
36 // NOP |
|
37 } // CSmsMessageAdditionalAttributes::CSmsMessageAdditionalAttributes |
|
38 |
|
39 |
|
40 CSmsMessageAdditionalAttributes::~CSmsMessageAdditionalAttributes() |
|
41 { |
|
42 LOGGSMU1("CSmsMessageAdditionalAttributes::~CSmsMessageAdditionalAttributes()"); |
|
43 |
|
44 iSmsPDUArray.ResetAndDestroy(); |
|
45 |
|
46 for (TInt category = 0; category < TSmsInformationElementCategories::ENumberOfCategories; category++) |
|
47 { |
|
48 if (iCollectionOfPointersToIEArrays[category] != NULL) |
|
49 { |
|
50 iCollectionOfPointersToIEArrays[category]->ResetAndDestroy(); |
|
51 } |
|
52 |
|
53 delete iCollectionOfPointersToIEArrays[category]; |
|
54 } |
|
55 |
|
56 delete iHyperLinkOperations; |
|
57 delete iReplyAddressOperations; |
|
58 delete iSpecialSMSMessageOperations; |
|
59 delete iEnhancedVoiceMailOperations; |
|
60 delete iSMSCCtrlParameterOperations; |
|
61 delete iTPSRROperations; |
|
62 delete iStatusReportScheme; |
|
63 delete iIncompleteClass0MessageInfo; |
|
64 } // CSmsMessageAdditionalAttributes::CSmsMessageAdditionalAttributes |
|
65 |
|
66 |
|
67 void CSmsMessageAdditionalAttributes::ConstructL() |
|
68 { |
|
69 LOGGSMU1("CSmsMessageAdditionalAttributes::ConstructL()"); |
|
70 |
|
71 iStatusReportScheme = new (ELeave) CSmsMessageAdditionalAttributes::CDefaultScheme(); |
|
72 |
|
73 for (TInt category = 0; category < TSmsInformationElementCategories::ENumberOfCategories; category++) |
|
74 { |
|
75 iCollectionOfPointersToIEArrays[category] = new (ELeave) CArrayOfPointersToControlInformationElements(8); |
|
76 } |
|
77 } // CSmsMessageAdditionalAttributes::ConstructL |
|
78 |
|
79 |
|
80 void CSmsMessageAdditionalAttributes::AddControlInformationElementL(CSmsInformationElement* aIE) |
|
81 { |
|
82 LOGGSMU1("CSmsMessageAdditionalAttributes::AddControlInformationElementL()"); |
|
83 |
|
84 TSmsInformationElementCategories::TInformationElementCategory category; |
|
85 if (aIE != NULL) |
|
86 { |
|
87 if (TSmsInformationElementCategories::GetCategoryDefinition(aIE->Identifier(), category)) |
|
88 { |
|
89 AddControlInformationElementL(category,aIE); |
|
90 } |
|
91 else |
|
92 { |
|
93 LOGGSMU1("CSmsMessageAdditionalAttributes::AddControlInformationElementL, aIE->Identifier() is invalid"); |
|
94 User::Leave(KErrArgument); |
|
95 } |
|
96 } |
|
97 else |
|
98 { |
|
99 LOGGSMU1("CSmsMessageAdditionalAttributes::AddControlInformationElementL, aIE == NULL"); |
|
100 User::Leave(KErrArgument); |
|
101 } |
|
102 } // CSmsMessageAdditionalAttributes::AddControlInformationElementL |
|
103 |
|
104 |
|
105 TBool CSmsMessageAdditionalAttributes::Find1stInstanceOfControlInformationElement(TInformationElementId aId, TUint& aIndex) const |
|
106 { |
|
107 LOGGSMU1("CSmsMessageAdditionalAttributes::Find1stInstanceOfControlInformationElement()"); |
|
108 |
|
109 TBool rc = EFalse; |
|
110 TSmsInformationElementCategories::TInformationElementCategory category; |
|
111 |
|
112 if (TSmsInformationElementCategories::GetCategoryDefinition(aId, category)) |
|
113 { |
|
114 TInt count=iCollectionOfPointersToIEArrays[category]->Count(); |
|
115 for (TInt i=0; i<count; i++) |
|
116 { |
|
117 if (iCollectionOfPointersToIEArrays[category]->operator[](i)->Identifier()==aId) |
|
118 { |
|
119 aIndex=i; |
|
120 rc=ETrue; |
|
121 break; |
|
122 } |
|
123 } |
|
124 } |
|
125 return rc; |
|
126 } // CSmsMessageAdditionalAttributes::Find1stInstanceOfControlInformationElement |
|
127 |
|
128 |
|
129 TBool CSmsMessageAdditionalAttributes::FindNextInstanceOfControlInformationElement(TInformationElementId aId, TUint aStartIndex, TUint& aIndex) const |
|
130 { |
|
131 LOGGSMU1("CSmsMessageAdditionalAttributes::FindNextInstanceOfControlInformationElement()"); |
|
132 |
|
133 TBool rc = EFalse; |
|
134 TSmsInformationElementCategories::TInformationElementCategory category; |
|
135 |
|
136 if (TSmsInformationElementCategories::GetCategoryDefinition(aId, category)) |
|
137 { |
|
138 TInt count=iCollectionOfPointersToIEArrays[category]->Count(); |
|
139 for (TInt i =aStartIndex + 1; i<count; i++) |
|
140 { |
|
141 if (iCollectionOfPointersToIEArrays[category]->operator[](i)->Identifier()==aId) |
|
142 { |
|
143 aIndex=i; |
|
144 rc=ETrue; |
|
145 break; |
|
146 } |
|
147 } |
|
148 } |
|
149 |
|
150 return rc; |
|
151 } // CSmsMessageAdditionalAttributes::FindNextInstanceOfControlInformationElement |
|
152 |
|
153 |
|
154 CSmsInformationElement& CSmsMessageAdditionalAttributes::GetControlInformationElementL(TInformationElementId aId, TUint aIndex) const |
|
155 { |
|
156 LOGGSMU1("CSmsMessageAdditionalAttributes::GetControlInformationElementL()"); |
|
157 |
|
158 |
|
159 TSmsInformationElementCategories::TInformationElementCategory category; |
|
160 |
|
161 if (TSmsInformationElementCategories::GetCategoryDefinition(aId, category) == EFalse) |
|
162 { |
|
163 User::Leave(KErrArgument); |
|
164 } |
|
165 |
|
166 if (aIndex >= iCollectionOfPointersToIEArrays[category]->Count()) |
|
167 { |
|
168 LOGGSMU3("CSmsMessageAdditionalAttributes::GetControlInformationElementL aId = %d , aIndex = %d", aId, aIndex); |
|
169 LOGGSMU2("CSmsMessageAdditionalAttributes::GetControlInformationElementL Count = %d", iCollectionOfPointersToIEArrays[category]->Count()); |
|
170 User::Leave(KErrArgument); |
|
171 } |
|
172 |
|
173 if (iCollectionOfPointersToIEArrays[category]->operator[](aIndex) == NULL) |
|
174 { |
|
175 LOGGSMU3("CSmsMessageAdditionalAttributes::GetControlInformationElementL aId = %d , aIndex = %d", aId, aIndex); |
|
176 User::Leave(KErrArgument); |
|
177 } |
|
178 |
|
179 if (iCollectionOfPointersToIEArrays[category]->operator[](aIndex)->Identifier()!=aId) |
|
180 { |
|
181 LOGGSMU3("CSmsMessageAdditionalAttributes::GetControlInformationElementL aId = %d, aIndex = %d", aId, aIndex); |
|
182 LOGGSMU2("CSmsMessageAdditionalAttributes::GetControlInformationElementL id = %d", iCollectionOfPointersToIEArrays[category]->operator[](aIndex)->Identifier()); |
|
183 User::Leave(KErrArgument); |
|
184 } |
|
185 |
|
186 CSmsInformationElement* ie = iCollectionOfPointersToIEArrays[category]->operator[](aIndex); |
|
187 return *ie; |
|
188 } // CSmsMessageAdditionalAttributes::GetControlInformationElementL |
|
189 |
|
190 |
|
191 TBool CSmsMessageAdditionalAttributes::RemoveControlInformationElement(TInformationElementId aId, TUint aIndex, CSmsInformationElementPtr& aIE) |
|
192 { |
|
193 LOGGSMU1("CSmsMessageAdditionalAttributes::RemoveControlInformationElement()"); |
|
194 |
|
195 TBool rc = EFalse; |
|
196 TSmsInformationElementCategories::TInformationElementCategory category; |
|
197 |
|
198 if (TSmsInformationElementCategories::GetCategoryDefinition(aId, category)) |
|
199 { |
|
200 if ((iCollectionOfPointersToIEArrays[category]->Count() > aIndex) && |
|
201 (iCollectionOfPointersToIEArrays[category]->operator[](aIndex)->Identifier()==aId)) |
|
202 { |
|
203 aIE = iCollectionOfPointersToIEArrays[category]->operator[](aIndex); |
|
204 iCollectionOfPointersToIEArrays[category]->Delete(aIndex); |
|
205 rc = ETrue; |
|
206 } |
|
207 } |
|
208 |
|
209 return rc; |
|
210 } // CSmsMessageAdditionalAttributes::RemoveControlInformationElement |
|
211 |
|
212 |
|
213 void CSmsMessageAdditionalAttributes::AddControlInformationElementL(TCategory aCategory, CSmsInformationElementPtr aIE) |
|
214 { |
|
215 LOGGSMU1("CSmsMessageAdditionalAttributes::AddControlInformationElementL()"); |
|
216 |
|
217 if ((aIE != NULL) && |
|
218 (aCategory < TSmsInformationElementCategories::ENumberOfCategories)) |
|
219 { |
|
220 iCollectionOfPointersToIEArrays[aCategory]->AppendL(aIE); |
|
221 } |
|
222 else |
|
223 { |
|
224 User::Leave(KErrArgument); |
|
225 } |
|
226 } // CSmsMessageAdditionalAttributes::AddControlInformationElementL |
|
227 |
|
228 |
|
229 TBool CSmsMessageAdditionalAttributes::RemoveNextControlInformationElement(TCategory aCategory, CSmsInformationElementPtr& aIEPtr) |
|
230 { |
|
231 LOGGSMU1("CSmsMessageAdditionalAttributes::RemoveNextControlInformationElement()"); |
|
232 |
|
233 TBool rc = EFalse; |
|
234 if (aCategory < TSmsInformationElementCategories::ENumberOfCategories) |
|
235 { |
|
236 TInt tailIndex; |
|
237 if ((tailIndex = (iCollectionOfPointersToIEArrays[aCategory]->Count() - 1)) >= 0) |
|
238 { |
|
239 aIEPtr = (*iCollectionOfPointersToIEArrays[aCategory])[tailIndex]; |
|
240 iCollectionOfPointersToIEArrays[aCategory]->Delete(tailIndex); |
|
241 rc = ETrue; |
|
242 } |
|
243 } |
|
244 return rc; |
|
245 } // CSmsMessageAdditionalAttributes::RemoveNextControlInformationElement |
|
246 |
|
247 |
|
248 CSmsInformationElement& CSmsMessageAdditionalAttributes::GetControlInformationElementL(TCategory aCategory, TUint aIndex) const |
|
249 { |
|
250 LOGGSMU3("CSmsMessageAdditionalAttributes::GetControlInformationElementL(): aCategory=%d, aIndex=%d", |
|
251 aCategory, aIndex); |
|
252 |
|
253 if ((aCategory >= TSmsInformationElementCategories::ENumberOfCategories) || |
|
254 (aIndex >= iCollectionOfPointersToIEArrays[aCategory]->Count())) |
|
255 { |
|
256 LOGGSMU1("CSmsMessageAdditionalAttributes::GetControlInformationElementL: KErrArgument"); |
|
257 User::Leave(KErrArgument); |
|
258 } |
|
259 |
|
260 if ((iCollectionOfPointersToIEArrays[aCategory])->operator[](aIndex) == NULL) |
|
261 { |
|
262 LOGGSMU1("CSmsMessageAdditionalAttributes::GetControlInformationElementL: KErrCorrupt"); |
|
263 User::Leave(KErrCorrupt); |
|
264 } |
|
265 |
|
266 return *(iCollectionOfPointersToIEArrays[aCategory]->operator[](aIndex)); |
|
267 } // CSmsMessageAdditionalAttributes::GetControlInformationElementL |
|
268 |
|
269 |
|
270 void CSmsMessageAdditionalAttributes::DeleteControlInformationElement(TCategory aCategory, TUint8 aIndex) |
|
271 { |
|
272 LOGGSMU1("CSmsMessageAdditionalAttributes::DeleteControlInformationElement()"); |
|
273 |
|
274 if (aCategory < TSmsInformationElementCategories::ENumberOfCategories) |
|
275 { |
|
276 TInt count = iCollectionOfPointersToIEArrays[aCategory]->Count(); |
|
277 if (aIndex < count) |
|
278 { |
|
279 CSmsInformationElement* iE = iCollectionOfPointersToIEArrays[aCategory]->operator[](aIndex); |
|
280 iCollectionOfPointersToIEArrays[aCategory]->Delete(aIndex); |
|
281 // The element being deleted has been removed from iCollectionOfPointersToIEArrays. So, next time it cannot be deleted again. |
|
282 // coverity[double_free] |
|
283 delete iE; |
|
284 } |
|
285 } |
|
286 } // CSmsMessageAdditionalAttributes::DeleteControlInformationElement |
|
287 |
|
288 |
|
289 TUint CSmsMessageAdditionalAttributes::NumberOfControlInformationElements(TCategory aCategory) const |
|
290 { |
|
291 LOGGSMU1("CSmsMessageAdditionalAttributes::NumberOfControlInformationElements1()"); |
|
292 |
|
293 TUint count = 0; |
|
294 |
|
295 if (aCategory < TSmsInformationElementCategories::ENumberOfCategories) |
|
296 { |
|
297 count = iCollectionOfPointersToIEArrays[aCategory]->Count(); |
|
298 } |
|
299 |
|
300 return count; |
|
301 } // CSmsMessageAdditionalAttributes::NumberOfControlInformationElements |
|
302 |
|
303 |
|
304 void CSmsMessageAdditionalAttributes::ExternalizeL(RWriteStream& aStream, TInt aVersion) const |
|
305 { |
|
306 LOGGSMU1("CSmsMessageAdditionalAttributes::ExternalizeL()"); |
|
307 |
|
308 if(aVersion == CSmsMessage::ESmsIncompleteClass0MessageV) |
|
309 { |
|
310 iIncompleteClass0MessageInfo->ExternalizeL(aStream); |
|
311 return; |
|
312 } |
|
313 |
|
314 for (TInt category = 0; category < TSmsInformationElementCategories::ENumberOfCategories; category++) |
|
315 { |
|
316 TUint32 count = iCollectionOfPointersToIEArrays[category]->Count(); |
|
317 |
|
318 aStream.WriteUint32L(count); |
|
319 for (TUint32 j = 0; j < count; j++) |
|
320 { |
|
321 iCollectionOfPointersToIEArrays[category]->operator[](j)->ExternalizeL(aStream); |
|
322 } |
|
323 } |
|
324 |
|
325 if (aVersion == CSmsMessage::ESmsMessageV2 || |
|
326 aVersion == CSmsMessage::ESmsMessageV3 || |
|
327 aVersion == CSmsMessage::ESmsMessageV4) // Status Report Scheme |
|
328 { |
|
329 aStream.WriteInt16L(iStatusReportScheme->Id()); //The Scheme |
|
330 |
|
331 if(iStatusReportScheme->Id() == ETPSRRScheme) |
|
332 { |
|
333 CTPSRRScheme* scheme = (CTPSRRScheme*)iStatusReportScheme; |
|
334 TUint32 count = (scheme->iTPSRRStatusReport).Count(); // TPSRR Array Count |
|
335 aStream << count; |
|
336 for(TInt ii=0; ii<count; ii++) |
|
337 { |
|
338 aStream.WriteUint16L((scheme->iTPSRRStatusReport[ii]).iSegmentSequenceNum); // Segment number |
|
339 aStream.WriteInt16L((scheme->iTPSRRStatusReport[ii]).iTPSRRStatus); // TPSRR Bit |
|
340 } |
|
341 aStream.WriteInt16L(scheme->iDefaultStatusReport); // Default |
|
342 aStream.WriteInt16L(scheme->iNumOfPDUs); |
|
343 } |
|
344 |
|
345 if(iStatusReportScheme->Id() == EControlParametersScheme) |
|
346 { |
|
347 CControlParametersScheme* scheme = (CControlParametersScheme*)iStatusReportScheme; |
|
348 TUint32 count = (scheme->iControlParametersStatusReport).Count(); // Control Params Array Count |
|
349 aStream << count; |
|
350 for(TInt ii=0; ii<count; ii++) |
|
351 { |
|
352 aStream.WriteUint16L((scheme->iControlParametersStatusReport[ii]).iSegmentSequenceNum); // Segment number |
|
353 aStream.WriteInt8L((scheme->iControlParametersStatusReport[ii]).iSelectiveStatus); // Selective Status |
|
354 } |
|
355 aStream.WriteInt8L(scheme->iDefaultStatusReport); // Default |
|
356 aStream.WriteInt16L(scheme->iNumOfPDUs); |
|
357 } |
|
358 } |
|
359 |
|
360 // CSmsMessage::ESmsMessageV3 is the same as CSmsMessage::ESmsIncompleteClass0MessageV! |
|
361 |
|
362 if (aVersion == CSmsMessage::ESmsMessageV4) // National language 7bit encoding support |
|
363 { |
|
364 aStream.WriteInt32L(iAlternative7bitEncoding); |
|
365 } |
|
366 } |
|
367 |
|
368 void CSmsMessageAdditionalAttributes::InternalizeL(RReadStream& aStream, TInt aVersion) |
|
369 { |
|
370 LOGGSMU1("CSmsMessageAdditionalAttributes::InternalizeL()"); |
|
371 |
|
372 if(aVersion == CSmsMessage::ESmsIncompleteClass0MessageV) |
|
373 { |
|
374 iIncompleteClass0MessageInfo->InternalizeL(aStream); |
|
375 return; |
|
376 } |
|
377 |
|
378 for (TInt category = 0; category < TSmsInformationElementCategories::ENumberOfCategories; category++) |
|
379 { |
|
380 TUint32 count = aStream.ReadInt32L(); |
|
381 iCollectionOfPointersToIEArrays[category]->ResetAndDestroy(); |
|
382 |
|
383 for (TInt32 j = 0; j < count; j++) |
|
384 { |
|
385 CSmsInformationElement* informationElement = CSmsInformationElement::NewL(); |
|
386 CleanupStack::PushL(informationElement); |
|
387 aStream >> *informationElement; |
|
388 iCollectionOfPointersToIEArrays[category]->AppendL(informationElement); |
|
389 CleanupStack::Pop(); |
|
390 } |
|
391 } |
|
392 |
|
393 if (aVersion == CSmsMessage::ESmsMessageV2 || |
|
394 aVersion == CSmsMessage::ESmsMessageV3 || |
|
395 aVersion == CSmsMessage::ESmsMessageV4) // Status Report Scheme |
|
396 { |
|
397 TSmsStatusReportScheme schemeId = static_cast<TSmsStatusReportScheme>(aStream.ReadInt16L()); |
|
398 |
|
399 if(schemeId == ETPSRRScheme) |
|
400 { |
|
401 SetStatusReportSchemeL(ETPSRRScheme); |
|
402 CTPSRRScheme* scheme = (CTPSRRScheme*)iStatusReportScheme; |
|
403 |
|
404 TUint32 count = aStream.ReadInt32L(); |
|
405 |
|
406 CSmsMessageAdditionalAttributes::CTPSRRScheme::TSmsTPSRRStatus tpsrrStatus; |
|
407 for(TInt ii=0; ii<count; ii++) |
|
408 { |
|
409 tpsrrStatus.iSegmentSequenceNum = aStream.ReadUint16L(); // Segment number |
|
410 tpsrrStatus.iTPSRRStatus = static_cast<TSmsFirstOctet::TSmsStatusReportRequest>(aStream.ReadInt16L()); // TPSRR Bit |
|
411 (scheme->iTPSRRStatusReport).AppendL(tpsrrStatus); |
|
412 } |
|
413 scheme->iDefaultStatusReport = static_cast<TSmsFirstOctet::TSmsStatusReportRequest>(aStream.ReadInt16L()); |
|
414 scheme->iNumOfPDUs = aStream.ReadInt16L(); |
|
415 } |
|
416 if(schemeId == EControlParametersScheme) |
|
417 { |
|
418 SetStatusReportSchemeL(EControlParametersScheme); |
|
419 CControlParametersScheme* scheme = (CControlParametersScheme*)iStatusReportScheme; |
|
420 |
|
421 TUint32 count = aStream.ReadInt32L(); |
|
422 |
|
423 CSmsMessageAdditionalAttributes::CControlParametersScheme::TSmsSMSCCtrlParameterStatus smscCtrlParameterStatus; |
|
424 for(TInt ii=0; ii<count; ii++) |
|
425 { |
|
426 smscCtrlParameterStatus.iSegmentSequenceNum = aStream.ReadUint16L(); // Segment number |
|
427 smscCtrlParameterStatus.iSelectiveStatus = aStream.ReadInt8L(); // Selective Status |
|
428 (scheme->iControlParametersStatusReport).AppendL(smscCtrlParameterStatus); |
|
429 } |
|
430 scheme->iDefaultStatusReport = aStream.ReadInt8L(); |
|
431 scheme->iNumOfPDUs = aStream.ReadInt16L(); |
|
432 } |
|
433 } |
|
434 else |
|
435 { |
|
436 SetStatusReportSchemeL(EDefaultScheme); |
|
437 } |
|
438 |
|
439 // CSmsMessage::ESmsMessageV3 is the same as CSmsMessage::ESmsIncompleteClass0MessageV! |
|
440 |
|
441 if (aVersion == CSmsMessage::ESmsMessageV4) // National language 7bit encoding support |
|
442 { |
|
443 iAlternative7bitEncoding = (TSmsEncoding) aStream.ReadInt32L(); |
|
444 } |
|
445 } // CSmsMessageAdditionalAttributes::InternalizeL |
|
446 |
|
447 |
|
448 void CSmsMessageAdditionalAttributes::ResetAttributesL() |
|
449 { |
|
450 LOGGSMU1("CSmsMessageAdditionalAttributes::ResetAttributesL()"); |
|
451 |
|
452 for (TInt category = 0; category < TSmsInformationElementCategories::ENumberOfCategories; category++) |
|
453 { |
|
454 iCollectionOfPointersToIEArrays[category]->ResetAndDestroy(); |
|
455 } |
|
456 |
|
457 if(iStatusReportScheme != NULL) |
|
458 { |
|
459 delete iStatusReportScheme; |
|
460 iStatusReportScheme = NULL; |
|
461 } |
|
462 |
|
463 iStatusReportScheme = new (ELeave) CSmsMessageAdditionalAttributes::CDefaultScheme(); |
|
464 |
|
465 iAlternative7bitEncoding = ESmsEncodingNone; |
|
466 } // CSmsMessageAdditionalAttributes::ResetAttributesL |
|
467 |
|
468 |
|
469 CSmsIEOperation& CSmsMessageAdditionalAttributes::GetIEOperationL(TInformationElementId aId) const |
|
470 { |
|
471 LOGGSMU1("CSmsMessageAdditionalAttributes::GetIEOperation()"); |
|
472 |
|
473 CSmsIEOperation* operation = NULL; |
|
474 |
|
475 switch(aId) |
|
476 { |
|
477 case CSmsInformationElement::ESmsHyperLinkFormat: |
|
478 operation = iHyperLinkOperations; |
|
479 break; |
|
480 case CSmsInformationElement::ESmsReplyAddressFormat: |
|
481 operation = iReplyAddressOperations; |
|
482 break; |
|
483 case CSmsInformationElement::ESmsEnhanceVoiceMailInformation: |
|
484 operation = iEnhancedVoiceMailOperations; |
|
485 break; |
|
486 case CSmsInformationElement::ESmsIEISpecialSMSMessageIndication: |
|
487 operation = iSpecialSMSMessageOperations; |
|
488 break; |
|
489 case CSmsInformationElement::ESmsIEISMSCControlParameters: |
|
490 operation = iSMSCCtrlParameterOperations; |
|
491 break; |
|
492 default: |
|
493 User::Leave(KErrArgument); |
|
494 break; |
|
495 } |
|
496 |
|
497 return *operation; |
|
498 } // CSmsMessageAdditionalAttributes::GetIEOperationL |
|
499 |
|
500 |
|
501 /** |
|
502 * Gets the operation being used but for a non Information Element Type. |
|
503 * |
|
504 * @note In the present case it is the TPSRR operation as that's the only one which exists as for now. |
|
505 * |
|
506 * @param aId The Identifier for the operation. |
|
507 */ |
|
508 CSmsNonIEOperation& CSmsMessageAdditionalAttributes::GetNonIEOperationL(TSmsNonIEIdentifier aId) const |
|
509 { |
|
510 LOGGSMU1("CSmsMessageAdditionalAttributes::GetNonIEOperationL"); |
|
511 |
|
512 CSmsNonIEOperation* operation = NULL; |
|
513 |
|
514 if(aId == ESmsTPSRRParameter) |
|
515 { |
|
516 operation = iTPSRROperations; |
|
517 } |
|
518 else if (aId == ESmsIncompleteClass0MessageParameter) |
|
519 { |
|
520 operation = iIncompleteClass0MessageInfo; |
|
521 } |
|
522 else |
|
523 { |
|
524 User::Leave(KErrArgument); |
|
525 } |
|
526 |
|
527 return *operation; |
|
528 } // CSmsMessageAdditionalAttributes::GetIEOperationL |
|
529 |
|
530 |
|
531 void CSmsMessageAdditionalAttributes::SetIEOperationL(CSmsIEOperation* aOperation) |
|
532 { |
|
533 LOGGSMU1("CSmsMessageAdditionalAttributes::SetIEOperationL()"); |
|
534 |
|
535 if (aOperation == NULL) |
|
536 { |
|
537 User::Leave(KErrArgument); |
|
538 } |
|
539 |
|
540 LOGGSMU2("CSmsMessageAdditionalAttributes::AddIEOperation, operation=%d", aOperation->Id()); |
|
541 |
|
542 switch(aOperation->Id()) |
|
543 { |
|
544 case CSmsInformationElement::ESmsHyperLinkFormat: |
|
545 iHyperLinkOperations = (CSmsHyperLinkOperations*) aOperation; |
|
546 break; |
|
547 case CSmsInformationElement::ESmsReplyAddressFormat: |
|
548 iReplyAddressOperations = (CSmsReplyAddressOperations*)aOperation; |
|
549 break; |
|
550 case CSmsInformationElement::ESmsEnhanceVoiceMailInformation: |
|
551 iEnhancedVoiceMailOperations = (CSmsEnhancedVoiceMailOperations*) aOperation; |
|
552 break; |
|
553 case CSmsInformationElement::ESmsIEISpecialSMSMessageIndication: |
|
554 iSpecialSMSMessageOperations = (CSmsSpecialSMSMessageOperations*) aOperation; |
|
555 break; |
|
556 case CSmsInformationElement::ESmsIEISMSCControlParameters: |
|
557 iSMSCCtrlParameterOperations = (CSmsSMSCCtrlParameterOperations*) aOperation; |
|
558 break; |
|
559 default: |
|
560 (void) aOperation; |
|
561 User::Leave(KErrArgument); |
|
562 break; |
|
563 } |
|
564 } // CSmsMessageAdditionalAttributes::SetIEOperationL |
|
565 |
|
566 |
|
567 /** |
|
568 * Sets the operation but for a non Information Element Type. |
|
569 * |
|
570 * @note In the present case it is the TPSRR operation as that's the only one which exists as for now. |
|
571 */ |
|
572 void CSmsMessageAdditionalAttributes::SetNonIEOperationL(CSmsNonIEOperation* aOperation) |
|
573 { |
|
574 if (aOperation == NULL) |
|
575 { |
|
576 User::Leave(KErrArgument); |
|
577 } |
|
578 |
|
579 LOGGSMU2("CSmsMessageAdditionalAttributes::SetNonIEOperationL, operation = %d", aOperation->Id()); |
|
580 |
|
581 if (aOperation->Id() == ESmsTPSRRParameter) |
|
582 { |
|
583 iTPSRROperations = (CSmsTPSRROperations*) aOperation; |
|
584 } |
|
585 else if (aOperation->Id() == ESmsIncompleteClass0MessageParameter) |
|
586 { |
|
587 iIncompleteClass0MessageInfo = (CIncompleteClass0MessageInfo*) aOperation; |
|
588 } |
|
589 else |
|
590 { |
|
591 User::Leave(KErrArgument); |
|
592 } |
|
593 } // CSmsMessageAdditionalAttributes::SetNonIEOperationL |
|
594 |
|
595 |
|
596 /** |
|
597 * Gets the pointer to the scheme being used for Status reporting. This is called in operations class and |
|
598 * in Segmentation Store. |
|
599 * |
|
600 * @return Pointer to the scheme being used. |
|
601 */ |
|
602 CSmsMessageAdditionalAttributes::CSmsStatusReportScheme& CSmsMessageAdditionalAttributes::GetStatusReportScheme() const |
|
603 { |
|
604 return *iStatusReportScheme; |
|
605 } // CSmsMessageAdditionalAttributes::GetStatusReportScheme |
|
606 |
|
607 |
|
608 void CSmsMessageAdditionalAttributes::SetStatusReportSchemeL(TSmsStatusReportScheme aId) |
|
609 { |
|
610 if(iStatusReportScheme != NULL) |
|
611 { |
|
612 delete iStatusReportScheme; |
|
613 iStatusReportScheme = NULL; |
|
614 } |
|
615 |
|
616 if (aId == EControlParametersScheme) |
|
617 { |
|
618 iStatusReportScheme = new (ELeave) CSmsMessageAdditionalAttributes::CControlParametersScheme(); |
|
619 } |
|
620 if (aId == ETPSRRScheme) |
|
621 { |
|
622 iStatusReportScheme = new (ELeave) CSmsMessageAdditionalAttributes::CTPSRRScheme(); |
|
623 } |
|
624 if (aId == EDefaultScheme) |
|
625 { |
|
626 iStatusReportScheme = new (ELeave) CSmsMessageAdditionalAttributes::CDefaultScheme(); |
|
627 } |
|
628 } // CSmsMessageAdditionalAttributes::SetStatusReportSchemeL |
|
629 |
|
630 |
|
631 /** |
|
632 * Get the current encoding value. |
|
633 * |
|
634 * @return Encoding value. |
|
635 */ |
|
636 TSmsEncoding CSmsMessageAdditionalAttributes::Alternative7bitEncoding() const |
|
637 { |
|
638 return iAlternative7bitEncoding; |
|
639 } // CSmsMessageAdditionalAttributes::Alternative7bitEncoding |
|
640 |
|
641 |
|
642 /** |
|
643 * Set the encoding value. |
|
644 * |
|
645 * @param aEncoding Encoding value. |
|
646 */ |
|
647 void CSmsMessageAdditionalAttributes::SetAlternative7bitEncoding(TSmsEncoding aEncoding) |
|
648 { |
|
649 iAlternative7bitEncoding = aEncoding; |
|
650 } // CSmsMessageAdditionalAttributes::SetAlternative7bitEncoding |
|
651 |
|
652 |
|
653 CSmsMessageAdditionalAttributes::CControlParametersScheme::CControlParametersScheme() |
|
654 : iControlParametersStatusReport(), iNumOfPDUs(0) |
|
655 { |
|
656 } // CSmsMessageAdditionalAttributes::CControlParametersScheme::CControlParametersScheme |
|
657 |
|
658 |
|
659 /** |
|
660 * Returns the ID of the current scheme. |
|
661 */ |
|
662 TSmsStatusReportScheme CSmsMessageAdditionalAttributes::CControlParametersScheme::Id() |
|
663 { |
|
664 return EControlParametersScheme; |
|
665 } // CSmsMessageAdditionalAttributes::CControlParametersScheme::Id |
|
666 |
|
667 |
|
668 CSmsMessageAdditionalAttributes::CControlParametersScheme::~CControlParametersScheme() |
|
669 { |
|
670 iControlParametersStatusReport.Reset(); |
|
671 iControlParametersStatusReport.Close(); |
|
672 } // CSmsMessageAdditionalAttributes::CControlParametersScheme::~CControlParametersScheme |
|
673 |
|
674 |
|
675 CSmsMessageAdditionalAttributes::CTPSRRScheme::CTPSRRScheme() |
|
676 : iTPSRRStatusReport(), iNumOfPDUs(0) |
|
677 { |
|
678 |
|
679 } // CSmsMessageAdditionalAttributes::CTPSRRScheme::CTPSRRScheme |
|
680 |
|
681 |
|
682 /** |
|
683 * Returns the ID of the current scheme. |
|
684 */ |
|
685 TSmsStatusReportScheme CSmsMessageAdditionalAttributes::CTPSRRScheme::Id() |
|
686 { |
|
687 return ETPSRRScheme; |
|
688 } // CSmsMessageAdditionalAttributes::CTPSRRScheme::Id |
|
689 |
|
690 |
|
691 CSmsMessageAdditionalAttributes::CTPSRRScheme::~CTPSRRScheme() |
|
692 { |
|
693 iTPSRRStatusReport.Reset(); |
|
694 iTPSRRStatusReport.Close(); |
|
695 } // CSmsMessageAdditionalAttributes::CTPSRRScheme::~CTPSRRScheme |
|
696 |
|
697 |
|
698 CSmsMessageAdditionalAttributes::CDefaultScheme::CDefaultScheme() |
|
699 { |
|
700 |
|
701 } // CSmsMessageAdditionalAttributes::CDefaultScheme::CDefaultScheme |
|
702 |
|
703 |
|
704 /** |
|
705 * Returns the ID of the current scheme. |
|
706 */ |
|
707 TSmsStatusReportScheme CSmsMessageAdditionalAttributes::CDefaultScheme::Id() |
|
708 { |
|
709 return EDefaultScheme; |
|
710 } // CSmsMessageAdditionalAttributes::CDefaultScheme::Id |
|
711 |
|
712 |
|
713 CSmsMessageAdditionalAttributes::CDefaultScheme::~CDefaultScheme() |
|
714 { |
|
715 |
|
716 } // CSmsMessageAdditionalAttributes::CDefaultScheme::~CDefaultScheme |