1 // Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
17 |
17 |
18 /** |
18 /** |
19 @file |
19 @file |
20 */ |
20 */ |
21 |
21 |
22 |
|
23 #include "OstTraceDefinitions.h" |
|
24 #ifdef OST_TRACE_COMPILER_IN_USE |
|
25 #include "GsmumsgTraces.h" |
|
26 #endif |
|
27 |
|
28 #include <gsmumsg.h> |
22 #include <gsmumsg.h> |
29 #include "Gsmumain.h" |
23 #include "Gsmumain.h" |
30 #include <gsmubuf.h> |
24 #include <gsmubuf.h> |
31 #include <gsmuset.h> |
25 #include <gsmuset.h> |
32 #include <gsmusar.h> |
26 #include <gsmusar.h> |
33 #include "gsmumsgadditionalattributes.h" |
27 #include "gsmumsgadditionalattributes.h" |
34 #include <gsmuieoperations.h> |
28 #include <gsmuieoperations.h> |
35 #include <gsmunonieoperations.h> |
29 #include <gsmunonieoperations.h> |
36 |
30 |
37 #include <logwraplimits.h> |
31 #include <logwrap.h> // Used for KLogNullId only |
38 #include <e32uid.h> |
32 #include <e32uid.h> |
39 #include <etelmm.h> |
33 #include <etelmm.h> |
|
34 #include <logwraplimits.h> |
40 |
35 |
41 #include <emsinformationelement.h> |
36 #include <emsinformationelement.h> |
42 #include <emsformatie.h> |
37 #include <emsformatie.h> |
43 #include <emsuserpromptie.h> |
38 #include <emsuserpromptie.h> |
44 #include <emsobjectdistributionie.h> |
39 #include <emsobjectdistributionie.h> |
61 * @return New CSmsMessage object |
56 * @return New CSmsMessage object |
62 * @capability None |
57 * @capability None |
63 */ |
58 */ |
64 EXPORT_C CSmsMessage* CSmsMessage::NewL(RFs& aFs, const TGsmSms& aGsmSms,CSmsBufferBase* aBuffer, TBool aIsRPError,TBool aIsMobileTerminated) |
59 EXPORT_C CSmsMessage* CSmsMessage::NewL(RFs& aFs, const TGsmSms& aGsmSms,CSmsBufferBase* aBuffer, TBool aIsRPError,TBool aIsMobileTerminated) |
65 { |
60 { |
66 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_NEWL_1, "CSmsMessage::NewL()"); |
61 LOGGSMU1("CSmsMessage::NewL()"); |
67 |
62 |
68 CleanupStack::PushL(aBuffer); |
63 CleanupStack::PushL(aBuffer); |
69 CSmsMessage* smsmessage=new(ELeave) CSmsMessage(aFs, aBuffer); |
64 CSmsMessage* smsmessage=new(ELeave) CSmsMessage(aFs, aBuffer); |
70 CleanupStack::Pop(); |
65 CleanupStack::Pop(); |
71 CleanupStack::PushL(smsmessage); |
66 CleanupStack::PushL(smsmessage); |
88 * @return New CSmsMessage object |
83 * @return New CSmsMessage object |
89 * @capability None |
84 * @capability None |
90 */ |
85 */ |
91 EXPORT_C CSmsMessage* CSmsMessage::NewL(RFs& aFs, CSmsPDU::TSmsPDUType aType,CSmsBufferBase* aBuffer,TBool aIsRPError) |
86 EXPORT_C CSmsMessage* CSmsMessage::NewL(RFs& aFs, CSmsPDU::TSmsPDUType aType,CSmsBufferBase* aBuffer,TBool aIsRPError) |
92 { |
87 { |
93 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_NEWL1_1, "CSmsMessage::NewL()"); |
88 LOGGSMU1("CSmsMessage::NewL()"); |
94 |
89 |
95 CleanupStack::PushL(aBuffer); |
90 CleanupStack::PushL(aBuffer); |
96 CSmsMessage* smsmessage=new(ELeave) CSmsMessage(aFs, aBuffer); |
91 CSmsMessage* smsmessage=new(ELeave) CSmsMessage(aFs, aBuffer); |
97 CleanupStack::Pop(); |
92 CleanupStack::Pop(); |
98 CleanupStack::PushL(smsmessage); |
93 CleanupStack::PushL(smsmessage); |
132 * @param aStream Stream to read from |
127 * @param aStream Stream to read from |
133 * @capability None |
128 * @capability None |
134 */ |
129 */ |
135 EXPORT_C void CSmsMessage::InternalizeWithoutBufferL(RReadStream& aStream) |
130 EXPORT_C void CSmsMessage::InternalizeWithoutBufferL(RReadStream& aStream) |
136 { |
131 { |
137 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_INTERNALIZEWITHOUTBUFFERL_1, "CSmsMessage::InternalizeWithoutBufferL()"); |
132 LOGGSMU1("CSmsMessage::InternalizeWithoutBufferL()"); |
138 |
133 |
139 InternalizeWithoutBufferAndVersionL(aStream); |
134 InternalizeWithoutBufferAndVersionL(aStream); |
140 InternalizeVersionL(aStream); |
135 InternalizeVersionL(aStream); |
141 |
136 |
142 iAdditionalInfo->ResetAttributesL(); |
137 iAdditionalInfo->ResetAttributesL(); |
156 * @param aStream Stream to write to |
151 * @param aStream Stream to write to |
157 * @capability None |
152 * @capability None |
158 */ |
153 */ |
159 EXPORT_C void CSmsMessage::ExternalizeWithoutBufferL(RWriteStream& aStream) const |
154 EXPORT_C void CSmsMessage::ExternalizeWithoutBufferL(RWriteStream& aStream) const |
160 { |
155 { |
161 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_EXTERNALIZEWITHOUTBUFFERL_1, "CSmsMessage::ExternalizeWithoutBufferL()"); |
156 LOGGSMU1("CSmsMessage::ExternalizeWithoutBufferL()"); |
162 |
157 |
163 ExternalizeWithoutBufferAndVersionL(aStream); |
158 ExternalizeWithoutBufferAndVersionL(aStream); |
164 ExternalizeVersionL(aStream); |
159 ExternalizeVersionL(aStream); |
165 |
160 |
166 if (iVersion > ESmsMessageV0) |
161 if (iVersion > ESmsMessageV0) |
176 * @param aStream Stream to read from |
171 * @param aStream Stream to read from |
177 * @capability None |
172 * @capability None |
178 */ |
173 */ |
179 EXPORT_C void CSmsMessage::InternalizeL(RReadStream& aStream) |
174 EXPORT_C void CSmsMessage::InternalizeL(RReadStream& aStream) |
180 { |
175 { |
181 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_INTERNALIZEL_1, "CSmsMessage::InternalizeL()"); |
176 LOGGSMU1("CSmsMessage::InternalizeL()"); |
182 |
177 |
183 InternalizeWithoutBufferAndVersionL(aStream); |
178 InternalizeWithoutBufferAndVersionL(aStream); |
184 InternalizeBufferL(aStream); |
179 InternalizeBufferL(aStream); |
185 InternalizeVersionL(aStream); |
180 InternalizeVersionL(aStream); |
186 |
181 |
198 * @param aStream Stream to write to |
193 * @param aStream Stream to write to |
199 * @capability None |
194 * @capability None |
200 */ |
195 */ |
201 EXPORT_C void CSmsMessage::ExternalizeL(RWriteStream& aStream) const |
196 EXPORT_C void CSmsMessage::ExternalizeL(RWriteStream& aStream) const |
202 { |
197 { |
203 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_EXTERNALIZEL_1, "CSmsMessage::ExternalizeL()"); |
198 LOGGSMU1("CSmsMessage::ExternalizeL()"); |
204 |
199 |
205 ExternalizeWithoutBufferAndVersionL(aStream); |
200 ExternalizeWithoutBufferAndVersionL(aStream); |
206 ExternalizeBufferL(aStream); |
201 ExternalizeBufferL(aStream); |
207 ExternalizeVersionL(aStream); |
202 ExternalizeVersionL(aStream); |
208 |
203 |
219 * @return True if the message contains text |
214 * @return True if the message contains text |
220 * @capability None |
215 * @capability None |
221 */ |
216 */ |
222 EXPORT_C TBool CSmsMessage::TextPresent() const |
217 EXPORT_C TBool CSmsMessage::TextPresent() const |
223 { |
218 { |
224 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_TEXTPRESENT_1, "CSmsMessage::TextPresent()"); |
219 LOGGSMU1("CSmsMessage::TextPresent()"); |
225 |
220 |
226 CSmsPDU::TSmsPDUType pdutype=SmsPDU().Type(); |
221 CSmsPDU::TSmsPDUType pdutype=SmsPDU().Type(); |
227 return (pdutype==CSmsPDU::ESmsSubmit) || |
222 return (pdutype==CSmsPDU::ESmsSubmit) || |
228 (pdutype==CSmsPDU::ESmsDeliver) || |
223 (pdutype==CSmsPDU::ESmsDeliver) || |
229 (((pdutype==CSmsPDU::ESmsSubmitReport) || (pdutype==CSmsPDU::ESmsDeliverReport) || |
224 (((pdutype==CSmsPDU::ESmsSubmitReport) || (pdutype==CSmsPDU::ESmsDeliverReport) || |
261 else if (TextPresent() && SmsPDU().TextConcatenated()) |
256 else if (TextPresent() && SmsPDU().TextConcatenated()) |
262 { |
257 { |
263 nummessagepdus=SmsPDU().NumConcatenatedMessagePDUs(); |
258 nummessagepdus=SmsPDU().NumConcatenatedMessagePDUs(); |
264 } |
259 } |
265 |
260 |
266 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_NUMMESSAGEPDUSL_2, "CSmsMessage::NumMessagePDUsL() returns %d", nummessagepdus); |
261 LOGGSMU2("CSmsMessage::NumMessagePDUsL() returns %d", nummessagepdus); |
267 |
262 |
268 return nummessagepdus; |
263 return nummessagepdus; |
269 } // CSmsMessage::NumMessagePDUsL |
264 } // CSmsMessage::NumMessagePDUsL |
270 |
265 |
271 |
266 |
285 if (SmsPDU().TextConcatenated()) |
280 if (SmsPDU().TextConcatenated()) |
286 { |
281 { |
287 maxmessagelength=maxmessagelength*0xFF; |
282 maxmessagelength=maxmessagelength*0xFF; |
288 } |
283 } |
289 |
284 |
290 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_MAXMESSAGELENGTH_1, "CSmsMessage::MaxMessageLength() returns %d", maxmessagelength); |
285 LOGGSMU2("CSmsMessage::MaxMessageLength() returns %d", maxmessagelength); |
291 |
286 |
292 return maxmessagelength; |
287 return maxmessagelength; |
293 } // CSmsMessage::MaxMessageLength |
288 } // CSmsMessage::MaxMessageLength |
294 |
289 |
295 |
290 |
301 TInt CSmsMessage::ConvertedBufferLengthL(const CSmsBufferBase& aBuffer) |
296 TInt CSmsMessage::ConvertedBufferLengthL(const CSmsBufferBase& aBuffer) |
302 { |
297 { |
303 // Ignore in code coverage - not used in SMS stack and not exported |
298 // Ignore in code coverage - not used in SMS stack and not exported |
304 // but cannot be removed as impacts public header. |
299 // but cannot be removed as impacts public header. |
305 BULLSEYE_OFF |
300 BULLSEYE_OFF |
306 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_CONVERTEDBUFFERLENGTHL_1, "CSmsMessage::ConvertedBufferLengthL()"); |
301 LOGGSMU1("CSmsMessage::ConvertedBufferLengthL()"); |
307 |
302 |
308 TInt convertedBufferLength=0; |
303 TInt convertedBufferLength=0; |
309 CSmsAlphabetConverter* converter=CSmsAlphabetConverter::NewLC(*iCharacterSetConverter,iFs,SmsPDU().Alphabet(),BinaryData()); |
304 CSmsAlphabetConverter* converter=CSmsAlphabetConverter::NewLC(*iCharacterSetConverter,iFs,SmsPDU().Alphabet(),BinaryData()); |
310 CSmsBufferSegmenter* segmenter=CSmsBufferSegmenter::NewLC(*converter,aBuffer); |
305 CSmsBufferSegmenter* segmenter=CSmsBufferSegmenter::NewLC(*converter,aBuffer); |
311 convertedBufferLength=segmenter->TotalConvertedLengthL(iAdditionalInfo->Alternative7bitEncoding()); |
306 convertedBufferLength=segmenter->TotalConvertedLengthL(iAdditionalInfo->Alternative7bitEncoding()); |
312 CleanupStack::PopAndDestroy(2, converter); |
307 CleanupStack::PopAndDestroy(2, converter); |
313 |
308 |
314 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_CONVERTEDBUFFERLENGTHL_2, "CSmsMessage::ConvertedBufferLengthL() returns %d", convertedBufferLength); |
309 LOGGSMU2("CSmsMessage::ConvertedBufferLengthL() returns %d", convertedBufferLength); |
315 |
310 |
316 return convertedBufferLength; |
311 return convertedBufferLength; |
317 BULLSEYE_RESTORE |
312 BULLSEYE_RESTORE |
318 } |
313 } |
319 |
314 |
329 * @return Message length |
324 * @return Message length |
330 * @capability None |
325 * @capability None |
331 */ |
326 */ |
332 EXPORT_C TInt CSmsMessage::MessageLengthL() |
327 EXPORT_C TInt CSmsMessage::MessageLengthL() |
333 { |
328 { |
334 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_MESSAGELENGTHL_1, "CSmsMessage::MessageLengthL()"); |
329 LOGGSMU1("CSmsMessage::MessageLengthL()"); |
335 |
330 |
336 TInt messagelength=0; |
331 TInt messagelength=0; |
337 if (!SmsPDU().TextCompressed()) |
332 if (!SmsPDU().TextCompressed()) |
338 { |
333 { |
339 messagelength=iBuffer->Length(); |
334 messagelength=iBuffer->Length(); |
348 |
343 |
349 |
344 |
350 EXPORT_C void CSmsMessage::GetEncodingInfoL(TInt& aPdus, TInt& aUnconvertedChars, |
345 EXPORT_C void CSmsMessage::GetEncodingInfoL(TInt& aPdus, TInt& aUnconvertedChars, |
351 TInt& aDowngradedChars, TInt& aFreeUDUnitsInLastPDU) |
346 TInt& aDowngradedChars, TInt& aFreeUDUnitsInLastPDU) |
352 { |
347 { |
353 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_GETENCODINGINFOL_1, "CSmsMessage::GetEncodingInfoL()"); |
348 LOGGSMU1("CSmsMessage::GetEncodingInfoL()"); |
354 |
349 |
355 aPdus = 1; |
350 aPdus = 1; |
356 aUnconvertedChars = 0; |
351 aUnconvertedChars = 0; |
357 aDowngradedChars = 0; |
352 aDowngradedChars = 0; |
358 aFreeUDUnitsInLastPDU = 0; |
353 aFreeUDUnitsInLastPDU = 0; |
398 aDowngradedChars = 0; |
393 aDowngradedChars = 0; |
399 aFreeUDUnitsInLastPDU = 0; |
394 aFreeUDUnitsInLastPDU = 0; |
400 } |
395 } |
401 } |
396 } |
402 |
397 |
403 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_GETENCODINGINFOL_2, "CSmsMessage::GetEncodingInfoL(): aPdus=%d", aPdus); |
398 LOGGSMU2("CSmsMessage::GetEncodingInfoL(): aPdus=%d", aPdus); |
404 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_GETENCODINGINFOL_3, "CSmsMessage::GetEncodingInfoL(): aUnconvertedChars=%d", aUnconvertedChars); |
399 LOGGSMU2("CSmsMessage::GetEncodingInfoL(): aUnconvertedChars=%d", aUnconvertedChars); |
405 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_GETENCODINGINFOL_4, "CSmsMessage::GetEncodingInfoL(): aDowngradedChars=%d", aDowngradedChars); |
400 LOGGSMU2("CSmsMessage::GetEncodingInfoL(): aDowngradedChars=%d", aDowngradedChars); |
406 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_GETENCODINGINFOL_5, "CSmsMessage::GetEncodingInfoL(): aFreeUDUnitsInLastPDU=%d", aFreeUDUnitsInLastPDU); |
401 LOGGSMU2("CSmsMessage::GetEncodingInfoL(): aFreeUDUnitsInLastPDU=%d", aFreeUDUnitsInLastPDU); |
407 } // CSmsMessage::GetEncodingInfoL |
402 } // CSmsMessage::GetEncodingInfoL |
408 |
403 |
409 |
404 |
410 /** |
405 /** |
411 * Gets the User Data Settings. |
406 * Gets the User Data Settings. |
413 * @param aSettings User Data Settings |
408 * @param aSettings User Data Settings |
414 * @capability None |
409 * @capability None |
415 */ |
410 */ |
416 EXPORT_C void CSmsMessage::UserDataSettings(TSmsUserDataSettings& aSettings) const |
411 EXPORT_C void CSmsMessage::UserDataSettings(TSmsUserDataSettings& aSettings) const |
417 { |
412 { |
418 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_USERDATASETTINGS_1, "CSmsMessage::UserDataSettings()"); |
413 LOGGSMU1("CSmsMessage::UserDataSettings()"); |
419 |
414 |
420 __ASSERT_DEBUG(TextPresent(),Panic(KGsmuPanicTextNotPresent)); |
415 __ASSERT_DEBUG(TextPresent(),Panic(KGsmuPanicTextNotPresent)); |
421 aSettings.SetAlphabet(SmsPDU().Alphabet()); |
416 aSettings.SetAlphabet(SmsPDU().Alphabet()); |
422 aSettings.SetTextCompressed(SmsPDU().TextCompressed()); |
417 aSettings.SetTextCompressed(SmsPDU().TextCompressed()); |
423 TBool is16bit; |
418 TBool is16bit; |
432 * @param aSettings User Data Settings |
427 * @param aSettings User Data Settings |
433 * @capability None |
428 * @capability None |
434 */ |
429 */ |
435 EXPORT_C void CSmsMessage::SetUserDataSettingsL(const TSmsUserDataSettings& aSettings) |
430 EXPORT_C void CSmsMessage::SetUserDataSettingsL(const TSmsUserDataSettings& aSettings) |
436 { |
431 { |
437 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_SETUSERDATASETTINGSL_1, "CSmsMessage::SetUserDataSettingsL()"); |
432 LOGGSMU1("CSmsMessage::SetUserDataSettingsL()"); |
438 |
433 |
439 __ASSERT_DEBUG(TextPresent(),Panic(KGsmuPanicTextNotPresent)); |
434 __ASSERT_DEBUG(TextPresent(),Panic(KGsmuPanicTextNotPresent)); |
440 SmsPDU().SetAlphabet(aSettings.Alphabet()); |
435 SmsPDU().SetAlphabet(aSettings.Alphabet()); |
441 SmsPDU().SetTextCompressed(aSettings.TextCompressed()); |
436 SmsPDU().SetTextCompressed(aSettings.TextCompressed()); |
442 TBool is16bit; |
437 TBool is16bit; |
468 * @param aOptions Combination of TSmsOptimizationFlags |
463 * @param aOptions Combination of TSmsOptimizationFlags |
469 * @capability None |
464 * @capability None |
470 */ |
465 */ |
471 EXPORT_C void CSmsMessage::OptimizeSettingsL(TInt aOptions) |
466 EXPORT_C void CSmsMessage::OptimizeSettingsL(TInt aOptions) |
472 { |
467 { |
473 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_OPTIMIZESETTINGSL_1, "CSmsMessage::OptimizeSettingsL()"); |
468 LOGGSMU1("CSmsMessage::OptimizeSettingsL()"); |
474 |
469 |
475 __ASSERT_DEBUG(TextPresent(),Panic(KGsmuPanicTextNotPresent)); |
470 __ASSERT_DEBUG(TextPresent(),Panic(KGsmuPanicTextNotPresent)); |
476 __ASSERT_DEBUG(IsDecoded(),Panic(KGsmuPanicNotDecoded)); |
471 __ASSERT_DEBUG(IsDecoded(),Panic(KGsmuPanicNotDecoded)); |
477 |
472 |
478 if (aOptions&ESmsFlagOptimizeAlphabet && (SmsPDU().Alphabet()==TSmsDataCodingScheme::ESmsAlphabet7Bit)) |
473 if (aOptions&ESmsFlagOptimizeAlphabet && (SmsPDU().Alphabet()==TSmsDataCodingScheme::ESmsAlphabet7Bit)) |
581 * |
576 * |
582 * @param aEncoding Encoding setting to merge. |
577 * @param aEncoding Encoding setting to merge. |
583 */ |
578 */ |
584 void CSmsMessage::MergeAlternative7bitEncoding(TSmsEncoding aEncoding) const |
579 void CSmsMessage::MergeAlternative7bitEncoding(TSmsEncoding aEncoding) const |
585 { |
580 { |
586 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_MERGEALTERNATIVE7BITENCODING_1, "CSmsMessage::MergeAlternative7bitEncoding(): aEncoding=%d (currently %d)",aEncoding, iAdditionalInfo->Alternative7bitEncoding()); |
581 LOGGSMU3("CSmsMessage::MergeAlternative7bitEncoding(): aEncoding=%d (currently %d)", |
|
582 aEncoding, iAdditionalInfo->Alternative7bitEncoding()); |
587 |
583 |
588 switch (iAdditionalInfo->Alternative7bitEncoding()) |
584 switch (iAdditionalInfo->Alternative7bitEncoding()) |
589 { |
585 { |
590 case ESmsEncodingNone: |
586 case ESmsEncodingNone: |
591 { |
587 { |
641 { |
637 { |
642 // NOP - Cannot merge anything into these... |
638 // NOP - Cannot merge anything into these... |
643 } |
639 } |
644 }; |
640 }; |
645 |
641 |
646 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_MERGEALTERNATIVE7BITENCODING_2, "CSmsMessage::MergeAlternative7bitEncoding(): New encoding=%d",iAdditionalInfo->Alternative7bitEncoding()); |
642 LOGGSMU2("CSmsMessage::MergeAlternative7bitEncoding(): New encoding=%d", |
|
643 iAdditionalInfo->Alternative7bitEncoding()); |
647 } // CSmsMessage::MergeAlternative7bitEncoding |
644 } // CSmsMessage::MergeAlternative7bitEncoding |
648 |
645 |
649 |
646 |
650 /** |
647 /** |
651 * Tests if a buffer can be encoded without loss of information. |
648 * Tests if a buffer can be encoded without loss of information. |
661 * @capability None |
658 * @capability None |
662 */ |
659 */ |
663 EXPORT_C TBool CSmsMessage::IsSupportedL(const TDesC& aDes, TInt& aNumberOfUnconvertibleCharacters, |
660 EXPORT_C TBool CSmsMessage::IsSupportedL(const TDesC& aDes, TInt& aNumberOfUnconvertibleCharacters, |
664 TInt& aIndexOfFirstUnconvertibleCharacter) |
661 TInt& aIndexOfFirstUnconvertibleCharacter) |
665 { |
662 { |
666 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_ISSUPPORTEDL_1, "[1] CSmsMessage::IsSupportedL()"); |
663 LOGGSMU1("[1] CSmsMessage::IsSupportedL()"); |
667 |
664 |
668 __ASSERT_DEBUG(TextPresent(), Panic(KGsmuPanicTextNotPresent)); |
665 __ASSERT_DEBUG(TextPresent(), Panic(KGsmuPanicTextNotPresent)); |
669 |
666 |
670 aNumberOfUnconvertibleCharacters = 0; |
667 aNumberOfUnconvertibleCharacters = 0; |
671 aIndexOfFirstUnconvertibleCharacter = aDes.Length(); |
668 aIndexOfFirstUnconvertibleCharacter = aDes.Length(); |
701 EXPORT_C TBool CSmsMessage::IsSupportedL(const TDesC& aDes, TInt& aNumberOfUnconvertibleCharacters, |
698 EXPORT_C TBool CSmsMessage::IsSupportedL(const TDesC& aDes, TInt& aNumberOfUnconvertibleCharacters, |
702 TInt& aNumberOfDowngradedCharacters, |
699 TInt& aNumberOfDowngradedCharacters, |
703 TInt& aNumberRequiringAlternativeEncoding, |
700 TInt& aNumberRequiringAlternativeEncoding, |
704 TInt& aIndexOfFirstUnconvertibleCharacter) const |
701 TInt& aIndexOfFirstUnconvertibleCharacter) const |
705 { |
702 { |
706 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_ISSUPPORTEDL1_1, "[2] CSmsMessage::IsSupportedL()"); |
703 LOGGSMU1("[2] CSmsMessage::IsSupportedL()"); |
707 |
704 |
708 __ASSERT_DEBUG(TextPresent(), Panic(KGsmuPanicTextNotPresent)); |
705 __ASSERT_DEBUG(TextPresent(), Panic(KGsmuPanicTextNotPresent)); |
709 |
706 |
710 aNumberOfUnconvertibleCharacters = 0; |
707 aNumberOfUnconvertibleCharacters = 0; |
711 aNumberOfDowngradedCharacters = 0; |
708 aNumberOfDowngradedCharacters = 0; |
735 * @param aReference Sets a Concatenated Message Reference (default 0) |
732 * @param aReference Sets a Concatenated Message Reference (default 0) |
736 * @capability None |
733 * @capability None |
737 */ |
734 */ |
738 EXPORT_C void CSmsMessage::EncodeMessagePDUsL(CArrayFix<TGsmSms>& aSmsArray, TInt aReference) |
735 EXPORT_C void CSmsMessage::EncodeMessagePDUsL(CArrayFix<TGsmSms>& aSmsArray, TInt aReference) |
739 { |
736 { |
740 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_ENCODEMESSAGEPDUSL_1, "CSmsMessage::EncodeMessagePDUsL(): aReference=%d", aReference); |
737 LOGGSMU2("CSmsMessage::EncodeMessagePDUsL(): aReference=%d", aReference); |
741 |
738 |
742 __ASSERT_DEBUG((aSmsArray.Count()==0),Panic(KGsmuPanicSmsArrayNotEmpty)); |
739 __ASSERT_DEBUG((aSmsArray.Count()==0),Panic(KGsmuPanicSmsArrayNotEmpty)); |
743 |
740 |
744 if (TextPresent()) |
741 if (TextPresent()) |
745 { |
742 { |
792 * |
789 * |
793 * @leave KErrAlreadyExists or KErrAlreadyExists |
790 * @leave KErrAlreadyExists or KErrAlreadyExists |
794 */ |
791 */ |
795 void CSmsMessage::PrepareCommandMessageL() |
792 void CSmsMessage::PrepareCommandMessageL() |
796 { |
793 { |
797 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_PREPARECOMMANDMESSAGEL_1, "CSmsMessage::PrepareCommandMessageL()"); |
794 LOGGSMU1("CSmsMessage::PrepareCommandMessageL()"); |
798 |
795 |
799 if (SmsPDU().Type()==CSmsPDU::ESmsCommand) |
796 if (SmsPDU().Type()==CSmsPDU::ESmsCommand) |
800 { |
797 { |
801 CSmsCommand& command = static_cast<CSmsCommand&>(SmsPDU()); |
798 CSmsCommand& command = static_cast<CSmsCommand&>(SmsPDU()); |
802 |
799 |
834 * @param aSmsArray Concatenated message |
831 * @param aSmsArray Concatenated message |
835 * @capability None |
832 * @capability None |
836 */ |
833 */ |
837 EXPORT_C void CSmsMessage::DecodeMessagePDUsL(const CArrayFix<TGsmSms>& aSmsArray) |
834 EXPORT_C void CSmsMessage::DecodeMessagePDUsL(const CArrayFix<TGsmSms>& aSmsArray) |
838 { |
835 { |
839 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_DECODEMESSAGEPDUSL_1, "CSmsMessage::DecodeMessagePDUsL(): PDUs=%d", aSmsArray.Count()); |
836 LOGGSMU2("CSmsMessage::DecodeMessagePDUsL(): PDUs=%d", aSmsArray.Count()); |
840 |
837 |
841 TInt count=aSmsArray.Count(); |
838 TInt count=aSmsArray.Count(); |
842 SetIsComplete(ETrue); |
839 SetIsComplete(ETrue); |
843 CArrayPtrFlat<CSmsPDU>* smspduarray=new(ELeave) CArrayPtrFlat<CSmsPDU>(8); |
840 CArrayPtrFlat<CSmsPDU>* smspduarray=new(ELeave) CArrayPtrFlat<CSmsPDU>(8); |
844 CleanupStack::PushL(smspduarray); |
841 CleanupStack::PushL(smspduarray); |
892 * incomplete message for a particular concatenated message. |
889 * incomplete message for a particular concatenated message. |
893 * @capability None |
890 * @capability None |
894 */ |
891 */ |
895 EXPORT_C void CSmsMessage::DecodePartialCompleteMessagePDUsL(const CArrayFix<TGsmSms>& aSmsArray, TBool aLastPartialCompleteMsg) |
892 EXPORT_C void CSmsMessage::DecodePartialCompleteMessagePDUsL(const CArrayFix<TGsmSms>& aSmsArray, TBool aLastPartialCompleteMsg) |
896 { |
893 { |
897 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_DECODEPARTIALCOMPLETEMESSAGEPDUSL_1, "CSmsMessage::DecodePartialCompleteMessagePDUsL(): PDUs=%d", aSmsArray.Count()); |
894 LOGGSMU2("CSmsMessage::DecodePartialCompleteMessagePDUsL(): PDUs=%d", aSmsArray.Count()); |
898 |
895 |
899 TInt count=aSmsArray.Count(); |
896 TInt count=aSmsArray.Count(); |
900 SetIsComplete(EFalse); |
897 SetIsComplete(EFalse); |
901 CArrayPtrFlat<CSmsPDU>* smspduarray=new(ELeave) CArrayPtrFlat<CSmsPDU>(8); |
898 CArrayPtrFlat<CSmsPDU>* smspduarray=new(ELeave) CArrayPtrFlat<CSmsPDU>(8); |
902 CleanupStack::PushL(smspduarray); |
899 CleanupStack::PushL(smspduarray); |
979 __ASSERT_DEBUG(result, Panic(KGSMUPanicUserTimeZoneOffsetOutOfRange)); |
976 __ASSERT_DEBUG(result, Panic(KGSMUPanicUserTimeZoneOffsetOutOfRange)); |
980 } // NMobileSmsStore::EStoredMessageUnread |
977 } // NMobileSmsStore::EStoredMessageUnread |
981 |
978 |
982 void CSmsMessage::ConstructL(const TGsmSms& aGsmSms, TBool aIsRPError,TBool aIsMobileTerminated) |
979 void CSmsMessage::ConstructL(const TGsmSms& aGsmSms, TBool aIsRPError,TBool aIsMobileTerminated) |
983 { |
980 { |
984 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_CONSTRUCTL_1, "CSmsMessage::ConstructL()"); |
981 LOGGSMU1("CSmsMessage::ConstructL()"); |
985 |
982 |
986 iCharacterSetConverter=CCnvCharacterSetConverter::NewL(); |
983 iCharacterSetConverter=CCnvCharacterSetConverter::NewL(); |
987 iInformationElementArray = new (ELeave) RPointerArray<CEmsInformationElement>(8); |
984 iInformationElementArray = new (ELeave) RPointerArray<CEmsInformationElement>(8); |
988 |
985 |
989 iAdditionalInfo = CSmsMessageAdditionalAttributes::NewL(); |
986 iAdditionalInfo = CSmsMessageAdditionalAttributes::NewL(); |
1038 } // CSmsMessage::ConstructL |
1035 } // CSmsMessage::ConstructL |
1039 |
1036 |
1040 |
1037 |
1041 void CSmsMessage::ConstructL(CSmsPDU::TSmsPDUType aType,TBool aIsRPError) |
1038 void CSmsMessage::ConstructL(CSmsPDU::TSmsPDUType aType,TBool aIsRPError) |
1042 { |
1039 { |
1043 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_CONSTRUCTL1_1, "CSmsMessage::ConstructL(): aType=%d, aIsRPError=%d", (TInt) aType,aIsRPError); |
1040 LOGGSMU3("CSmsMessage::ConstructL(): aType=%d, aIsRPError=%d", (TInt) aType, |
|
1041 aIsRPError); |
1044 |
1042 |
1045 iCharacterSetConverter=CCnvCharacterSetConverter::NewL(); |
1043 iCharacterSetConverter=CCnvCharacterSetConverter::NewL(); |
1046 iInformationElementArray = new (ELeave) RPointerArray<CEmsInformationElement>(2); |
1044 iInformationElementArray = new (ELeave) RPointerArray<CEmsInformationElement>(2); |
1047 |
1045 |
1048 iAdditionalInfo = CSmsMessageAdditionalAttributes::NewL(); |
1046 iAdditionalInfo = CSmsMessageAdditionalAttributes::NewL(); |
1063 * |
1061 * |
1064 * @return Number of PDUs required. |
1062 * @return Number of PDUs required. |
1065 */ |
1063 */ |
1066 TInt CSmsMessage::NumMessageEmsPDUsL() |
1064 TInt CSmsMessage::NumMessageEmsPDUsL() |
1067 { |
1065 { |
1068 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_NUMMESSAGEEMSPDUSL_1, "CSmsMessage::NumMessageEmsPDUsL()"); |
1066 LOGGSMU1("CSmsMessage::NumMessageEmsPDUsL()"); |
1069 |
1067 |
1070 // |
1068 // |
1071 // Clear the concatenated flag, EncodeBufferL() will add it if needed. |
1069 // Clear the concatenated flag, EncodeBufferL() will add it if needed. |
1072 // |
1070 // |
1073 SmsPDU().SetTextConcatenatedL(EFalse, EFalse); |
1071 SmsPDU().SetTextConcatenatedL(EFalse, EFalse); |
1108 * |
1106 * |
1109 * @leave KErrAlreadyExists or KErrAlreadyExists |
1107 * @leave KErrAlreadyExists or KErrAlreadyExists |
1110 */ |
1108 */ |
1111 void CSmsMessage::ResetWorkingPDUL() |
1109 void CSmsMessage::ResetWorkingPDUL() |
1112 { |
1110 { |
1113 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_RESETWORKINGPDUL_1, "CSmsMessage::ResetWorkingPDUL()"); |
1111 LOGGSMU1("CSmsMessage::ResetWorkingPDUL()"); |
1114 |
1112 |
1115 CSmsUserData& uData = SmsPDU().UserData(); |
1113 CSmsUserData& uData = SmsPDU().UserData(); |
1116 //remove non-mandatory EMS information elements |
1114 //remove non-mandatory EMS information elements |
1117 for (TInt a=uData.NumInformationElements(); a>0; --a) |
1115 for (TInt a=uData.NumInformationElements(); a>0; --a) |
1118 { |
1116 { |
1135 |
1133 |
1136 void CSmsMessage::CorrectFormattingL(TUint aCharsAddedToCurrentPDU, |
1134 void CSmsMessage::CorrectFormattingL(TUint aCharsAddedToCurrentPDU, |
1137 RPointerArray<CEmsInformationElement>& aCorrectedFormattingIEArray, |
1135 RPointerArray<CEmsInformationElement>& aCorrectedFormattingIEArray, |
1138 TUint aCharsAlreadyAdded) |
1136 TUint aCharsAlreadyAdded) |
1139 { |
1137 { |
1140 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_CORRECTFORMATTINGL_1, "CSmsMessage::CorrectFormattingL(): aCharsAddedToCurrentPDU=%u, aCharsAlreadyAdded=%u",aCharsAddedToCurrentPDU, aCharsAlreadyAdded); |
1138 LOGGSMU3("CSmsMessage::CorrectFormattingL(): aCharsAddedToCurrentPDU=%d, aCharsAlreadyAdded=%d", |
|
1139 aCharsAddedToCurrentPDU, aCharsAlreadyAdded); |
1141 |
1140 |
1142 CSmsUserData& uData = SmsPDU().UserData(); |
1141 CSmsUserData& uData = SmsPDU().UserData(); |
1143 for (TInt a= 0; a < uData.NumInformationElements(); a++) |
1142 for (TInt a= 0; a < uData.NumInformationElements(); a++) |
1144 { |
1143 { |
1145 CSmsInformationElement& ie = uData.InformationElement(a); |
1144 CSmsInformationElement& ie = uData.InformationElement(a); |
1162 { |
1161 { |
1163 CEmsFormatIE* newie=static_cast<CEmsFormatIE*>(formatIE.DuplicateL()); |
1162 CEmsFormatIE* newie=static_cast<CEmsFormatIE*>(formatIE.DuplicateL()); |
1164 CleanupStack::PushL(newie); |
1163 CleanupStack::PushL(newie); |
1165 newie->SetFormatLength(oldFormatLen - newFormatLen); |
1164 newie->SetFormatLength(oldFormatLen - newFormatLen); |
1166 newie->SetStartPosition(aCharsAlreadyAdded+aCharsAddedToCurrentPDU); |
1165 newie->SetStartPosition(aCharsAlreadyAdded+aCharsAddedToCurrentPDU); |
1167 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_CORRECTFORMATTINGL_2, "CSmsMessage::CorrectFormattingL Count=%d",aCorrectedFormattingIEArray.Count()); |
1166 LOGGSMU2("CSmsMessage::CorrectFormattingL",aCorrectedFormattingIEArray.Count()); |
1168 User::LeaveIfError(aCorrectedFormattingIEArray.Append(newie)); |
1167 aCorrectedFormattingIEArray.Append(newie); |
1169 CleanupStack::Pop(newie); |
1168 CleanupStack::Pop(newie); |
1170 } |
1169 } |
1171 } |
1170 } |
1172 } |
1171 } |
1173 } |
1172 } |
1174 } // CSmsMessage::CorrectFormattingL |
1173 } // CSmsMessage::CorrectFormattingL |
1175 |
1174 |
1176 |
1175 |
1177 void CSmsMessage::CorrectFormattingInSinglePDUL() |
1176 void CSmsMessage::CorrectFormattingInSinglePDUL() |
1178 { |
1177 { |
1179 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_CORRECTFORMATTINGINSINGLEPDUL_1, "CSmsMessage::CorrectFormattingInSinglePDUL()"); |
1178 LOGGSMU1("CSmsMessage::CorrectFormattingInSinglePDUL()"); |
1180 |
1179 |
1181 CSmsUserData& uData = SmsPDU().UserData(); |
1180 CSmsUserData& uData = SmsPDU().UserData(); |
1182 for (TInt a= 0; a < uData.NumInformationElements(); a++) |
1181 for (TInt a= 0; a < uData.NumInformationElements(); a++) |
1183 { |
1182 { |
1184 CSmsInformationElement& ie = uData.InformationElement(a); |
1183 CSmsInformationElement& ie = uData.InformationElement(a); |
1208 * PDUs to be quickly counted if the encoded PDUs are of |
1207 * PDUs to be quickly counted if the encoded PDUs are of |
1209 * no further use. |
1208 * no further use. |
1210 */ |
1209 */ |
1211 void CSmsMessage::AddCurrentPDUToPDUArrayL(TBool aDoEncode) |
1210 void CSmsMessage::AddCurrentPDUToPDUArrayL(TBool aDoEncode) |
1212 { |
1211 { |
1213 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ADDCURRENTPDUTOPDUARRAYL_1, "CSmsMessage::AddCurrentPDUToPDUArrayL(): Adding PDU number %d",iAdditionalInfo->SmsPDUArray().Count() + 1); |
1212 LOGGSMU2("CSmsMessage::AddCurrentPDUToPDUArrayL(): Adding PDU number %d", |
|
1213 iAdditionalInfo->SmsPDUArray().Count() + 1); |
1214 |
1214 |
1215 // |
1215 // |
1216 // Maximum number of PDU is 255, so if we have that already then we cannot |
1216 // Maximum number of PDU is 255, so if we have that already then we cannot |
1217 // continue. |
1217 // continue. |
1218 // |
1218 // |
1259 } // CSmsMessage::AddCurrentPDUToPDUArrayL |
1259 } // CSmsMessage::AddCurrentPDUToPDUArrayL |
1260 |
1260 |
1261 |
1261 |
1262 TBool CSmsMessage::AddIEToUserDataL(CEmsInformationElement* aIE, TInt aCharsAlreadyAdded,TUint& aCharsAddedToCurrentPDU,CSmsEMSBufferSegmenter& aSeg) |
1262 TBool CSmsMessage::AddIEToUserDataL(CEmsInformationElement* aIE, TInt aCharsAlreadyAdded,TUint& aCharsAddedToCurrentPDU,CSmsEMSBufferSegmenter& aSeg) |
1263 { |
1263 { |
1264 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ADDIETOUSERDATAL_1, "CSmsMessage::AddIEToUserDataL()"); |
1264 LOGGSMU1("CSmsMessage::AddIEToUserDataL()"); |
1265 |
1265 |
1266 TBool ieAdded=EFalse; |
1266 TBool ieAdded=EFalse; |
1267 if (SmsPDU().UserData().EmsInformationElementWillFitL(aIE,aSeg,aCharsAddedToCurrentPDU)) |
1267 if (SmsPDU().UserData().EmsInformationElementWillFitL(aIE,aSeg,aCharsAddedToCurrentPDU)) |
1268 { |
1268 { |
1269 CEmsInformationElement* newIE=aIE->DuplicateL(); |
1269 CEmsInformationElement* newIE=aIE->DuplicateL(); |
1286 * |
1286 * |
1287 * @return TInt Number of native characters added |
1287 * @return TInt Number of native characters added |
1288 */ |
1288 */ |
1289 TInt CSmsMessage::FillPduL(CSmsEMSBufferSegmenter& aSeg, TInt aNumChars, TSmsEncoding aEncoding) |
1289 TInt CSmsMessage::FillPduL(CSmsEMSBufferSegmenter& aSeg, TInt aNumChars, TSmsEncoding aEncoding) |
1290 { |
1290 { |
1291 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_FILLPDUL_1, "CSmsMessage::FillPduL()"); |
1291 LOGGSMU1("CSmsMessage::FillPduL()"); |
1292 |
1292 |
1293 TUint maxUDUnitsREmaining=SmsPDU().UserData().MaxPackedUDUnitsInBodyRemaining(); |
1293 TUint maxUDUnitsREmaining=SmsPDU().UserData().MaxPackedUDUnitsInBodyRemaining(); |
1294 |
1294 |
1295 if (aNumChars==0 || maxUDUnitsREmaining==0) |
1295 if (aNumChars==0 || maxUDUnitsREmaining==0) |
1296 { |
1296 { |
1331 * a PDU that contains only the mandatory elements. |
1331 * a PDU that contains only the mandatory elements. |
1332 */ |
1332 */ |
1333 void CSmsMessage::AddControlInformationElementsToMultiSegmentMessageL(TSmsInformationElementCategories::TInformationElementCategory aCategory, |
1333 void CSmsMessage::AddControlInformationElementsToMultiSegmentMessageL(TSmsInformationElementCategories::TInformationElementCategory aCategory, |
1334 TBool aMandatoryInPDU, TBool aDoEncode) |
1334 TBool aMandatoryInPDU, TBool aDoEncode) |
1335 { |
1335 { |
1336 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ADDCONTROLINFORMATIONELEMENTSTOMULTISEGMENTMESSAGEL_1, "CSmsMessage::AddControlInformationElementsToMultiSegmentMessageL()"); |
1336 LOGGSMU1("CSmsMessage::AddControlInformationElementsToMultiSegmentMessageL()"); |
1337 |
1337 |
1338 TUint numberOfInformationElements = iAdditionalInfo->NumberOfControlInformationElements(aCategory); |
1338 TUint numberOfInformationElements = iAdditionalInfo->NumberOfControlInformationElements(aCategory); |
1339 |
1339 |
1340 for (TInt i = 0; i < numberOfInformationElements; i++) |
1340 for (TInt i = 0; i < numberOfInformationElements; i++) |
1341 { |
1341 { |
1363 // It is possible to make Enhanced Voice Mail Information Elements |
1363 // It is possible to make Enhanced Voice Mail Information Elements |
1364 // bigger than the available space in the PDU. |
1364 // bigger than the available space in the PDU. |
1365 TBool canFit = SmsPDU().UserData().ControlInformationElementWillFitL(cloneInformationElement); |
1365 TBool canFit = SmsPDU().UserData().ControlInformationElementWillFitL(cloneInformationElement); |
1366 if (canFit == EFalse) |
1366 if (canFit == EFalse) |
1367 { |
1367 { |
1368 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ADDCONTROLINFORMATIONELEMENTSTOMULTISEGMENTMESSAGEL_2, "CSmsMessage::AddControlInformationElementsToMultiSegmentMessage, IE too bit to fit in any PDUL"); |
1368 LOGGSMU1("CSmsMessage::AddControlInformationElementsToMultiSegmentMessage, IE too bit to fit in any PDUL"); |
1369 User::Leave(KErrArgument); |
1369 User::Leave(KErrArgument); |
1370 } |
1370 } |
1371 i--; |
1371 i--; |
1372 } |
1372 } |
1373 |
1373 |
1387 * @leave KErrArgument If the category is mandatory but one or more elements |
1387 * @leave KErrArgument If the category is mandatory but one or more elements |
1388 * cannot be added then the encoding will fail. |
1388 * cannot be added then the encoding will fail. |
1389 */ |
1389 */ |
1390 void CSmsMessage::AddControlInformationElementsToMultiSegmentMessageL(TBool aDoEncode) |
1390 void CSmsMessage::AddControlInformationElementsToMultiSegmentMessageL(TBool aDoEncode) |
1391 { |
1391 { |
1392 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ADDCONTROLINFORMATIONELEMENTSTOMULTISEGMENTMESSAGEL1_1, "CSmsMessage::AddControlInformationElementsToMultiSegmentMessageL() 1"); |
1392 LOGGSMU1("CSmsMessage::AddControlInformationElementsToMultiSegmentMessageL() 1"); |
1393 |
1393 |
1394 TBool mandatoryInEachPDU = ETrue; |
1394 TBool mandatoryInEachPDU = ETrue; |
1395 AddControlInformationElementsToMultiSegmentMessageL(TSmsInformationElementCategories::ECtrlMandatoryIn1stPDUOnly, |
1395 AddControlInformationElementsToMultiSegmentMessageL(TSmsInformationElementCategories::ECtrlMandatoryIn1stPDUOnly, |
1396 mandatoryInEachPDU, aDoEncode); |
1396 mandatoryInEachPDU, aDoEncode); |
1397 mandatoryInEachPDU = EFalse; |
1397 mandatoryInEachPDU = EFalse; |
1423 TSmsEncoding& aEncoding, |
1423 TSmsEncoding& aEncoding, |
1424 RPointerArray<CEmsInformationElement>& aCorrectedFormatingIEArray, |
1424 RPointerArray<CEmsInformationElement>& aCorrectedFormatingIEArray, |
1425 TUint& aCurrEMSIEno, |
1425 TUint& aCurrEMSIEno, |
1426 TUint& aCharsAlreadyAdded) |
1426 TUint& aCharsAlreadyAdded) |
1427 { |
1427 { |
1428 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ADDEMSINFORMATIONELEMENTSTOMULTISEGMENTMESSAGEL_1, "CSmsMessage::AddEMSInformationElementsToMultiSegmentMessageL()"); |
1428 LOGGSMU1("CSmsMessage::AddEMSInformationElementsToMultiSegmentMessageL()"); |
1429 |
1429 |
1430 TUint startPosition=0; |
1430 TUint startPosition=0; |
1431 |
1431 |
1432 // number of chars added to the current PDU |
1432 // number of chars added to the current PDU |
1433 TUint no=iInformationElementArray->Count(); |
1433 TUint no=iInformationElementArray->Count(); |
1434 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ADDEMSINFORMATIONELEMENTSTOMULTISEGMENTMESSAGEL_2, "CSmsMessage::AddEMSInformationElementsToMultiSegmentMessageL no of IE %d",no); |
1434 LOGGSMU2("CSmsMessage::AddEMSInformationElementsToMultiSegmentMessageL no of IE %d",no); |
1435 CEmsInformationElement* ie = NULL; |
1435 CEmsInformationElement* ie = NULL; |
1436 TUint msgLen=iBuffer->Length(); |
1436 TUint msgLen=iBuffer->Length(); |
1437 TUint filledChars=0; |
1437 TUint filledChars=0; |
1438 |
1438 |
1439 while(aCurrEMSIEno < no || aCorrectedFormatingIEArray.Count() > 0) |
1439 while(aCurrEMSIEno < no || aCorrectedFormatingIEArray.Count() > 0) |
1470 { |
1470 { |
1471 filledChars = FillPduL(aSegmenter, startPosition-aCharsAddedToCurrentPDU, aEncoding); |
1471 filledChars = FillPduL(aSegmenter, startPosition-aCharsAddedToCurrentPDU, aEncoding); |
1472 aCharsAddedToCurrentPDU+=filledChars; |
1472 aCharsAddedToCurrentPDU+=filledChars; |
1473 } |
1473 } |
1474 |
1474 |
1475 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ADDEMSINFORMATIONELEMENTSTOMULTISEGMENTMESSAGEL_3, "CSmsMessage::AddEMSInformationElementsToMultiSegmentMessageL: filled %d chars", filledChars); |
1475 LOGGSMU2("CSmsMessage::AddEMSInformationElementsToMultiSegmentMessageL: filled %d chars", filledChars); |
1476 |
1476 |
1477 if (aCharsAddedToCurrentPDU==startPosition) |
1477 if (aCharsAddedToCurrentPDU==startPosition) |
1478 { |
1478 { |
1479 // Try adding the IE. |
1479 // Try adding the IE. |
1480 if (AddIEToUserDataL(ie, aCharsAlreadyAdded,aCharsAddedToCurrentPDU,aSegmenter)) |
1480 if (AddIEToUserDataL(ie, aCharsAlreadyAdded,aCharsAddedToCurrentPDU,aSegmenter)) |
1490 else aCurrEMSIEno++; |
1490 else aCurrEMSIEno++; |
1491 } |
1491 } |
1492 else |
1492 else |
1493 { |
1493 { |
1494 // Information Element will not fit send PDU |
1494 // Information Element will not fit send PDU |
1495 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ADDEMSINFORMATIONELEMENTSTOMULTISEGMENTMESSAGEL_4, "CSmsMessage::AddEMSInformationElementsToMultiSegmentMessageL: ie will not fit send Message"); |
1495 LOGGSMU1("CSmsMessage::AddEMSInformationElementsToMultiSegmentMessageL: ie will not fit send Message"); |
1496 CorrectFormattingL(aCharsAddedToCurrentPDU,aCorrectedFormatingIEArray,aCharsAlreadyAdded); |
1496 CorrectFormattingL(aCharsAddedToCurrentPDU,aCorrectedFormatingIEArray,aCharsAlreadyAdded); |
1497 |
1497 |
1498 aCharsAlreadyAdded += aCharsAddedToCurrentPDU; |
1498 aCharsAlreadyAdded += aCharsAddedToCurrentPDU; |
1499 aCharsAddedToCurrentPDU=0; |
1499 aCharsAddedToCurrentPDU=0; |
1500 |
1500 |
1511 } |
1511 } |
1512 } |
1512 } |
1513 else |
1513 else |
1514 { |
1514 { |
1515 // native chars upto start position will not fit send PDu. |
1515 // native chars upto start position will not fit send PDu. |
1516 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ADDEMSINFORMATIONELEMENTSTOMULTISEGMENTMESSAGEL_5, "CSmsMessage::AddEMSInformationElementsToMultiSegmentMessageL: PDU is filled with chars sending"); |
1516 LOGGSMU1("CSmsMessage::AddEMSInformationElementsToMultiSegmentMessageL: PDU is filled with chars sending"); |
1517 |
1517 |
1518 CorrectFormattingL(aCharsAddedToCurrentPDU,aCorrectedFormatingIEArray,aCharsAlreadyAdded); |
1518 CorrectFormattingL(aCharsAddedToCurrentPDU,aCorrectedFormatingIEArray,aCharsAlreadyAdded); |
1519 |
1519 |
1520 aCharsAlreadyAdded += aCharsAddedToCurrentPDU; |
1520 aCharsAlreadyAdded += aCharsAddedToCurrentPDU; |
1521 aCharsAddedToCurrentPDU=0; |
1521 aCharsAddedToCurrentPDU=0; |
1549 * @return TBool whether EMS IEs have been added to segment |
1549 * @return TBool whether EMS IEs have been added to segment |
1550 */ |
1550 */ |
1551 TBool CSmsMessage::AddEMSInformationElementsToSingleSegmentMessageL(CSmsEMSBufferSegmenter& aSegmenter, |
1551 TBool CSmsMessage::AddEMSInformationElementsToSingleSegmentMessageL(CSmsEMSBufferSegmenter& aSegmenter, |
1552 TSmsEncoding aEncoding) |
1552 TSmsEncoding aEncoding) |
1553 { |
1553 { |
1554 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ADDEMSINFORMATIONELEMENTSTOSINGLESEGMENTMESSAGEL_1, "CSmsMessage::AddEMSInformationElementsToSingleSegmentMessageL()"); |
1554 LOGGSMU1("CSmsMessage::AddEMSInformationElementsToSingleSegmentMessageL()"); |
1555 |
1555 |
1556 TUint charsAddedToCurrentPDU=0; |
1556 TUint charsAddedToCurrentPDU=0; |
1557 TUint numOfEmsIE=iInformationElementArray->Count(); |
1557 TUint numOfEmsIE=iInformationElementArray->Count(); |
1558 TUint currEmsIEindex=0; |
1558 TUint currEmsIEindex=0; |
1559 CEmsInformationElement* ie = NULL; |
1559 CEmsInformationElement* ie = NULL; |
1606 void CSmsMessage::EncodeBufferL(CArrayFix<TGsmSms>& aSmsArray, TInt aReference, |
1606 void CSmsMessage::EncodeBufferL(CArrayFix<TGsmSms>& aSmsArray, TInt aReference, |
1607 const CSmsBufferBase& aBuffer, |
1607 const CSmsBufferBase& aBuffer, |
1608 TInt& aUnconvertedChars, TInt& aDowngradedChars, |
1608 TInt& aUnconvertedChars, TInt& aDowngradedChars, |
1609 TInt& aFreeUDUnitsInLastPDU, TBool aDoEncode) |
1609 TInt& aFreeUDUnitsInLastPDU, TBool aDoEncode) |
1610 { |
1610 { |
1611 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ENCODEBUFFERL_1, "CSmsMessage::EncodeBufferL()"); |
1611 LOGGSMU1("CSmsMessage::EncodeBufferL()"); |
1612 |
1612 |
1613 aUnconvertedChars = 0; |
1613 aUnconvertedChars = 0; |
1614 aDowngradedChars = 0; |
1614 aDowngradedChars = 0; |
1615 aFreeUDUnitsInLastPDU = 0; |
1615 aFreeUDUnitsInLastPDU = 0; |
1616 |
1616 |
1710 // While there is still data to encode see how much space is left in this |
1710 // While there is still data to encode see how much space is left in this |
1711 // PDU and attempt to encode something into it... |
1711 // PDU and attempt to encode something into it... |
1712 // |
1712 // |
1713 while (segmenter->MoreL()) |
1713 while (segmenter->MoreL()) |
1714 { |
1714 { |
1715 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ENCODEBUFFERL_2, "CSmsMessage::EncodeBufferL - there is MoreL"); |
1715 LOGGSMU1("CSmsMessage::EncodeBufferL - there is MoreL"); |
1716 |
1716 |
1717 // |
1717 // |
1718 // Calculate the space left to use in this PDU... |
1718 // Calculate the space left to use in this PDU... |
1719 // |
1719 // |
1720 TInt size = SmsPDU().UserData().MaxPackedUDUnitsInBodyRemaining(); |
1720 TInt size = SmsPDU().UserData().MaxPackedUDUnitsInBodyRemaining(); |
1721 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ENCODEBUFFERL_3, "CSmsMessage::EncodeBufferL - remaining size in PDU is %d",size); |
1721 LOGGSMU2("CSmsMessage::EncodeBufferL - remaining size in PDU is %d",size); |
1722 |
1722 |
1723 // |
1723 // |
1724 // While there is no space, correct the formatting (which may |
1724 // While there is no space, correct the formatting (which may |
1725 // introduce any un-placed EMS Elements into the corrected format |
1725 // introduce any un-placed EMS Elements into the corrected format |
1726 // array) and then start a new PDU... |
1726 // array) and then start a new PDU... |
1753 |
1753 |
1754 // |
1754 // |
1755 // Add any elements that can be placed now (from previous |
1755 // Add any elements that can be placed now (from previous |
1756 // PDUs and above)... |
1756 // PDUs and above)... |
1757 // |
1757 // |
1758 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ENCODEBUFFERL_4, "CSmsMessage::EncodeBufferL: IE count %d corrected count %d",iInformationElementArray->Count(),correctedFormatingIEArray.Count() ); |
1758 LOGGSMU3("CSmsMessage::EncodeBufferL: IE count %d corrected count %d",iInformationElementArray->Count(),correctedFormatingIEArray.Count() ); |
1759 if ((TUint)iInformationElementArray->Count() > currEMSIEno || |
1759 if ((TUint)iInformationElementArray->Count() > currEMSIEno || |
1760 correctedFormatingIEArray.Count() > 0) |
1760 correctedFormatingIEArray.Count() > 0) |
1761 { |
1761 { |
1762 AddEMSInformationElementsToMultiSegmentMessageL(*segmenter,charsAdded2CurrentPDU, |
1762 AddEMSInformationElementsToMultiSegmentMessageL(*segmenter,charsAdded2CurrentPDU, |
1763 aDoEncode, encodingToUse, |
1763 aDoEncode, encodingToUse, |
1767 |
1767 |
1768 // |
1768 // |
1769 // Calculate the space left remaining in this new PDU... |
1769 // Calculate the space left remaining in this new PDU... |
1770 // |
1770 // |
1771 size = SmsPDU().UserData().MaxPackedUDUnitsInBodyRemaining(); |
1771 size = SmsPDU().UserData().MaxPackedUDUnitsInBodyRemaining(); |
1772 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ENCODEBUFFERL_5, "CSmsMessage::EncodeBufferL - remaining size in PDU is %d",size); |
1772 LOGGSMU2("CSmsMessage::EncodeBufferL - remaining size in PDU is %d",size); |
1773 } |
1773 } |
1774 |
1774 |
1775 // |
1775 // |
1776 // We have space in this PDU and no elements to place, so obtain |
1776 // We have space in this PDU and no elements to place, so obtain |
1777 // the next peice of text that can fit and append it. |
1777 // the next peice of text that can fit and append it. |
1778 // |
1778 // |
1779 segmenter->SegmentNextL(ptr, size, aUnconvertedChars, aDowngradedChars, encodingToUse); |
1779 segmenter->SegmentNextL(ptr, size, aUnconvertedChars, aDowngradedChars, encodingToUse); |
1780 SmsPDU().UserData().AppendBodyL(ptr); |
1780 SmsPDU().UserData().AppendBodyL(ptr); |
1781 |
1781 |
1782 TUint charsInSegment= isUnicode ? ptr.Length()/2 : ptr.Length(); |
1782 TUint charsInSegment= isUnicode ? ptr.Length()/2 : ptr.Length(); |
1783 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ENCODEBUFFERL_6, "CSmsMessage::EncodeBufferL: segmenting added %d chars", charsInSegment); |
1783 LOGGSMU2("CSmsMessage::EncodeBufferL: segmenting added %d chars", charsInSegment); |
1784 |
1784 |
1785 // |
1785 // |
1786 // At this point the working PDU is either full (e.g. we filled the |
1786 // At this point the working PDU is either full (e.g. we filled the |
1787 // remaining space with a chuck of text, or the is some space as we |
1787 // remaining space with a chuck of text, or the is some space as we |
1788 // stored the last part of the text. |
1788 // stored the last part of the text. |
1791 // formatting array... |
1791 // formatting array... |
1792 // |
1792 // |
1793 charsAdded2CurrentPDU+=charsInSegment; |
1793 charsAdded2CurrentPDU+=charsInSegment; |
1794 CorrectFormattingL(charsAdded2CurrentPDU, correctedFormatingIEArray, charsAlreadyAdded); |
1794 CorrectFormattingL(charsAdded2CurrentPDU, correctedFormatingIEArray, charsAlreadyAdded); |
1795 charsAlreadyAdded+=charsAdded2CurrentPDU; |
1795 charsAlreadyAdded+=charsAdded2CurrentPDU; |
1796 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ENCODEBUFFERL_7, "CSmsMessage::EncodeBufferL(): charsAlreadyAdded=%d", charsAlreadyAdded); |
1796 LOGGSMU2("CSmsMessage::EncodeBufferL(): charsAlreadyAdded=%d", charsAlreadyAdded); |
1797 |
1797 |
1798 // |
1798 // |
1799 // Now store this PDU and reset the working PDU... |
1799 // Now store this PDU and reset the working PDU... |
1800 // |
1800 // |
1801 aFreeUDUnitsInLastPDU = SmsPDU().UserData().MaxPackedUDUnitsInBodyRemaining(); |
1801 aFreeUDUnitsInLastPDU = SmsPDU().UserData().MaxPackedUDUnitsInBodyRemaining(); |
1814 |
1814 |
1815 // |
1815 // |
1816 // Add any elements that can be placed now given we have a new |
1816 // Add any elements that can be placed now given we have a new |
1817 // empty PDU... |
1817 // empty PDU... |
1818 // |
1818 // |
1819 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ENCODEBUFFERL_8, "CSmsMessage::EncodeBufferL: IE count %d corrected count %d",iInformationElementArray->Count(), correctedFormatingIEArray.Count() ); |
1819 LOGGSMU3("CSmsMessage::EncodeBufferL: IE count %d corrected count %d", |
|
1820 iInformationElementArray->Count(), correctedFormatingIEArray.Count() ); |
1820 if ((TUint)iInformationElementArray->Count() > currEMSIEno || |
1821 if ((TUint)iInformationElementArray->Count() > currEMSIEno || |
1821 correctedFormatingIEArray.Count() > 0) |
1822 correctedFormatingIEArray.Count() > 0) |
1822 { |
1823 { |
1823 AddEMSInformationElementsToMultiSegmentMessageL(*segmenter, charsAdded2CurrentPDU, |
1824 AddEMSInformationElementsToMultiSegmentMessageL(*segmenter, charsAdded2CurrentPDU, |
1824 aDoEncode, encodingToUse, |
1825 aDoEncode, encodingToUse, |
1825 correctedFormatingIEArray, |
1826 correctedFormatingIEArray, |
1826 currEMSIEno, charsAlreadyAdded); |
1827 currEMSIEno, charsAlreadyAdded); |
1827 } |
1828 } |
1828 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ENCODEBUFFERL_9, "CSmsMessage::EncodeBufferL end Moreloop"); |
1829 LOGGSMU1("CSmsMessage::EncodeBufferL end Moreloop"); |
1829 } |
1830 } |
1830 CleanupStack::PopAndDestroy(buf); |
1831 CleanupStack::PopAndDestroy(buf); |
1831 |
1832 |
1832 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ENCODEBUFFERL_10, "CSmsMessage::EncodeBufferL - last PDU"); |
1833 LOGGSMU1("CSmsMessage::EncodeBufferL - last PDU"); |
1833 |
1834 |
1834 // |
1835 // |
1835 // This is the last PDU. We need to check if there is a partial PDU left over |
1836 // This is the last PDU. We need to check if there is a partial PDU left over |
1836 // and add it if needed. |
1837 // and add it if needed. |
1837 // |
1838 // |
1862 // Note: In the case were aDoEncode is EFalse, iSmsPDUArray will be full |
1863 // Note: In the case were aDoEncode is EFalse, iSmsPDUArray will be full |
1863 // of NULL pointers as it is only the count that we need in that case. |
1864 // of NULL pointers as it is only the count that we need in that case. |
1864 // |
1865 // |
1865 TInt numPDUs = iAdditionalInfo->SmsPDUArray().Count(); |
1866 TInt numPDUs = iAdditionalInfo->SmsPDUArray().Count(); |
1866 |
1867 |
1867 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ENCODEBUFFERL_11, "CSmsMessage::EncodeBufferL number of PDUs: %d", iAdditionalInfo->SmsPDUArray().Count()); |
1868 LOGGSMU2("CSmsMessage::EncodeBufferL number of PDUs: %d", iAdditionalInfo->SmsPDUArray().Count()); |
1868 |
1869 |
1869 if (aDoEncode) |
1870 if (aDoEncode) |
1870 { |
1871 { |
1871 CSmsMessageAdditionalAttributes::CSmsStatusReportScheme& scheme = iAdditionalInfo->GetStatusReportScheme(); |
1872 CSmsMessageAdditionalAttributes::CSmsStatusReportScheme& scheme = iAdditionalInfo->GetStatusReportScheme(); |
1872 TGsmSms gsmSms; |
1873 TGsmSms gsmSms; |
1953 * in the last PDU. |
1954 * in the last PDU. |
1954 */ |
1955 */ |
1955 TBool CSmsMessage::EncodeIntoSinglePDUL(CArrayFix<TGsmSms>& aSmsArray, TInt& aUnconvertedChars, |
1956 TBool CSmsMessage::EncodeIntoSinglePDUL(CArrayFix<TGsmSms>& aSmsArray, TInt& aUnconvertedChars, |
1956 TInt& aDowngradedChars, TInt& aFreeUDUnitsInLastPDU) |
1957 TInt& aDowngradedChars, TInt& aFreeUDUnitsInLastPDU) |
1957 { |
1958 { |
1958 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ENCODEINTOSINGLEPDUL_1, "CSmsMessage::EncodeIntoSinglePDUL()"); |
1959 LOGGSMU1("CSmsMessage::EncodeIntoSinglePDUL()"); |
1959 |
1960 |
1960 __ASSERT_DEBUG((aSmsArray.Count()==0),Panic(KGsmuPanicSmsArrayNotEmpty)); |
1961 __ASSERT_DEBUG((aSmsArray.Count()==0),Panic(KGsmuPanicSmsArrayNotEmpty)); |
1961 |
1962 |
1962 aUnconvertedChars = 0; |
1963 aUnconvertedChars = 0; |
1963 aDowngradedChars = 0; |
1964 aDowngradedChars = 0; |
2015 |
2016 |
2016 TInt msgLength=MessageLengthL(); // in octets |
2017 TInt msgLength=MessageLengthL(); // in octets |
2017 |
2018 |
2018 if( msgLength > remainInBody) return EFalse; |
2019 if( msgLength > remainInBody) return EFalse; |
2019 |
2020 |
2020 OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ENCODEINTOSINGLEPDUL_3, "CSmsMessage::EncodeIntoSinglePDUL, ie len = %d, remainInBody = %d, msgLength = %d", ieLength, msgLength, remainInBody); |
2021 LOGGSMU4("CSmsMessage::EncodeIntoSinglePDUL, ie len = %d, remainInBody = %d, msgLength = %d", ieLength, msgLength, remainInBody); |
2021 // add all control information elements into working PDU. |
2022 // add all control information elements into working PDU. |
2022 // |
2023 // |
2023 for (TUint8 category = 0; category < TSmsInformationElementCategories::ENumberOfCategories; category++) |
2024 for (TUint8 category = 0; category < TSmsInformationElementCategories::ENumberOfCategories; category++) |
2024 { |
2025 { |
2025 switch (category) |
2026 switch (category) |
2133 * |
2134 * |
2134 * @capability None |
2135 * @capability None |
2135 */ |
2136 */ |
2136 EXPORT_C TBool CSmsMessage::EncodeIntoSinglePDUL(CArrayFix<TGsmSms>& aSmsArray) |
2137 EXPORT_C TBool CSmsMessage::EncodeIntoSinglePDUL(CArrayFix<TGsmSms>& aSmsArray) |
2137 { |
2138 { |
2138 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_ENCODEINTOSINGLEPDUL1_1, "CSmsMessage::EncodeIntoSinglePDUL()"); |
2139 LOGGSMU1("CSmsMessage::EncodeIntoSinglePDUL()"); |
2139 |
2140 |
2140 TInt unconvertedChars, downgradedChars, freeUDUnitsInLastPDU; |
2141 TInt unconvertedChars, downgradedChars, freeUDUnitsInLastPDU; |
2141 |
2142 |
2142 return EncodeIntoSinglePDUL(aSmsArray, unconvertedChars, |
2143 return EncodeIntoSinglePDUL(aSmsArray, unconvertedChars, |
2143 downgradedChars, freeUDUnitsInLastPDU); |
2144 downgradedChars, freeUDUnitsInLastPDU); |
2216 * of the UserData. |
2217 * of the UserData. |
2217 */ |
2218 */ |
2218 void CSmsMessage::DecodeBufferL(CArrayPtr<CSmsPDU>& aSmsPDUArray, |
2219 void CSmsMessage::DecodeBufferL(CArrayPtr<CSmsPDU>& aSmsPDUArray, |
2219 CSmsBufferBase& aBuffer) |
2220 CSmsBufferBase& aBuffer) |
2220 { |
2221 { |
2221 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_DECODEBUFFERL_1, "CSmsMessage::DecodeBufferL()"); |
2222 LOGGSMU1("CSmsMessage::DecodeBufferL()"); |
2222 |
2223 |
2223 iInformationElementArray->ResetAndDestroy(); |
2224 iInformationElementArray->ResetAndDestroy(); |
2224 |
2225 |
2225 TSmsStatusReportScheme schemeId = FindSchemeL(aSmsPDUArray); |
2226 TSmsStatusReportScheme schemeId = FindSchemeL(aSmsPDUArray); |
2226 |
2227 |
2278 * |
2279 * |
2279 */ |
2280 */ |
2280 void CSmsMessage::DecodeOnlyTextL(CArrayPtr<CSmsPDU>& aSmsPDUArray, |
2281 void CSmsMessage::DecodeOnlyTextL(CArrayPtr<CSmsPDU>& aSmsPDUArray, |
2281 CSmsBufferBase& aBuffer) |
2282 CSmsBufferBase& aBuffer) |
2282 { |
2283 { |
2283 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_DECODEONLYTEXTL_1, "CSmsMessage::DecodeOnlyTextL()"); |
2284 LOGGSMU1("CSmsMessage::DecodeOnlyTextL()"); |
2284 |
2285 |
2285 for (TInt i=0; i<aSmsPDUArray.Count(); i++) |
2286 for (TInt i=0; i<aSmsPDUArray.Count(); i++) |
2286 { |
2287 { |
2287 CSmsAlphabetConverter* converter=CSmsAlphabetConverter::NewLC(*iCharacterSetConverter,iFs,aSmsPDUArray[i]->Alphabet(),BinaryData()); |
2288 CSmsAlphabetConverter* converter=CSmsAlphabetConverter::NewLC(*iCharacterSetConverter,iFs,aSmsPDUArray[i]->Alphabet(),BinaryData()); |
2288 TSmsBufferReassembler reassembler(*converter,aBuffer); |
2289 TSmsBufferReassembler reassembler(*converter,aBuffer); |
2305 * @param aLastPartialCompleteMsg boolean value indicating whether |
2306 * @param aLastPartialCompleteMsg boolean value indicating whether |
2306 this message is the last incomplete message sent to client. |
2307 this message is the last incomplete message sent to client. |
2307 */ |
2308 */ |
2308 void CSmsMessage::AddIncompleteMessageInfoL(TInt aStartPDU, TInt aEndPDU, TBool aLastPartialCompleteMsg) |
2309 void CSmsMessage::AddIncompleteMessageInfoL(TInt aStartPDU, TInt aEndPDU, TBool aLastPartialCompleteMsg) |
2309 { |
2310 { |
2310 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ADDINCOMPLETEMESSAGEINFOL_1, "CSmsMessage::AddIncompleteMessageInfoL()"); |
2311 LOGGSMU1("CSmsMessage::AddIncompleteMessageInfoL()"); |
2311 |
2312 |
2312 CIncompleteClass0MessageInfo& incompleteClass0MsgInfo = (CIncompleteClass0MessageInfo&) iAdditionalInfo->GetNonIEOperationL(ESmsIncompleteClass0MessageParameter); |
2313 CIncompleteClass0MessageInfo& incompleteClass0MsgInfo = (CIncompleteClass0MessageInfo&) iAdditionalInfo->GetNonIEOperationL(ESmsIncompleteClass0MessageParameter); |
2313 incompleteClass0MsgInfo.SetVersion(CIncompleteClass0MessageInfo::ESmsIncompleteClass0MessageV0); |
2314 incompleteClass0MsgInfo.SetVersion(CIncompleteClass0MessageInfo::ESmsIncompleteClass0MessageV0); |
2314 incompleteClass0MsgInfo.SetIncompleteMessageInfoL(aStartPDU, aEndPDU, aLastPartialCompleteMsg); |
2315 incompleteClass0MsgInfo.SetIncompleteMessageInfoL(aStartPDU, aEndPDU, aLastPartialCompleteMsg); |
2315 } |
2316 } |
2329 * @internalComponent |
2330 * @internalComponent |
2330 */ |
2331 */ |
2331 void CSmsMessage::InstallControlInformationElementsL(CSmsUserData& aUserData, TInt aSegmentSequenceNum) |
2332 void CSmsMessage::InstallControlInformationElementsL(CSmsUserData& aUserData, TInt aSegmentSequenceNum) |
2332 { |
2333 { |
2333 // Installs all the information elements within the subsequent PDUs. |
2334 // Installs all the information elements within the subsequent PDUs. |
2334 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_INSTALLCONTROLINFORMATIONELEMENTSL_1, "CSmsMessage::InstallControlInformationElements()"); |
2335 LOGGSMU1("CSmsMessage::InstallControlInformationElements()"); |
2335 |
2336 |
2336 CSmsMessageAdditionalAttributes::CSmsStatusReportScheme& scheme = iAdditionalInfo->GetStatusReportScheme(); |
2337 CSmsMessageAdditionalAttributes::CSmsStatusReportScheme& scheme = iAdditionalInfo->GetStatusReportScheme(); |
2337 |
2338 |
2338 for (TInt z=0; z<aUserData.NumInformationElements(); z++) |
2339 for (TInt z=0; z<aUserData.NumInformationElements(); z++) |
2339 { |
2340 { |
2344 if (TSmsInformationElementCategories::GetCategoryDefinition(ie.Identifier(), category)) |
2345 if (TSmsInformationElementCategories::GetCategoryDefinition(ie.Identifier(), category)) |
2345 { |
2346 { |
2346 switch (category) |
2347 switch (category) |
2347 { |
2348 { |
2348 case TSmsInformationElementCategories::ECtrlMandatoryInEveryPDUMultipleInstancesPerPDU: // e.g. Special SMS Message Indication |
2349 case TSmsInformationElementCategories::ECtrlMandatoryInEveryPDUMultipleInstancesPerPDU: // e.g. Special SMS Message Indication |
2349 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_INSTALLCONTROLINFORMATIONELEMENTSL_2, "CSmsMessage::InstallControlInformationElements \ECtrlMandatoryInEveryPDUMultipleInstancesPerPDU id = %d", ie.Identifier()); |
2350 LOGGSMU2("CSmsMessage::InstallControlInformationElements \ |
|
2351 ECtrlMandatoryInEveryPDUMultipleInstancesPerPDU id = %d", ie.Identifier()); |
2350 |
2352 |
2351 if (ie.Identifier()== CSmsInformationElement::ESmsIEISpecialSMSMessageIndication) |
2353 if (ie.Identifier()== CSmsInformationElement::ESmsIEISpecialSMSMessageIndication) |
2352 { |
2354 { |
2353 TBool found = EFalse; |
2355 TBool found = EFalse; |
2354 CArrayFixFlat<TInt>* indices = new(ELeave) CArrayFixFlat<TInt>(4); |
2356 CArrayFixFlat<TInt>* indices = new(ELeave) CArrayFixFlat<TInt>(4); |
2376 } |
2378 } |
2377 } |
2379 } |
2378 else |
2380 else |
2379 { |
2381 { |
2380 // Unknown category. |
2382 // Unknown category. |
2381 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_INSTALLCONTROLINFORMATIONELEMENTSL_3, "CSmsMessage::InstallControlInformationElementsL category = %d, id = %d", category, ie.Identifier()); |
2383 LOGGSMU3("CSmsMessage::InstallControlInformationElementsL category = %d, id = %d", category, ie.Identifier()); |
2382 User::Leave(KErrArgument); |
2384 User::Leave(KErrArgument); |
2383 } |
2385 } |
2384 break; |
2386 break; |
2385 case TSmsInformationElementCategories::ECtrlMandatoryIn1stPDUOnly: |
2387 case TSmsInformationElementCategories::ECtrlMandatoryIn1stPDUOnly: |
2386 case TSmsInformationElementCategories::ECtrlSingleInstanceOnly: |
2388 case TSmsInformationElementCategories::ECtrlSingleInstanceOnly: |
2387 { |
2389 { |
2388 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_INSTALLCONTROLINFORMATIONELEMENTSL_4, "CSmsMessage::InstallControlInformationElements ECtrlMandatoryIn1stPDUOnly ""ECtrlSingleInstanceOnly, id = %d", ie.Identifier()); |
2390 LOGGSMU2("CSmsMessage::InstallControlInformationElements ECtrlMandatoryIn1stPDUOnly " |
|
2391 "ECtrlSingleInstanceOnly, id = %d", ie.Identifier()); |
2389 |
2392 |
2390 TUint index = 0; |
2393 TUint index = 0; |
2391 if (iAdditionalInfo->Find1stInstanceOfControlInformationElement(ie.Identifier(), index)) |
2394 if (iAdditionalInfo->Find1stInstanceOfControlInformationElement(ie.Identifier(), index)) |
2392 { |
2395 { |
2393 iAdditionalInfo->DeleteControlInformationElement(category, index); // might want to pass the |
2396 iAdditionalInfo->DeleteControlInformationElement(category, index); // might want to pass the |
2408 } |
2411 } |
2409 break; |
2412 break; |
2410 } |
2413 } |
2411 case TSmsInformationElementCategories::ECtrlMandatoryInEveryPDUAndWithIdenticalValues: |
2414 case TSmsInformationElementCategories::ECtrlMandatoryInEveryPDUAndWithIdenticalValues: |
2412 { |
2415 { |
2413 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_INSTALLCONTROLINFORMATIONELEMENTSL_5, "CSmsMessage::InstallControlInformationElements ECtrlMandatoryInEveryPDUAndWithIdenticalValues ""ECtrlSingleInstanceOnly, id = %d", ie.Identifier()); |
2416 LOGGSMU2("CSmsMessage::InstallControlInformationElements ECtrlMandatoryInEveryPDUAndWithIdenticalValues " |
|
2417 "ECtrlSingleInstanceOnly, id = %d", ie.Identifier()); |
2414 TInt index = 0; |
2418 TInt index = 0; |
2415 if (SmsPDU().UserData().InformationElementIndex(ie.Identifier(),index)) |
2419 if (SmsPDU().UserData().InformationElementIndex(ie.Identifier(),index)) |
2416 { |
2420 { |
2417 CSmsInformationElement* newInformationElement = CSmsInformationElement::NewL(ie.Identifier(),ie.Data()); |
2421 CSmsInformationElement* newInformationElement = CSmsInformationElement::NewL(ie.Identifier(),ie.Data()); |
2418 |
2422 |
2432 break; |
2436 break; |
2433 } |
2437 } |
2434 |
2438 |
2435 case TSmsInformationElementCategories::ECtrlMultipleInstancesAllowed: |
2439 case TSmsInformationElementCategories::ECtrlMultipleInstancesAllowed: |
2436 { |
2440 { |
2437 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_INSTALLCONTROLINFORMATIONELEMENTSL_6, "CSmsMessage::InstallControlInformationElements ECtrlMandatoryInEveryPDUAndWithIdenticalValues ""ECtrlSingleInstanceOnly, id = %d", ie.Identifier() ); |
2441 LOGGSMU2("CSmsMessage::InstallControlInformationElements ECtrlMandatoryInEveryPDUAndWithIdenticalValues " |
|
2442 "ECtrlSingleInstanceOnly, id = %d", ie.Identifier() ); |
2438 |
2443 |
2439 CSmsInformationElement* cloneInformationElement = CSmsInformationElement::NewL( ie.Identifier(),ie.Data() ); |
2444 CSmsInformationElement* cloneInformationElement = CSmsInformationElement::NewL( ie.Identifier(),ie.Data() ); |
2440 CleanupStack::PushL(cloneInformationElement); |
2445 CleanupStack::PushL(cloneInformationElement); |
2441 iAdditionalInfo->AddControlInformationElementL( TSmsInformationElementCategories::ECtrlMultipleInstancesAllowed, cloneInformationElement); |
2446 iAdditionalInfo->AddControlInformationElementL( TSmsInformationElementCategories::ECtrlMultipleInstancesAllowed, cloneInformationElement); |
2442 CleanupStack::Pop(cloneInformationElement); |
2447 CleanupStack::Pop(cloneInformationElement); |
2443 break; |
2448 break; |
2444 } |
2449 } |
2445 case TSmsInformationElementCategories::ECtrlMandatoryInEveryPDUButWithValueSpecificToPDU: |
2450 case TSmsInformationElementCategories::ECtrlMandatoryInEveryPDUButWithValueSpecificToPDU: |
2446 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_INSTALLCONTROLINFORMATIONELEMENTSL_7, "CSmsMessage::InstallControlInformationElements ECtrlMandatoryInEveryPDUButWithValueSpecificToPDU ""ECtrlSingleInstanceOnly, id = %d", ie.Identifier() ); |
2451 LOGGSMU2("CSmsMessage::InstallControlInformationElements ECtrlMandatoryInEveryPDUButWithValueSpecificToPDU " |
|
2452 "ECtrlSingleInstanceOnly, id = %d", ie.Identifier() ); |
2447 |
2453 |
2448 if (ie.Identifier() == CSmsInformationElement::ESmsIEISMSCControlParameters) |
2454 if (ie.Identifier() == CSmsInformationElement::ESmsIEISMSCControlParameters) |
2449 { |
2455 { |
2450 if(scheme.Id() == EControlParametersScheme) |
2456 if(scheme.Id() == EControlParametersScheme) |
2451 { |
2457 { |
2468 // e.g Email Header / Concatenation Elements. |
2474 // e.g Email Header / Concatenation Elements. |
2469 // Consider whether EMail Header should be ported here. |
2475 // Consider whether EMail Header should be ported here. |
2470 // or left as is. |
2476 // or left as is. |
2471 break; |
2477 break; |
2472 case TSmsInformationElementCategories::EEmsInformationElement: |
2478 case TSmsInformationElementCategories::EEmsInformationElement: |
2473 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_INSTALLCONTROLINFORMATIONELEMENTSL_8, "CSmsMessage::InstallControlInformationElements ECtrlMandatoryInEveryPDUButWithValueSpecificToPDU ""ECtrlSingleInstanceOnly, id = %d", ie.Identifier() ); |
2479 LOGGSMU2("CSmsMessage::InstallControlInformationElements ECtrlMandatoryInEveryPDUButWithValueSpecificToPDU " |
|
2480 "ECtrlSingleInstanceOnly, id = %d", ie.Identifier() ); |
2474 // Will be handled in the method InstallEmsInformationElements, nothing to do here |
2481 // Will be handled in the method InstallEmsInformationElements, nothing to do here |
2475 break; |
2482 break; |
2476 default: |
2483 default: |
2477 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_INSTALLCONTROLINFORMATIONELEMENTSL_9, "CSmsMessage::InstallControlInformationElementsToMultiSegmentMessageL, default switch, category = %d, id= %d", category, ie.Identifier() ); |
2484 LOGGSMU3("CSmsMessage::InstallControlInformationElementsToMultiSegmentMessageL, default switch, category = %d, id= %d", category, ie.Identifier() ); |
2478 break; |
2485 break; |
2479 } |
2486 } |
2480 } |
2487 } |
2481 } |
2488 } |
2482 } // CSmsMessage::InstallControlInformationElementsL |
2489 } // CSmsMessage::InstallControlInformationElementsL |
2490 * of the UserData. |
2497 * of the UserData. |
2491 */ |
2498 */ |
2492 void CSmsMessage::InstallEmsInformationElementsL(CSmsUserData& aUserData, TInt aCharsAlreadyAdded) |
2499 void CSmsMessage::InstallEmsInformationElementsL(CSmsUserData& aUserData, TInt aCharsAlreadyAdded) |
2493 { |
2500 { |
2494 // Installs all the information elements within the subsequent PDUs. |
2501 // Installs all the information elements within the subsequent PDUs. |
2495 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_INSTALLEMSINFORMATIONELEMENTSL_1, "CSmsMessage::InstallEmsInformationElements()"); |
2502 LOGGSMU1("CSmsMessage::InstallEmsInformationElements()"); |
2496 |
2503 |
2497 CSmsInformationElement::TSmsInformationElementIdentifier id; |
2504 CSmsInformationElement::TSmsInformationElementIdentifier id; |
2498 CEmsInformationElement* newIE =NULL; |
2505 CEmsInformationElement* newIE =NULL; |
2499 |
2506 |
2500 for (TInt z=0; z<aUserData.NumInformationElements(); z++) |
2507 for (TInt z=0; z<aUserData.NumInformationElements(); z++) |
2538 { |
2545 { |
2539 // Ignore in code coverage - not used in SMS stack and not exported |
2546 // Ignore in code coverage - not used in SMS stack and not exported |
2540 // but cannot be removed as impacts public header. |
2547 // but cannot be removed as impacts public header. |
2541 BULLSEYE_OFF |
2548 BULLSEYE_OFF |
2542 // Installs all the information elements within the subsequent PDUs. |
2549 // Installs all the information elements within the subsequent PDUs. |
2543 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_INSTALLEMSINFORMATIONELEMENTSL1_1, "CSmsMessage::InstallEmsInformationElements()"); |
2550 LOGGSMU1("CSmsMessage::InstallEmsInformationElements()"); |
2544 |
2551 |
2545 CSmsInformationElement::TSmsInformationElementIdentifier id; |
2552 CSmsInformationElement::TSmsInformationElementIdentifier id; |
2546 CEmsInformationElement* newIE=NULL; |
2553 CEmsInformationElement* newIE=NULL; |
2547 |
2554 |
2548 for (TInt z=0; z<aCommand.NumInformationElements(); z++) |
2555 for (TInt z=0; z<aCommand.NumInformationElements(); z++) |
2744 * |
2751 * |
2745 * @param aEmsIE EMS object to be added. |
2752 * @param aEmsIE EMS object to be added. |
2746 */ |
2753 */ |
2747 void CSmsMessage::AddEmsUserPromptL(const CEmsUserPrompt& aUserPromptIE) |
2754 void CSmsMessage::AddEmsUserPromptL(const CEmsUserPrompt& aUserPromptIE) |
2748 { |
2755 { |
2749 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ADDEMSUSERPROMPTL_1, "CSmsMessage::AddEmsUserPromptL()"); |
2756 LOGGSMU1("CSmsMessage::AddEmsUserPromptL()"); |
2750 |
2757 |
2751 if(aUserPromptIE.ObjectCount() == 0 )User::Leave(KErrArgument); |
2758 if(aUserPromptIE.ObjectCount() == 0 )User::Leave(KErrArgument); |
2752 |
2759 |
2753 TUint count=iInformationElementArray->Count(); |
2760 TUint count=iInformationElementArray->Count(); |
2754 TUint userPromptStartPosition=aUserPromptIE.StartPosition(); |
2761 TUint userPromptStartPosition=aUserPromptIE.StartPosition(); |
2821 * |
2828 * |
2822 * @param aEmsIE EMS object to be added. |
2829 * @param aEmsIE EMS object to be added. |
2823 */ |
2830 */ |
2824 void CSmsMessage::AddEmsObjectDistributionL(const CEmsObjectDistribution& aObjectDistributionIE) |
2831 void CSmsMessage::AddEmsObjectDistributionL(const CEmsObjectDistribution& aObjectDistributionIE) |
2825 { |
2832 { |
2826 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ADDEMSOBJECTDISTRIBUTIONL_1, "CSmsMessage::AddEmsObjectDistributionL()"); |
2833 LOGGSMU1("CSmsMessage::AddEmsObjectDistributionL()"); |
2827 |
2834 |
2828 TUint count=iInformationElementArray->Count(); |
2835 TUint count=iInformationElementArray->Count(); |
2829 TUint objectDistributionStartPosition=aObjectDistributionIE.StartPosition(); |
2836 TUint objectDistributionStartPosition=aObjectDistributionIE.StartPosition(); |
2830 |
2837 |
2831 TBool firstIndexFound=EFalse; |
2838 TBool firstIndexFound=EFalse; |
2873 * @capability |
2880 * @capability |
2874 * @capability None |
2881 * @capability None |
2875 */ |
2882 */ |
2876 EXPORT_C CEmsInformationElement* CSmsMessage::RemoveEMSInformationElementL(const TUint aStartPosition,const TSmsId aEmsId) |
2883 EXPORT_C CEmsInformationElement* CSmsMessage::RemoveEMSInformationElementL(const TUint aStartPosition,const TSmsId aEmsId) |
2877 { |
2884 { |
2878 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_REMOVEEMSINFORMATIONELEMENTL_1, "CSmsMessage::RemoveEMSInformationElementL()"); |
2885 LOGGSMU1("CSmsMessage::RemoveEMSInformationElementL()"); |
2879 |
2886 |
2880 CEmsInformationElement* emsIE=NULL; |
2887 CEmsInformationElement* emsIE=NULL; |
2881 CEmsInformationElement* ie=NULL; |
2888 CEmsInformationElement* ie=NULL; |
2882 |
2889 |
2883 TUint count=iInformationElementArray->Count(); |
2890 TUint count=iInformationElementArray->Count(); |
2911 * |
2918 * |
2912 * @capability None |
2919 * @capability None |
2913 */ |
2920 */ |
2914 EXPORT_C RPointerArray<CEmsInformationElement>* CSmsMessage::RemoveEMSInformationElementsL(const TUint aStartPosition,const TSmsId aEmsId) |
2921 EXPORT_C RPointerArray<CEmsInformationElement>* CSmsMessage::RemoveEMSInformationElementsL(const TUint aStartPosition,const TSmsId aEmsId) |
2915 { |
2922 { |
2916 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_REMOVEEMSINFORMATIONELEMENTSL_1, "CSmsMessage::RemoveEMSInformationElementsL()"); |
2923 LOGGSMU1("CSmsMessage::RemoveEMSInformationElementsL()"); |
2917 |
2924 |
2918 CEmsInformationElement* ie=NULL; |
2925 CEmsInformationElement* ie=NULL; |
2919 RPointerArray<CEmsInformationElement>* selectedIEs = NULL; |
2926 RPointerArray<CEmsInformationElement>* selectedIEs = NULL; |
2920 TUint count=iInformationElementArray->Count(); |
2927 TUint count=iInformationElementArray->Count(); |
2921 |
2928 |
2956 * |
2963 * |
2957 * @capability None |
2964 * @capability None |
2958 */ |
2965 */ |
2959 EXPORT_C const RPointerArray<const CEmsInformationElement>& CSmsMessage::GetEMSInformationElementsL()const |
2966 EXPORT_C const RPointerArray<const CEmsInformationElement>& CSmsMessage::GetEMSInformationElementsL()const |
2960 { |
2967 { |
2961 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_GETEMSINFORMATIONELEMENTSL_1, "CSmsMessage::GetEMSInformationElementsL()"); |
2968 LOGGSMU1("CSmsMessage::GetEMSInformationElementsL()"); |
2962 |
2969 |
2963 return (const RPointerArray<const CEmsInformationElement>&)(*iInformationElementArray); |
2970 return (const RPointerArray<const CEmsInformationElement>&)(*iInformationElementArray); |
2964 } // CSmsMessage::GetEMSInformationElementsL |
2971 } // CSmsMessage::GetEMSInformationElementsL |
2965 |
2972 |
2966 |
2973 |
2967 void CSmsMessage::UpdateUserPromptAndODIElementsStartPosition() |
2974 void CSmsMessage::UpdateUserPromptAndODIElementsStartPosition() |
2968 { |
2975 { |
2969 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_UPDATEUSERPROMPTANDODIELEMENTSSTARTPOSITION_1, "CSmsMessage::UpdateUserPromptAndODIElementsStartPosition()"); |
2976 LOGGSMU1("CSmsMessage::UpdateUserPromptAndODIElementsStartPosition()"); |
2970 |
2977 |
2971 TUint num=iInformationElementArray->Count(); |
2978 TUint num=iInformationElementArray->Count(); |
2972 TInt startPosition=-1; |
2979 TInt startPosition=-1; |
2973 CEmsInformationElement* ie = NULL; |
2980 CEmsInformationElement* ie = NULL; |
2974 |
2981 |
2992 } // CSmsMessage::UpdateUserPromptAndODIElementsStartPosition |
2999 } // CSmsMessage::UpdateUserPromptAndODIElementsStartPosition |
2993 |
3000 |
2994 |
3001 |
2995 TInt CSmsMessage::AddReceivedEmsInformationElement(CEmsInformationElement* aEmsIE) |
3002 TInt CSmsMessage::AddReceivedEmsInformationElement(CEmsInformationElement* aEmsIE) |
2996 { |
3003 { |
2997 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_ADDRECEIVEDEMSINFORMATIONELEMENT_1, "CSmsMessage::AddReceivedEmsInformationElement()"); |
3004 LOGGSMU1("CSmsMessage::AddReceivedEmsInformationElement()"); |
2998 |
3005 |
2999 TInt ret=KErrNone; |
3006 TInt ret=KErrNone; |
3000 if(CSmsInformationElement::ESmsEnhancedUserPromptIndicator == aEmsIE->Identifier() || CSmsInformationElement::ESmsEnhancedODI == aEmsIE->Identifier()) |
3007 if(CSmsInformationElement::ESmsEnhancedUserPromptIndicator == aEmsIE->Identifier() || CSmsInformationElement::ESmsEnhancedODI == aEmsIE->Identifier()) |
3001 ret=iInformationElementArray->Append(aEmsIE); |
3008 ret=iInformationElementArray->Append(aEmsIE); |
3002 else |
3009 else |
3068 * |
3075 * |
3069 * @capability None |
3076 * @capability None |
3070 */ |
3077 */ |
3071 EXPORT_C void CSmsMessage::CopyEmsElementsL(CSmsMessage& aToMessage) const |
3078 EXPORT_C void CSmsMessage::CopyEmsElementsL(CSmsMessage& aToMessage) const |
3072 { |
3079 { |
3073 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_COPYEMSELEMENTSL_1, "CSmsMessage::CopyEmsElementsL()"); |
3080 LOGGSMU1("CSmsMessage::CopyEmsElementsL()"); |
3074 |
3081 |
3075 // CSmsMessage extended EMS API method creates array of references to EMS elements in |
3082 // CSmsMessage extended EMS API method creates array of references to EMS elements in |
3076 // the source message |
3083 // the source message |
3077 // Loop through the array copying each individual method using the CSmsMessage |
3084 // Loop through the array copying each individual method using the CSmsMessage |
3078 // and CEmsInformationElement API's |
3085 // and CEmsInformationElement API's |
3090 /** |
3097 /** |
3091 * @capability None |
3098 * @capability None |
3092 */ |
3099 */ |
3093 EXPORT_C void CSmsMessage::AddSlotL(const TGsmSmsSlotEntry& aSlot) |
3100 EXPORT_C void CSmsMessage::AddSlotL(const TGsmSmsSlotEntry& aSlot) |
3094 { |
3101 { |
3095 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_ADDSLOTL_1, "CSmsMessage::AddSlotL()"); |
3102 LOGGSMU1("CSmsMessage::AddSlotL()"); |
3096 |
3103 |
3097 TInt count = iSlotArray.Count(); |
3104 TInt count = iSlotArray.Count(); |
3098 TInt i(0); |
3105 TInt i(0); |
3099 TBool found(EFalse); |
3106 TBool found(EFalse); |
3100 while(!found && i<count) |
3107 while(!found && i<count) |
3101 { |
3108 { |
3102 if(aSlot.iIndex == iSlotArray[i].iIndex)found=ETrue; |
3109 if(aSlot.iIndex == iSlotArray[i].iIndex)found=ETrue; |
3103 else ++i; |
3110 else ++i; |
3104 } |
3111 } |
3105 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_ADDSLOTL_2, "CSmsMessage::AddSlotL current no in: %d, adds index %d", count,aSlot.iIndex ); |
3112 LOGGSMU3("CSmsMessage::AddSlotL current no in: %d, adds index %d", count,aSlot.iIndex ); |
3106 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_ADDSLOTL_3, "found %d at position %d",found,i); |
3113 LOGGSMU3("found %d at position %d",found,i); |
3107 iSlotArray.AppendL(aSlot); |
3114 iSlotArray.AppendL(aSlot); |
3108 } // CSmsMessage::AddSlotL |
3115 } // CSmsMessage::AddSlotL |
3109 |
3116 |
3110 /** |
3117 /** |
3111 * @capability None |
3118 * @capability None |
3112 */ |
3119 */ |
3113 EXPORT_C TBool CSmsMessage::MatchSlots(const CArrayFixFlat<TGsmSmsSlotEntry>& aSlotArray) |
3120 EXPORT_C TBool CSmsMessage::MatchSlots(const CArrayFixFlat<TGsmSmsSlotEntry>& aSlotArray) |
3114 { |
3121 { |
3115 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_MATCHSLOTS_1, "CSmsMessage::MatchSlots()"); |
3122 LOGGSMU1("CSmsMessage::MatchSlots()"); |
3116 |
3123 |
3117 TBool match = EFalse; |
3124 TBool match = EFalse; |
3118 TInt count = aSlotArray.Count(); |
3125 TInt count = aSlotArray.Count(); |
3119 if(iSlotArray.Count() == count) |
3126 if(iSlotArray.Count() == count) |
3120 { |
3127 { |
3171 * of the UserData. |
3178 * of the UserData. |
3172 */ |
3179 */ |
3173 void CSmsMessage::InstallEmailHeaderInformationElementL(CSmsUserData& aUserData,TInt& aHeaderLength) |
3180 void CSmsMessage::InstallEmailHeaderInformationElementL(CSmsUserData& aUserData,TInt& aHeaderLength) |
3174 { |
3181 { |
3175 // Installs all the information elements within the subsequent PDUs. |
3182 // Installs all the information elements within the subsequent PDUs. |
3176 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_INSTALLEMAILHEADERINFORMATIONELEMENTL_1, "CSmsMessage::InstallEmailHeaderInformationElementL()"); |
3183 LOGGSMU1("CSmsMessage::InstallEmailHeaderInformationElementL()"); |
3177 |
3184 |
3178 CSmsInformationElement::TSmsInformationElementIdentifier id; |
3185 CSmsInformationElement::TSmsInformationElementIdentifier id; |
3179 |
3186 |
3180 for (TInt z=0; z<aUserData.NumInformationElements(); z++) |
3187 for (TInt z=0; z<aUserData.NumInformationElements(); z++) |
3181 { |
3188 { |
3200 { |
3207 { |
3201 // Ignore in code coverage - not used in SMS stack and not exported |
3208 // Ignore in code coverage - not used in SMS stack and not exported |
3202 // but cannot be removed as impacts public header. |
3209 // but cannot be removed as impacts public header. |
3203 BULLSEYE_OFF |
3210 BULLSEYE_OFF |
3204 // Installs all the information elements within the subsequent PDUs. |
3211 // Installs all the information elements within the subsequent PDUs. |
3205 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_INSTALLEMAILHEADERINFORMATIONELEMENTL1_1, "CSmsMessage::InstallEmailHeaderInformationElementL()"); |
3212 LOGGSMU1("CSmsMessage::InstallEmailHeaderInformationElementL()"); |
3206 |
3213 |
3207 CSmsInformationElement::TSmsInformationElementIdentifier id; |
3214 CSmsInformationElement::TSmsInformationElementIdentifier id; |
3208 |
3215 |
3209 for (TInt z=0; z<aCommand.NumInformationElements(); z++) |
3216 for (TInt z=0; z<aCommand.NumInformationElements(); z++) |
3210 { |
3217 { |
3424 * @return KErrNone if aVersion is valid and successfully set, KErrArgument otherwise. |
3431 * @return KErrNone if aVersion is valid and successfully set, KErrArgument otherwise. |
3425 * @capability None |
3432 * @capability None |
3426 */ |
3433 */ |
3427 EXPORT_C TInt CSmsMessage::SetVersion(TInt aVersion) |
3434 EXPORT_C TInt CSmsMessage::SetVersion(TInt aVersion) |
3428 { |
3435 { |
3429 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_SETVERSION_1, "CSmsMessage::SetVersion(), version = %d", aVersion); |
3436 LOGGSMU2("CSmsMessage::SetVersion()", aVersion); |
3430 |
3437 |
3431 if((aVersion>=ESmsMessageV0) && (aVersion<=ESmsMessageV4)) |
3438 if((aVersion>=ESmsMessageV0) && (aVersion<=ESmsMessageV4)) |
3432 { |
3439 { |
3433 iVersion=aVersion; |
3440 iVersion=aVersion; |
3434 return KErrNone; |
3441 return KErrNone; |
3447 * @param aStream Stream to read from |
3454 * @param aStream Stream to read from |
3448 * @capability None |
3455 * @capability None |
3449 */ |
3456 */ |
3450 EXPORT_C void CSmsMessage::InternalizeWithoutBufferAndVersionL(RReadStream& aStream) |
3457 EXPORT_C void CSmsMessage::InternalizeWithoutBufferAndVersionL(RReadStream& aStream) |
3451 { |
3458 { |
3452 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_INTERNALIZEWITHOUTBUFFERANDVERSIONL_1, "CSmsMessage::InternalizeWithoutBufferAndVersionL()"); |
3459 LOGGSMU1("CSmsMessage::InternalizeWithoutBufferAndVersionL()"); |
3453 |
3460 |
3454 iFlags=aStream.ReadInt32L(); |
3461 iFlags=aStream.ReadInt32L(); |
3455 iStatus=(NMobileSmsStore::TMobileSmsStoreStatus) aStream.ReadInt32L(); |
3462 iStatus=(NMobileSmsStore::TMobileSmsStoreStatus) aStream.ReadInt32L(); |
3456 iLogServerId=aStream.ReadInt32L(); |
3463 iLogServerId=aStream.ReadInt32L(); |
3457 TInt64 time; |
3464 TInt64 time; |
3487 * @param aStream Stream to write to |
3494 * @param aStream Stream to write to |
3488 * @capability None |
3495 * @capability None |
3489 */ |
3496 */ |
3490 EXPORT_C void CSmsMessage::ExternalizeWithoutBufferAndVersionL(RWriteStream& aStream) const |
3497 EXPORT_C void CSmsMessage::ExternalizeWithoutBufferAndVersionL(RWriteStream& aStream) const |
3491 { |
3498 { |
3492 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_EXTERNALIZEWITHOUTBUFFERANDVERSIONL_1, "CSmsMessage::ExternalizeWithoutBufferAndVersionL()"); |
3499 LOGGSMU1("CSmsMessage::ExternalizeWithoutBufferAndVersionL()"); |
3493 |
3500 |
3494 aStream.WriteInt32L(iFlags); |
3501 aStream.WriteInt32L(iFlags); |
3495 aStream.WriteInt32L(iStatus); |
3502 aStream.WriteInt32L(iStatus); |
3496 aStream.WriteInt32L(iLogServerId); |
3503 aStream.WriteInt32L(iLogServerId); |
3497 aStream << Time().Int64(); |
3504 aStream << Time().Int64(); |
3583 * When there is not accessor class available for the specified type of information element. |
3590 * When there is not accessor class available for the specified type of information element. |
3584 * @capability None |
3591 * @capability None |
3585 */ |
3592 */ |
3586 EXPORT_C CSmsIEOperation& CSmsMessage::GetOperationsForIEL(CSmsInformationElement::TSmsInformationElementIdentifier aId) const |
3593 EXPORT_C CSmsIEOperation& CSmsMessage::GetOperationsForIEL(CSmsInformationElement::TSmsInformationElementIdentifier aId) const |
3587 { |
3594 { |
3588 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_GETOPERATIONSFORIEL_1, "CSmsMessage::GetOperationsForIEL()"); |
3595 LOGGSMU1("CSmsMessage::GetOperationsForIEL()"); |
3589 |
3596 |
3590 if (iVersion < CSmsMessage::ESmsMessageV1) |
3597 if (iVersion < CSmsMessage::ESmsMessageV1) |
3591 { |
3598 { |
3592 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_GETOPERATIONSFORIEL_2, "CSmsMessage::GetOperationsForIEL, Operation not supported, Msg Version %d", iVersion); |
3599 LOGGSMU2("CSmsMessage::GetOperationsForIEL, Operation not supported, Msg Version %d", iVersion); |
3593 User::Leave(KErrNotSupported); |
3600 User::Leave(KErrNotSupported); |
3594 } |
3601 } |
3595 |
3602 |
3596 return iAdditionalInfo->GetIEOperationL(aId); |
3603 return iAdditionalInfo->GetIEOperationL(aId); |
3597 } // CSmsMessage::GetOperationsForIEL |
3604 } // CSmsMessage::GetOperationsForIEL |
3598 |
3605 |
3599 EXPORT_C CSmsNonIEOperation& CSmsMessage::GetOperationsForNonIEL(TSmsNonIEIdentifier aId) const |
3606 EXPORT_C CSmsNonIEOperation& CSmsMessage::GetOperationsForNonIEL(TSmsNonIEIdentifier aId) const |
3600 { |
3607 { |
3601 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_GETOPERATIONSFORNONIEL_1, "CSmsMessage::GetOperationsForNonIEL"); |
3608 LOGGSMU1("CSmsMessage::GetOperationsForNonIEL"); |
3602 |
3609 |
3603 if (iVersion < CSmsMessage::ESmsMessageV2) |
3610 if (iVersion < CSmsMessage::ESmsMessageV2) |
3604 { |
3611 { |
3605 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSMESSAGE_GETOPERATIONSFORNONIEL_2, "GetOperationsForNonIEL not supported, Msg Version %d", iVersion); |
3612 LOGGSMU2("GetOperationsForNonIEL not supported, Msg Version %d", iVersion); |
3606 User::Leave(KErrNotSupported); |
3613 User::Leave(KErrNotSupported); |
3607 } |
3614 } |
3608 |
3615 |
3609 return iAdditionalInfo->GetNonIEOperationL(aId); |
3616 return iAdditionalInfo->GetNonIEOperationL(aId); |
3610 } // CSmsMessage::GetOperationsForNonIEL |
3617 } // CSmsMessage::GetOperationsForNonIEL |
3611 |
3618 |
3612 |
3619 |
3613 void CSmsMessage::CreateControlIEOperationsClassesL() |
3620 void CSmsMessage::CreateControlIEOperationsClassesL() |
3614 { |
3621 { |
3615 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGE_CREATECONTROLIEOPERATIONSCLASSESL_1, "CSmsMessage::CreateControlIEOperationsClassesL()"); |
3622 LOGGSMU1("CSmsMessage::CreateControlIEOperationsClassesL()"); |
3616 |
3623 |
3617 CSmsIEOperation* iEOperation = NULL; |
3624 CSmsIEOperation* iEOperation = NULL; |
3618 |
3625 |
3619 iEOperation = CSmsIEOperation::NewL(CSmsInformationElement::ESmsHyperLinkFormat, *this, *iCharacterSetConverter, iFs); |
3626 iEOperation = CSmsIEOperation::NewL(CSmsInformationElement::ESmsHyperLinkFormat, *this, *iCharacterSetConverter, iFs); |
3620 iAdditionalInfo->SetIEOperationL(iEOperation); |
3627 iAdditionalInfo->SetIEOperationL(iEOperation); |