24
|
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 |
// This file implements the different PDU elements
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
*/
|
|
21 |
|
|
22 |
#include <gsmuelem.h>
|
|
23 |
#include <gsmumsg.h>
|
|
24 |
#include "Gsmumain.h"
|
|
25 |
#include <gsmusar.h>
|
|
26 |
#include "gsmupriv.h"
|
|
27 |
#include <s32strm.h>
|
|
28 |
#include <etelmm.h>
|
|
29 |
#include <gsmuetel.h>
|
|
30 |
#include <exterror.h>
|
|
31 |
#include <emsinformationelement.h>
|
|
32 |
#include <emsformatie.h>
|
|
33 |
#include <charconv.h>
|
|
34 |
|
|
35 |
/**
|
|
36 |
* Question Mark character.
|
|
37 |
*/
|
|
38 |
const TInt KReplacementCharacter = 0x003f;
|
|
39 |
|
|
40 |
|
|
41 |
/**
|
|
42 |
* Constructs the object with a descriptor. The extraction mark and next character members are initialised to point to the start of the string.
|
|
43 |
*
|
|
44 |
* @param aSource Descriptor to be assigned by reference
|
|
45 |
*/
|
|
46 |
TGsmuLex8::TGsmuLex8(const TDesC8& aSource): TLex8(aSource)
|
|
47 |
{
|
|
48 |
//NOP
|
|
49 |
} // TGsmuLex8::TGsmuLex8
|
|
50 |
|
|
51 |
|
|
52 |
/**
|
|
53 |
* Gets the next character in the string and increments the next character position.
|
|
54 |
*
|
|
55 |
* @return The next character in the string
|
|
56 |
* @leave Leaves with KErrGsmuDecoding if at end of string
|
|
57 |
*/
|
|
58 |
TUint8 TGsmuLex8::GetL()
|
|
59 |
{
|
|
60 |
if (Eos())
|
|
61 |
LeaveL();
|
|
62 |
|
|
63 |
return static_cast<TUint8>(Get());
|
|
64 |
} // TGsmuLex8::GetL
|
|
65 |
|
|
66 |
|
|
67 |
/**
|
|
68 |
* Increments the next character position by aNumber
|
|
69 |
*
|
|
70 |
* @param aNumber The number of characters to increment the next character position by.
|
|
71 |
* @leave If the increment puts the next character position before the start or beyond the end of the string, the function leaves with KErrGsmuDecoding.
|
|
72 |
*/
|
|
73 |
void TGsmuLex8::IncL(TInt aNumber)
|
|
74 |
{
|
|
75 |
if (aNumber != 0)
|
|
76 |
{
|
|
77 |
if (aNumber < 0 || Eos() || Remainder().Length() < aNumber)
|
|
78 |
LeaveL();
|
|
79 |
else
|
|
80 |
Inc(aNumber);
|
|
81 |
}
|
|
82 |
} // TGsmuLex8::IncL
|
|
83 |
|
|
84 |
|
|
85 |
/**
|
|
86 |
* Checks there are enough remaining characters, then returns a TPtrC containing the next aLength characters. Does not increment the current position.
|
|
87 |
*
|
|
88 |
* @param aLength Number of characters to return
|
|
89 |
* @return Remainder().Left(aLength)
|
|
90 |
* @leave Leaves with KErrGsmuDecoding if there are insufficient characters remaining
|
|
91 |
*/
|
|
92 |
TPtrC8 TGsmuLex8::NextWithNoIncL(TInt aLength) const
|
|
93 |
{
|
|
94 |
return NextWithNoIncL(aLength, EFalse);
|
|
95 |
}
|
|
96 |
|
|
97 |
/**
|
|
98 |
* Checks there are enough remaining characters, then returns a TPtrC containing the next aLength characters. Does not increment the current position.
|
|
99 |
*
|
|
100 |
* @param aLength Number of characters to return
|
|
101 |
* @param aAcceptTruncation ETrue if a mismatch between length indicator and actual length is acceptable. EFalse otherwise.
|
|
102 |
* @return Remainder().Left(aLength) if aAcceptTruncation is EFalse. Remainder() otherwise.
|
|
103 |
* @leave Leaves with KErrGsmuDecoding if there are insufficient characters remaining, unless aAcceptTruncation is ETrue.
|
|
104 |
*/
|
|
105 |
TPtrC8 TGsmuLex8::NextWithNoIncL(TInt aLength, TBool aAcceptTruncation) const
|
|
106 |
{
|
|
107 |
const TPtrC8 remainder(Remainder());
|
|
108 |
|
|
109 |
if ( (aLength < 0) || (remainder.Length()< aLength && !aAcceptTruncation) )
|
|
110 |
{
|
|
111 |
LeaveL();
|
|
112 |
}
|
|
113 |
|
|
114 |
if (!aAcceptTruncation)
|
|
115 |
{
|
|
116 |
return Remainder().Left(aLength);
|
|
117 |
}
|
|
118 |
// aAcceptTruncation is ETrue
|
|
119 |
else if (remainder.Length() < aLength)
|
|
120 |
{
|
|
121 |
return Remainder();
|
|
122 |
}
|
|
123 |
// otherwise, no need for truncation:
|
|
124 |
|
|
125 |
return Remainder().Left(aLength);
|
|
126 |
}
|
|
127 |
|
|
128 |
|
|
129 |
/**
|
|
130 |
* Calls TGsmuLeax8::NextWithNoIncL then increments the next character position by aLength
|
|
131 |
*
|
|
132 |
* @param aLength Number of characters to return and increment the next character position
|
|
133 |
* @return Remainder().Left(aLength)
|
|
134 |
* @leave If the increment puts the next character position before the start or beyond the end of the string, the function leaves with KErrGsmuDecoding.
|
|
135 |
*/
|
|
136 |
TPtrC8 TGsmuLex8::NextAndIncL(TInt aLength)
|
|
137 |
{
|
|
138 |
const TPtrC8 next(NextWithNoIncL(aLength));
|
|
139 |
IncL(aLength);
|
|
140 |
return next;
|
|
141 |
} // TGsmuLeax8::NextWithNoIncL
|
|
142 |
|
|
143 |
|
|
144 |
const TSmsOctet& TSmsOctet::operator = (TInt aValue)
|
|
145 |
{
|
|
146 |
iValue = static_cast<TUint8>(aValue);
|
|
147 |
return *this;
|
|
148 |
} // TSmsOctet::operator
|
|
149 |
|
|
150 |
|
|
151 |
TUint8* TSmsOctet::EncodeL(TUint8* aPtr) const
|
|
152 |
{
|
|
153 |
*aPtr=iValue;
|
|
154 |
return aPtr+1;
|
|
155 |
} // TSmsOctet::EncodeL
|
|
156 |
|
|
157 |
|
|
158 |
TSmsFirstOctet::TSmsFirstOctet(TInt aValue):
|
|
159 |
TSmsOctet(aValue)
|
|
160 |
{
|
|
161 |
} // TSmsFirstOctet::TSmsFirstOctet
|
|
162 |
|
|
163 |
|
|
164 |
const TSmsFirstOctet& TSmsFirstOctet::operator = (TInt aValue)
|
|
165 |
{
|
|
166 |
TSmsOctet::operator = (aValue);
|
|
167 |
return *this;
|
|
168 |
} // TSmsFirstOctet::operator
|
|
169 |
|
|
170 |
|
|
171 |
TSmsFailureCause::TSmsFailureCause():
|
|
172 |
TSmsOctet(ESmsErrorUnspecified)
|
|
173 |
{
|
|
174 |
} // TSmsFailureCause::TSmsFailureCause
|
|
175 |
|
|
176 |
|
|
177 |
TSmsStatus::TSmsStatus():
|
|
178 |
TSmsOctet(ESmsShortMessageReceivedBySME)
|
|
179 |
{
|
|
180 |
} // TSmsStatus::TSmsStatus
|
|
181 |
|
|
182 |
|
|
183 |
CSmsCommandData* CSmsCommandData::NewL(TSmsFirstOctet& aFirstOctet)
|
|
184 |
{
|
|
185 |
LOGGSMU1("CSmsCommandData::NewL()");
|
|
186 |
|
|
187 |
CSmsCommandData* commanddata=new(ELeave) CSmsCommandData(aFirstOctet);
|
|
188 |
CleanupStack::PushL(commanddata);
|
|
189 |
TPtrC8 ptr;
|
|
190 |
commanddata->SetDataL(ptr);
|
|
191 |
CleanupStack::Pop();
|
|
192 |
return commanddata;
|
|
193 |
} // CSmsCommandData::NewL
|
|
194 |
|
|
195 |
|
|
196 |
CSmsCommandData::~CSmsCommandData()
|
|
197 |
{
|
|
198 |
iInformationElementArray.ResetAndDestroy();
|
|
199 |
delete iBuffer;
|
|
200 |
} // CSmsCommandData::NewL
|
|
201 |
|
|
202 |
|
|
203 |
/**
|
|
204 |
* Duplicates this CSmsCommandData object.
|
|
205 |
*
|
|
206 |
* @return Pointer to the newly created CSmsCommandData object.
|
|
207 |
*/
|
|
208 |
CSmsCommandData* CSmsCommandData::DuplicateL() const
|
|
209 |
{
|
|
210 |
LOGGSMU1("CSmsCommandData::DuplicateL()");
|
|
211 |
|
|
212 |
CSmsCommandData* smsCommandData = CSmsCommandData::NewL(iFirstOctet);
|
|
213 |
CleanupStack::PushL(smsCommandData);
|
|
214 |
|
|
215 |
smsCommandData->SetDataL(Data());
|
|
216 |
|
|
217 |
for (TInt ie = 0; ie < iInformationElementArray.Count(); ie++)
|
|
218 |
{
|
|
219 |
smsCommandData->AddInformationElementL(iInformationElementArray[ie]->Identifier(),
|
|
220 |
iInformationElementArray[ie]->Data());
|
|
221 |
}
|
|
222 |
|
|
223 |
CleanupStack::Pop(smsCommandData);
|
|
224 |
|
|
225 |
return smsCommandData;
|
|
226 |
} // CSmsCommandData::DuplicateL
|
|
227 |
|
|
228 |
|
|
229 |
CSmsInformationElement& CSmsCommandData::InformationElement(TInt aIndex) const
|
|
230 |
{
|
|
231 |
LOGGSMU1("CSmsCommandData::InformationElement()");
|
|
232 |
|
|
233 |
CSmsInformationElement* ie=iInformationElementArray[aIndex];
|
|
234 |
return *ie;
|
|
235 |
} // CSmsCommandData::InformationElement
|
|
236 |
|
|
237 |
|
|
238 |
CSmsInformationElement*& CSmsCommandData::InformationElementPtr(TInt aIndex)
|
|
239 |
{
|
|
240 |
// Ignore in code coverage - not used in SMS stack and not exported
|
|
241 |
// but cannot be removed as impacts public header.
|
|
242 |
BULLSEYE_OFF
|
|
243 |
LOGGSMU1("CSmsCommandData::InformationElementPtr()");
|
|
244 |
return iInformationElementArray[aIndex];
|
|
245 |
BULLSEYE_RESTORE
|
|
246 |
}
|
|
247 |
|
|
248 |
TBool CSmsCommandData::InformationElementIndex(CSmsInformationElement::TSmsInformationElementIdentifier aIdentifier,
|
|
249 |
TInt& aIndex) const
|
|
250 |
{
|
|
251 |
LOGGSMU1("CSmsCommandData::InformationElementIndex()");
|
|
252 |
|
|
253 |
TBool found=EFalse;
|
|
254 |
TInt count=NumInformationElements();
|
|
255 |
for (TInt i=0; (!found) && (i<count); i++)
|
|
256 |
if (InformationElement(i).Identifier()==aIdentifier)
|
|
257 |
{
|
|
258 |
found=ETrue;
|
|
259 |
aIndex=i;
|
|
260 |
}
|
|
261 |
return found;
|
|
262 |
} // CSmsCommandData::InformationElementIndex
|
|
263 |
|
|
264 |
|
|
265 |
void CSmsCommandData::AddInformationElementL(const TSmsId aIdentifier,const TDesC8& aData)
|
|
266 |
{
|
|
267 |
LOGGSMU1("CSmsCommandData::AddInformationElementL()");
|
|
268 |
|
|
269 |
//
|
|
270 |
// Currently there is no restriction on how many instances of an information element can be
|
|
271 |
// placed in the collection.
|
|
272 |
// No restriction will be placed on the number of Special SMS Message Indications that can be
|
|
273 |
// added in order to maintain FC.
|
|
274 |
// (cf CSmsUserData::AddInformationElementL(const TSmsId aIdentifier,const TDesC8& aData);
|
|
275 |
//
|
|
276 |
CSmsInformationElement* informationelement=CSmsInformationElement::NewL(aIdentifier,aData);
|
|
277 |
CleanupStack::PushL(informationelement);
|
|
278 |
iInformationElementArray.AppendL(informationelement);
|
|
279 |
CleanupStack::Pop();
|
|
280 |
if (NumInformationElements()>=1)
|
|
281 |
SetHeaderPresent(ETrue);
|
|
282 |
} // CSmsCommandData::AddInformationElementL
|
|
283 |
|
|
284 |
|
|
285 |
void CSmsCommandData::RemoveInformationElement(TInt aIndex)
|
|
286 |
{
|
|
287 |
LOGGSMU1("CSmsCommandData::RemoveInformationElement()");
|
|
288 |
// Since iInformationElementArray[aIndex] is removed from iInformationElementArray, no double free issue.
|
|
289 |
// coverity[double_free]
|
|
290 |
delete iInformationElementArray[aIndex];
|
|
291 |
iInformationElementArray[aIndex] = NULL;
|
|
292 |
iInformationElementArray.Delete(aIndex);
|
|
293 |
|
|
294 |
if (NumInformationElements()==0)
|
|
295 |
{
|
|
296 |
SetHeaderPresent(EFalse);
|
|
297 |
}
|
|
298 |
} // CSmsCommandData::RemoveInformationElement
|
|
299 |
|
|
300 |
|
|
301 |
TPtrC8 CSmsCommandData::Data() const
|
|
302 |
{
|
|
303 |
LOGGSMU1("CSmsCommandData::Data()");
|
|
304 |
|
|
305 |
TPtrC8 ptr;
|
|
306 |
ptr.Set(iBuffer->Des());
|
|
307 |
return ptr;
|
|
308 |
} // CSmsCommandData::Data
|
|
309 |
|
|
310 |
|
|
311 |
void CSmsCommandData::SetDataL(const TDesC8& aData)
|
|
312 |
{
|
|
313 |
LOGGSMU1("CSmsCommandData::SetDataL()");
|
|
314 |
|
|
315 |
TInt length=aData.Length();
|
|
316 |
__ASSERT_DEBUG(length<=KSmsMaxDataSize,Panic(KGsmuPanicCommandDataLengthTooLong));
|
|
317 |
HBufC8* buffer=HBufC8::NewL(length);
|
|
318 |
delete iBuffer;
|
|
319 |
iBuffer=buffer;
|
|
320 |
iBuffer->Des().SetLength(length);
|
|
321 |
iBuffer->Des().Copy(aData);
|
|
322 |
} // CSmsCommandData::SetDataL
|
|
323 |
|
|
324 |
|
|
325 |
TUint8* CSmsCommandData::EncodeL(TUint8* aPtr) const
|
|
326 |
{
|
|
327 |
LOGGSMU1("CSmsCommandData::EncodeL()");
|
|
328 |
|
|
329 |
__ASSERT_DEBUG(iBuffer->Length()<=MaxDataLength(),Panic(KGsmuPanicCommandDataBufferTooLong));
|
|
330 |
TSmsOctet datalength=iBuffer->Length()+TSmsOctet(TotalHeaderLengthInUDLUnits());
|
|
331 |
aPtr=datalength.EncodeL(aPtr);
|
|
332 |
TPtr8 ptr((TUint8*) aPtr,datalength);
|
|
333 |
|
|
334 |
if (HeaderPresent())
|
|
335 |
{
|
|
336 |
TSmsOctet headerLength(HeaderLength());
|
|
337 |
aPtr=headerLength.EncodeL(aPtr);
|
|
338 |
for (TInt i=0; i<NumInformationElements(); i++)
|
|
339 |
{
|
|
340 |
aPtr=iInformationElementArray[i]->EncodeL(aPtr);
|
|
341 |
}
|
|
342 |
}
|
|
343 |
|
|
344 |
ptr.Copy(iBuffer->Des());
|
|
345 |
aPtr+=TInt(iBuffer->Length());
|
|
346 |
return aPtr;
|
|
347 |
} // CSmsCommandData::EncodeL
|
|
348 |
|
|
349 |
|
|
350 |
void CSmsCommandData::DecodeL(TGsmuLex8& aPdu)
|
|
351 |
{
|
|
352 |
LOGGSMU1("CSmsCommandData::DecodeL()");
|
|
353 |
|
|
354 |
iInformationElementArray.ResetAndDestroy();
|
|
355 |
const TBool headerPresent=HeaderPresent();
|
|
356 |
TSmsOctet dataLength;
|
|
357 |
dataLength.DecodeL(aPdu);
|
|
358 |
|
|
359 |
if (headerPresent)
|
|
360 |
{
|
|
361 |
TSmsOctet headerLength;
|
|
362 |
headerLength.DecodeL(aPdu);
|
|
363 |
if ((1+headerLength)>KSmsMaxDataSize)
|
|
364 |
User::Leave(KErrGsmSMSTpduNotSupported);
|
|
365 |
while (HeaderLength()<headerLength)
|
|
366 |
{
|
|
367 |
CSmsInformationElement* informationElement=CSmsInformationElement::NewL();
|
|
368 |
CleanupStack::PushL(informationElement);
|
|
369 |
informationElement->DecodeL(aPdu);
|
|
370 |
iInformationElementArray.AppendL(informationElement);
|
|
371 |
CleanupStack::Pop(informationElement);
|
|
372 |
}
|
|
373 |
if (HeaderLength()!=headerLength)
|
|
374 |
User::Leave(KErrGsmSMSTpduNotSupported);
|
|
375 |
}
|
|
376 |
const TInt totalHeaderLength=TotalHeaderLengthInUDLUnits();
|
|
377 |
const TInt totalDataLength=dataLength-totalHeaderLength;
|
|
378 |
const TPtrC8 next(aPdu.NextAndIncL(totalDataLength));
|
|
379 |
SetDataL(next);
|
|
380 |
} // CSmsCommandData::DecodeL
|
|
381 |
|
|
382 |
|
|
383 |
void CSmsCommandData::InternalizeL(RReadStream& aStream)
|
|
384 |
{
|
|
385 |
iInformationElementArray.ResetAndDestroy();
|
|
386 |
TInt numInformationElements=aStream.ReadInt32L();
|
|
387 |
for (TInt i=0; i<numInformationElements; i++)
|
|
388 |
{
|
|
389 |
CSmsInformationElement* informationElement=CSmsInformationElement::NewL();
|
|
390 |
CleanupStack::PushL(informationElement);
|
|
391 |
aStream >> *informationElement;
|
|
392 |
iInformationElementArray.AppendL(informationElement);
|
|
393 |
CleanupStack::Pop();
|
|
394 |
}
|
|
395 |
HBufC8* buffer=HBufC8::NewL(aStream,KSmsMaxDataSize);
|
|
396 |
delete iBuffer;
|
|
397 |
iBuffer=buffer;
|
|
398 |
} // CSmsCommandData::InternalizeL
|
|
399 |
|
|
400 |
|
|
401 |
void CSmsCommandData::ExternalizeL(RWriteStream& aStream) const
|
|
402 |
{
|
|
403 |
TInt numInformationElements=iInformationElementArray.Count();
|
|
404 |
aStream.WriteInt32L(numInformationElements);
|
|
405 |
for (TInt i=0; i<numInformationElements; i++)
|
|
406 |
aStream << *iInformationElementArray[i];
|
|
407 |
aStream << *iBuffer;
|
|
408 |
} // CSmsCommandData::ExternalizeL
|
|
409 |
|
|
410 |
|
|
411 |
CSmsCommandData::CSmsCommandData(TSmsFirstOctet& aFirstOctet):
|
|
412 |
iFirstOctet(aFirstOctet),
|
|
413 |
iInformationElementArray(8)
|
|
414 |
{
|
|
415 |
} // CSmsCommandData::CSmsCommandData
|
|
416 |
|
|
417 |
|
|
418 |
TInt CSmsCommandData::HeaderLength() const
|
|
419 |
{
|
|
420 |
LOGGSMU1("CSmsCommandData::HeaderLength()");
|
|
421 |
|
|
422 |
TInt headerLength=0;
|
|
423 |
for (TInt i=0; i<NumInformationElements(); i++)
|
|
424 |
headerLength+=iInformationElementArray[i]->Length();
|
|
425 |
return headerLength;
|
|
426 |
} // CSmsCommandData::HeaderLength
|
|
427 |
|
|
428 |
|
|
429 |
TInt CSmsCommandData::TotalHeaderLengthInUDLUnits() const
|
|
430 |
{
|
|
431 |
LOGGSMU1("CSmsCommandData::TotalHeaderLengthInUDLUnits()");
|
|
432 |
|
|
433 |
if (iInformationElementArray.Count()==0)
|
|
434 |
return 0;
|
|
435 |
else
|
|
436 |
return (HeaderLength()+1); // +1 stands for UDHL
|
|
437 |
} // CSmsCommandData::TotalHeaderLengthInUDLUnits
|
|
438 |
|
|
439 |
|
|
440 |
TBool CSmsCommandData::HeaderPresent() const
|
|
441 |
{
|
|
442 |
LOGGSMU1("CSmsCommandData::HeaderPresent()");
|
|
443 |
|
|
444 |
return (iFirstOctet&TSmsFirstOctet::ESmsUDHIMask)==TSmsFirstOctet::ESmsUDHIHeaderPresent;
|
|
445 |
} // CSmsCommandData::HeaderPresent
|
|
446 |
|
|
447 |
|
|
448 |
void CSmsCommandData::SetHeaderPresent(TBool aHeaderPresent)
|
|
449 |
{
|
|
450 |
LOGGSMU1("CSmsCommandData::SetHeaderPresent()");
|
|
451 |
|
|
452 |
iFirstOctet=aHeaderPresent? (iFirstOctet&(~TSmsFirstOctet::ESmsUDHIMask))|TSmsFirstOctet::ESmsUDHIHeaderPresent: (iFirstOctet&(~TSmsFirstOctet::ESmsUDHIMask))|TSmsFirstOctet::ESmsUDHIHeaderNotPresent;
|
|
453 |
} // CSmsCommandData::SetHeaderPresent
|
|
454 |
|
|
455 |
|
|
456 |
TSmsParameterIndicator::TSmsParameterIndicator():
|
|
457 |
TSmsOctet(ESmsPIDProtocolIdentifierPresent|ESmsPIDUserDataPresent|ESmsPIDDataCodingSchemePresent)
|
|
458 |
{
|
|
459 |
} // TSmsParameterIndicator::TSmsParameterIndicator
|
|
460 |
|
|
461 |
|
|
462 |
TSmsCommandType::TSmsCommandType():
|
|
463 |
TSmsOctet(ESmsCommandTypeEnquiry)
|
|
464 |
{
|
|
465 |
} // TSmsCommandType::TSmsCommandType
|
|
466 |
|
|
467 |
|
|
468 |
TSmsProtocolIdentifier::TSmsProtocolIdentifier():
|
|
469 |
TSmsOctet((TInt)ESmsPIDTelematicInterworking|(TInt)ESmsNoTelematicDevice)
|
|
470 |
{
|
|
471 |
} // TSmsProtocolIdentifier::TSmsProtocolIdentifier
|
|
472 |
|
|
473 |
|
|
474 |
TSmsProtocolIdentifier::TSmsTelematicDeviceIndicator TSmsProtocolIdentifier::TelematicDeviceIndicator() const
|
|
475 |
{
|
|
476 |
__ASSERT_DEBUG(PIDType()==ESmsPIDTelematicInterworking,Panic(KGsmuPanicNoTelematicInterworking));
|
|
477 |
return (TSmsTelematicDeviceIndicator) (iValue&EPIDTelematicDeviceIndicatorMask);
|
|
478 |
} // TSmsProtocolIdentifier::TSmsTelematicDeviceIndicator
|
|
479 |
|
|
480 |
|
|
481 |
void TSmsProtocolIdentifier::SetTelematicDeviceIndicator(TSmsTelematicDeviceIndicator aIndicator)
|
|
482 |
{
|
|
483 |
LOGGSMU1("TSmsProtocolIdentifier::SetTelematicDeviceIndicator()");
|
|
484 |
|
|
485 |
__ASSERT_DEBUG(PIDType()==ESmsPIDTelematicInterworking,Panic(KGsmuPanicNoTelematicInterworking));
|
|
486 |
|
|
487 |
//iValue=(TUint8) ((iValue&ESmsPIDTypeMask)|aIndicator);
|
|
488 |
iValue=(TUint8) ((iValue&(~EPIDTelematicDeviceIndicatorMask))|aIndicator);
|
|
489 |
} // TSmsProtocolIdentifier::SetTelematicDeviceIndicator
|
|
490 |
|
|
491 |
|
|
492 |
TSmsProtocolIdentifier::TSmsTelematicDeviceType TSmsProtocolIdentifier::TelematicDeviceType() const
|
|
493 |
{
|
|
494 |
__ASSERT_DEBUG(TelematicDeviceIndicator()==ESmsTelematicDevice,Panic(KGsmuPanicNoTelematicDevice));
|
|
495 |
return (TSmsTelematicDeviceType) (iValue&ESmsTelematicDeviceTypeMask);
|
|
496 |
} // TSmsProtocolIdentifier::TSmsTelematicDeviceType
|
|
497 |
|
|
498 |
|
|
499 |
void TSmsProtocolIdentifier::SetTelematicDeviceType(TSmsTelematicDeviceType aDeviceType)
|
|
500 |
{
|
|
501 |
LOGGSMU1("TSmsProtocolIdentifier::SetTelematicDeviceType()");
|
|
502 |
|
|
503 |
__ASSERT_DEBUG(TelematicDeviceIndicator()==ESmsTelematicDevice,Panic(KGsmuPanicNoTelematicDevice));
|
|
504 |
iValue=(TUint8) ((iValue&(~ESmsTelematicDeviceTypeMask))|aDeviceType);
|
|
505 |
} // TSmsProtocolIdentifier::SetTelematicDeviceType
|
|
506 |
|
|
507 |
|
|
508 |
TInt TSmsProtocolIdentifier::ShortMessageALProtocol() const
|
|
509 |
{
|
|
510 |
// Ignore in code coverage - not used in SMS stack and not exported
|
|
511 |
// but cannot be removed as impacts public header.
|
|
512 |
BULLSEYE_OFF
|
|
513 |
LOGGSMU1("TSmsProtocolIdentifier::ShortMessageALProtocol()");
|
|
514 |
|
|
515 |
__ASSERT_DEBUG(TelematicDeviceIndicator()==ESmsNoTelematicDevice,Panic(KGsmuPanicNoTelematicDevice));
|
|
516 |
return (TSmsShortMessageALProtocol) (iValue&ESmsShortMessageALProtocolMask);
|
|
517 |
BULLSEYE_RESTORE
|
|
518 |
}
|
|
519 |
|
|
520 |
void TSmsProtocolIdentifier::SetShortMessageALProtocol(TSmsShortMessageALProtocol aProtocol)
|
|
521 |
{
|
|
522 |
// Ignore in code coverage - not used in SMS stack and not exported
|
|
523 |
// but cannot be removed as impacts public header.
|
|
524 |
BULLSEYE_OFF
|
|
525 |
LOGGSMU1("TSmsProtocolIdentifier::SetShortMessageALProtocol()");
|
|
526 |
|
|
527 |
__ASSERT_DEBUG(TelematicDeviceIndicator()==ESmsNoTelematicDevice,Panic(KGsmuPanicNoTelematicDevice));
|
|
528 |
iValue=(TUint8) ((iValue&(~ESmsShortMessageALProtocolMask))|aProtocol);
|
|
529 |
BULLSEYE_RESTORE
|
|
530 |
}
|
|
531 |
|
|
532 |
TInt TSmsProtocolIdentifier::ShortMessageType() const
|
|
533 |
{
|
|
534 |
LOGGSMU1("TSmsProtocolIdentifier::ShortMessageType()");
|
|
535 |
|
|
536 |
__ASSERT_DEBUG(PIDType()==ESmsPIDShortMessageType,Panic(KGsmuPanicNoShortMessageType));
|
|
537 |
return (TSmsShortMessageType) (iValue&ESmsShortMessageTypeMask);
|
|
538 |
} // TSmsProtocolIdentifier::ShortMessageType
|
|
539 |
|
|
540 |
|
|
541 |
void TSmsProtocolIdentifier::SetShortMessageType(TSmsShortMessageType aShortMessageType)
|
|
542 |
{
|
|
543 |
LOGGSMU1("TSmsProtocolIdentifier::SetShortMessageType()");
|
|
544 |
|
|
545 |
__ASSERT_DEBUG(PIDType()==ESmsPIDShortMessageType,Panic(KGsmuPanicNoShortMessageType));
|
|
546 |
//iValue=(TUint8) ((iValue&(~ESmsPIDTypeMask))|aShortMessageType);
|
|
547 |
iValue=(TUint8) ((iValue&(~ESmsShortMessageTypeMask))|aShortMessageType);
|
|
548 |
} // TSmsProtocolIdentifier::SetShortMessageType
|
|
549 |
|
|
550 |
|
|
551 |
TSmsDataCodingScheme::TSmsDataCodingScheme():
|
|
552 |
TSmsOctet((TInt)ESmsDCSTextUncompressedWithNoClassInfo|(TInt)ESmsAlphabet7Bit|(TInt)ESmsClass0)
|
|
553 |
// Constructor is expected to set the octet = 0, This is needed by
|
|
554 |
// CSmsDeliverReport::DecodeL, CSmsSubmitReport::DecodeL and CSmsStatusReport::DecodeL, per
|
|
555 |
// 23.040 v6.5.0 section 9.2.3.27.
|
|
556 |
{
|
|
557 |
} // CSmsDeliverReport::DecodeL
|
|
558 |
|
|
559 |
|
|
560 |
TBool TSmsDataCodingScheme::TextCompressed() const
|
|
561 |
{
|
|
562 |
LOGGSMU1("TSmsDataCodingScheme::TextCompressed()");
|
|
563 |
|
|
564 |
TInt bits7to4=Bits7To4();
|
|
565 |
return (bits7to4==ESmsDCSTextCompressedWithNoClassInfo) || (bits7to4==ESmsDCSTextCompressedWithClassInfo) ||
|
|
566 |
(bits7to4==ESmsDCSAutoDelNoClassInfoCompressedText) || (bits7to4==ESmsDCSAutoDelClassInfoTextCompressedText);
|
|
567 |
} // TSmsDataCodingScheme::TextCompressed
|
|
568 |
|
|
569 |
|
|
570 |
void TSmsDataCodingScheme::SetTextCompressed(TBool aCompressed)
|
|
571 |
{
|
|
572 |
LOGGSMU1("TSmsDataCodingScheme::SetTextCompressed()");
|
|
573 |
|
|
574 |
TInt bits7to4=Bits7To4();
|
|
575 |
if (aCompressed)
|
|
576 |
{
|
|
577 |
switch (bits7to4)
|
|
578 |
{
|
|
579 |
case (ESmsDCSTextUncompressedWithNoClassInfo):
|
|
580 |
{
|
|
581 |
iValue=(TUint8) (ESmsDCSTextCompressedWithNoClassInfo|(iValue&(~ESmsDCSBits7To4Mask)));
|
|
582 |
break;
|
|
583 |
}
|
|
584 |
case (ESmsDCSAutoDelNoClassInfoUncompressedText):
|
|
585 |
{
|
|
586 |
iValue=(TUint8) (ESmsDCSAutoDelNoClassInfoCompressedText|(iValue&(~ESmsDCSBits7To4Mask)));
|
|
587 |
break;
|
|
588 |
}
|
|
589 |
case (ESmsDCSAutoDelClassInfoUncompressedText):
|
|
590 |
{
|
|
591 |
iValue=(TUint8) (ESmsDCSAutoDelClassInfoTextCompressedText|(iValue&(~ESmsDCSBits7To4Mask)));
|
|
592 |
break;
|
|
593 |
}
|
|
594 |
case (ESmsDCSTextUncompressedWithClassInfo):
|
|
595 |
case (ESmsDCSTextUncompressed7BitOr8Bit):
|
|
596 |
{
|
|
597 |
iValue=(TUint8) (ESmsDCSTextCompressedWithClassInfo|(iValue&(~ESmsDCSBits7To4Mask)));
|
|
598 |
break;
|
|
599 |
}
|
|
600 |
case (ESmsDCSTextCompressedWithNoClassInfo):
|
|
601 |
case (ESmsDCSTextCompressedWithClassInfo):
|
|
602 |
case (ESmsDCSAutoDelNoClassInfoCompressedText):
|
|
603 |
case (ESmsDCSAutoDelClassInfoTextCompressedText):
|
|
604 |
break;
|
|
605 |
default:
|
|
606 |
break;
|
|
607 |
// has to be tested, what happens in this default case
|
|
608 |
//Panic(KGsmuPanicNotSupportedWithDCSBits7To4);
|
|
609 |
}
|
|
610 |
}
|
|
611 |
else
|
|
612 |
{
|
|
613 |
switch (bits7to4)
|
|
614 |
{
|
|
615 |
case (ESmsDCSTextCompressedWithNoClassInfo):
|
|
616 |
{
|
|
617 |
iValue=(TUint8) (ESmsDCSTextUncompressedWithNoClassInfo|(iValue&(~ESmsDCSBits7To4Mask)));
|
|
618 |
break;
|
|
619 |
}
|
|
620 |
case (ESmsDCSTextCompressedWithClassInfo):
|
|
621 |
{
|
|
622 |
iValue=(TUint8) (ESmsDCSTextUncompressedWithClassInfo|(iValue&(~ESmsDCSBits7To4Mask)));
|
|
623 |
break;
|
|
624 |
}
|
|
625 |
case (ESmsDCSAutoDelNoClassInfoCompressedText):
|
|
626 |
{
|
|
627 |
iValue=(TUint8) (ESmsDCSAutoDelNoClassInfoUncompressedText|(iValue&(~ESmsDCSBits7To4Mask)));
|
|
628 |
break;
|
|
629 |
}
|
|
630 |
case (ESmsDCSAutoDelClassInfoTextCompressedText):
|
|
631 |
{
|
|
632 |
iValue=(TUint8) ( ESmsDCSAutoDelClassInfoUncompressedText|(iValue&(~ESmsDCSBits7To4Mask)));
|
|
633 |
break;
|
|
634 |
}
|
|
635 |
case (ESmsDCSTextUncompressedWithNoClassInfo):
|
|
636 |
case (ESmsDCSTextUncompressedWithClassInfo):
|
|
637 |
case (ESmsDCSAutoDelClassInfoUncompressedText):
|
|
638 |
case (ESmsDCSAutoDelNoClassInfoUncompressedText):
|
|
639 |
case (ESmsDCSTextUncompressed7BitOr8Bit):
|
|
640 |
default:
|
|
641 |
{
|
|
642 |
}
|
|
643 |
}
|
|
644 |
}
|
|
645 |
} // TSmsDataCodingScheme::SetTextCompressed
|
|
646 |
|
|
647 |
|
|
648 |
TSmsDataCodingScheme::TSmsAlphabet TSmsDataCodingScheme::Alphabet() const
|
|
649 |
{
|
|
650 |
LOGGSMU1("TSmsDataCodingScheme::TSmsAlphabet()");
|
|
651 |
|
|
652 |
TInt bits7to4=Bits7To4();
|
|
653 |
TInt alphabet=ESmsAlphabet7Bit;
|
|
654 |
switch (bits7to4)
|
|
655 |
{
|
|
656 |
case (ESmsDCSTextUncompressedWithNoClassInfo):
|
|
657 |
case (ESmsDCSTextUncompressedWithClassInfo):
|
|
658 |
case (ESmsDCSTextCompressedWithNoClassInfo): // Alphabet not used in these cases
|
|
659 |
case (ESmsDCSTextCompressedWithClassInfo):
|
|
660 |
case (ESmsDCSAutoDelNoClassInfoUncompressedText):
|
|
661 |
case (ESmsDCSAutoDelClassInfoUncompressedText):
|
|
662 |
case (ESmsDCSAutoDelNoClassInfoCompressedText):
|
|
663 |
case (ESmsDCSAutoDelClassInfoTextCompressedText):
|
|
664 |
{
|
|
665 |
alphabet=iValue&ESmsAlphabetMask;
|
|
666 |
break;
|
|
667 |
}
|
|
668 |
case (ESmsDCSTextUncompressed7BitOr8Bit):
|
|
669 |
{
|
|
670 |
alphabet=iValue&ESmsAlphabet8Bit; // N.B. only one bit used to code alphabet
|
|
671 |
break;
|
|
672 |
}
|
|
673 |
case (ESmsDCSMessageWaitingIndicationDiscardMessage):
|
|
674 |
case (ESmsDCSMessageWaitingIndication7Bit):
|
|
675 |
{
|
|
676 |
alphabet=ESmsAlphabet7Bit;
|
|
677 |
break;
|
|
678 |
}
|
|
679 |
case (ESmsDCSMessageWaitingIndicationUCS2):
|
|
680 |
{
|
|
681 |
alphabet=ESmsAlphabetUCS2;
|
|
682 |
break;
|
|
683 |
}
|
|
684 |
default:
|
|
685 |
LOGGSMU1("TSmsDataCodingScheme::Alphabet() WARNING! default case has been reached");
|
|
686 |
break;
|
|
687 |
}
|
|
688 |
return (TSmsAlphabet) alphabet;
|
|
689 |
} // TSmsDataCodingScheme::TSmsAlphabet
|
|
690 |
|
|
691 |
void TSmsDataCodingScheme::SetAlphabet(TSmsAlphabet aAlphabet)
|
|
692 |
{
|
|
693 |
LOGGSMU1("TSmsDataCodingScheme::SetAlphabet()");
|
|
694 |
|
|
695 |
TInt bits7to4=Bits7To4();
|
|
696 |
switch (bits7to4)
|
|
697 |
{
|
|
698 |
case (ESmsDCSTextUncompressedWithNoClassInfo):
|
|
699 |
case (ESmsDCSTextUncompressedWithClassInfo):
|
|
700 |
case (ESmsDCSTextCompressedWithNoClassInfo): // Alphabet not used in these cases
|
|
701 |
case (ESmsDCSTextCompressedWithClassInfo):
|
|
702 |
case (ESmsDCSAutoDelNoClassInfoUncompressedText):
|
|
703 |
case (ESmsDCSAutoDelClassInfoUncompressedText):
|
|
704 |
case (ESmsDCSAutoDelNoClassInfoCompressedText):
|
|
705 |
case (ESmsDCSAutoDelClassInfoTextCompressedText):
|
|
706 |
{
|
|
707 |
iValue=(TUint8) ((iValue&(~ESmsAlphabetMask))|aAlphabet);
|
|
708 |
break;
|
|
709 |
}
|
|
710 |
case (ESmsDCSTextUncompressed7BitOr8Bit):
|
|
711 |
{
|
|
712 |
if ((aAlphabet==ESmsAlphabet7Bit) || (aAlphabet==ESmsAlphabet8Bit))
|
|
713 |
{
|
|
714 |
iValue=(TUint8) ((iValue&(~ESmsAlphabet8Bit))|aAlphabet); // N.B. only one bit used to code alphabet
|
|
715 |
}
|
|
716 |
break;
|
|
717 |
}
|
|
718 |
case (ESmsDCSMessageWaitingIndicationDiscardMessage):
|
|
719 |
{
|
|
720 |
if (aAlphabet!=ESmsAlphabet7Bit)
|
|
721 |
{
|
|
722 |
LOGGSMU3("TSmsDataCodingScheme::SetAlphabet() WARNING! Not Supported With Discard Message [Bits7To4=%d], [aAlphabet=%d]", bits7to4, aAlphabet);
|
|
723 |
}
|
|
724 |
break;
|
|
725 |
}
|
|
726 |
case (ESmsDCSMessageWaitingIndication7Bit):
|
|
727 |
{
|
|
728 |
if (aAlphabet==ESmsAlphabetUCS2)
|
|
729 |
{
|
|
730 |
iValue=(TUint8) (ESmsDCSMessageWaitingIndicationUCS2|(iValue&(~ESmsDCSBits7To4Mask)));
|
|
731 |
}
|
|
732 |
else
|
|
733 |
{
|
|
734 |
LOGGSMU3("TSmsDataCodingScheme::SetAlphabet() WARNING! Not Supported With Discard Message [Bits7To4=%d], [aAlphabet=%d]", bits7to4, aAlphabet);
|
|
735 |
}
|
|
736 |
break;
|
|
737 |
}
|
|
738 |
case (ESmsDCSMessageWaitingIndicationUCS2):
|
|
739 |
{
|
|
740 |
if (aAlphabet==ESmsAlphabet7Bit)
|
|
741 |
{
|
|
742 |
iValue=(TUint8) (ESmsDCSMessageWaitingIndication7Bit|(iValue&(~ESmsDCSBits7To4Mask)));
|
|
743 |
}
|
|
744 |
else
|
|
745 |
{
|
|
746 |
LOGGSMU3("TSmsDataCodingScheme::SetAlphabet() WARNING! Not Supported With Discard Message [Bits7To4=%d], [aAlphabet=%d]", bits7to4, aAlphabet);
|
|
747 |
}
|
|
748 |
break;
|
|
749 |
}
|
|
750 |
default:
|
|
751 |
LOGGSMU1("TSmsDataCodingScheme::SetAlphabet() WARNING! default case has been reached");
|
|
752 |
break;
|
|
753 |
}
|
|
754 |
} // TSmsDataCodingScheme::SetAlphabet
|
|
755 |
|
|
756 |
|
|
757 |
TBool TSmsDataCodingScheme::Class(TSmsClass& aClass) const
|
|
758 |
{
|
|
759 |
LOGGSMU1("TSmsDataCodingScheme::Class()");
|
|
760 |
|
|
761 |
switch (Bits7To4())
|
|
762 |
{
|
|
763 |
case (ESmsDCSTextUncompressedWithClassInfo):
|
|
764 |
case (ESmsDCSTextCompressedWithClassInfo):
|
|
765 |
case (ESmsDCSAutoDelClassInfoUncompressedText):
|
|
766 |
case (ESmsDCSAutoDelClassInfoTextCompressedText):
|
|
767 |
case (ESmsDCSTextUncompressed7BitOr8Bit):
|
|
768 |
aClass=(TSmsClass) (iValue&ESmsClassMask);
|
|
769 |
return ETrue;
|
|
770 |
default:
|
|
771 |
return EFalse;
|
|
772 |
}
|
|
773 |
} // TSmsDataCodingScheme::Class
|
|
774 |
|
|
775 |
|
|
776 |
void TSmsDataCodingScheme::SetClass(TBool aClassDefined,TSmsDataCodingScheme::TSmsClass aClass)
|
|
777 |
{
|
|
778 |
LOGGSMU1("TSmsDataCodingScheme::SetClass()");
|
|
779 |
|
|
780 |
TInt bits7to4=Bits7To4();
|
|
781 |
if (aClassDefined)
|
|
782 |
{
|
|
783 |
switch (bits7to4)
|
|
784 |
{
|
|
785 |
case (ESmsDCSTextUncompressedWithNoClassInfo):
|
|
786 |
{
|
|
787 |
iValue=(TUint8) (ESmsDCSTextUncompressedWithClassInfo|(iValue&ESmsAlphabetMask|aClass));
|
|
788 |
break;
|
|
789 |
}
|
|
790 |
case (ESmsDCSTextCompressedWithNoClassInfo):
|
|
791 |
{
|
|
792 |
iValue=(TUint8) (ESmsDCSTextCompressedWithClassInfo|(iValue&ESmsAlphabetMask|aClass));
|
|
793 |
break;
|
|
794 |
}
|
|
795 |
case (ESmsDCSAutoDelNoClassInfoUncompressedText):
|
|
796 |
{
|
|
797 |
iValue=(TUint8) (ESmsDCSAutoDelClassInfoUncompressedText|(iValue&ESmsAlphabetMask|aClass));
|
|
798 |
break;
|
|
799 |
}
|
|
800 |
case (ESmsDCSAutoDelNoClassInfoCompressedText):
|
|
801 |
{
|
|
802 |
iValue=(TUint8) (ESmsDCSAutoDelClassInfoTextCompressedText|(iValue&ESmsAlphabetMask|aClass));
|
|
803 |
break;
|
|
804 |
}
|
|
805 |
case (ESmsDCSTextUncompressedWithClassInfo):
|
|
806 |
case (ESmsDCSTextCompressedWithClassInfo):
|
|
807 |
case (ESmsDCSAutoDelClassInfoUncompressedText):
|
|
808 |
case (ESmsDCSAutoDelClassInfoTextCompressedText):
|
|
809 |
case (ESmsDCSTextUncompressed7BitOr8Bit):
|
|
810 |
|
|
811 |
{
|
|
812 |
iValue=(TUint8) (iValue&(~ESmsClassMask)|aClass);
|
|
813 |
break;
|
|
814 |
}
|
|
815 |
default:
|
|
816 |
LOGGSMU1("WARNING! default case has been reached");
|
|
817 |
break;
|
|
818 |
}
|
|
819 |
}
|
|
820 |
else
|
|
821 |
{
|
|
822 |
switch (bits7to4)
|
|
823 |
{
|
|
824 |
case (ESmsDCSTextUncompressedWithClassInfo):
|
|
825 |
{
|
|
826 |
iValue=(TUint8) (ESmsDCSTextUncompressedWithNoClassInfo|(iValue&ESmsAlphabetMask)|aClass);
|
|
827 |
break;
|
|
828 |
}
|
|
829 |
case (ESmsDCSTextCompressedWithClassInfo):
|
|
830 |
{
|
|
831 |
iValue=(TUint8) (ESmsDCSTextCompressedWithNoClassInfo|(iValue&ESmsAlphabetMask)|aClass);
|
|
832 |
break;
|
|
833 |
}
|
|
834 |
case (ESmsDCSAutoDelClassInfoUncompressedText):
|
|
835 |
{
|
|
836 |
iValue=(TUint8) (ESmsDCSAutoDelNoClassInfoUncompressedText|(iValue&ESmsAlphabetMask)|aClass);
|
|
837 |
break;
|
|
838 |
}
|
|
839 |
case (ESmsDCSAutoDelClassInfoTextCompressedText):
|
|
840 |
{
|
|
841 |
iValue=(TUint8) (ESmsDCSAutoDelNoClassInfoCompressedText|(iValue&ESmsAlphabetMask)|aClass);
|
|
842 |
break;
|
|
843 |
}
|
|
844 |
case (ESmsDCSTextUncompressed7BitOr8Bit):
|
|
845 |
{
|
|
846 |
iValue=(TUint8) (ESmsDCSTextUncompressedWithNoClassInfo|(iValue&ESmsAlphabetMask)|aClass);
|
|
847 |
break;
|
|
848 |
}
|
|
849 |
case (ESmsDCSTextUncompressedWithNoClassInfo):
|
|
850 |
case (ESmsDCSTextCompressedWithNoClassInfo):
|
|
851 |
case (ESmsDCSAutoDelNoClassInfoUncompressedText):
|
|
852 |
case (ESmsDCSAutoDelNoClassInfoCompressedText):
|
|
853 |
case (ESmsDCSMessageWaitingIndicationDiscardMessage):
|
|
854 |
case (ESmsDCSMessageWaitingIndication7Bit):
|
|
855 |
case (ESmsDCSMessageWaitingIndicationUCS2):
|
|
856 |
default:
|
|
857 |
{
|
|
858 |
}
|
|
859 |
}
|
|
860 |
}
|
|
861 |
} // TSmsDataCodingScheme::SetClass
|
|
862 |
|
|
863 |
|
|
864 |
TSmsDataCodingScheme::TSmsIndicationState TSmsDataCodingScheme::IndicationState() const
|
|
865 |
{
|
|
866 |
LOGGSMU1("TSmsDataCodingScheme::IndicationState()");
|
|
867 |
|
|
868 |
TInt bits7to4=Bits7To4();
|
|
869 |
TSmsIndicationState state=ESmsIndicationInactive;
|
|
870 |
switch (bits7to4)
|
|
871 |
{
|
|
872 |
case (ESmsDCSMessageWaitingIndicationDiscardMessage):
|
|
873 |
case (ESmsDCSMessageWaitingIndication7Bit):
|
|
874 |
case (ESmsDCSMessageWaitingIndicationUCS2):
|
|
875 |
{
|
|
876 |
state=(TSmsIndicationState) (iValue&ESmsIndicationStateMask);
|
|
877 |
break;
|
|
878 |
}
|
|
879 |
default:
|
|
880 |
LOGGSMU1("WARNING! default case has been reached");
|
|
881 |
break;
|
|
882 |
}
|
|
883 |
return state;
|
|
884 |
} // TSmsDataCodingScheme::TSmsIndicationState
|
|
885 |
|
|
886 |
|
|
887 |
void TSmsDataCodingScheme::SetIndicationState(TSmsIndicationState aState)
|
|
888 |
{
|
|
889 |
LOGGSMU1("TSmsDataCodingScheme::SetIndicationState()");
|
|
890 |
|
|
891 |
TInt bits7to4=Bits7To4();
|
|
892 |
switch (bits7to4)
|
|
893 |
{
|
|
894 |
case (ESmsDCSMessageWaitingIndicationDiscardMessage):
|
|
895 |
case (ESmsDCSMessageWaitingIndication7Bit):
|
|
896 |
case (ESmsDCSMessageWaitingIndicationUCS2):
|
|
897 |
{
|
|
898 |
iValue=(TUint8) (aState | (iValue&(~ESmsIndicationStateMask)));
|
|
899 |
break;
|
|
900 |
}
|
|
901 |
default:
|
|
902 |
LOGGSMU1("TSmsDataCodingScheme::SetIndicationState() WARNING! default case has been reached");
|
|
903 |
break;
|
|
904 |
}
|
|
905 |
} // TSmsDataCodingScheme::SetIndicationState
|
|
906 |
|
|
907 |
|
|
908 |
TSmsDataCodingScheme::TSmsIndicationType TSmsDataCodingScheme::IndicationType() const
|
|
909 |
{
|
|
910 |
LOGGSMU1("TSmsDataCodingScheme::IndicationType()");
|
|
911 |
|
|
912 |
TInt bits7to4=Bits7To4();
|
|
913 |
TSmsIndicationType type=ESmsVoicemailMessageWaiting;
|
|
914 |
switch (bits7to4)
|
|
915 |
{
|
|
916 |
case (ESmsDCSMessageWaitingIndicationDiscardMessage):
|
|
917 |
case (ESmsDCSMessageWaitingIndication7Bit):
|
|
918 |
case (ESmsDCSMessageWaitingIndicationUCS2):
|
|
919 |
{
|
|
920 |
type=(TSmsIndicationType) (iValue&ESmsIndicationTypeMask);
|
|
921 |
break;
|
|
922 |
}
|
|
923 |
default:
|
|
924 |
LOGGSMU1("TSmsDataCodingScheme::IndicationType() WARNING default case has been reached");
|
|
925 |
break;
|
|
926 |
}
|
|
927 |
return type;
|
|
928 |
} // TSmsDataCodingScheme::TSmsIndicationType
|
|
929 |
|
|
930 |
|
|
931 |
void TSmsDataCodingScheme::SetIndicationType(TSmsIndicationType aType)
|
|
932 |
{
|
|
933 |
LOGGSMU1("TSmsDataCodingScheme::SetIndicationType()");
|
|
934 |
|
|
935 |
TInt bits7to4=Bits7To4();
|
|
936 |
switch (bits7to4)
|
|
937 |
{
|
|
938 |
case (ESmsDCSMessageWaitingIndicationDiscardMessage):
|
|
939 |
case (ESmsDCSMessageWaitingIndication7Bit):
|
|
940 |
case (ESmsDCSMessageWaitingIndicationUCS2):
|
|
941 |
{
|
|
942 |
iValue=(TUint8) (aType | (iValue&(~ESmsIndicationTypeMask)));
|
|
943 |
break;
|
|
944 |
}
|
|
945 |
default:
|
|
946 |
LOGGSMU1("TSmsDataCodingScheme::SetIndicationType() WARNING! default case has been reached");
|
|
947 |
break;
|
|
948 |
}
|
|
949 |
} // TSmsDataCodingScheme::SetIndicationType
|
|
950 |
|
|
951 |
|
|
952 |
/**
|
|
953 |
* Allocates and creates a CSmsAlphabetConverter object, specifying an Alphabet
|
|
954 |
* Coding scheme and a Binary flag.
|
|
955 |
*
|
|
956 |
* @param aCharacterSetConverter Pre-initialised character set converter
|
|
957 |
* @param aFs File system handle
|
|
958 |
* @param aSmsAlphabet Data coding scheme alphabet
|
|
959 |
* @param aIsBinary Set to true for WAP or compressed data
|
|
960 |
* @return New CSmsAlphabetConverter object
|
|
961 |
* @capability None
|
|
962 |
*/
|
|
963 |
EXPORT_C CSmsAlphabetConverter* CSmsAlphabetConverter::NewLC(CCnvCharacterSetConverter& aCharacterSetConverter,RFs& aFs,TSmsDataCodingScheme::TSmsAlphabet aSmsAlphabet,TBool aIsBinary)
|
|
964 |
{
|
|
965 |
LOGGSMU1("CSmsAlphabetConverter::NewLC()");
|
|
966 |
|
|
967 |
CSmsAlphabetConverter* converter=new (ELeave)CSmsAlphabetConverter(aCharacterSetConverter,aFs,aSmsAlphabet,aIsBinary);
|
|
968 |
CleanupStack::PushL(converter);
|
|
969 |
converter->ConstructL();
|
|
970 |
return converter;
|
|
971 |
} // CSmsAlphabetConverter::NewLC
|
|
972 |
|
|
973 |
|
|
974 |
/**
|
|
975 |
* Destructor.
|
|
976 |
* @capability None
|
|
977 |
*/
|
|
978 |
EXPORT_C CSmsAlphabetConverter::~CSmsAlphabetConverter()
|
|
979 |
{
|
|
980 |
delete iConvertedNativeCharacters;
|
|
981 |
delete iConvertedUDElements;
|
|
982 |
delete iUnconvertedNativeCharacters;
|
|
983 |
delete iUnconvertedUDElements;
|
|
984 |
} // CSmsAlphabetConverter::NewLC
|
|
985 |
|
|
986 |
|
|
987 |
//
|
|
988 |
// C'tor - standard stuff
|
|
989 |
//
|
|
990 |
CSmsAlphabetConverter::CSmsAlphabetConverter(CCnvCharacterSetConverter& aCharacterSetConverter,RFs& aFs,TSmsDataCodingScheme::TSmsAlphabet aSmsAlphabet,TBool aIsBinary)
|
|
991 |
: iCharacterSetConverter(aCharacterSetConverter),
|
|
992 |
iFs(aFs),
|
|
993 |
iSmsAlphabet(aSmsAlphabet),
|
|
994 |
iIsBinary(aIsBinary),
|
|
995 |
iUnconvertedNativeCharactersPtr(NULL,0),
|
|
996 |
iUnconvertedUDElementsPtr(NULL,0)
|
|
997 |
{
|
|
998 |
} // CSmsAlphabetConverter::CSmsAlphabetConverter
|
|
999 |
|
|
1000 |
|
|
1001 |
//
|
|
1002 |
// Ensures this is a supported character set if not binary conversion
|
|
1003 |
//
|
|
1004 |
void CSmsAlphabetConverter::ConstructL()
|
|
1005 |
{
|
|
1006 |
LOGGSMU1("CSmsAlphabetConverter::ConstructL()");
|
|
1007 |
|
|
1008 |
|
|
1009 |
if (!iIsBinary)
|
|
1010 |
{
|
|
1011 |
switch (iSmsAlphabet)
|
|
1012 |
{
|
|
1013 |
case TSmsDataCodingScheme::ESmsAlphabet7Bit:
|
|
1014 |
case TSmsDataCodingScheme::ESmsAlphabet8Bit:
|
|
1015 |
case TSmsDataCodingScheme::ESmsAlphabetUCS2:
|
|
1016 |
{
|
|
1017 |
// Supported
|
|
1018 |
break;
|
|
1019 |
}
|
|
1020 |
default:
|
|
1021 |
{
|
|
1022 |
// Not supported
|
|
1023 |
User::Leave(KErrGsmSMSDataCodingSchemeNotSupported);
|
|
1024 |
break;
|
|
1025 |
}
|
|
1026 |
}
|
|
1027 |
}
|
|
1028 |
} // CSmsAlphabetConverter::ConstructL
|
|
1029 |
|
|
1030 |
|
|
1031 |
//
|
|
1032 |
// Returns whether the character set converter is invoked. Provided to allow
|
|
1033 |
// clients to provided efficient converted length calculation where no
|
|
1034 |
// conversion is required.
|
|
1035 |
//
|
|
1036 |
void CSmsAlphabetConverter::ConversionPropertiesL(TSmsAlphabetConversionProperties& aConversionProperties) const
|
|
1037 |
{
|
|
1038 |
LOGGSMU1("CSmsAlphabetConverter::ConversionPropertiesL()");
|
|
1039 |
|
|
1040 |
|
|
1041 |
// Set defaults
|
|
1042 |
aConversionProperties.iWidthConversion=ESmsAlphabetWidthConversionFixed;
|
|
1043 |
aConversionProperties.iUDElementsPerNativeCharacter=1;
|
|
1044 |
// Modify if different
|
|
1045 |
if (iIsBinary)
|
|
1046 |
return;
|
|
1047 |
switch (iSmsAlphabet)
|
|
1048 |
{
|
|
1049 |
case TSmsDataCodingScheme::ESmsAlphabet7Bit:
|
|
1050 |
case TSmsDataCodingScheme::ESmsAlphabet8Bit:
|
|
1051 |
{
|
|
1052 |
aConversionProperties.iWidthConversion=ESmsAlphabetWidthConversionVariable;
|
|
1053 |
break;
|
|
1054 |
}
|
|
1055 |
case TSmsDataCodingScheme::ESmsAlphabetUCS2:
|
|
1056 |
{
|
|
1057 |
aConversionProperties.iUDElementsPerNativeCharacter=sizeof(TText);
|
|
1058 |
break;
|
|
1059 |
}
|
|
1060 |
default:
|
|
1061 |
{
|
|
1062 |
User::Leave(KErrGsmSMSDataCodingSchemeNotSupported);
|
|
1063 |
}
|
|
1064 |
}
|
|
1065 |
} // CSmsAlphabetConverter::ConversionPropertiesL
|
|
1066 |
|
|
1067 |
|
|
1068 |
/**
|
|
1069 |
* Converts from the native character set to unpacked user data elements of the
|
|
1070 |
* desired character set.
|
|
1071 |
*
|
|
1072 |
* The function stores the converted data internally.
|
|
1073 |
*
|
|
1074 |
* @param aNativeCharacters The native character set data (Unicode only)
|
|
1075 |
* @return Converted characters
|
|
1076 |
* @capability None
|
|
1077 |
*/
|
|
1078 |
EXPORT_C TPtrC8 CSmsAlphabetConverter::ConvertFromNativeL(const TDesC& aNativeCharacters)
|
|
1079 |
{
|
|
1080 |
LOGGSMU1("CSmsAlphabetConverter::ConvertFromNativeL()");
|
|
1081 |
|
|
1082 |
TInt numberOfUnconvertibleCharacters, numberOfDowngradedCharacters;
|
|
1083 |
|
|
1084 |
return ConvertFromNativeL(aNativeCharacters, ESmsEncodingNone,
|
|
1085 |
numberOfUnconvertibleCharacters,
|
|
1086 |
numberOfDowngradedCharacters);
|
|
1087 |
} // CSmsAlphabetConverter::ConvertFromNativeL
|
|
1088 |
|
|
1089 |
|
|
1090 |
/**
|
|
1091 |
* Converts from the native character set to unpacked user data elements of the
|
|
1092 |
* desired character set.
|
|
1093 |
*
|
|
1094 |
* The function stores the converted data internally.
|
|
1095 |
*
|
|
1096 |
* @param aNativeCharacters The native character set data (Unicode only)
|
|
1097 |
* @param aNumberOfUnconvertibleCharacters Number of characters unconverted
|
|
1098 |
* @param aNumberOfDowngradedCharacters Number of characters downgraded
|
|
1099 |
* @param aEncoding Alternative 7bit encoding to used (if needed)
|
|
1100 |
*
|
|
1101 |
* @return Converted characters
|
|
1102 |
*
|
|
1103 |
* @capability None
|
|
1104 |
*/
|
|
1105 |
EXPORT_C TPtrC8 CSmsAlphabetConverter::ConvertFromNativeL(const TDesC& aNativeCharacters,
|
|
1106 |
TSmsEncoding aEncoding,
|
|
1107 |
TInt& aNumberOfUnconvertibleCharacters,
|
|
1108 |
TInt& aNumberOfDowngradedCharacters)
|
|
1109 |
{
|
|
1110 |
LOGGSMU2("CSmsAlphabetConverter::ConvertFromNativeL(): aEncoding=%d", aEncoding);
|
|
1111 |
|
|
1112 |
aNumberOfUnconvertibleCharacters = 0;
|
|
1113 |
aNumberOfDowngradedCharacters = 0;
|
|
1114 |
|
|
1115 |
// Check for some shortcuts
|
|
1116 |
if (iIsBinary || iSmsAlphabet == TSmsDataCodingScheme::ESmsAlphabet8Bit)
|
|
1117 |
{
|
|
1118 |
// Binary data stored as padded unicode
|
|
1119 |
TPtr8 outputPtr=CheckAllocBufferL(&iConvertedUDElements,aNativeCharacters.Length(),0);
|
|
1120 |
outputPtr.Copy(aNativeCharacters);
|
|
1121 |
iUnconvertedNativeCharactersPtr.Zero();
|
|
1122 |
return outputPtr;
|
|
1123 |
}
|
|
1124 |
else if (iSmsAlphabet==TSmsDataCodingScheme::ESmsAlphabetUCS2)
|
|
1125 |
{
|
|
1126 |
TInt nativeCharactersLength = aNativeCharacters.Length();
|
|
1127 |
// 16-bit copy with possible endianess correction
|
|
1128 |
TInt elementCount=nativeCharactersLength*2;
|
|
1129 |
TPtr8 outputPtr(CheckAllocBufferL(&iConvertedUDElements,elementCount,elementCount));
|
|
1130 |
for (TInt i=0;i<nativeCharactersLength;i++)
|
|
1131 |
{
|
|
1132 |
outputPtr[2*i]=(TUint8)(aNativeCharacters[i]>>8);
|
|
1133 |
outputPtr[2*i+1]=(TUint8)aNativeCharacters[i];
|
|
1134 |
}
|
|
1135 |
iUnconvertedNativeCharactersPtr.Zero();
|
|
1136 |
return outputPtr;
|
|
1137 |
}
|
|
1138 |
else // No shortcuts, do proper conversion
|
|
1139 |
{
|
|
1140 |
PrepareForConversionFromNativeL(aEncoding);
|
|
1141 |
|
|
1142 |
// Create input buffer
|
|
1143 |
TInt newInputLength=iUnconvertedNativeCharactersPtr.Length()+aNativeCharacters.Length();
|
|
1144 |
iUnconvertedNativeCharactersPtr.Set(CheckAllocBufferL(&iUnconvertedNativeCharacters,newInputLength,iUnconvertedNativeCharactersPtr.Length()));
|
|
1145 |
iUnconvertedNativeCharactersPtr.Append(aNativeCharacters);
|
|
1146 |
|
|
1147 |
// Ensure buffer is at least the length of the input buffer
|
|
1148 |
TPtr8 outputPtr=CheckAllocBufferL(&iConvertedUDElements,iUnconvertedNativeCharactersPtr.Length(),0);
|
|
1149 |
|
|
1150 |
TInt retryCount=0;
|
|
1151 |
TInt unconvertedCount=iUnconvertedNativeCharactersPtr.Length();
|
|
1152 |
while (unconvertedCount)
|
|
1153 |
{
|
|
1154 |
TInt tempNumberOfUnconvertibleCharacters = 0;
|
|
1155 |
TInt tempNumberOfDowngradedCharacters = 0;
|
|
1156 |
|
|
1157 |
// Get a pointer to unfilled area of output buffer
|
|
1158 |
TPtr8 fillPtr((TUint8*)outputPtr.Ptr()+outputPtr.Length(),0,outputPtr.MaxLength()-outputPtr.Length());
|
|
1159 |
// Try the conversion & get number of unconverted characters
|
|
1160 |
TInt newUnconvertedCount=iCharacterSetConverter.ConvertFromUnicode(fillPtr,iUnconvertedNativeCharactersPtr);
|
|
1161 |
if (newUnconvertedCount<0)
|
|
1162 |
break;
|
|
1163 |
|
|
1164 |
// Compare what is converted with the original, to get downgrade count
|
|
1165 |
TPtr tempBufPtr((TUint16*)iUnconvertedNativeCharactersPtr.Ptr(), 0, fillPtr.Length());
|
|
1166 |
TInt offset = aNativeCharacters.Length() - unconvertedCount;
|
|
1167 |
TInt state = CCnvCharacterSetConverter::KStateDefault;
|
|
1168 |
TInt notRestored = iCharacterSetConverter.ConvertToUnicode(tempBufPtr, fillPtr, state);
|
|
1169 |
|
|
1170 |
if (notRestored > 0)
|
|
1171 |
{
|
|
1172 |
tempNumberOfUnconvertibleCharacters += notRestored;
|
|
1173 |
}
|
|
1174 |
|
|
1175 |
for (TInt pos = 0; pos < tempBufPtr.Length(); pos++)
|
|
1176 |
{
|
|
1177 |
if (tempBufPtr[pos] != aNativeCharacters[offset + pos])
|
|
1178 |
{
|
|
1179 |
if (tempBufPtr[pos] != KReplacementCharacter)
|
|
1180 |
{
|
|
1181 |
tempNumberOfDowngradedCharacters++;
|
|
1182 |
}
|
|
1183 |
else
|
|
1184 |
{
|
|
1185 |
tempNumberOfUnconvertibleCharacters++;
|
|
1186 |
}
|
|
1187 |
}
|
|
1188 |
}
|
|
1189 |
|
|
1190 |
//
|
|
1191 |
// If characters were downgraded or unconverted then replace them
|
|
1192 |
// with downgrades from the PREQ2090 converter.
|
|
1193 |
//
|
|
1194 |
if (tempNumberOfUnconvertibleCharacters > 0 &&
|
|
1195 |
aEncoding != ESmsEncodingNone)
|
|
1196 |
{
|
|
1197 |
HBufC8* downgradesBuf = HBufC8::NewLC(iUnconvertedNativeCharactersPtr.Length());
|
|
1198 |
HBufC* nativeBuf = HBufC::NewLC(iUnconvertedNativeCharactersPtr.Length());
|
|
1199 |
TPtr8 downgradesPtr = downgradesBuf->Des();
|
|
1200 |
TPtr nativePtr = nativeBuf->Des();
|
|
1201 |
|
|
1202 |
PrepareForConversionFromNativeL(ESmsEncodingNone);
|
|
1203 |
|
|
1204 |
// Attempt to convert the text
|
|
1205 |
TInt ret = iCharacterSetConverter.ConvertFromUnicode(downgradesPtr, iUnconvertedNativeCharactersPtr);
|
|
1206 |
if (ret >= 0)
|
|
1207 |
{
|
|
1208 |
// Compare what is converted with the original...
|
|
1209 |
state = CCnvCharacterSetConverter::KStateDefault;
|
|
1210 |
notRestored = iCharacterSetConverter.ConvertToUnicode(nativePtr, downgradesPtr, state);
|
|
1211 |
|
|
1212 |
if (notRestored >= 0)
|
|
1213 |
{
|
|
1214 |
// Merge in the downgrades
|
|
1215 |
TInt pos;
|
|
1216 |
|
|
1217 |
for (pos = 0; pos < tempBufPtr.Length(); pos++)
|
|
1218 |
{
|
|
1219 |
if (tempBufPtr[pos] != aNativeCharacters[offset + pos])
|
|
1220 |
{
|
|
1221 |
if (tempBufPtr[pos] != KReplacementCharacter)
|
|
1222 |
{
|
|
1223 |
tempBufPtr[pos] = nativePtr[pos];
|
|
1224 |
}
|
|
1225 |
}
|
|
1226 |
}
|
|
1227 |
|
|
1228 |
// Reconvert...
|
|
1229 |
PrepareForConversionFromNativeL(aEncoding);
|
|
1230 |
|
|
1231 |
newUnconvertedCount=iCharacterSetConverter.ConvertFromUnicode(fillPtr,iUnconvertedNativeCharactersPtr);
|
|
1232 |
if (newUnconvertedCount<0)
|
|
1233 |
break;
|
|
1234 |
|
|
1235 |
// Recount the changed characters...
|
|
1236 |
tempNumberOfUnconvertibleCharacters = 0;
|
|
1237 |
tempNumberOfDowngradedCharacters = 0;
|
|
1238 |
|
|
1239 |
for (pos = 0; pos < tempBufPtr.Length(); pos++)
|
|
1240 |
{
|
|
1241 |
if (tempBufPtr[pos] != aNativeCharacters[offset + pos])
|
|
1242 |
{
|
|
1243 |
if (tempBufPtr[pos] != KReplacementCharacter)
|
|
1244 |
{
|
|
1245 |
tempNumberOfDowngradedCharacters++;
|
|
1246 |
}
|
|
1247 |
else
|
|
1248 |
{
|
|
1249 |
tempNumberOfUnconvertibleCharacters++;
|
|
1250 |
}
|
|
1251 |
}
|
|
1252 |
}
|
|
1253 |
}
|
|
1254 |
}
|
|
1255 |
|
|
1256 |
CleanupStack::PopAndDestroy(2, downgradesBuf);
|
|
1257 |
}
|
|
1258 |
|
|
1259 |
//
|
|
1260 |
// Store these downgraded/unconvertible character counts...
|
|
1261 |
//
|
|
1262 |
aNumberOfDowngradedCharacters += tempNumberOfDowngradedCharacters;
|
|
1263 |
aNumberOfUnconvertibleCharacters += tempNumberOfUnconvertibleCharacters;
|
|
1264 |
|
|
1265 |
// Update original buffer length, check retry count and realloc if req'd
|
|
1266 |
outputPtr.SetLength(outputPtr.Length()+fillPtr.Length());
|
|
1267 |
if (newUnconvertedCount==unconvertedCount)
|
|
1268 |
{
|
|
1269 |
if (++retryCount>KMaxSmsAlphabetConversionRetries)
|
|
1270 |
{
|
|
1271 |
__ASSERT_DEBUG(EFalse,Panic(KGsmuPanicConversionRetriedOut));
|
|
1272 |
break;
|
|
1273 |
}
|
|
1274 |
}
|
|
1275 |
else
|
|
1276 |
{
|
|
1277 |
iUnconvertedNativeCharactersPtr.Delete(0,unconvertedCount-newUnconvertedCount);
|
|
1278 |
retryCount=0;
|
|
1279 |
}
|
|
1280 |
unconvertedCount=newUnconvertedCount;
|
|
1281 |
// Check for realloc
|
|
1282 |
if (unconvertedCount)
|
|
1283 |
outputPtr.Set(CheckAllocBufferL(&iConvertedUDElements,iConvertedUDElements->Length()+Max(unconvertedCount,KMinSmsAlphabetConversionAllocIncrement),outputPtr.Length()));
|
|
1284 |
}
|
|
1285 |
|
|
1286 |
return outputPtr;
|
|
1287 |
}
|
|
1288 |
} // CSmsAlphabetConverter::ConvertFromNativeL
|
|
1289 |
|
|
1290 |
|
|
1291 |
/**
|
|
1292 |
* Converts the user data elements of the specified character set to the native
|
|
1293 |
* character set.
|
|
1294 |
*
|
|
1295 |
* @param aUDElements The converted character set data
|
|
1296 |
*
|
|
1297 |
* @return Native character set data (Unicode only)
|
|
1298 |
*
|
|
1299 |
* @capability None
|
|
1300 |
*/
|
|
1301 |
EXPORT_C TPtrC CSmsAlphabetConverter::ConvertToNativeL(const TDesC8& aUDElements)
|
|
1302 |
{
|
|
1303 |
LOGGSMU1("CSmsAlphabetConverter::ConvertToNativeL()");
|
|
1304 |
|
|
1305 |
return ConvertToNativeL(aUDElements, ESmsEncodingNone);
|
|
1306 |
} // CSmsAlphabetConverter::ConvertToNativeL
|
|
1307 |
|
|
1308 |
|
|
1309 |
/**
|
|
1310 |
* Converts the user data elements of the specified character set to the native
|
|
1311 |
* character set.
|
|
1312 |
*
|
|
1313 |
* @param aUDElements The converted character set data
|
|
1314 |
* @param aEncoding Alternative 7bit encoding to used (if needed)
|
|
1315 |
*
|
|
1316 |
* @return Native character set data (Unicode only)
|
|
1317 |
*
|
|
1318 |
* @capability None
|
|
1319 |
*/
|
|
1320 |
EXPORT_C TPtrC CSmsAlphabetConverter::ConvertToNativeL(const TDesC8& aUDElements,
|
|
1321 |
TSmsEncoding aEncoding)
|
|
1322 |
{
|
|
1323 |
LOGGSMU2("CSmsAlphabetConverter::ConvertToNativeL(): aEncoding=%d", aEncoding);
|
|
1324 |
|
|
1325 |
// Check for some shortcuts
|
|
1326 |
if (iIsBinary || iSmsAlphabet == TSmsDataCodingScheme::ESmsAlphabet8Bit)
|
|
1327 |
{
|
|
1328 |
// Binary data stored as padded unicode
|
|
1329 |
TPtr16 outputPtr=CheckAllocBufferL(&iConvertedNativeCharacters,aUDElements.Length(),0);
|
|
1330 |
outputPtr.Copy(aUDElements);
|
|
1331 |
iUnconvertedUDElementsPtr.Zero();
|
|
1332 |
return outputPtr;
|
|
1333 |
}
|
|
1334 |
else if (iSmsAlphabet==TSmsDataCodingScheme::ESmsAlphabetUCS2)
|
|
1335 |
{
|
|
1336 |
// 16-bit copy with possible endianess correction
|
|
1337 |
TInt charCount=aUDElements.Length()/2;
|
|
1338 |
TPtr16 outputPtr=CheckAllocBufferL(&iConvertedNativeCharacters,charCount,charCount);
|
|
1339 |
for (TInt i=0; i<charCount; i++)
|
|
1340 |
{
|
|
1341 |
outputPtr[i]=(TText)(aUDElements[2*i]<<8);
|
|
1342 |
outputPtr[i]=(TText)(outputPtr[i]+(aUDElements[2*i+1]));
|
|
1343 |
}
|
|
1344 |
iUnconvertedUDElementsPtr.Zero();
|
|
1345 |
return outputPtr;
|
|
1346 |
}
|
|
1347 |
else
|
|
1348 |
{
|
|
1349 |
PrepareForConversionToNativeL(aEncoding);
|
|
1350 |
|
|
1351 |
// Create input buffer with unconverted characters prepended
|
|
1352 |
TInt newInputLength=iUnconvertedUDElementsPtr.Length()+aUDElements.Length();
|
|
1353 |
iUnconvertedUDElementsPtr.Set(CheckAllocBufferL(&iUnconvertedUDElements,newInputLength,iUnconvertedUDElementsPtr.Length()));
|
|
1354 |
iUnconvertedUDElementsPtr.Append(aUDElements);
|
|
1355 |
|
|
1356 |
// Ensure buffer is at least the length of the input buffer
|
|
1357 |
TPtr outputPtr=CheckAllocBufferL(&iConvertedNativeCharacters,iUnconvertedUDElementsPtr.Length(),0);
|
|
1358 |
|
|
1359 |
TInt retryCount=0;
|
|
1360 |
TInt unconvertedCount=iUnconvertedUDElementsPtr.Length();
|
|
1361 |
TInt state=CCnvCharacterSetConverter::KStateDefault;
|
|
1362 |
while (unconvertedCount)
|
|
1363 |
{
|
|
1364 |
// Get a pointer to unfilled area of output buffer
|
|
1365 |
TPtr16 fillPtr((TUint16*)outputPtr.Ptr()+outputPtr.Length(),0,outputPtr.MaxLength()-outputPtr.Length());
|
|
1366 |
// Try the conversion & get number of unconverted characters
|
|
1367 |
TInt newUnconvertedCount=iCharacterSetConverter.ConvertToUnicode(fillPtr,iUnconvertedUDElementsPtr,state);
|
|
1368 |
if (newUnconvertedCount<0)
|
|
1369 |
break;
|
|
1370 |
// Update original buffer length & check retry count
|
|
1371 |
outputPtr.SetLength(outputPtr.Length()+fillPtr.Length());
|
|
1372 |
if (newUnconvertedCount==unconvertedCount)
|
|
1373 |
{
|
|
1374 |
if (++retryCount>KMaxSmsAlphabetConversionRetries)
|
|
1375 |
{
|
|
1376 |
__ASSERT_DEBUG(EFalse,Panic(KGsmuPanicConversionRetriedOut));
|
|
1377 |
break;
|
|
1378 |
}
|
|
1379 |
}
|
|
1380 |
else
|
|
1381 |
{
|
|
1382 |
iUnconvertedUDElementsPtr.Delete(0,unconvertedCount-newUnconvertedCount);
|
|
1383 |
retryCount=0;
|
|
1384 |
}
|
|
1385 |
unconvertedCount=newUnconvertedCount;
|
|
1386 |
// Check for realloc
|
|
1387 |
if (unconvertedCount)
|
|
1388 |
outputPtr.Set(CheckAllocBufferL(&iConvertedNativeCharacters,iConvertedNativeCharacters->Length()+Max(unconvertedCount,KMinSmsAlphabetConversionAllocIncrement),outputPtr.Length()));
|
|
1389 |
}
|
|
1390 |
return outputPtr;
|
|
1391 |
}
|
|
1392 |
} // CSmsAlphabetConverter::ConvertToNativeL
|
|
1393 |
|
|
1394 |
|
|
1395 |
/**
|
|
1396 |
* Tests if the character is supported by the current character set.
|
|
1397 |
* This function can be used with 7bit and 8bit alphabets.
|
|
1398 |
*
|
|
1399 |
* @param aChar Character to investigate.
|
|
1400 |
*
|
|
1401 |
* @return ETrue if the character is supported.
|
|
1402 |
*
|
|
1403 |
* @note Since the function is based on the old behaviour (pre-PREQ2090)
|
|
1404 |
* it does not accept a downgraded character or alternative encoding
|
|
1405 |
* as being supported.
|
|
1406 |
*/
|
|
1407 |
TBool CSmsAlphabetConverter::IsSupportedL(TChar aChar)
|
|
1408 |
{
|
|
1409 |
LOGGSMU2("[1] CSmsAlphabetConverter::IsSupportedL(aChar=0x%04x)", (TUint) aChar);
|
|
1410 |
|
|
1411 |
TBool isDowngrade, isRequiresAlternativeEncoding;
|
|
1412 |
|
|
1413 |
TBool supported = IsSupportedL(aChar, ESmsEncodingNone,
|
|
1414 |
isDowngrade, isRequiresAlternativeEncoding);
|
|
1415 |
|
|
1416 |
LOGGSMU2("CSmsAlphabetConverter::IsSupportedL(): supported=%d.", supported);
|
|
1417 |
|
|
1418 |
return supported;
|
|
1419 |
} // CSmsAlphabetConverter::IsSupportedL
|
|
1420 |
|
|
1421 |
|
|
1422 |
/**
|
|
1423 |
* Tests if the descriptor text is supported by the current character set.
|
|
1424 |
* This function can be used with 7bit and 8bit alphabets.
|
|
1425 |
*
|
|
1426 |
* @param aDes Text string to check.
|
|
1427 |
* @param aNumberOfUnconvertibleCharacters Exit param for the number of
|
|
1428 |
* characters unconvertible.
|
|
1429 |
* @param aIndexOfFirstUnconvertibleCharacter Exit param for the first
|
|
1430 |
* unconverted character.
|
|
1431 |
*
|
|
1432 |
* @return ETrue if the character is supported.
|
|
1433 |
*/
|
|
1434 |
TBool CSmsAlphabetConverter::IsSupportedL(const TDesC& aDes, TInt& aNumberOfUnconvertibleCharacters,
|
|
1435 |
TInt& aIndexOfFirstUnconvertibleCharacter)
|
|
1436 |
{
|
|
1437 |
LOGGSMU2("[2] CSmsAlphabetConverter::IsSupportedL(aDes=\"%S\")", &aDes);
|
|
1438 |
|
|
1439 |
TInt desLength = aDes.Length();
|
|
1440 |
//
|
|
1441 |
// Initialise the exit params...
|
|
1442 |
//
|
|
1443 |
aNumberOfUnconvertibleCharacters = 0;
|
|
1444 |
aIndexOfFirstUnconvertibleCharacter = desLength;
|
|
1445 |
|
|
1446 |
//
|
|
1447 |
// Create buffers for the input converted to 7Bit and a buffer for it once
|
|
1448 |
// converted back again...
|
|
1449 |
//
|
|
1450 |
HBufC8* encodedBuf = HBufC8::NewLC(desLength*2); // worse case
|
|
1451 |
HBufC* backToUnicodeAfterStdBuf = HBufC::NewLC(desLength);
|
|
1452 |
TPtr8 encoded(encodedBuf->Des());
|
|
1453 |
TPtr backToUnicodeAfterStd(backToUnicodeAfterStdBuf->Des());
|
|
1454 |
|
|
1455 |
//
|
|
1456 |
// Convert the input string to standard 7bit (with downgrades if needed)...
|
|
1457 |
//
|
|
1458 |
PrepareForConversionFromNativeL(ESmsEncodingNone);
|
|
1459 |
|
|
1460 |
TInt notConverted = iCharacterSetConverter.ConvertFromUnicode(encoded, aDes);
|
|
1461 |
|
|
1462 |
if (notConverted > 0)
|
|
1463 |
{
|
|
1464 |
aNumberOfUnconvertibleCharacters += notConverted;
|
|
1465 |
}
|
|
1466 |
else if (notConverted < 0)
|
|
1467 |
{
|
|
1468 |
aNumberOfUnconvertibleCharacters = desLength;
|
|
1469 |
}
|
|
1470 |
|
|
1471 |
//
|
|
1472 |
// Convert it back again to the native format...
|
|
1473 |
//
|
|
1474 |
TInt state = CCnvCharacterSetConverter::KStateDefault;
|
|
1475 |
TInt notRestored = iCharacterSetConverter.ConvertToUnicode(backToUnicodeAfterStd, encoded, state);
|
|
1476 |
|
|
1477 |
if (notRestored > 0)
|
|
1478 |
{
|
|
1479 |
aNumberOfUnconvertibleCharacters += notRestored;
|
|
1480 |
}
|
|
1481 |
else if (notRestored < 0)
|
|
1482 |
{
|
|
1483 |
aNumberOfUnconvertibleCharacters = desLength;
|
|
1484 |
}
|
|
1485 |
|
|
1486 |
//
|
|
1487 |
// Work out if the string is acceptable as it is (e.g. no unconvertible
|
|
1488 |
// and no downgrades). We only need do this if the previous conversions were
|
|
1489 |
// complete with no issues.
|
|
1490 |
//
|
|
1491 |
for (TInt pos = desLength-1; pos >= 0; --pos)
|
|
1492 |
{
|
|
1493 |
if (backToUnicodeAfterStd[pos] != aDes[pos])
|
|
1494 |
{
|
|
1495 |
aNumberOfUnconvertibleCharacters++;
|
|
1496 |
aIndexOfFirstUnconvertibleCharacter = pos;
|
|
1497 |
}
|
|
1498 |
}
|
|
1499 |
|
|
1500 |
CleanupStack::PopAndDestroy(backToUnicodeAfterStdBuf);
|
|
1501 |
CleanupStack::PopAndDestroy(encodedBuf);
|
|
1502 |
|
|
1503 |
//
|
|
1504 |
// Useful logging...
|
|
1505 |
//
|
|
1506 |
TBool supported = (aNumberOfUnconvertibleCharacters == 0);
|
|
1507 |
|
|
1508 |
LOGGSMU2("CSmsAlphabetConverter::IsSupportedL(): aNumberOfUnconvertibleCharacters=%d.", aNumberOfUnconvertibleCharacters);
|
|
1509 |
LOGGSMU2("CSmsAlphabetConverter::IsSupportedL(): aIndexOfFirstUnconvertibleCharacter=%d.", aIndexOfFirstUnconvertibleCharacter);
|
|
1510 |
LOGGSMU2("CSmsAlphabetConverter::IsSupportedL(): supported=%d.", supported);
|
|
1511 |
|
|
1512 |
return supported;
|
|
1513 |
} // CSmsAlphabetConverter::IsSupportedL
|
|
1514 |
|
|
1515 |
|
|
1516 |
/**
|
|
1517 |
* Tests if the character is supported by the current character set.
|
|
1518 |
* This function can be used with 7bit and 8bit alphabets.
|
|
1519 |
*
|
|
1520 |
* @param aChar Character to investigate.
|
|
1521 |
* @param aEncoding Alternative 7bit encoding (if used).
|
|
1522 |
* @param aIsDowngrade Exit param set to ETrue if the
|
|
1523 |
* character has to be downgraded.
|
|
1524 |
* @param aRequiresAlternativeEncoding Exit param set to ETrue if the
|
|
1525 |
* alternative encoding has to be
|
|
1526 |
* used to encode it.
|
|
1527 |
*
|
|
1528 |
* @return ETrue if the character is supported.
|
|
1529 |
*/
|
|
1530 |
TBool CSmsAlphabetConverter::IsSupportedL(TChar aChar, TSmsEncoding aEncoding,
|
|
1531 |
TBool& aIsDowngrade,
|
|
1532 |
TBool& aRequiresAlternativeEncoding)
|
|
1533 |
{
|
|
1534 |
LOGGSMU2("[3] CSmsAlphabetConverter::IsSupportedL(aChar=0x%04x)", (TUint) aChar);
|
|
1535 |
|
|
1536 |
//
|
|
1537 |
// Convert the character...
|
|
1538 |
//
|
|
1539 |
TInt numberOfUnconvertibleCharacters, numberOfDowngradedCharacters,
|
|
1540 |
numberRequiringAlternativeEncoding, indexOfFirstUnconvertibleCharacter;
|
|
1541 |
TBuf<4> toEncode;
|
|
1542 |
|
|
1543 |
toEncode.SetLength(1);
|
|
1544 |
toEncode[0]=(TText)aChar;
|
|
1545 |
|
|
1546 |
TBool supported = IsSupportedL(toEncode, aEncoding,
|
|
1547 |
numberOfUnconvertibleCharacters,
|
|
1548 |
numberOfDowngradedCharacters,
|
|
1549 |
numberRequiringAlternativeEncoding,
|
|
1550 |
indexOfFirstUnconvertibleCharacter);
|
|
1551 |
|
|
1552 |
//
|
|
1553 |
// Calculate the exit params...
|
|
1554 |
//
|
|
1555 |
aIsDowngrade = (numberOfDowngradedCharacters > 0);
|
|
1556 |
aRequiresAlternativeEncoding = (numberRequiringAlternativeEncoding > 0);
|
|
1557 |
|
|
1558 |
//
|
|
1559 |
// Useful logging...
|
|
1560 |
//
|
|
1561 |
LOGGSMU2("CSmsAlphabetConverter::IsSupportedL(): aIsDowngrade=%d.", aIsDowngrade);
|
|
1562 |
LOGGSMU2("CSmsAlphabetConverter::IsSupportedL(): aRequiresAlternativeEncoding=%d.", aRequiresAlternativeEncoding);
|
|
1563 |
LOGGSMU2("CSmsAlphabetConverter::IsSupportedL(): supported=%d.", supported);
|
|
1564 |
|
|
1565 |
return supported;
|
|
1566 |
} // CSmsAlphabetConverter::IsSupportedL
|
|
1567 |
|
|
1568 |
|
|
1569 |
/**
|
|
1570 |
* Tests if the descriptor text is supported by the current character set.
|
|
1571 |
* This function can be used with 7bit and 8bit alphabets.
|
|
1572 |
*
|
|
1573 |
* @param aDes Text string to check.
|
|
1574 |
* @param aEncoding Alternative 7bit encoding (if used).
|
|
1575 |
* @param aNumberOfUnconvertibleCharacters Exit param for the number of
|
|
1576 |
* characters unconvertible.
|
|
1577 |
* @param aNumberOfDowngradedCharacters Exit param for the number of
|
|
1578 |
* downgraded characters.
|
|
1579 |
* @param aNumberRequiringAlternativeEncoding Exit param for the number of
|
|
1580 |
* characters requiring use of
|
|
1581 |
* the alternative encoder.
|
|
1582 |
* @param aIndexOfFirstUnconvertibleCharacter Exit param for the first
|
|
1583 |
* unconverted character.
|
|
1584 |
*
|
|
1585 |
* @return ETrue if the character is supported.
|
|
1586 |
*/
|
|
1587 |
TBool CSmsAlphabetConverter::IsSupportedL(const TDesC& aDes, TSmsEncoding aEncoding,
|
|
1588 |
TInt& aNumberOfUnconvertibleCharacters,
|
|
1589 |
TInt& aNumberOfDowngradedCharacters,
|
|
1590 |
TInt& aNumberRequiringAlternativeEncoding,
|
|
1591 |
TInt& aIndexOfFirstUnconvertibleCharacter)
|
|
1592 |
{
|
|
1593 |
LOGGSMU2("[4] CSmsAlphabetConverter::IsSupportedL(aDes=\"%S\")", &aDes);
|
|
1594 |
|
|
1595 |
TInt desLength = aDes.Length();
|
|
1596 |
//
|
|
1597 |
// Initialise the exit params...
|
|
1598 |
//
|
|
1599 |
aNumberOfUnconvertibleCharacters = 0;
|
|
1600 |
aNumberOfDowngradedCharacters = 0;
|
|
1601 |
aNumberRequiringAlternativeEncoding = 0;
|
|
1602 |
aIndexOfFirstUnconvertibleCharacter = desLength;
|
|
1603 |
|
|
1604 |
//
|
|
1605 |
// Create buffers for the input converted to 7Bit and a buffer for it once
|
|
1606 |
// converted back again...
|
|
1607 |
//
|
|
1608 |
HBufC8* encodedBuf = HBufC8::NewLC(desLength*2); // worse case
|
|
1609 |
HBufC* backToUnicodeAfterStdBuf = HBufC::NewLC(desLength);
|
|
1610 |
TPtr8 encoded(encodedBuf->Des());
|
|
1611 |
TPtr backToUnicodeAfterStd(backToUnicodeAfterStdBuf->Des());
|
|
1612 |
|
|
1613 |
//
|
|
1614 |
// Convert the input string to standard 7bit (with downgrades if needed)...
|
|
1615 |
//
|
|
1616 |
PrepareForConversionFromNativeL(ESmsEncodingNone);
|
|
1617 |
|
|
1618 |
TInt notConverted = iCharacterSetConverter.ConvertFromUnicode(encoded, aDes);
|
|
1619 |
|
|
1620 |
if (notConverted > 0)
|
|
1621 |
{
|
|
1622 |
aNumberOfUnconvertibleCharacters += notConverted;
|
|
1623 |
}
|
|
1624 |
else if (notConverted < 0)
|
|
1625 |
{
|
|
1626 |
aNumberOfUnconvertibleCharacters = desLength;
|
|
1627 |
}
|
|
1628 |
|
|
1629 |
//
|
|
1630 |
// Convert it back again to the native format...
|
|
1631 |
//
|
|
1632 |
TInt state = CCnvCharacterSetConverter::KStateDefault;
|
|
1633 |
TInt notRestored = iCharacterSetConverter.ConvertToUnicode(backToUnicodeAfterStd, encoded, state);
|
|
1634 |
|
|
1635 |
if (notRestored > 0)
|
|
1636 |
{
|
|
1637 |
aNumberOfUnconvertibleCharacters += notRestored;
|
|
1638 |
}
|
|
1639 |
else if (notRestored < 0)
|
|
1640 |
{
|
|
1641 |
aNumberOfUnconvertibleCharacters = desLength;
|
|
1642 |
}
|
|
1643 |
|
|
1644 |
//
|
|
1645 |
// Work out if the string is acceptable as it is (e.g. no unconvertible
|
|
1646 |
// and no downgrades).
|
|
1647 |
//
|
|
1648 |
for (TInt pos = desLength-1; pos >= 0; --pos)
|
|
1649 |
{
|
|
1650 |
if (backToUnicodeAfterStd[pos] != aDes[pos])
|
|
1651 |
{
|
|
1652 |
if (backToUnicodeAfterStd[pos] != KReplacementCharacter)
|
|
1653 |
{
|
|
1654 |
aNumberOfDowngradedCharacters++;
|
|
1655 |
}
|
|
1656 |
else
|
|
1657 |
{
|
|
1658 |
aNumberOfUnconvertibleCharacters++;
|
|
1659 |
aIndexOfFirstUnconvertibleCharacter = pos;
|
|
1660 |
}
|
|
1661 |
}
|
|
1662 |
}
|
|
1663 |
|
|
1664 |
TInt totalCharFaultsSoFar = aNumberOfUnconvertibleCharacters +
|
|
1665 |
aNumberOfDowngradedCharacters;
|
|
1666 |
|
|
1667 |
//
|
|
1668 |
// If the total unconvertible plus downgrades is zero, then there is nothing
|
|
1669 |
// more to do as the string can be converted to 7bit with no issues and no
|
|
1670 |
// other encoder is needed.
|
|
1671 |
//
|
|
1672 |
// Otherwise we have to look at the alternative encoder...
|
|
1673 |
//
|
|
1674 |
if (totalCharFaultsSoFar == 0)
|
|
1675 |
{
|
|
1676 |
//
|
|
1677 |
// We are done (the return counts are already zero and therefore
|
|
1678 |
// correct at this point too!).
|
|
1679 |
//
|
|
1680 |
}
|
|
1681 |
else if (iSmsAlphabet != TSmsDataCodingScheme::ESmsAlphabet7Bit ||
|
|
1682 |
aEncoding == ESmsEncodingNone)
|
|
1683 |
{
|
|
1684 |
//
|
|
1685 |
// The string was not perfectly converted, but there is no alternative
|
|
1686 |
// encoder to try. We are done.
|
|
1687 |
//
|
|
1688 |
}
|
|
1689 |
else
|
|
1690 |
{
|
|
1691 |
//
|
|
1692 |
// Initialise the params...
|
|
1693 |
//
|
|
1694 |
TInt tmpDowngradedCharacters = 0;
|
|
1695 |
TInt tmpUnconvertibleCharacters = 0;
|
|
1696 |
TInt tmpIndexOfFirstUnconvertibleCharacter = desLength;
|
|
1697 |
|
|
1698 |
//
|
|
1699 |
// Convert the input string to the alternative encoding...
|
|
1700 |
//
|
|
1701 |
PrepareForConversionFromNativeL(aEncoding);
|
|
1702 |
|
|
1703 |
notConverted = iCharacterSetConverter.ConvertFromUnicode(encoded, aDes);
|
|
1704 |
if (notConverted > 0)
|
|
1705 |
{
|
|
1706 |
tmpUnconvertibleCharacters = notConverted;
|
|
1707 |
}
|
|
1708 |
else if (notConverted < 0)
|
|
1709 |
{
|
|
1710 |
tmpUnconvertibleCharacters = desLength;
|
|
1711 |
}
|
|
1712 |
|
|
1713 |
//
|
|
1714 |
// Convert it back again to the native format...
|
|
1715 |
//
|
|
1716 |
HBufC* backToUnicodeAfterAltBuf = HBufC::NewLC(desLength);
|
|
1717 |
TPtr backToUnicodeAfterAlt(backToUnicodeAfterAltBuf->Des());
|
|
1718 |
TInt state = CCnvCharacterSetConverter::KStateDefault;
|
|
1719 |
TInt notRestored = iCharacterSetConverter.ConvertToUnicode(backToUnicodeAfterAlt, encoded, state);
|
|
1720 |
|
|
1721 |
if (notRestored > 0)
|
|
1722 |
{
|
|
1723 |
tmpUnconvertibleCharacters += notRestored;
|
|
1724 |
}
|
|
1725 |
else if (notRestored < 0)
|
|
1726 |
{
|
|
1727 |
tmpUnconvertibleCharacters = desLength;
|
|
1728 |
}
|
|
1729 |
|
|
1730 |
//
|
|
1731 |
// Now work out which characters are downgrades, require alternative encoding
|
|
1732 |
// or are unsupported.
|
|
1733 |
//
|
|
1734 |
for (TInt pos = desLength-1; pos >= 0; --pos)
|
|
1735 |
{
|
|
1736 |
if (backToUnicodeAfterStd[pos] != aDes[pos])
|
|
1737 |
{
|
|
1738 |
// Not supported by standard encoder...
|
|
1739 |
if (backToUnicodeAfterAlt[pos] == aDes[pos])
|
|
1740 |
{
|
|
1741 |
// Supported by alternative encoder...
|
|
1742 |
aNumberRequiringAlternativeEncoding++;
|
|
1743 |
}
|
|
1744 |
else if (backToUnicodeAfterStd[pos] != KReplacementCharacter)
|
|
1745 |
{
|
|
1746 |
// Downgraded by standard encoder...
|
|
1747 |
tmpDowngradedCharacters++;
|
|
1748 |
}
|
|
1749 |
else if (backToUnicodeAfterAlt[pos] != KReplacementCharacter)
|
|
1750 |
{
|
|
1751 |
// Downgraded by alternative encoder...
|
|
1752 |
tmpDowngradedCharacters++;
|
|
1753 |
aNumberRequiringAlternativeEncoding++;
|
|
1754 |
}
|
|
1755 |
else
|
|
1756 |
{
|
|
1757 |
// Unconvertible...
|
|
1758 |
tmpUnconvertibleCharacters++;
|
|
1759 |
tmpIndexOfFirstUnconvertibleCharacter = pos;
|
|
1760 |
}
|
|
1761 |
}
|
|
1762 |
}
|
|
1763 |
|
|
1764 |
// Is this better?
|
|
1765 |
if ( totalCharFaultsSoFar >= (tmpUnconvertibleCharacters + tmpDowngradedCharacters) )
|
|
1766 |
{
|
|
1767 |
// Best conversion is the alternative conversion
|
|
1768 |
aNumberOfUnconvertibleCharacters = tmpUnconvertibleCharacters;
|
|
1769 |
aNumberOfDowngradedCharacters = tmpDowngradedCharacters;
|
|
1770 |
aIndexOfFirstUnconvertibleCharacter = tmpIndexOfFirstUnconvertibleCharacter;
|
|
1771 |
}
|
|
1772 |
else
|
|
1773 |
{
|
|
1774 |
// Best conversion is the standard conversion
|
|
1775 |
aNumberRequiringAlternativeEncoding = 0;
|
|
1776 |
}
|
|
1777 |
|
|
1778 |
CleanupStack::PopAndDestroy(backToUnicodeAfterAltBuf);
|
|
1779 |
}
|
|
1780 |
|
|
1781 |
CleanupStack::PopAndDestroy(backToUnicodeAfterStdBuf);
|
|
1782 |
CleanupStack::PopAndDestroy(encodedBuf);
|
|
1783 |
|
|
1784 |
//
|
|
1785 |
// Useful logging...
|
|
1786 |
//
|
|
1787 |
TBool supported = (aNumberOfUnconvertibleCharacters == 0);
|
|
1788 |
|
|
1789 |
LOGGSMU2("CSmsAlphabetConverter::IsSupportedL(): aNumberOfUnconvertibleCharacters=%d.", aNumberOfUnconvertibleCharacters);
|
|
1790 |
LOGGSMU2("CSmsAlphabetConverter::IsSupportedL(): aNumberOfDowngradedCharacters=%d.", aNumberOfDowngradedCharacters);
|
|
1791 |
LOGGSMU2("CSmsAlphabetConverter::IsSupportedL(): aNumberRequiringAlternativeEncoding=%d.", aNumberRequiringAlternativeEncoding);
|
|
1792 |
LOGGSMU2("CSmsAlphabetConverter::IsSupportedL(): aIndexOfFirstUnconvertibleCharacter=%d.", aIndexOfFirstUnconvertibleCharacter);
|
|
1793 |
LOGGSMU2("CSmsAlphabetConverter::IsSupportedL(): supported=%d.", supported);
|
|
1794 |
|
|
1795 |
return supported;
|
|
1796 |
} // CSmsAlphabetConverter::IsSupportedL
|
|
1797 |
|
|
1798 |
|
|
1799 |
/**
|
|
1800 |
* Given a piece of text and an alternative encoding, this function works out
|
|
1801 |
* which encoding is best to use and returns the ID of that converter.
|
|
1802 |
*
|
|
1803 |
* @param aNativeCharacters Text to use as a sample.
|
|
1804 |
* @param aEncoding Suggested alternative 7bit encoding method.
|
|
1805 |
*
|
|
1806 |
* @return Encoding that should be used.
|
|
1807 |
*/
|
|
1808 |
TSmsEncoding CSmsAlphabetConverter::FindBestAlternativeEncodingL(const TDesC& aNativeCharacters,
|
|
1809 |
TSmsEncoding aSuggestedEncoding)
|
|
1810 |
{
|
|
1811 |
LOGGSMU2("CSmsAlphabetConverter::FindBestAlternativeEncodingL(): aSuggestedEncoding=%d",
|
|
1812 |
aSuggestedEncoding);
|
|
1813 |
|
|
1814 |
TSmsEncoding encodingToUse = ESmsEncodingNone;
|
|
1815 |
|
|
1816 |
//
|
|
1817 |
// If this is not 7bit or the alternative encoding is not set then do
|
|
1818 |
// nothing...
|
|
1819 |
//
|
|
1820 |
if (aSuggestedEncoding != ESmsEncodingNone &&
|
|
1821 |
iSmsAlphabet == TSmsDataCodingScheme::ESmsAlphabet7Bit)
|
|
1822 |
{
|
|
1823 |
TInt numberOfUnconvertibleCharacters, numberOfDowngradedCharacters;
|
|
1824 |
TInt numberRequiringAlternativeEncoding, indexOfFirstUnconvertibleCharacter;
|
|
1825 |
|
|
1826 |
//
|
|
1827 |
// First try the default encoding (but in this case treat downgrades
|
|
1828 |
// as unconverted, since later encoders might do better)...
|
|
1829 |
//
|
|
1830 |
IsSupportedL(aNativeCharacters, ESmsEncodingNone,
|
|
1831 |
numberOfUnconvertibleCharacters,
|
|
1832 |
numberOfDowngradedCharacters,
|
|
1833 |
numberRequiringAlternativeEncoding,
|
|
1834 |
indexOfFirstUnconvertibleCharacter);
|
|
1835 |
|
|
1836 |
TInt leastUnconvertibleCharacters = numberOfUnconvertibleCharacters + numberOfDowngradedCharacters;
|
|
1837 |
|
|
1838 |
//
|
|
1839 |
// Create a list of alternative encodings to try...
|
|
1840 |
//
|
|
1841 |
TSmsEncoding encodingList[8];
|
|
1842 |
TInt encodingCount = 0;
|
|
1843 |
|
|
1844 |
if (aSuggestedEncoding == ESmsEncodingTurkishLockingAndSingleShift)
|
|
1845 |
{
|
|
1846 |
encodingList[encodingCount++] = ESmsEncodingTurkishSingleShift;
|
|
1847 |
encodingList[encodingCount++] = ESmsEncodingTurkishLockingShift;
|
|
1848 |
}
|
|
1849 |
else if (aSuggestedEncoding == ESmsEncodingPortugueseLockingAndSingleShift)
|
|
1850 |
{
|
|
1851 |
encodingList[encodingCount++] = ESmsEncodingPortugueseSingleShift;
|
|
1852 |
encodingList[encodingCount++] = ESmsEncodingPortugueseLockingShift;
|
|
1853 |
}
|
|
1854 |
|
|
1855 |
encodingList[encodingCount++] = aSuggestedEncoding;
|
|
1856 |
encodingList[encodingCount++] = ESmsEncodingNone;
|
|
1857 |
|
|
1858 |
//
|
|
1859 |
// Now try the all the alternatives...
|
|
1860 |
//
|
|
1861 |
for (TInt encoder = 0; encoder < encodingCount; encoder++)
|
|
1862 |
{
|
|
1863 |
IsSupportedL(aNativeCharacters, encodingList[encoder],
|
|
1864 |
numberOfUnconvertibleCharacters,
|
|
1865 |
numberOfDowngradedCharacters,
|
|
1866 |
numberRequiringAlternativeEncoding,
|
|
1867 |
indexOfFirstUnconvertibleCharacter);
|
|
1868 |
if (numberOfUnconvertibleCharacters + numberOfDowngradedCharacters < leastUnconvertibleCharacters)
|
|
1869 |
{
|
|
1870 |
encodingToUse = encodingList[encoder];
|
|
1871 |
leastUnconvertibleCharacters = numberOfUnconvertibleCharacters + numberOfDowngradedCharacters;
|
|
1872 |
}
|
|
1873 |
}
|
|
1874 |
}
|
|
1875 |
|
|
1876 |
LOGGSMU2("CSmsAlphabetConverter::FindBestAlternativeEncodingL(): encodingToUse=%d", encodingToUse);
|
|
1877 |
|
|
1878 |
return encodingToUse;
|
|
1879 |
} // CSmsAlphabetConverter::FindBestAlternativeEncoding
|
|
1880 |
|
|
1881 |
|
|
1882 |
/**
|
|
1883 |
* Confirms that the requested encoding method is present (e.g. the converter
|
|
1884 |
* plug-in can be loaded).
|
|
1885 |
*
|
|
1886 |
* @param aEncoding Alternative 7bit encoding method.
|
|
1887 |
*
|
|
1888 |
* @leave KErrNotSupported if the encoder is not available.
|
|
1889 |
*/
|
|
1890 |
void CSmsAlphabetConverter::ConfirmAlternativeEncoderL(TSmsEncoding aEncoding) const
|
|
1891 |
{
|
|
1892 |
//
|
|
1893 |
// Check the ID for the encoder exists...
|
|
1894 |
//
|
|
1895 |
if (aEncoding != ESmsEncodingNone)
|
|
1896 |
{
|
|
1897 |
TUint encoderID;
|
|
1898 |
|
|
1899 |
GetAlternativeEncoderIDL(aEncoding, encoderID);
|
|
1900 |
|
|
1901 |
//
|
|
1902 |
// Confirm it can be loaded...
|
|
1903 |
//
|
|
1904 |
if (iCharacterSetConverter.PrepareToConvertToOrFromL(encoderID, iFs) != CCnvCharacterSetConverter::EAvailable)
|
|
1905 |
{
|
|
1906 |
User::Leave(KErrNotSupported);
|
|
1907 |
}
|
|
1908 |
}
|
|
1909 |
} // CSmsAlphabetConverter::ConfirmAlternativeEncoderL
|
|
1910 |
|
|
1911 |
|
|
1912 |
/**
|
|
1913 |
* Prepares the converted for conversion from native charset.
|
|
1914 |
* Character set specific preparation is performed here.
|
|
1915 |
*
|
|
1916 |
* @param aEncoding Alternative 7bit encoding to use if required.
|
|
1917 |
*/
|
|
1918 |
void CSmsAlphabetConverter::PrepareForConversionFromNativeL(TSmsEncoding aEncoding)
|
|
1919 |
{
|
|
1920 |
LOGGSMU2("CSmsAlphabetConverter::PrepareForConversionFromNativeL(): aEncoding=%d",
|
|
1921 |
aEncoding);
|
|
1922 |
|
|
1923 |
__ASSERT_DEBUG(iIsBinary==EFalse,Panic(KGsmuPanicUnsupportedAlphabet));
|
|
1924 |
switch (iSmsAlphabet)
|
|
1925 |
{
|
|
1926 |
case TSmsDataCodingScheme::ESmsAlphabet7Bit:
|
|
1927 |
{
|
|
1928 |
//
|
|
1929 |
// If an alternative encoding has been specified then try and
|
|
1930 |
// load that converter...
|
|
1931 |
//
|
|
1932 |
if (aEncoding != ESmsEncodingNone)
|
|
1933 |
{
|
|
1934 |
TUint alternativeEncoderID;
|
|
1935 |
|
|
1936 |
GetAlternativeEncoderIDL(aEncoding, alternativeEncoderID);
|
|
1937 |
if (alternativeEncoderID != 0)
|
|
1938 |
{
|
|
1939 |
CCnvCharacterSetConverter::TAvailability availability;
|
|
1940 |
|
|
1941 |
LOGGSMU2("CSmsAlphabetConverter::PrepareForConversionFromNativeL(): Converter 0x%08x",
|
|
1942 |
alternativeEncoderID);
|
|
1943 |
|
|
1944 |
availability = iCharacterSetConverter.PrepareToConvertToOrFromL(alternativeEncoderID, iFs);
|
|
1945 |
if (availability == CCnvCharacterSetConverter::EAvailable)
|
|
1946 |
{
|
|
1947 |
// Force unicode line termination characters to simple line feed
|
|
1948 |
iCharacterSetConverter.SetDowngradeForExoticLineTerminatingCharacters(
|
|
1949 |
CCnvCharacterSetConverter::EDowngradeExoticLineTerminatingCharactersToJustLineFeed);
|
|
1950 |
|
|
1951 |
// Job done, return
|
|
1952 |
return;
|
|
1953 |
}
|
|
1954 |
|
|
1955 |
// Plug-in could not be loaded, so drop through and load the default!
|
|
1956 |
}
|
|
1957 |
}
|
|
1958 |
|
|
1959 |
//
|
|
1960 |
// Check for the PREQ2090 7bit converter with Eastern European
|
|
1961 |
// downgrade support first, otherwise if the plug-in is not found
|
|
1962 |
// use the standard internal converter.
|
|
1963 |
//
|
|
1964 |
CCnvCharacterSetConverter::TAvailability availability;
|
|
1965 |
|
|
1966 |
availability = iCharacterSetConverter.PrepareToConvertToOrFromL(KCharacterSetIdentifierExtendedSms7Bit, iFs);
|
|
1967 |
if (availability == CCnvCharacterSetConverter::ENotAvailable)
|
|
1968 |
{
|
|
1969 |
availability = iCharacterSetConverter.PrepareToConvertToOrFromL(KCharacterSetIdentifierSms7Bit, iFs);
|
|
1970 |
if (availability == CCnvCharacterSetConverter::ENotAvailable)
|
|
1971 |
{
|
|
1972 |
User::Leave(KErrNotFound);
|
|
1973 |
}
|
|
1974 |
}
|
|
1975 |
|
|
1976 |
// Force unicode line termination characters to simple line feed
|
|
1977 |
iCharacterSetConverter.SetDowngradeForExoticLineTerminatingCharacters(
|
|
1978 |
CCnvCharacterSetConverter::EDowngradeExoticLineTerminatingCharactersToJustLineFeed);
|
|
1979 |
break;
|
|
1980 |
}
|
|
1981 |
case TSmsDataCodingScheme::ESmsAlphabet8Bit:
|
|
1982 |
{
|
|
1983 |
CCnvCharacterSetConverter::TAvailability availability=iCharacterSetConverter.PrepareToConvertToOrFromL(KCharacterSetIdentifierCodePage1252,iFs);
|
|
1984 |
if (availability==CCnvCharacterSetConverter::ENotAvailable)
|
|
1985 |
{
|
|
1986 |
User::Leave(KErrNotFound);
|
|
1987 |
}
|
|
1988 |
|
|
1989 |
// Force unicode line termination characters to simple line feed
|
|
1990 |
iCharacterSetConverter.SetDowngradeForExoticLineTerminatingCharacters(
|
|
1991 |
CCnvCharacterSetConverter::EDowngradeExoticLineTerminatingCharactersToJustLineFeed);
|
|
1992 |
break;
|
|
1993 |
}
|
|
1994 |
case TSmsDataCodingScheme::ESmsAlphabetUCS2:
|
|
1995 |
default:
|
|
1996 |
{
|
|
1997 |
User::Leave(KErrNotSupported);
|
|
1998 |
}
|
|
1999 |
}
|
|
2000 |
} // CSmsAlphabetConverter::PrepareForConversionFromNativeL
|
|
2001 |
|
|
2002 |
|
|
2003 |
/**
|
|
2004 |
* Prepares the converted for conversion to unicode. Character set
|
|
2005 |
* specific preparation is performed here.
|
|
2006 |
*
|
|
2007 |
* @param aEncoding Alternative 7bit encoding to use if required.
|
|
2008 |
*/
|
|
2009 |
void CSmsAlphabetConverter::PrepareForConversionToNativeL(TSmsEncoding aEncoding)
|
|
2010 |
{
|
|
2011 |
LOGGSMU2("CSmsAlphabetConverter::PrepareForConversionToNativeL(): aEncoding=%d",
|
|
2012 |
aEncoding);
|
|
2013 |
|
|
2014 |
switch (iSmsAlphabet)
|
|
2015 |
{
|
|
2016 |
case TSmsDataCodingScheme::ESmsAlphabet7Bit:
|
|
2017 |
{
|
|
2018 |
//
|
|
2019 |
// If an alternative encoding has been specified then try and
|
|
2020 |
// load that converter...
|
|
2021 |
//
|
|
2022 |
if (aEncoding != ESmsEncodingNone)
|
|
2023 |
{
|
|
2024 |
TUint alternativeEncoderID;
|
|
2025 |
|
|
2026 |
GetAlternativeEncoderIDL(aEncoding, alternativeEncoderID);
|
|
2027 |
if (alternativeEncoderID != 0)
|
|
2028 |
{
|
|
2029 |
CCnvCharacterSetConverter::TAvailability availability;
|
|
2030 |
|
|
2031 |
LOGGSMU2("CSmsAlphabetConverter::PrepareForConversionFromNativeL(): Converter 0x%08x",
|
|
2032 |
alternativeEncoderID);
|
|
2033 |
|
|
2034 |
availability = iCharacterSetConverter.PrepareToConvertToOrFromL(alternativeEncoderID, iFs);
|
|
2035 |
if (availability == CCnvCharacterSetConverter::EAvailable)
|
|
2036 |
{
|
|
2037 |
// Job done, return
|
|
2038 |
return;
|
|
2039 |
}
|
|
2040 |
|
|
2041 |
// Plug-in could not be loaded, so drop through and load the default!
|
|
2042 |
}
|
|
2043 |
}
|
|
2044 |
|
|
2045 |
//
|
|
2046 |
// Always use the internal converter, as it is quicker to prepare
|
|
2047 |
// and the PREQ2090 7bit converter with Eastern European downgrade
|
|
2048 |
// offers no benefit when converting to native.
|
|
2049 |
//
|
|
2050 |
CCnvCharacterSetConverter::TAvailability availability=iCharacterSetConverter.PrepareToConvertToOrFromL(KCharacterSetIdentifierSms7Bit,iFs);
|
|
2051 |
if (availability==CCnvCharacterSetConverter::ENotAvailable)
|
|
2052 |
{
|
|
2053 |
User::Leave(KErrNotFound);
|
|
2054 |
}
|
|
2055 |
break;
|
|
2056 |
}
|
|
2057 |
case TSmsDataCodingScheme::ESmsAlphabet8Bit:
|
|
2058 |
{
|
|
2059 |
CCnvCharacterSetConverter::TAvailability availability=iCharacterSetConverter.PrepareToConvertToOrFromL(KCharacterSetIdentifierCodePage1252,iFs);
|
|
2060 |
if (availability==CCnvCharacterSetConverter::ENotAvailable)
|
|
2061 |
{
|
|
2062 |
User::Leave(KErrNotFound);
|
|
2063 |
}
|
|
2064 |
break;
|
|
2065 |
}
|
|
2066 |
case TSmsDataCodingScheme::ESmsAlphabetUCS2:
|
|
2067 |
default:
|
|
2068 |
{
|
|
2069 |
User::Leave(KErrNotSupported);
|
|
2070 |
}
|
|
2071 |
}
|
|
2072 |
} // CSmsAlphabetConverter::PrepareForConversionToNativeL
|
|
2073 |
|
|
2074 |
|
|
2075 |
/**
|
|
2076 |
* This function returns the alternative encoding converters that are used
|
|
2077 |
* incase the default GSM encoding cannot encode the message completely
|
|
2078 |
* without data loss.
|
|
2079 |
*
|
|
2080 |
* @param aEncoding Encoding to obtain the converter for.
|
|
2081 |
* @param aEncoderID Returned converter UID if present.
|
|
2082 |
*
|
|
2083 |
* @leave KErrArgument if the encoding enum is invalid or
|
|
2084 |
*/
|
|
2085 |
void CSmsAlphabetConverter::GetAlternativeEncoderIDL(TSmsEncoding aEncoding, TUint& aEncoderID) const
|
|
2086 |
{
|
|
2087 |
LOGGSMU2("CSmsAlphabetConverter::GetAlternativeEncoderIDL(%d)", aEncoding);
|
|
2088 |
|
|
2089 |
aEncoderID = 0;
|
|
2090 |
|
|
2091 |
//
|
|
2092 |
// Decide on appropriate encoders.
|
|
2093 |
//
|
|
2094 |
switch (aEncoding)
|
|
2095 |
{
|
|
2096 |
case ESmsEncodingNone:
|
|
2097 |
{
|
|
2098 |
// Nothing to set.
|
|
2099 |
}
|
|
2100 |
break;
|
|
2101 |
|
|
2102 |
case ESmsEncodingTurkishSingleShift:
|
|
2103 |
{
|
|
2104 |
aEncoderID = KCharacterSetIdentifierTurkishSingleSms7Bit;
|
|
2105 |
}
|
|
2106 |
break;
|
|
2107 |
|
|
2108 |
case ESmsEncodingTurkishLockingShift:
|
|
2109 |
{
|
|
2110 |
aEncoderID = KCharacterSetIdentifierTurkishLockingSms7Bit;
|
|
2111 |
}
|
|
2112 |
break;
|
|
2113 |
|
|
2114 |
case ESmsEncodingTurkishLockingAndSingleShift:
|
|
2115 |
{
|
|
2116 |
aEncoderID = KCharacterSetIdentifierTurkishLockingAndSingleSms7Bit;
|
|
2117 |
}
|
|
2118 |
break;
|
|
2119 |
|
|
2120 |
case ESmsEncodingSpanishSingleShift:
|
|
2121 |
{
|
|
2122 |
aEncoderID = KCharacterSetIdentifierSpanishSingleSms7Bit;
|
|
2123 |
}
|
|
2124 |
break;
|
|
2125 |
|
|
2126 |
case ESmsEncodingPortugueseSingleShift:
|
|
2127 |
{
|
|
2128 |
aEncoderID = KCharacterSetIdentifierPortugueseSingleSms7Bit;
|
|
2129 |
}
|
|
2130 |
break;
|
|
2131 |
|
|
2132 |
case ESmsEncodingPortugueseLockingShift:
|
|
2133 |
{
|
|
2134 |
aEncoderID = KCharacterSetIdentifierPortugueseLockingSms7Bit;
|
|
2135 |
}
|
|
2136 |
break;
|
|
2137 |
|
|
2138 |
case ESmsEncodingPortugueseLockingAndSingleShift:
|
|
2139 |
{
|
|
2140 |
aEncoderID = KCharacterSetIdentifierPortugueseLockingAndSingleSms7Bit;
|
|
2141 |
}
|
|
2142 |
break;
|
|
2143 |
|
|
2144 |
default:
|
|
2145 |
{
|
|
2146 |
//
|
|
2147 |
// Invalid encoder method!
|
|
2148 |
//
|
|
2149 |
User::Leave(KErrArgument);
|
|
2150 |
}
|
|
2151 |
};
|
|
2152 |
} // CSmsAlphabetConverter::GetAlternativeEncoderIDL
|
|
2153 |
|
|
2154 |
|
|
2155 |
//
|
|
2156 |
// Ensures the allocated 16 bit buffer is at least of the specified length
|
|
2157 |
//
|
|
2158 |
TPtr16 CSmsAlphabetConverter::CheckAllocBufferL(HBufC16** aBuffer,TInt aMaxLength,TInt aUsedLength)
|
|
2159 |
{
|
|
2160 |
LOGGSMU1("CSmsAlphabetConverter::CheckAllocBufferL()");
|
|
2161 |
|
|
2162 |
if (*aBuffer!=NULL)
|
|
2163 |
{
|
|
2164 |
if ((*aBuffer)->Length()<aMaxLength)
|
|
2165 |
{
|
|
2166 |
*aBuffer=(*aBuffer)->ReAllocL(aMaxLength);
|
|
2167 |
(*aBuffer)->Des().SetLength(aMaxLength);
|
|
2168 |
}
|
|
2169 |
}
|
|
2170 |
else
|
|
2171 |
{
|
|
2172 |
*aBuffer=HBufC16::NewMaxL(aMaxLength);
|
|
2173 |
}
|
|
2174 |
return TPtr16((TUint16*)(*aBuffer)->Des().Ptr(),aUsedLength,(*aBuffer)->Length());
|
|
2175 |
} // CSmsAlphabetConverter::CheckAllocBufferL
|
|
2176 |
|
|
2177 |
|
|
2178 |
//
|
|
2179 |
// Ensures the allocated 8 bit buffer is at least of the specified length
|
|
2180 |
//
|
|
2181 |
TPtr8 CSmsAlphabetConverter::CheckAllocBufferL(HBufC8** aBuffer,TInt aMaxLength,TInt aUsedLength)
|
|
2182 |
{
|
|
2183 |
LOGGSMU1("CSmsAlphabetConverter::CheckAllocBufferL()");
|
|
2184 |
|
|
2185 |
if (*aBuffer!=NULL)
|
|
2186 |
{
|
|
2187 |
if ((*aBuffer)->Length()<aMaxLength)
|
|
2188 |
{
|
|
2189 |
*aBuffer=(*aBuffer)->ReAllocL(aMaxLength);
|
|
2190 |
(*aBuffer)->Des().SetLength(aMaxLength);
|
|
2191 |
}
|
|
2192 |
}
|
|
2193 |
else
|
|
2194 |
{
|
|
2195 |
*aBuffer=HBufC8::NewMaxL(aMaxLength);
|
|
2196 |
}
|
|
2197 |
return TPtr8((TUint8*)(*aBuffer)->Des().Ptr(),aUsedLength,(*aBuffer)->Length());
|
|
2198 |
} // CSmsAlphabetConverter::CheckAllocBufferL
|
|
2199 |
|
|
2200 |
|
|
2201 |
/**
|
|
2202 |
* @internalComponent
|
|
2203 |
*
|
|
2204 |
* Determines whether the address format matches the specified type.
|
|
2205 |
*
|
|
2206 |
* @param aType Specifies an indicator type, as defined in the Common PCN Handset Specification
|
|
2207 |
* @return returns ETrue if address is of specified type, EFalse otherwise
|
|
2208 |
*/
|
|
2209 |
EXPORT_C TBool TGsmSmsTelNumber::IsInstanceOf(TTypeOfIndicator aType)
|
|
2210 |
{
|
|
2211 |
LOGGSMU1("TGsmSmsTelNumber::IsInstanceOf()");
|
|
2212 |
|
|
2213 |
TBool rc = EFalse;
|
|
2214 |
|
|
2215 |
(void) aType;
|
|
2216 |
|
|
2217 |
if((aType == EVoiceMessageWaitingIndicator)
|
|
2218 |
&& ((iTypeOfAddress & TGsmSmsTypeOfAddress::EGsmSmsTONMask)==EGsmSmsTONAlphaNumeric)
|
|
2219 |
&& (iTelNumber.Length()==ECPHSSizeOfAddressField)
|
|
2220 |
&& ((iTelNumber[ECPHSAddressIndicatorType] & ECPSHIndicatorTypeBitMask) == ECPSHVoiceMailId)
|
|
2221 |
&& ((iTelNumber[ECPHSAddressIndicatorId] & ECPSHIndicatorIdBitMask) == ECPSHIndicatorId ))
|
|
2222 |
rc = ETrue;
|
|
2223 |
|
|
2224 |
return rc;
|
|
2225 |
} // TGsmSmsTelNumber::IsInstanceOf
|
|
2226 |
|
|
2227 |
|
|
2228 |
//
|
|
2229 |
// CSmsAddress
|
|
2230 |
//
|
|
2231 |
|
|
2232 |
CSmsAddress* CSmsAddress::NewL(CCnvCharacterSetConverter& aCharacterSetConverter,RFs& aFs)
|
|
2233 |
{
|
|
2234 |
LOGGSMU1("CSmsAddress::NewL()");
|
|
2235 |
|
|
2236 |
CSmsAddress* address=new(ELeave) CSmsAddress(aCharacterSetConverter,aFs);
|
|
2237 |
CleanupStack::PushL(address);
|
|
2238 |
TPtrC ptr;
|
|
2239 |
address->SetAddressL(ptr);
|
|
2240 |
CleanupStack::Pop();
|
|
2241 |
return address;
|
|
2242 |
} // CSmsAddress::NewL
|
|
2243 |
|
|
2244 |
|
|
2245 |
CSmsAddress::~CSmsAddress()
|
|
2246 |
{
|
|
2247 |
delete iBuffer;
|
|
2248 |
} // CSmsAddress::NewL
|
|
2249 |
|
|
2250 |
|
|
2251 |
/**
|
|
2252 |
* Duplicates this CSmsAddress object.
|
|
2253 |
*
|
|
2254 |
* @return Pointer to the newly created CSmsAddress object.
|
|
2255 |
*/
|
|
2256 |
CSmsAddress* CSmsAddress::DuplicateL() const
|
|
2257 |
{
|
|
2258 |
LOGGSMU1("CSmsAddress::DuplicateL()");
|
|
2259 |
|
|
2260 |
CSmsAddress* address = CSmsAddress::NewL(iCharacterSetConverter, iFs);
|
|
2261 |
CleanupStack::PushL(address);
|
|
2262 |
|
|
2263 |
address->SetRawAddressL(iTypeOfAddress, *iBuffer);
|
|
2264 |
|
|
2265 |
CleanupStack::Pop();
|
|
2266 |
|
|
2267 |
return address;
|
|
2268 |
} // CSmsAddress::DuplicateL
|
|
2269 |
|
|
2270 |
|
|
2271 |
TPtrC CSmsAddress::Address() const
|
|
2272 |
{
|
|
2273 |
LOGGSMU1("CSmsAddress::Address()");
|
|
2274 |
|
|
2275 |
TPtrC ptr;
|
|
2276 |
if (iBuffer)
|
|
2277 |
ptr.Set(iBuffer->Des());
|
|
2278 |
return ptr;
|
|
2279 |
} // CSmsAddress::Address
|
|
2280 |
|
|
2281 |
|
|
2282 |
void CSmsAddress::SetRawAddressL(TGsmSmsTypeOfAddress aTypeOfAddress, TPtrC aBufferPtr)
|
|
2283 |
{
|
|
2284 |
LOGGSMU1("CSmsAddress::SetRawAddressL()");
|
|
2285 |
|
|
2286 |
iTypeOfAddress = aTypeOfAddress;
|
|
2287 |
|
|
2288 |
NewBufferL(aBufferPtr.Length());
|
|
2289 |
|
|
2290 |
*iBuffer=aBufferPtr;
|
|
2291 |
} // CSmsAddress::SetRawAddressL
|
|
2292 |
|
|
2293 |
|
|
2294 |
TGsmSmsTypeOfAddress& CSmsAddress::TypeOfAddress()
|
|
2295 |
{
|
|
2296 |
LOGGSMU1("CSmsAddress::TypeOfAddress()");
|
|
2297 |
|
|
2298 |
return iTypeOfAddress;
|
|
2299 |
} // CSmsAddress::TypeOfAddress
|
|
2300 |
|
|
2301 |
|
|
2302 |
void CSmsAddress::SetAddressL(const TDesC& aAddress)
|
|
2303 |
{
|
|
2304 |
LOGGSMU1("CSmsAddress::SetAddressL()");
|
|
2305 |
|
|
2306 |
TInt length=aAddress.Length();
|
|
2307 |
NewBufferL(length);
|
|
2308 |
iBuffer->Des().Copy(aAddress);
|
|
2309 |
|
|
2310 |
const TGsmSmsTypeOfNumber typeofnumber=length && (iBuffer->Des()[0]=='+')? EGsmSmsTONInternationalNumber: EGsmSmsTONUnknown;
|
|
2311 |
iTypeOfAddress.SetTON(typeofnumber);
|
|
2312 |
} // CSmsAddress::SetAddressL
|
|
2313 |
|
|
2314 |
|
|
2315 |
void CSmsAddress::ParsedAddress(TGsmSmsTelNumber& aParsedAddress) const
|
|
2316 |
{
|
|
2317 |
aParsedAddress.iTypeOfAddress = iTypeOfAddress;
|
|
2318 |
|
|
2319 |
TInt maxparsedlength=aParsedAddress.iTelNumber.MaxLength();
|
|
2320 |
|
|
2321 |
if (iTypeOfAddress.TON()==EGsmSmsTONAlphaNumeric)
|
|
2322 |
{
|
|
2323 |
TInt parsedlength=Address().Length();
|
|
2324 |
if (parsedlength>maxparsedlength)
|
|
2325 |
parsedlength=maxparsedlength;
|
|
2326 |
aParsedAddress.iTelNumber.Copy(Address().Mid(0,parsedlength));
|
|
2327 |
}
|
|
2328 |
else
|
|
2329 |
{
|
|
2330 |
aParsedAddress.iTelNumber.SetLength(maxparsedlength);
|
|
2331 |
|
|
2332 |
TInt length=iBuffer->Des().Length();
|
|
2333 |
TInt parsedlength=0;
|
|
2334 |
for (TInt i=0; (i<length) && (parsedlength<maxparsedlength); i++)
|
|
2335 |
{
|
|
2336 |
TText ch=iBuffer->Des()[i];
|
|
2337 |
switch(ch)
|
|
2338 |
{
|
|
2339 |
case '*':
|
|
2340 |
case '#':
|
|
2341 |
case 'a':
|
|
2342 |
case 'b':
|
|
2343 |
case 'c':
|
|
2344 |
aParsedAddress.iTelNumber[parsedlength]=(TUint8) ch;
|
|
2345 |
parsedlength++;
|
|
2346 |
break;
|
|
2347 |
default:
|
|
2348 |
if ((ch>='0') && (ch<='9'))
|
|
2349 |
{
|
|
2350 |
aParsedAddress.iTelNumber[parsedlength]=(TUint8) ch;
|
|
2351 |
parsedlength++;
|
|
2352 |
}
|
|
2353 |
break;
|
|
2354 |
}
|
|
2355 |
}
|
|
2356 |
|
|
2357 |
aParsedAddress.iTelNumber.SetLength(parsedlength);
|
|
2358 |
}
|
|
2359 |
}
|
|
2360 |
|
|
2361 |
|
|
2362 |
void CSmsAddress::SetParsedAddressL(const TGsmSmsTelNumber& aParsedAddress)
|
|
2363 |
{
|
|
2364 |
LOGGSMU1("CSmsAddress::SetParsedAddressL()");
|
|
2365 |
|
|
2366 |
iTypeOfAddress=aParsedAddress.iTypeOfAddress;
|
|
2367 |
DoSetParsedAddressL(aParsedAddress.iTelNumber);
|
|
2368 |
} // CSmsAddress::SetParsedAddressL
|
|
2369 |
|
|
2370 |
|
|
2371 |
TUint8 CSmsAddress::SizeL()
|
|
2372 |
{
|
|
2373 |
LOGGSMU1("CSmsAddress::SizeL()");
|
|
2374 |
|
|
2375 |
TUint8 size = 0;
|
|
2376 |
|
|
2377 |
TBuf8<KSmsAddressMaxAddressLength> testBuffer;
|
|
2378 |
testBuffer.SetLength(KSmsAddressMaxAddressLength);
|
|
2379 |
TUint8* startPtr = &testBuffer[0];
|
|
2380 |
TUint8* endPtr = NULL;
|
|
2381 |
|
|
2382 |
TRAPD(err,endPtr = EncodeL(startPtr));
|
|
2383 |
|
|
2384 |
if (err != KErrNone)
|
|
2385 |
{
|
|
2386 |
User::Leave(KErrArgument);
|
|
2387 |
}
|
|
2388 |
else
|
|
2389 |
{
|
|
2390 |
// handle architectures whose address space increments or whose address space decrements.
|
|
2391 |
(endPtr > startPtr) ? (size = endPtr - startPtr) : (size = startPtr - endPtr);
|
|
2392 |
}
|
|
2393 |
|
|
2394 |
return size;
|
|
2395 |
} // CSmsAddress::SizeL
|
|
2396 |
|
|
2397 |
|
|
2398 |
TUint8* CSmsAddress::EncodeL(TUint8* aPtr) const
|
|
2399 |
{
|
|
2400 |
TGsmSmsTelNumber parsedaddress;
|
|
2401 |
ParsedAddress(parsedaddress);
|
|
2402 |
|
|
2403 |
switch (iTypeOfAddress.TON())
|
|
2404 |
{
|
|
2405 |
case EGsmSmsTONAlphaNumeric:
|
|
2406 |
{
|
|
2407 |
// Mark buffer for length encoding after conversion
|
|
2408 |
TUint8* lengthPtr=aPtr++;
|
|
2409 |
// Encode type
|
|
2410 |
aPtr=iTypeOfAddress.EncodeL(aPtr);
|
|
2411 |
// 7-bit conversion
|
|
2412 |
TPtrC address=Address();
|
|
2413 |
TInt convertedNumUDUnits=0;
|
|
2414 |
TPtr8 packedPtr(aPtr,0,KSmsAddressMaxAddressValueLength);
|
|
2415 |
TSmsAlphabetPacker packer(TSmsDataCodingScheme::ESmsAlphabet7Bit,EFalse,0);
|
|
2416 |
aPtr+=packer.ConvertAndPackL(iCharacterSetConverter,iFs,packedPtr,address,convertedNumUDUnits);
|
|
2417 |
// Now encode length
|
|
2418 |
TSmsOctet length=(convertedNumUDUnits*7+3)/4;
|
|
2419 |
length.EncodeL(lengthPtr);
|
|
2420 |
break;
|
|
2421 |
}
|
|
2422 |
case EGsmSmsTONInternationalNumber:
|
|
2423 |
default:
|
|
2424 |
{
|
|
2425 |
TSmsOctet length=parsedaddress.iTelNumber.Length();
|
|
2426 |
if (length > KSmsAddressMaxAddressValueLength * 2)
|
|
2427 |
// each address value occupies one nibble.
|
|
2428 |
{
|
|
2429 |
User::Leave(KErrArgument);
|
|
2430 |
}
|
|
2431 |
aPtr=length.EncodeL(aPtr);
|
|
2432 |
aPtr=iTypeOfAddress.EncodeL(aPtr);
|
|
2433 |
TSmsOctet octet;
|
|
2434 |
for (TInt i=0; i<length; i++)
|
|
2435 |
{
|
|
2436 |
if ((i%2)==0) // even
|
|
2437 |
{
|
|
2438 |
switch(parsedaddress.iTelNumber[i])
|
|
2439 |
{
|
|
2440 |
case '*':
|
|
2441 |
{
|
|
2442 |
octet=10; // 1010 as a binary, according to 23.040 …
|
|
2443 |
}
|
|
2444 |
break;
|
|
2445 |
|
|
2446 |
case '#':
|
|
2447 |
{
|
|
2448 |
octet=11; // 1011 as a binary, according to 23.040…
|
|
2449 |
}
|
|
2450 |
break;
|
|
2451 |
|
|
2452 |
case 'a':
|
|
2453 |
{
|
|
2454 |
octet=12; // 1100 as a binary, according to 23.040...
|
|
2455 |
}
|
|
2456 |
break;
|
|
2457 |
|
|
2458 |
case 'b':
|
|
2459 |
{
|
|
2460 |
octet=13; // 1101 as a binary, according to 23.040…
|
|
2461 |
}
|
|
2462 |
break;
|
|
2463 |
|
|
2464 |
case 'c':
|
|
2465 |
{
|
|
2466 |
octet=14; // 1110 as a binary, according to 23.040…
|
|
2467 |
}
|
|
2468 |
break;
|
|
2469 |
|
|
2470 |
default:
|
|
2471 |
octet=(parsedaddress.iTelNumber[i])-'0';
|
|
2472 |
break;
|
|
2473 |
}
|
|
2474 |
}
|
|
2475 |
else
|
|
2476 |
{
|
|
2477 |
TInt tempOctet = 0;
|
|
2478 |
|
|
2479 |
switch(parsedaddress.iTelNumber[i])
|
|
2480 |
{
|
|
2481 |
case '*':
|
|
2482 |
{
|
|
2483 |
tempOctet=10; // 1010 as a binary, according to 23.040…
|
|
2484 |
}
|
|
2485 |
break;
|
|
2486 |
|
|
2487 |
case '#':
|
|
2488 |
{
|
|
2489 |
tempOctet=11; // 1011 as a binary, according to 23.040…
|
|
2490 |
}
|
|
2491 |
break;
|
|
2492 |
|
|
2493 |
case 'a':
|
|
2494 |
{
|
|
2495 |
tempOctet=12; // 1100 as a binary, according to 23.040…
|
|
2496 |
}
|
|
2497 |
break;
|
|
2498 |
|
|
2499 |
case 'b':
|
|
2500 |
{
|
|
2501 |
tempOctet=13; // 1101 as a binary, according to 23.040…
|
|
2502 |
}
|
|
2503 |
break;
|
|
2504 |
|
|
2505 |
case 'c':
|
|
2506 |
{
|
|
2507 |
tempOctet=14; // 1110 as a binary, according to 23.040…
|
|
2508 |
}
|
|
2509 |
break;
|
|
2510 |
|
|
2511 |
default:
|
|
2512 |
tempOctet=(parsedaddress.iTelNumber[i])-'0';
|
|
2513 |
break;
|
|
2514 |
}
|
|
2515 |
octet=octet|tempOctet<<4;
|
|
2516 |
aPtr=octet.EncodeL(aPtr);
|
|
2517 |
}
|
|
2518 |
|
|
2519 |
} // end for loop
|
|
2520 |
|
|
2521 |
if (length%2) // odd number of semioctets
|
|
2522 |
{
|
|
2523 |
octet=octet|0xF0;
|
|
2524 |
aPtr=octet.EncodeL(aPtr);
|
|
2525 |
}
|
|
2526 |
|
|
2527 |
} // end default case
|
|
2528 |
}
|
|
2529 |
return aPtr;
|
|
2530 |
}
|
|
2531 |
|
|
2532 |
|
|
2533 |
void CSmsAddress::DecodeL(TGsmuLex8& aPdu)
|
|
2534 |
{
|
|
2535 |
TSmsOctet length; //represents the number of valid semi-octets
|
|
2536 |
length.DecodeL(aPdu);
|
|
2537 |
iTypeOfAddress.DecodeL(aPdu);
|
|
2538 |
|
|
2539 |
switch (iTypeOfAddress.TON())
|
|
2540 |
{
|
|
2541 |
case EGsmSmsTONAlphaNumeric:
|
|
2542 |
{
|
|
2543 |
const TUint cphs1 = aPdu.GetL();
|
|
2544 |
const TUint cphs2 = aPdu.GetL();
|
|
2545 |
aPdu.UnGet();
|
|
2546 |
aPdu.UnGet();
|
|
2547 |
|
|
2548 |
const TPtrC8 remainder(aPdu.Remainder());
|
|
2549 |
// we assume that it is a cphs message waiting indicator
|
|
2550 |
// we might want to do further tests tobe sure that it is a CPHS message
|
|
2551 |
if( (length==4)
|
|
2552 |
&& ((cphs1 & 0x7E) == 0x10) // x001 000x constant value
|
|
2553 |
&& ((cphs2 & 0x7E) == 0x00) // x000 000x constant value
|
|
2554 |
)
|
|
2555 |
{
|
|
2556 |
TGsmSmsTelNumber parsedaddress;
|
|
2557 |
parsedaddress.iTelNumber.SetLength(length);
|
|
2558 |
//Copy the two bytes of the cphs message waiting address into the parsed address
|
|
2559 |
parsedaddress.iTelNumber[0]=(TUint8)length;
|
|
2560 |
parsedaddress.iTelNumber[1]= (TUint8)iTypeOfAddress;
|
|
2561 |
parsedaddress.iTelNumber[2]= (TUint8)aPdu.GetL();
|
|
2562 |
parsedaddress.iTelNumber[3]= (TUint8)aPdu.GetL();
|
|
2563 |
DoSetParsedAddressL(parsedaddress.iTelNumber);
|
|
2564 |
}
|
|
2565 |
else if(length==11 && remainder.Left(6).CompareF(KMOSES) ==KErrNone ) //check for MOSES
|
|
2566 |
{
|
|
2567 |
DoSetParsedAddressL(KNETWORK);
|
|
2568 |
aPdu.IncL(6);
|
|
2569 |
}
|
|
2570 |
else
|
|
2571 |
{
|
|
2572 |
// Encoded length is number of semi-octets used to store address using
|
|
2573 |
// 7-bit char set - determine number of user data units required
|
|
2574 |
const TInt numUDUnits=length*4/7;
|
|
2575 |
// Unpack the data - assume max converted length twice the unconverted length
|
|
2576 |
// VEP Why this assumption, the length will be doubled at the client because of that??
|
|
2577 |
// EXT-568BMW
|
|
2578 |
// Fix is not to multiply by 2
|
|
2579 |
//NewBufferL(2*numUDUnits);
|
|
2580 |
NewBufferL(numUDUnits);
|
|
2581 |
TPtr unpackedPtr((TText*)iBuffer->Des().Ptr(),0,iBuffer->Length());
|
|
2582 |
|
|
2583 |
if (remainder.Length() < KSmsAddressMaxAddressValueLength)
|
|
2584 |
User::Leave(KErrGsmuDecoding);
|
|
2585 |
|
|
2586 |
TPtrC8 packedPtr(remainder.Ptr(), KSmsAddressMaxAddressValueLength);
|
|
2587 |
TSmsAlphabetPacker unpacker(TSmsDataCodingScheme::ESmsAlphabet7Bit,EFalse,0);
|
|
2588 |
unpacker.UnpackAndConvertL(iCharacterSetConverter,iFs,packedPtr,unpackedPtr,numUDUnits);
|
|
2589 |
aPdu.IncL(length / 2);
|
|
2590 |
if ((length % 2) != 0)
|
|
2591 |
aPdu.IncL();
|
|
2592 |
}
|
|
2593 |
break;
|
|
2594 |
}
|
|
2595 |
case EGsmSmsTONInternationalNumber:
|
|
2596 |
default:
|
|
2597 |
{
|
|
2598 |
TGsmSmsTelNumber parsedaddress;
|
|
2599 |
if (length>parsedaddress.iTelNumber.MaxLength())
|
|
2600 |
User::Leave(KErrGsmuDecoding);
|
|
2601 |
parsedaddress.iTelNumber.SetLength(length);
|
|
2602 |
TSmsOctet octet;
|
|
2603 |
for (TInt i=0; i<length; i++)
|
|
2604 |
{
|
|
2605 |
if ((i%2)==0) // even
|
|
2606 |
{
|
|
2607 |
TUint8 tempOctet = 0;
|
|
2608 |
octet.DecodeL(aPdu);
|
|
2609 |
tempOctet = (TUint8)octet&0x0F; // four topmost bits set to zero
|
|
2610 |
|
|
2611 |
switch(tempOctet)
|
|
2612 |
{
|
|
2613 |
case 10: // 1010
|
|
2614 |
{
|
|
2615 |
parsedaddress.iTelNumber[i] = '*';
|
|
2616 |
}
|
|
2617 |
break;
|
|
2618 |
|
|
2619 |
case 11: // 1011
|
|
2620 |
{
|
|
2621 |
parsedaddress.iTelNumber[i] = '#';
|
|
2622 |
}
|
|
2623 |
break;
|
|
2624 |
|
|
2625 |
case 12: // 1100
|
|
2626 |
{
|
|
2627 |
parsedaddress.iTelNumber[i] = 'a';
|
|
2628 |
}
|
|
2629 |
break;
|
|
2630 |
|
|
2631 |
case 13: //1101
|
|
2632 |
{
|
|
2633 |
parsedaddress.iTelNumber[i] = 'b';
|
|
2634 |
}
|
|
2635 |
break;
|
|
2636 |
|
|
2637 |
case 14: //1110
|
|
2638 |
{
|
|
2639 |
parsedaddress.iTelNumber[i] = 'c';
|
|
2640 |
}
|
|
2641 |
break;
|
|
2642 |
|
|
2643 |
case 15:
|
|
2644 |
// Skip if 1111 is received
|
|
2645 |
break;
|
|
2646 |
|
|
2647 |
default:
|
|
2648 |
parsedaddress.iTelNumber[i]=(TUint8) (tempOctet+'0');
|
|
2649 |
break;
|
|
2650 |
}
|
|
2651 |
}
|
|
2652 |
else
|
|
2653 |
{
|
|
2654 |
TUint8 tempOctet = 0;
|
|
2655 |
octet&0xF0; // four least significant bits…
|
|
2656 |
tempOctet = (TUint8)octet>>4;
|
|
2657 |
|
|
2658 |
switch(tempOctet)
|
|
2659 |
{
|
|
2660 |
case 10: // 1010
|
|
2661 |
{
|
|
2662 |
parsedaddress.iTelNumber[i] = '*';
|
|
2663 |
}
|
|
2664 |
break;
|
|
2665 |
|
|
2666 |
case 11: // 1011
|
|
2667 |
{
|
|
2668 |
parsedaddress.iTelNumber[i] = '#';
|
|
2669 |
}
|
|
2670 |
break;
|
|
2671 |
|
|
2672 |
case 12: // 1100
|
|
2673 |
{
|
|
2674 |
parsedaddress.iTelNumber[i] = 'a';
|
|
2675 |
}
|
|
2676 |
break;
|
|
2677 |
|
|
2678 |
case 13: // 1101
|
|
2679 |
{
|
|
2680 |
parsedaddress.iTelNumber[i] = 'b';
|
|
2681 |
}
|
|
2682 |
break;
|
|
2683 |
|
|
2684 |
case 14: // 1110
|
|
2685 |
{
|
|
2686 |
parsedaddress.iTelNumber[i] = 'c';
|
|
2687 |
}
|
|
2688 |
break;
|
|
2689 |
|
|
2690 |
case 15:
|
|
2691 |
// Skip if 1111 is received
|
|
2692 |
break;
|
|
2693 |
|
|
2694 |
default:
|
|
2695 |
parsedaddress.iTelNumber[i]=(TUint8) (tempOctet+'0');
|
|
2696 |
// unwanted bits zeroed in the beginning
|
|
2697 |
|
|
2698 |
break;
|
|
2699 |
}
|
|
2700 |
}
|
|
2701 |
}
|
|
2702 |
DoSetParsedAddressL(parsedaddress.iTelNumber);
|
|
2703 |
}
|
|
2704 |
}
|
|
2705 |
}
|
|
2706 |
|
|
2707 |
void CSmsAddress::InternalizeL(RReadStream& aStream)
|
|
2708 |
{
|
|
2709 |
aStream >> iTypeOfAddress;
|
|
2710 |
HBufC* buffer=HBufC::NewL(aStream,256);
|
|
2711 |
delete iBuffer;
|
|
2712 |
iBuffer=buffer;
|
|
2713 |
} // CSmsAddress::InternalizeL
|
|
2714 |
|
|
2715 |
|
|
2716 |
void CSmsAddress::ExternalizeL(RWriteStream& aStream) const
|
|
2717 |
{
|
|
2718 |
aStream << iTypeOfAddress;
|
|
2719 |
aStream << *iBuffer;
|
|
2720 |
} // CSmsAddress::ExternalizeL
|
|
2721 |
|
|
2722 |
|
|
2723 |
CSmsAddress::CSmsAddress(CCnvCharacterSetConverter& aCharacterSetConverter,RFs& aFs):
|
|
2724 |
iCharacterSetConverter(aCharacterSetConverter),
|
|
2725 |
iFs(aFs),
|
|
2726 |
iTypeOfAddress(EGsmSmsTONUnknown, EGsmSmsNPIISDNTelephoneNumberingPlan)
|
|
2727 |
{
|
|
2728 |
} // CSmsAddress::CSmsAddress
|
|
2729 |
|
|
2730 |
|
|
2731 |
void CSmsAddress::NewBufferL(TInt aLength)
|
|
2732 |
{
|
|
2733 |
LOGGSMU1("CSmsAddress::NewBufferL()");
|
|
2734 |
|
|
2735 |
HBufC* buffer=HBufC::NewL(aLength);
|
|
2736 |
delete iBuffer;
|
|
2737 |
iBuffer=buffer;
|
|
2738 |
iBuffer->Des().SetLength(aLength);
|
|
2739 |
iBuffer->Des().FillZ();
|
|
2740 |
}
|
|
2741 |
|
|
2742 |
|
|
2743 |
void CSmsAddress::DoSetParsedAddressL(const TDesC& aAddress)
|
|
2744 |
{
|
|
2745 |
LOGGSMU2("CSmsAddress::DoSetParsedAddressL() the length of the Address [Length = %d", aAddress.Length());
|
|
2746 |
|
|
2747 |
TInt length=aAddress.Length();
|
|
2748 |
if ((iTypeOfAddress.TON()==EGsmSmsTONInternationalNumber) &&
|
|
2749 |
(length && (aAddress[0]!='+')))
|
|
2750 |
{
|
|
2751 |
NewBufferL(length+1);
|
|
2752 |
iBuffer->Des()[0]='+';
|
|
2753 |
TPtr ptr((TText*) (iBuffer->Des().Ptr()+1),length,length);
|
|
2754 |
ptr.Copy(aAddress);
|
|
2755 |
}
|
|
2756 |
else
|
|
2757 |
{
|
|
2758 |
NewBufferL(length);
|
|
2759 |
iBuffer->Des().Copy(aAddress);
|
|
2760 |
}
|
|
2761 |
} // CSmsAddress::DoSetParsedAddressL
|
|
2762 |
|
|
2763 |
|
|
2764 |
TSmsServiceCenterTimeStamp::TSmsServiceCenterTimeStamp()
|
|
2765 |
{
|
|
2766 |
iTimeZoneNumQuarterHours = 0;
|
|
2767 |
} // TSmsServiceCenterTimeStamp::TSmsServiceCenterTimeStamp
|
|
2768 |
|
|
2769 |
|
|
2770 |
void TSmsServiceCenterTimeStamp::SetTimeOffset(TInt aNumQuarterHours)
|
|
2771 |
{
|
|
2772 |
__ASSERT_DEBUG((aNumQuarterHours>=-KSmsMaxTimeZoneNumQuarterHours) && (aNumQuarterHours<=KSmsMaxTimeZoneNumQuarterHours),Panic(KGsmuPanicNumQuarterHoursOutOfRange));
|
|
2773 |
iTimeZoneNumQuarterHours=aNumQuarterHours;
|
|
2774 |
} // TSmsServiceCenterTimeStamp::SetTimeOffset
|
|
2775 |
|
|
2776 |
|
|
2777 |
TUint8* TSmsServiceCenterTimeStamp::EncodeL(TUint8* aPtr) const
|
|
2778 |
{
|
|
2779 |
LOGGSMU1("TSmsServiceCenterTimeStamp::EncodeL()");
|
|
2780 |
|
|
2781 |
TInt numquarterhours=iTimeZoneNumQuarterHours;
|
|
2782 |
|
|
2783 |
TInt timeZoneOffsetInSeconds = numquarterhours * CSmsMessage::E15MinutesRepresentedInSeconds;
|
|
2784 |
TTimeIntervalSeconds offsetFromUTCToLocal(timeZoneOffsetInSeconds);
|
|
2785 |
|
|
2786 |
TTime time = iTime;
|
|
2787 |
time += offsetFromUTCToLocal;
|
|
2788 |
|
|
2789 |
TDateTime datetime=time.DateTime();
|
|
2790 |
|
|
2791 |
TSmsOctet octet;
|
|
2792 |
octet.FillSemiOctets(datetime.Year()%100);
|
|
2793 |
aPtr=octet.EncodeL(aPtr);
|
|
2794 |
octet.FillSemiOctets(datetime.Month()+1);
|
|
2795 |
aPtr=octet.EncodeL(aPtr);
|
|
2796 |
octet.FillSemiOctets(datetime.Day()+1);
|
|
2797 |
aPtr=octet.EncodeL(aPtr);
|
|
2798 |
octet.FillSemiOctets(datetime.Hour());
|
|
2799 |
aPtr=octet.EncodeL(aPtr);
|
|
2800 |
octet.FillSemiOctets(datetime.Minute());
|
|
2801 |
aPtr=octet.EncodeL(aPtr);
|
|
2802 |
octet.FillSemiOctets(datetime.Second());
|
|
2803 |
aPtr=octet.EncodeL(aPtr);
|
|
2804 |
|
|
2805 |
TInt signbit=ESmsTimeZonePositive;
|
|
2806 |
if (numquarterhours<0)
|
|
2807 |
{
|
|
2808 |
numquarterhours=-numquarterhours;
|
|
2809 |
signbit=ESmsTimeZoneNegative;
|
|
2810 |
}
|
|
2811 |
|
|
2812 |
TSmsOctet timezone;
|
|
2813 |
timezone.FillSemiOctets(numquarterhours);
|
|
2814 |
timezone=timezone|signbit;
|
|
2815 |
return timezone.EncodeL(aPtr);
|
|
2816 |
} // TSmsServiceCenterTimeStamp::EncodeL
|
|
2817 |
|
|
2818 |
|
|
2819 |
void TSmsServiceCenterTimeStamp::DecodeL(TGsmuLex8& aPdu, TInt& aTimeError)
|
|
2820 |
{
|
|
2821 |
LOGGSMU1("TSmsServiceCenterTimeStamp::DecodeL()");
|
|
2822 |
|
|
2823 |
TSmsOctet octet;
|
|
2824 |
octet.DecodeL(aPdu);
|
|
2825 |
TInt year=octet.SemiOctetsToNum();
|
|
2826 |
if (year>95)
|
|
2827 |
year+=1900;
|
|
2828 |
else
|
|
2829 |
year+=2000;
|
|
2830 |
octet.DecodeL(aPdu);
|
|
2831 |
TInt month=octet.SemiOctetsToNum();
|
|
2832 |
octet.DecodeL(aPdu);
|
|
2833 |
|
|
2834 |
TInt day=octet.SemiOctetsToNum();
|
|
2835 |
octet.DecodeL(aPdu);
|
|
2836 |
TInt hour=octet.SemiOctetsToNum();
|
|
2837 |
octet.DecodeL(aPdu);
|
|
2838 |
TInt minute=octet.SemiOctetsToNum();
|
|
2839 |
octet.DecodeL(aPdu);
|
|
2840 |
TInt second=octet.SemiOctetsToNum();
|
|
2841 |
|
|
2842 |
TDateTime datetime;
|
|
2843 |
aTimeError = datetime.Set(year,(TMonth) (month-1),day-1,hour,minute,second,0);
|
|
2844 |
|
|
2845 |
TSmsOctet timezone;
|
|
2846 |
timezone.DecodeL(aPdu);
|
|
2847 |
|
|
2848 |
TInt signBit = (timezone&ESmsTimeZoneSignBitMask) ? ESmsTimeZoneNegative : ESmsTimeZonePositive;
|
|
2849 |
timezone=timezone &(~ESmsTimeZoneSignBitMask); // clear sign bit
|
|
2850 |
|
|
2851 |
TInt offsetToUTCInSeconds = 0;
|
|
2852 |
if (timezone.SemiOctetsToNum() <= KSmsMaxTimeZoneNumQuarterHours)
|
|
2853 |
{
|
|
2854 |
offsetToUTCInSeconds = ((TInt) timezone.SemiOctetsToNum()) * CSmsMessage::E15MinutesRepresentedInSeconds;
|
|
2855 |
if (signBit == ESmsTimeZoneNegative)
|
|
2856 |
{
|
|
2857 |
offsetToUTCInSeconds = -offsetToUTCInSeconds;
|
|
2858 |
}
|
|
2859 |
|
|
2860 |
TTimeIntervalSeconds offsetToUTC(offsetToUTCInSeconds) ;
|
|
2861 |
|
|
2862 |
if (aTimeError == KErrNone)
|
|
2863 |
{
|
|
2864 |
TTime time = datetime;
|
|
2865 |
time -= offsetToUTC;
|
|
2866 |
iTime = time;
|
|
2867 |
|
|
2868 |
iTimeZoneNumQuarterHours=(signBit == ESmsTimeZonePositive) ? timezone.SemiOctetsToNum(): -timezone.SemiOctetsToNum();
|
|
2869 |
}
|
|
2870 |
|
|
2871 |
}
|
|
2872 |
else // Time zone out of range, set to 0 per 23.040 4.4.0 Section 9.2.3.11
|
|
2873 |
{
|
|
2874 |
if (aTimeError == KErrNone)
|
|
2875 |
{
|
|
2876 |
iTime = datetime;
|
|
2877 |
iTimeZoneNumQuarterHours=0;
|
|
2878 |
}
|
|
2879 |
}
|
|
2880 |
} // TSmsServiceCenterTimeStamp::DecodeL
|
|
2881 |
|
|
2882 |
|
|
2883 |
void TSmsServiceCenterTimeStamp::InternalizeL(RReadStream& aStream)
|
|
2884 |
{
|
|
2885 |
TInt64 time;
|
|
2886 |
aStream >> time;
|
|
2887 |
iTime=time;
|
|
2888 |
iTimeZoneNumQuarterHours=aStream.ReadInt32L();
|
|
2889 |
} // TSmsServiceCenterTimeStamp::InternalizeL
|
|
2890 |
|
|
2891 |
|
|
2892 |
void TSmsServiceCenterTimeStamp::ExternalizeL(RWriteStream& aStream) const
|
|
2893 |
{
|
|
2894 |
aStream << iTime.Int64();
|
|
2895 |
aStream.WriteInt32L(iTimeZoneNumQuarterHours);
|
|
2896 |
} // TSmsServiceCenterTimeStamp::ExternalizeL
|
|
2897 |
|
|
2898 |
|
|
2899 |
TSmsValidityPeriod::TSmsValidityPeriod(TSmsFirstOctet& aFirstOctet):
|
|
2900 |
iFirstOctet(aFirstOctet),
|
|
2901 |
iTimeIntervalMinutes(EOneDayUnitInMinutes)
|
|
2902 |
{
|
|
2903 |
} // TSmsValidityPeriod::TSmsValidityPeriod
|
|
2904 |
|
|
2905 |
|
|
2906 |
TTime TSmsValidityPeriod::Time() const
|
|
2907 |
{
|
|
2908 |
LOGGSMU1("TSmsValidityPeriod::Time()");
|
|
2909 |
|
|
2910 |
TTime time;
|
|
2911 |
time.UniversalTime();
|
|
2912 |
time+=iTimeIntervalMinutes;
|
|
2913 |
return time;
|
|
2914 |
} // TSmsValidityPeriod::Time
|
|
2915 |
|
|
2916 |
|
|
2917 |
TUint8* TSmsValidityPeriod::EncodeL(TUint8* aPtr) const
|
|
2918 |
{
|
|
2919 |
LOGGSMU1("TSmsValidityPeriod::EncodeL()");
|
|
2920 |
|
|
2921 |
TInt validityperiodformat=ValidityPeriodFormat();
|
|
2922 |
switch (validityperiodformat)
|
|
2923 |
{
|
|
2924 |
case (TSmsFirstOctet::ESmsVPFNone):
|
|
2925 |
break;
|
|
2926 |
case (TSmsFirstOctet::ESmsVPFInteger):
|
|
2927 |
{
|
|
2928 |
TInt timeintervalminutes=iTimeIntervalMinutes.Int();
|
|
2929 |
__ASSERT_DEBUG((timeintervalminutes>=EFiveMinuteUnitInMinutes) && (timeintervalminutes<=63*EOneWeekUnitLimitInMinutes),Panic(KGsmuPanicValidityPeriodOutOfRange));
|
|
2930 |
TSmsOctet octet;
|
|
2931 |
if (timeintervalminutes<=EFiveMinuteUnitLimitInMinutes)
|
|
2932 |
octet=((timeintervalminutes/EFiveMinuteUnitInMinutes)-1);
|
|
2933 |
else if (timeintervalminutes<=EHalfHourUnitLimitInMinutes)
|
|
2934 |
octet=(((timeintervalminutes-(EHalfHourUnitLimitInMinutes/2))/EHalfHourUnitInMinutes)+EFiveMinuteUnitLimit);
|
|
2935 |
|
|
2936 |
else if (timeintervalminutes<=EOneDayUnitLimitInMinutes)
|
|
2937 |
octet=((timeintervalminutes/EOneDayUnitInMinutes)+166);
|
|
2938 |
else
|
|
2939 |
octet=((timeintervalminutes/EOneWeekUnitInMinutes)+192);
|
|
2940 |
|
|
2941 |
aPtr=octet.EncodeL(aPtr);
|
|
2942 |
break;
|
|
2943 |
}
|
|
2944 |
case (TSmsFirstOctet::ESmsVPFSemiOctet):
|
|
2945 |
{
|
|
2946 |
TSmsServiceCenterTimeStamp timestamp;
|
|
2947 |
timestamp.SetTime(Time());
|
|
2948 |
|
|
2949 |
TTimeIntervalSeconds timeIntervalInSeconds(User::UTCOffset());
|
|
2950 |
timestamp.SetTimeOffset(timeIntervalInSeconds.Int() / CSmsMessage::E15MinutesRepresentedInSeconds);
|
|
2951 |
|
|
2952 |
aPtr=timestamp.EncodeL(aPtr);
|
|
2953 |
break;
|
|
2954 |
}
|
|
2955 |
default:
|
|
2956 |
__ASSERT_DEBUG(EFalse,Panic(KGsmuPanicUnsupportedValidityPeriodFormat));
|
|
2957 |
User::Leave(KErrGsmSMSTPVPFNotSupported);
|
|
2958 |
break;
|
|
2959 |
};
|
|
2960 |
return aPtr;
|
|
2961 |
} // TSmsValidityPeriod::EncodeL
|
|
2962 |
|
|
2963 |
TUint8* TSmsValidityPeriod::EncodeL(TUint8* aPtr, const TEncodeParams* aEncodeParams) const
|
|
2964 |
{
|
|
2965 |
LOGGSMU1("TSmsValidityPeriod::EncodeL()");
|
|
2966 |
|
|
2967 |
TInt validityperiodformat=ValidityPeriodFormat();
|
|
2968 |
switch (validityperiodformat)
|
|
2969 |
{
|
|
2970 |
case (TSmsFirstOctet::ESmsVPFNone):
|
|
2971 |
break;
|
|
2972 |
case (TSmsFirstOctet::ESmsVPFInteger):
|
|
2973 |
{
|
|
2974 |
TInt timeintervalminutes=iTimeIntervalMinutes.Int();
|
|
2975 |
__ASSERT_DEBUG((timeintervalminutes>=EFiveMinuteUnitInMinutes) && (timeintervalminutes<=63*EOneWeekUnitLimitInMinutes),Panic(KGsmuPanicValidityPeriodOutOfRange));
|
|
2976 |
TSmsOctet octet;
|
|
2977 |
if (timeintervalminutes<=EFiveMinuteUnitLimitInMinutes)
|
|
2978 |
octet=((timeintervalminutes/EFiveMinuteUnitInMinutes)-1);
|
|
2979 |
else if (timeintervalminutes<=EHalfHourUnitLimitInMinutes)
|
|
2980 |
octet=(((timeintervalminutes-(EHalfHourUnitLimitInMinutes/2))/EHalfHourUnitInMinutes)+EFiveMinuteUnitLimit);
|
|
2981 |
|
|
2982 |
else if (timeintervalminutes<=EOneDayUnitLimitInMinutes)
|
|
2983 |
octet=((timeintervalminutes/EOneDayUnitInMinutes)+166);
|
|
2984 |
else
|
|
2985 |
octet=((timeintervalminutes/EOneWeekUnitInMinutes)+192);
|
|
2986 |
|
|
2987 |
aPtr=octet.EncodeL(aPtr);
|
|
2988 |
break;
|
|
2989 |
}
|
|
2990 |
case (TSmsFirstOctet::ESmsVPFSemiOctet):
|
|
2991 |
{
|
|
2992 |
//The reason TSmsValidityPeriod::EncodeL(TUint8* aPtr, const TEncodeParams* aEncodeParams) was
|
|
2993 |
//created was to allow the CSmsMessage's time stamp to be used when generating the validity time.
|
|
2994 |
//The CSmsMessage's time stamp is typically created when the message is constructed by the SMS Stack client.
|
|
2995 |
//This means the validity time is based from the point the SMS Stack client actually sends the message, rather
|
|
2996 |
//than the SMS Stack encodes it
|
|
2997 |
|
|
2998 |
TSmsServiceCenterTimeStamp timestamp;
|
|
2999 |
timestamp.SetTime( *aEncodeParams->iTimeStamp + iTimeIntervalMinutes );
|
|
3000 |
|
|
3001 |
TTimeIntervalSeconds timeIntervalInSeconds( *aEncodeParams->iTimeIntervalInSeconds );
|
|
3002 |
timestamp.SetTimeOffset(timeIntervalInSeconds.Int() / CSmsMessage::E15MinutesRepresentedInSeconds);
|
|
3003 |
|
|
3004 |
aPtr=timestamp.EncodeL(aPtr);
|
|
3005 |
break;
|
|
3006 |
}
|
|
3007 |
default:
|
|
3008 |
__ASSERT_DEBUG(EFalse,Panic(KGsmuPanicUnsupportedValidityPeriodFormat));
|
|
3009 |
User::Leave(KErrGsmSMSTPVPFNotSupported);
|
|
3010 |
break;
|
|
3011 |
};
|
|
3012 |
return aPtr;
|
|
3013 |
} // TSmsValidityPeriod::EncodeL
|
|
3014 |
|
|
3015 |
void TSmsValidityPeriod::DecodeL(TGsmuLex8& aPdu)
|
|
3016 |
{
|
|
3017 |
LOGGSMU1("TSmsValidityPeriod::DecodeL()");
|
|
3018 |
|
|
3019 |
TInt validityperiodformat=ValidityPeriodFormat();
|
|
3020 |
switch (validityperiodformat)
|
|
3021 |
{
|
|
3022 |
case (TSmsFirstOctet::ESmsVPFNone):
|
|
3023 |
break;
|
|
3024 |
case (TSmsFirstOctet::ESmsVPFInteger):
|
|
3025 |
{
|
|
3026 |
TSmsOctet octet;
|
|
3027 |
octet.DecodeL(aPdu);
|
|
3028 |
if (octet<=EFiveMinuteUnitLimit)
|
|
3029 |
iTimeIntervalMinutes=(octet+1)*EFiveMinuteUnitInMinutes;
|
|
3030 |
else if (octet<=EHalfHourUnitLimit)
|
|
3031 |
iTimeIntervalMinutes=((EOneDayUnitInMinutes/2)+((octet-EFiveMinuteUnitLimit)*EHalfHourUnitInMinutes));
|
|
3032 |
else if (octet<=EOneDayUnitLimit)
|
|
3033 |
iTimeIntervalMinutes=(octet-166)*EOneDayUnitInMinutes;
|
|
3034 |
else
|
|
3035 |
iTimeIntervalMinutes=(octet-192)*EOneWeekUnitInMinutes;
|
|
3036 |
break;
|
|
3037 |
}
|
|
3038 |
case (TSmsFirstOctet::ESmsVPFSemiOctet):
|
|
3039 |
{
|
|
3040 |
TSmsServiceCenterTimeStamp timestamp;
|
|
3041 |
TInt timeError;
|
|
3042 |
timestamp.DecodeL(aPdu, timeError);
|
|
3043 |
User::LeaveIfError(timeError);
|
|
3044 |
TTime time;
|
|
3045 |
time.UniversalTime();
|
|
3046 |
timestamp.Time().MinutesFrom(time,iTimeIntervalMinutes);
|
|
3047 |
break;
|
|
3048 |
}
|
|
3049 |
default:
|
|
3050 |
__ASSERT_DEBUG(EFalse,Panic(KGsmuPanicUnsupportedValidityPeriodFormat));
|
|
3051 |
User::Leave(KErrGsmSMSTPVPFNotSupported);
|
|
3052 |
break;
|
|
3053 |
};
|
|
3054 |
} // TSmsValidityPeriod::DecodeL
|
|
3055 |
|
|
3056 |
|
|
3057 |
void TSmsValidityPeriod::InternalizeL(RReadStream& aStream)
|
|
3058 |
{
|
|
3059 |
TInt timeintervalinminutes=aStream.ReadInt32L();
|
|
3060 |
iTimeIntervalMinutes=timeintervalinminutes;
|
|
3061 |
} // TSmsValidityPeriod::InternalizeL
|
|
3062 |
|
|
3063 |
|
|
3064 |
void TSmsValidityPeriod::ExternalizeL(RWriteStream& aStream) const
|
|
3065 |
{
|
|
3066 |
aStream.WriteInt32L(iTimeIntervalMinutes.Int());
|
|
3067 |
} // TSmsValidityPeriod::ExternalizeL
|
|
3068 |
|
|
3069 |
|
|
3070 |
CSmsInformationElement* CSmsInformationElement::NewL(TSmsInformationElementIdentifier aIdentifier,const TDesC8& aData)
|
|
3071 |
{
|
|
3072 |
LOGGSMU1("CSmsInformationElement::NewL()");
|
|
3073 |
|
|
3074 |
CSmsInformationElement* informationelement=new(ELeave) CSmsInformationElement(aIdentifier);
|
|
3075 |
CleanupStack::PushL(informationelement);
|
|
3076 |
informationelement->ConstructL(aData);
|
|
3077 |
CleanupStack::Pop();
|
|
3078 |
return informationelement;
|
|
3079 |
} // CSmsInformationElement::NewL
|
|
3080 |
|
|
3081 |
|
|
3082 |
CSmsInformationElement* CSmsInformationElement::NewL()
|
|
3083 |
{
|
|
3084 |
LOGGSMU1("CSmsInformationElement::NewL()");
|
|
3085 |
|
|
3086 |
CSmsInformationElement* informationelement=new(ELeave) CSmsInformationElement(ESmsIEIConcatenatedShortMessages8BitReference);
|
|
3087 |
CleanupStack::PushL(informationelement);
|
|
3088 |
TPtrC8 data;
|
|
3089 |
informationelement->ConstructL(data);
|
|
3090 |
CleanupStack::Pop();
|
|
3091 |
return informationelement;
|
|
3092 |
} // CSmsInformationElement::NewL
|
|
3093 |
|
|
3094 |
|
|
3095 |
/**
|
|
3096 |
* Destructor.
|
|
3097 |
*/
|
|
3098 |
CSmsInformationElement::~CSmsInformationElement()
|
|
3099 |
{
|
|
3100 |
delete iData;
|
|
3101 |
} // CSmsInformationElement::NewL
|
|
3102 |
|
|
3103 |
|
|
3104 |
/**
|
|
3105 |
* Gets the Information Element data.
|
|
3106 |
*
|
|
3107 |
* @return Information Element data
|
|
3108 |
* @capability None
|
|
3109 |
*/
|
|
3110 |
EXPORT_C TPtr8 CSmsInformationElement::Data()
|
|
3111 |
{
|
|
3112 |
LOGGSMU1("CSmsInformationElement::Data()");
|
|
3113 |
|
|
3114 |
return iData->Des();
|
|
3115 |
} // CSmsInformationElement::Data
|
|
3116 |
|
|
3117 |
|
|
3118 |
/**
|
|
3119 |
* Gets the (const) Information Element data.
|
|
3120 |
*
|
|
3121 |
* @return Information Element data
|
|
3122 |
* @capability None
|
|
3123 |
*/
|
|
3124 |
EXPORT_C const TDesC8& CSmsInformationElement::Data() const
|
|
3125 |
{
|
|
3126 |
LOGGSMU1("CSmsInformationElement::Data()");
|
|
3127 |
|
|
3128 |
return *iData;
|
|
3129 |
} // CSmsInformationElement::Data
|
|
3130 |
|
|
3131 |
|
|
3132 |
/**
|
|
3133 |
* Gets the Information Element Identifier.
|
|
3134 |
*
|
|
3135 |
* @return Information Element Identifier
|
|
3136 |
* @capability None
|
|
3137 |
*/
|
|
3138 |
EXPORT_C CSmsInformationElement::TSmsInformationElementIdentifier CSmsInformationElement::Identifier() const
|
|
3139 |
{
|
|
3140 |
return TSmsId(TInt(iIdentifier));
|
|
3141 |
} // CSmsInformationElement::TSmsInformationElementIdentifier
|
|
3142 |
|
|
3143 |
|
|
3144 |
TUint8* CSmsInformationElement::EncodeL(TUint8* aPtr) const
|
|
3145 |
{
|
|
3146 |
LOGGSMU1("CSmsInformationElement::EncodeL()");
|
|
3147 |
|
|
3148 |
TSmsOctet id=iIdentifier;
|
|
3149 |
aPtr=id.EncodeL(aPtr);
|
|
3150 |
TSmsOctet informationelementlength=iData->Des().Length();
|
|
3151 |
aPtr=informationelementlength.EncodeL(aPtr);
|
|
3152 |
Mem::Copy(aPtr,iData->Des().Ptr(),informationelementlength);
|
|
3153 |
aPtr+=TInt(informationelementlength);
|
|
3154 |
return aPtr;
|
|
3155 |
} // CSmsInformationElement::EncodeL
|
|
3156 |
|
|
3157 |
|
|
3158 |
void CSmsInformationElement::DecodeL(TGsmuLex8& aPdu)
|
|
3159 |
{
|
|
3160 |
LOGGSMU1("CSmsInformationElement::DecodeL()");
|
|
3161 |
|
|
3162 |
TSmsOctet id;
|
|
3163 |
id.DecodeL(aPdu);
|
|
3164 |
iIdentifier=static_cast<TSmsInformationElementIdentifier>((TInt)id);
|
|
3165 |
|
|
3166 |
TSmsOctet informationelementlength;
|
|
3167 |
informationelementlength.DecodeL(aPdu);
|
|
3168 |
|
|
3169 |
switch(iIdentifier)
|
|
3170 |
{
|
|
3171 |
case (ESmsIEIConcatenatedShortMessages8BitReference):
|
|
3172 |
if(informationelementlength !=3)
|
|
3173 |
User::Leave(KErrGsmSMSTpduNotSupported);
|
|
3174 |
break;
|
|
3175 |
case (ESmsIEISpecialSMSMessageIndication):
|
|
3176 |
if(informationelementlength !=2)
|
|
3177 |
User::Leave(KErrGsmSMSTpduNotSupported);
|
|
3178 |
break;
|
|
3179 |
case (ESmsIEIApplicationPortAddressing8Bit):
|
|
3180 |
if(informationelementlength !=2)
|
|
3181 |
User::Leave(KErrGsmSMSTpduNotSupported);
|
|
3182 |
break;
|
|
3183 |
case (ESmsIEIApplicationPortAddressing16Bit):
|
|
3184 |
if(informationelementlength !=4)
|
|
3185 |
User::Leave(KErrGsmSMSTpduNotSupported);
|
|
3186 |
break;
|
|
3187 |
case (ESmsIEISMSCControlParameters):
|
|
3188 |
if(informationelementlength !=1)
|
|
3189 |
User::Leave(KErrGsmSMSTpduNotSupported);
|
|
3190 |
break;
|
|
3191 |
case (ESmsIEIUDHSourceIndicator):
|
|
3192 |
if(informationelementlength !=1)
|
|
3193 |
User::Leave(KErrGsmSMSTpduNotSupported);
|
|
3194 |
break;
|
|
3195 |
case (ESmsIEIConcatenatedShortMessages16BitReference):
|
|
3196 |
if(informationelementlength !=4)
|
|
3197 |
User::Leave(KErrGsmSMSTpduNotSupported);
|
|
3198 |
break;
|
|
3199 |
case (ESmsIEIRFC822EmailHeader):
|
|
3200 |
if(informationelementlength !=1)
|
|
3201 |
User::Leave(KErrGsmSMSTpduNotSupported);
|
|
3202 |
break;
|
|
3203 |
case (ESmsHyperLinkFormat):
|
|
3204 |
if(informationelementlength !=4)
|
|
3205 |
User::Leave(KErrGsmSMSTpduNotSupported);
|
|
3206 |
break;
|
|
3207 |
case (ESmsNationalLanguageSingleShift):
|
|
3208 |
if(informationelementlength != 1)
|
|
3209 |
User::Leave(KErrGsmSMSTpduNotSupported);
|
|
3210 |
break;
|
|
3211 |
case (ESmsNationalLanguageLockingShift):
|
|
3212 |
if(informationelementlength != 1)
|
|
3213 |
User::Leave(KErrGsmSMSTpduNotSupported);
|
|
3214 |
break;
|
|
3215 |
case (ESmsIEISIMToolkitSecurityHeaders1):
|
|
3216 |
case (ESmsIEISIMToolkitSecurityHeaders2):
|
|
3217 |
case (ESmsIEISIMToolkitSecurityHeaders3):
|
|
3218 |
case (ESmsIEISIMToolkitSecurityHeaders4):
|
|
3219 |
case (ESmsIEISIMToolkitSecurityHeaders5):
|
|
3220 |
case (ESmsIEISIMToolkitSecurityHeaders6):
|
|
3221 |
case (ESmsIEISIMToolkitSecurityHeaders7):
|
|
3222 |
case (ESmsIEISIMToolkitSecurityHeaders8):
|
|
3223 |
case (ESmsIEISIMToolkitSecurityHeaders9):
|
|
3224 |
case (ESmsIEISIMToolkitSecurityHeaders10):
|
|
3225 |
case (ESmsIEISIMToolkitSecurityHeaders11):
|
|
3226 |
case (ESmsIEISIMToolkitSecurityHeaders12):
|
|
3227 |
case (ESmsIEISIMToolkitSecurityHeaders13):
|
|
3228 |
case (ESmsIEISIMToolkitSecurityHeaders14):
|
|
3229 |
case (ESmsIEISIMToolkitSecurityHeaders15):
|
|
3230 |
case (ESmsIEISIMToolkitSecurityHeaders16):
|
|
3231 |
if(informationelementlength !=0)
|
|
3232 |
User::Leave(KErrGsmSMSTpduNotSupported);
|
|
3233 |
break;
|
|
3234 |
default:
|
|
3235 |
break;
|
|
3236 |
}
|
|
3237 |
|
|
3238 |
const TPtrC8 data(aPdu.NextAndIncL(informationelementlength));
|
|
3239 |
NewDataL(informationelementlength);
|
|
3240 |
TPtr8 ptr(iData->Des());
|
|
3241 |
ptr.Copy(data);
|
|
3242 |
} // CSmsInformationElement::DecodeL
|
|
3243 |
|
|
3244 |
|
|
3245 |
void CSmsInformationElement::InternalizeL(RReadStream& aStream)
|
|
3246 |
{
|
|
3247 |
TSmsOctet id;
|
|
3248 |
aStream >> id;
|
|
3249 |
iIdentifier=static_cast<TSmsInformationElementIdentifier>((TInt)id);
|
|
3250 |
delete iData;
|
|
3251 |
iData=NULL;
|
|
3252 |
iData=HBufC8::NewL(aStream,CSmsUserData::KSmsMaxUserDataSize);
|
|
3253 |
} // CSmsInformationElement::InternalizeL
|
|
3254 |
|
|
3255 |
|
|
3256 |
void CSmsInformationElement::ExternalizeL(RWriteStream& aStream) const
|
|
3257 |
{
|
|
3258 |
TSmsOctet id;
|
|
3259 |
id=(TInt)iIdentifier;
|
|
3260 |
aStream << id;
|
|
3261 |
aStream << *iData;
|
|
3262 |
} // CSmsInformationElement::ExternalizeL
|
|
3263 |
|
|
3264 |
|
|
3265 |
void CSmsInformationElement::ConstructL(const TDesC8& aData)
|
|
3266 |
{
|
|
3267 |
LOGGSMU1("CSmsInformationElement::ConstructL()");
|
|
3268 |
|
|
3269 |
NewDataL(aData.Length());
|
|
3270 |
iData->Des().Copy(aData);
|
|
3271 |
} // CSmsInformationElement::ConstructL
|
|
3272 |
|
|
3273 |
|
|
3274 |
void CSmsInformationElement::NewDataL(TInt aLength)
|
|
3275 |
{
|
|
3276 |
LOGGSMU1("CSmsInformationElement::NewDataL()");
|
|
3277 |
|
|
3278 |
HBufC8* data=HBufC8::NewL(aLength);
|
|
3279 |
delete iData;
|
|
3280 |
iData=data;
|
|
3281 |
iData->Des().SetLength(aLength);
|
|
3282 |
} // CSmsInformationElement::NewDataL
|
|
3283 |
|
|
3284 |
|
|
3285 |
TUint CSmsInformationElement::Length()const
|
|
3286 |
{
|
|
3287 |
LOGGSMU1("CSmsInformationElement::Length()");
|
|
3288 |
|
|
3289 |
return 2+iData->Length(); // 2 stands for IEID and IEDL
|
|
3290 |
} // CSmsInformationElement::Length
|
|
3291 |
|
|
3292 |
|
|
3293 |
/**
|
|
3294 |
* @internalComponent
|
|
3295 |
*
|
|
3296 |
* This method maps an information element to an index into an array of categories.
|
|
3297 |
*
|
|
3298 |
* @param aId
|
|
3299 |
* The information Element Identifier.
|
|
3300 |
* @param aIndex
|
|
3301 |
* The index into the array of categories
|
|
3302 |
* @return
|
|
3303 |
* True if the information element can be mapped.
|
|
3304 |
* False otherwise.
|
|
3305 |
*/
|
|
3306 |
TBool TSmsInformationElementCategories::TranslateCategoryToIndex(TInformationElementId aId, TInt& aIndex)
|
|
3307 |
{
|
|
3308 |
LOGGSMU1("CSmsMessage::TranslateCategoryToIndex");
|
|
3309 |
|
|
3310 |
TBool rc = ETrue;
|
|
3311 |
|
|
3312 |
if (aId < CSmsInformationElement::ESmsIEMaximum)
|
|
3313 |
{
|
|
3314 |
switch (aId)
|
|
3315 |
{
|
|
3316 |
case CSmsInformationElement::ESmsIEIConcatenatedShortMessages8BitReference:
|
|
3317 |
case CSmsInformationElement::ESmsIEIConcatenatedShortMessages16BitReference:
|
|
3318 |
case CSmsInformationElement::ESmsIEISMSCControlParameters:
|
|
3319 |
case CSmsInformationElement::ESmsIEIRFC822EmailHeader:
|
|
3320 |
{
|
|
3321 |
aIndex = EIndexCtrlMandatoryInEveryPDUButWithValueSpecificToPDU;
|
|
3322 |
break;
|
|
3323 |
}
|
|
3324 |
case CSmsInformationElement::ESmsIEISpecialSMSMessageIndication:
|
|
3325 |
{
|
|
3326 |
aIndex = EIndexCtrlMandatoryInEveryPDUMultipleInstancesPerPDU;
|
|
3327 |
break;
|
|
3328 |
}
|
|
3329 |
case CSmsInformationElement::ESmsHyperLinkFormat:
|
|
3330 |
{
|
|
3331 |
aIndex = EIndexCtrlMultipleInstancesAllowed;
|
|
3332 |
break;
|
|
3333 |
}
|
|
3334 |
case CSmsInformationElement::ESmsNationalLanguageSingleShift:
|
|
3335 |
case CSmsInformationElement::ESmsNationalLanguageLockingShift:
|
|
3336 |
{
|
|
3337 |
aIndex = EIndexCtrlOptionalInEveryPDUWithValueSpecificToPDU;
|
|
3338 |
break;
|
|
3339 |
}
|
|
3340 |
case CSmsInformationElement::ESmsReplyAddressFormat:
|
|
3341 |
{
|
|
3342 |
aIndex = EIndexCtrlMandatoryIn1stPDUOnly;
|
|
3343 |
break;
|
|
3344 |
}
|
|
3345 |
case CSmsInformationElement::ESmsEnhanceVoiceMailInformation:
|
|
3346 |
{
|
|
3347 |
aIndex = EIndexCtrlSingleInstanceOnly;
|
|
3348 |
break;
|
|
3349 |
}
|
|
3350 |
case CSmsInformationElement::ESmsEnhancedTextFormatting:
|
|
3351 |
case CSmsInformationElement::ESmsEnhancedPredefinedSound:
|
|
3352 |
case CSmsInformationElement::ESmsEnhancedUserDefinedSound:
|
|
3353 |
case CSmsInformationElement::ESmsEnhancedPredefinedAnimation:
|
|
3354 |
case CSmsInformationElement::ESmsEnhancedLargeAnimation:
|
|
3355 |
case CSmsInformationElement::ESmsEnhancedSmallAnimation:
|
|
3356 |
case CSmsInformationElement::ESmsEnhancedLargePicture:
|
|
3357 |
case CSmsInformationElement::ESmsEnhancedSmallPicture:
|
|
3358 |
case CSmsInformationElement::ESmsEnhancedVariablePicture:
|
|
3359 |
case CSmsInformationElement::ESmsEnhancedUserPromptIndicator:
|
|
3360 |
case CSmsInformationElement::ESmsEnhancedExtendedObject:
|
|
3361 |
case CSmsInformationElement::ESmsEnhancedReusedExtendedObject:
|
|
3362 |
case CSmsInformationElement::ESmsEnhancedCompressionControl:
|
|
3363 |
case CSmsInformationElement::ESmsEnhancedODI:
|
|
3364 |
case CSmsInformationElement::ESmsEnhancedStandardWVG:
|
|
3365 |
case CSmsInformationElement::ESmsEnhancedCharacterSizeWVG:
|
|
3366 |
case CSmsInformationElement::ESmsEnhancedextendedObjectDataRequest:
|
|
3367 |
{
|
|
3368 |
aIndex = EIndexEmsInformationElement;
|
|
3369 |
break;
|
|
3370 |
}
|
|
3371 |
case CSmsInformationElement::ESmsIEIReserved:
|
|
3372 |
case CSmsInformationElement::ESmsIEIValueNotUsed:
|
|
3373 |
{
|
|
3374 |
rc = EFalse;
|
|
3375 |
break;
|
|
3376 |
}
|
|
3377 |
default:
|
|
3378 |
{
|
|
3379 |
aIndex = EIndexCtrlMandatoryInEveryPDUAndWithIdenticalValues;
|
|
3380 |
break;
|
|
3381 |
}
|
|
3382 |
}
|
|
3383 |
}
|
|
3384 |
else
|
|
3385 |
{
|
|
3386 |
rc = EFalse;
|
|
3387 |
LOGGSMU3("CSmsMessage::TranslateCategoryToIndex id = %d, found = %d", aId, rc);
|
|
3388 |
}
|
|
3389 |
return rc;
|
|
3390 |
} // TSmsInformationElementCategories::TranslateCategoryToIndex
|
|
3391 |
|
|
3392 |
|
|
3393 |
/**
|
|
3394 |
* @internalComponent
|
|
3395 |
*
|
|
3396 |
* This method gets an information element identifier's category.
|
|
3397 |
*
|
|
3398 |
* @param aId
|
|
3399 |
* The information Element Identifier.
|
|
3400 |
* @param aCategory
|
|
3401 |
* The category of information element.
|
|
3402 |
* @return
|
|
3403 |
* ETrue if successful, EFalse if an information identifier is unknown or cannot
|
|
3404 |
* be mapped.
|
|
3405 |
*/
|
|
3406 |
TBool TSmsInformationElementCategories::GetCategoryDefinition(TInformationElementId aId, TInformationElementCategory& aCategory)
|
|
3407 |
{
|
|
3408 |
LOGGSMU1("TSmsInformationElementCategories::GetCategoryDefinition");
|
|
3409 |
TInt index;
|
|
3410 |
|
|
3411 |
if (TranslateCategoryToIndex(aId,index))
|
|
3412 |
{
|
|
3413 |
aCategory = categories[index];
|
|
3414 |
}
|
|
3415 |
else
|
|
3416 |
{
|
|
3417 |
LOGGSMU2("TSmsInformationElementCategories::GetCategoryDefinition, Failure, aId = %d", aId);
|
|
3418 |
return EFalse;
|
|
3419 |
}
|
|
3420 |
|
|
3421 |
return ETrue;
|
|
3422 |
} // TSmsInformationElementCategories::GetCategoryDefinition
|
|
3423 |
|
|
3424 |
|
|
3425 |
const TSmsInformationElementCategories::TInformationElementCategory TSmsInformationElementCategories::categories[TSmsInformationElementCategories::ENumberOfIndices] =
|
|
3426 |
{
|
|
3427 |
TSmsInformationElementCategories::EEmsInformationElement, // EDefaultEMSIndex
|
|
3428 |
TSmsInformationElementCategories::ECtrlMandatoryInEveryPDUAndWithIdenticalValues, // EDefaultControlIndex
|
|
3429 |
TSmsInformationElementCategories::ECtrlMandatoryInEveryPDUMultipleInstancesPerPDU, // EIndexForSpecialSMSMessageIndication, Concatenated Short Messages
|
|
3430 |
TSmsInformationElementCategories::ECtrlMandatoryInEveryPDUButWithValueSpecificToPDU,// EIndexForIRFC822EmailHeader, Application Port Addresses
|
|
3431 |
TSmsInformationElementCategories::ECtrlMandatoryIn1stPDUOnly, // EIndexReplyAddressFormat
|
|
3432 |
TSmsInformationElementCategories::ECtrlSingleInstanceOnly, // EIndexEnhanceVoiceMailInformation
|
|
3433 |
TSmsInformationElementCategories::ECtrlMultipleInstancesAllowed // EIndexForHyperLinkFormat
|
|
3434 |
};
|
|
3435 |
|
|
3436 |
|
|
3437 |
CSmsUserData* CSmsUserData::NewL(CCnvCharacterSetConverter& aCharacterSetConverter,RFs& aFs,TSmsFirstOctet& aFirstOctet,const TSmsDataCodingScheme& aDataCodingScheme)
|
|
3438 |
{
|
|
3439 |
LOGGSMU1("CSmsUserData::NewL()");
|
|
3440 |
|
|
3441 |
CSmsUserData* userdata=new(ELeave) CSmsUserData(aCharacterSetConverter,aFs,aFirstOctet,aDataCodingScheme);
|
|
3442 |
CleanupStack::PushL(userdata);
|
|
3443 |
userdata->ConstructL();
|
|
3444 |
CleanupStack::Pop();
|
|
3445 |
return userdata;
|
|
3446 |
} // CSmsUserData::NewL
|
|
3447 |
|
|
3448 |
|
|
3449 |
/**
|
|
3450 |
* Destructor.
|
|
3451 |
*/
|
|
3452 |
CSmsUserData::~CSmsUserData()
|
|
3453 |
{
|
|
3454 |
iInformationElementArray.ResetAndDestroy();
|
|
3455 |
delete iBody;
|
|
3456 |
} // CSmsUserData::NewL
|
|
3457 |
|
|
3458 |
|
|
3459 |
/**
|
|
3460 |
* Gets an information element by index.
|
|
3461 |
*
|
|
3462 |
* @param aIndex Index of the information element within the User Data
|
|
3463 |
* @return Information element
|
|
3464 |
* @capability None
|
|
3465 |
*/
|
|
3466 |
EXPORT_C CSmsInformationElement& CSmsUserData::InformationElement(TInt aIndex) const
|
|
3467 |
{
|
|
3468 |
LOGGSMU1("CSmsUserData::InformationElement()");
|
|
3469 |
|
|
3470 |
return *iInformationElementArray[aIndex];
|
|
3471 |
} // CSmsUserData::InformationElement
|
|
3472 |
|
|
3473 |
|
|
3474 |
CSmsInformationElement*& CSmsUserData::InformationElementPtr(TInt aIndex)
|
|
3475 |
{
|
|
3476 |
LOGGSMU1("CSmsUserData::InformationElementPtr()");
|
|
3477 |
|
|
3478 |
return iInformationElementArray[aIndex];
|
|
3479 |
} // CSmsUserData::InformationElementPtr
|
|
3480 |
|
|
3481 |
|
|
3482 |
/**
|
|
3483 |
* Gets the index of an information element.
|
|
3484 |
*
|
|
3485 |
* @param aIdentifier An information element Identifier to search for
|
|
3486 |
* @param aIndex The index within the User Data of the information element (if
|
|
3487 |
* found). If more than 1 instance of this information element exists, then
|
|
3488 |
* the 1st instance will be returned.
|
|
3489 |
*
|
|
3490 |
* Use InformationELementIndexL to get all elements.
|
|
3491 |
* @return True if aIdentifier is found in the User Data
|
|
3492 |
* @capability None
|
|
3493 |
*/
|
|
3494 |
EXPORT_C TBool CSmsUserData::InformationElementIndex(CSmsInformationElement::TSmsInformationElementIdentifier aIdentifier,TInt& aIndex) const
|
|
3495 |
{
|
|
3496 |
LOGGSMU1("CSmsUserData::InformationElementIndex()");
|
|
3497 |
|
|
3498 |
TBool found=EFalse;
|
|
3499 |
TInt count=NumInformationElements();
|
|
3500 |
for (TInt i=0; (!found) && (i<count); i++)
|
|
3501 |
if (InformationElement(i).Identifier()==aIdentifier)
|
|
3502 |
{
|
|
3503 |
found=ETrue;
|
|
3504 |
aIndex=i;
|
|
3505 |
}
|
|
3506 |
return found;
|
|
3507 |
} // CSmsUserData::InformationElementIndex
|
|
3508 |
|
|
3509 |
|
|
3510 |
/**
|
|
3511 |
* Gets the last index of an information element.
|
|
3512 |
*
|
|
3513 |
* @param aIdentifier An information element Identifier to search for
|
|
3514 |
* @param aIndex The index within the User Data of the information element (if
|
|
3515 |
* found). If more than 1 instance of this information element exists, then
|
|
3516 |
* the last instance will be returned.
|
|
3517 |
*
|
|
3518 |
* Use InformationELementIndexL to get all elements.
|
|
3519 |
* @return True if aIdentifier is found in the User Data
|
|
3520 |
* @capability None
|
|
3521 |
*/
|
|
3522 |
EXPORT_C TBool CSmsUserData::InformationElementLastIndex(CSmsInformationElement::TSmsInformationElementIdentifier aIdentifier,TInt& aIndex) const
|
|
3523 |
{
|
|
3524 |
LOGGSMU1("CSmsUserData::InformationElementLastIndex()");
|
|
3525 |
|
|
3526 |
TBool found=EFalse;
|
|
3527 |
TInt count=NumInformationElements();
|
|
3528 |
for (TInt i=count-1; (!found) && (i>=0); i--)
|
|
3529 |
if (InformationElement(i).Identifier()==aIdentifier)
|
|
3530 |
{
|
|
3531 |
found=ETrue;
|
|
3532 |
aIndex=i;
|
|
3533 |
}
|
|
3534 |
return found;
|
|
3535 |
} // CSmsUserData::InformationElementLastIndex
|
|
3536 |
|
|
3537 |
|
|
3538 |
/**
|
|
3539 |
* @internalComponent
|
|
3540 |
*
|
|
3541 |
* Locates every information element of type aIdentifier and
|
|
3542 |
* stores its location index in the output array aIndices.
|
|
3543 |
*
|
|
3544 |
* @param aIdentifer
|
|
3545 |
* The information element Identifier to search for
|
|
3546 |
* @param aIndices
|
|
3547 |
* A collection containing the location index for each information element of this type.
|
|
3548 |
*/
|
|
3549 |
void CSmsUserData::InformationElementIndicesL(CSmsInformationElement::TSmsInformationElementIdentifier aIdentifier, CArrayFixFlat<TInt>& aIndices) const
|
|
3550 |
{
|
|
3551 |
LOGGSMU1("CSmsUserData::InformationElementIndicesL()");
|
|
3552 |
|
|
3553 |
aIndices.Reset();
|
|
3554 |
|
|
3555 |
TInt count=NumInformationElements();
|
|
3556 |
for (TInt i=0; i<count; i++)
|
|
3557 |
{
|
|
3558 |
if (InformationElement(i).Identifier()==aIdentifier)
|
|
3559 |
{
|
|
3560 |
aIndices.AppendL(i);
|
|
3561 |
}
|
|
3562 |
}
|
|
3563 |
} // CSmsUserData::InformationElementIndicesL
|
|
3564 |
|
|
3565 |
|
|
3566 |
/**
|
|
3567 |
* Note that whilst a pointer to the aIe is passed as an
|
|
3568 |
* input argument, the information element is still owned
|
|
3569 |
* by the calling function, regardless of the return code.
|
|
3570 |
* @param aInformationElement An EMS Information Element
|
|
3571 |
*/
|
|
3572 |
TBool CSmsUserData::EmsInformationElementWillFitL(CEmsInformationElement* aIe,CSmsEMSBufferSegmenter& aSeg,TUint& aCharsAddedToCurrentPDU)
|
|
3573 |
{
|
|
3574 |
LOGGSMU1("CSmsUserData::EmsInformationElementWillFitL()");
|
|
3575 |
|
|
3576 |
// Before using an EmsInformationElement polymorphically as an SmsIE,
|
|
3577 |
// we need to make sure that the IE has been encoded
|
|
3578 |
aIe->EncodeInformationElementL();
|
|
3579 |
iInformationElementArray.AppendL(aIe);
|
|
3580 |
|
|
3581 |
TInt sizeLeft=MaxPackedUDUnitsInBodyRemaining();
|
|
3582 |
iInformationElementArray.Delete(iInformationElementArray.Count()-1);
|
|
3583 |
if(sizeLeft==0 && iBody && (iBody->Length() > 0) && (*iBody)[iBody->Length()-1] == KSms7BitAlphabetEscapeChar)
|
|
3584 |
{
|
|
3585 |
--aCharsAddedToCurrentPDU;
|
|
3586 |
--aSeg.iElementsExtracted;
|
|
3587 |
TPtr8 ptr(iBody->Des());
|
|
3588 |
ptr.Delete(iBody->Length()-1,1);
|
|
3589 |
--sizeLeft;
|
|
3590 |
}
|
|
3591 |
return sizeLeft>=0;
|
|
3592 |
} // CSmsUserData::EmsInformationElementWillFitL
|
|
3593 |
|
|
3594 |
|
|
3595 |
/**
|
|
3596 |
* Tests whether the control information element will fit in the current PDU.
|
|
3597 |
*
|
|
3598 |
* Note that whilst a pointer to the aIe is passed as an
|
|
3599 |
* input argument, the information element is still owned
|
|
3600 |
* by the calling function, regardless of the return code.
|
|
3601 |
*
|
|
3602 |
* @param aInformationElement A pointer to an information Element
|
|
3603 |
* @capability None
|
|
3604 |
*/
|
|
3605 |
TBool CSmsUserData::ControlInformationElementWillFitL(CSmsInformationElement* aIe)
|
|
3606 |
{
|
|
3607 |
LOGGSMU1("CSmsUserData::ControlInformationElementWillFitL()");
|
|
3608 |
|
|
3609 |
if (aIe == NULL)
|
|
3610 |
{
|
|
3611 |
User::Leave(KErrGeneral);
|
|
3612 |
}
|
|
3613 |
|
|
3614 |
TSmsInformationElementCategories::TInformationElementCategory category;
|
|
3615 |
|
|
3616 |
if (TSmsInformationElementCategories::GetCategoryDefinition(aIe->Identifier(), category) == EFalse ||
|
|
3617 |
category == TSmsInformationElementCategories::EEmsInformationElement)
|
|
3618 |
{
|
|
3619 |
User::Leave(KErrArgument);
|
|
3620 |
}
|
|
3621 |
|
|
3622 |
iInformationElementArray.AppendL(aIe);
|
|
3623 |
|
|
3624 |
TInt sizeLeft=MaxPackedUDUnitsInBodyRemaining();
|
|
3625 |
iInformationElementArray.Delete(iInformationElementArray.Count()-1);
|
|
3626 |
|
|
3627 |
// Not considering whether escape characters exist in the buffer
|
|
3628 |
// as control information elements do not add text to the buffer.
|
|
3629 |
|
|
3630 |
return sizeLeft>=0;
|
|
3631 |
} // CSmsUserData::ControlInformationElementWillFitL
|
|
3632 |
|
|
3633 |
|
|
3634 |
/**
|
|
3635 |
* Adds an information element.
|
|
3636 |
* This method can be used to create information elements in the range:
|
|
3637 |
* 00 - 09 - i.e. Control Information Elements
|
|
3638 |
* It can be used to create information elements in the following ranges
|
|
3639 |
* (on the assumption that the information element is intended to be encoded into
|
|
3640 |
* every PDU):
|
|
3641 |
* 24 - 25 - i.e. National Language Encodings
|
|
3642 |
* 70 - 7F - i.e. SIM Tool Kit Security Headers
|
|
3643 |
* 80 - 9F - i.e SMS to SME specific use
|
|
3644 |
* C0 - CF - i.e. SC specific use
|
|
3645 |
*
|
|
3646 |
* Information elements in the following ranges should not be
|
|
3647 |
* added using this interface. Instead they should be added using
|
|
3648 |
* the following identified interfaces:
|
|
3649 |
* 0A-1F - Use the interfaces provided to support EMS Elements
|
|
3650 |
* 20 - Use the interfaces provided for Email in CSmsMessage
|
|
3651 |
* 21 - Use the interface provided by CSmsHyperLinkOperations
|
|
3652 |
* 22 - Use the interface provided by CSmsReplyAddressOperations
|
|
3653 |
* 23 - Use the interface provided by CSmsEnhancedVoiceMailOperations
|
|
3654 |
*
|
|
3655 |
* This interface should not be used for information element in the following
|
|
3656 |
* ranges, these are reserved for future use in TS23.040 V6.5.0 and their
|
|
3657 |
* characteristics and repeatability have not yet been defined.
|
|
3658 |
* 26-6F
|
|
3659 |
* A0-BF
|
|
3660 |
* E0-FF
|
|
3661 |
*
|
|
3662 |
* @param aIdentifier An information element Identifier for aData
|
|
3663 |
* @param aData The information element to add to the User Data
|
|
3664 |
* @leave
|
|
3665 |
* KErrNotSupported if the information element is not supported via this interface.
|
|
3666 |
* @capability None
|
|
3667 |
*/
|
|
3668 |
EXPORT_C void CSmsUserData::AddInformationElementL(TSmsId aIdentifier,const TDesC8& aData)
|
|
3669 |
{
|
|
3670 |
LOGGSMU1("CSmsUserData::AddInformationElementL");
|
|
3671 |
|
|
3672 |
if ((aIdentifier >= 0x21) && (aIdentifier <= 0x23) ||
|
|
3673 |
(aIdentifier >= 0x26) && (aIdentifier <= 0x6F) ||
|
|
3674 |
(aIdentifier >= 0xA0) && (aIdentifier <= 0xBF) ||
|
|
3675 |
(aIdentifier >= 0xE0) && (aIdentifier <= 0xFF))
|
|
3676 |
{
|
|
3677 |
User::Leave(KErrNotSupported);
|
|
3678 |
}
|
|
3679 |
UpdateInformationElementArrayL(aIdentifier, aData);
|
|
3680 |
|
|
3681 |
} // CSmsUserData::AddInformationElementL
|
|
3682 |
|
|
3683 |
|
|
3684 |
/**
|
|
3685 |
* @internalComponent
|
|
3686 |
*
|
|
3687 |
* Either adds an information element to
|
|
3688 |
* iInformationElementArray.
|
|
3689 |
*
|
|
3690 |
* @param aIdentifier An information element Identifier for aData
|
|
3691 |
* @param aData The information element to add to the User Data
|
|
3692 |
*/
|
|
3693 |
void CSmsUserData::UpdateInformationElementArrayL(TSmsId aIdentifier,const TDesC8& aData)
|
|
3694 |
{
|
|
3695 |
LOGGSMU1("CSmsUserData::UpdateInformationElementsL");
|
|
3696 |
|
|
3697 |
TInt count=NumInformationElements();
|
|
3698 |
if(!CEmsFactory::Supported(aIdentifier))
|
|
3699 |
{
|
|
3700 |
for (TInt i=0; i<count; i++)
|
|
3701 |
{
|
|
3702 |
if (InformationElement(i).Identifier()==aIdentifier)
|
|
3703 |
{
|
|
3704 |
TSmsInformationElementCategories::TInformationElementCategory category;
|
|
3705 |
|
|
3706 |
if (TSmsInformationElementCategories::GetCategoryDefinition(aIdentifier, category) == EFalse)
|
|
3707 |
{
|
|
3708 |
User::Leave(KErrArgument);
|
|
3709 |
}
|
|
3710 |
|
|
3711 |
switch (category)
|
|
3712 |
{
|
|
3713 |
case TSmsInformationElementCategories::ECtrlMandatoryInEveryPDUMultipleInstancesPerPDU:
|
|
3714 |
{
|
|
3715 |
if (InformationElement(i).Identifier() == CSmsInformationElement::ESmsIEISpecialSMSMessageIndication)
|
|
3716 |
{
|
|
3717 |
LOGGSMU3("CSmsUserData::AddInformationElementL1 category = %d, identifier = %d",category,aIdentifier);
|
|
3718 |
|
|
3719 |
//if Msg type is the same, swap with the most recent value
|
|
3720 |
if ((InformationElement(i).Data()[0] & ((TUint8) EGsmSmsSpecialMessageIndicationTypeMask)) ==
|
|
3721 |
(aData[0] & ((TUint8) EGsmSmsSpecialMessageIndicationTypeMask)))
|
|
3722 |
{
|
|
3723 |
User::Leave(KErrAlreadyExists);
|
|
3724 |
}
|
|
3725 |
}
|
|
3726 |
else
|
|
3727 |
{
|
|
3728 |
LOGGSMU4("CSmsUserData::AddInformationElementL3 category = %d, identifier = %d, data = %S",category,aIdentifier, &aData);
|
|
3729 |
User::Leave(KErrArgument);
|
|
3730 |
}
|
|
3731 |
break;
|
|
3732 |
}
|
|
3733 |
case TSmsInformationElementCategories::ECtrlMandatoryInEveryPDUAndWithIdenticalValues:
|
|
3734 |
case TSmsInformationElementCategories::ECtrlMandatoryIn1stPDUOnly:
|
|
3735 |
case TSmsInformationElementCategories::ECtrlSingleInstanceOnly:
|
|
3736 |
{
|
|
3737 |
LOGGSMU3("CSmsUserData::AddInformationElementL4 category = %d, identifier = %d",category,aIdentifier);
|
|
3738 |
User::Leave(KErrAlreadyExists);
|
|
3739 |
break;
|
|
3740 |
}
|
|
3741 |
case TSmsInformationElementCategories::ECtrlMultipleInstancesAllowed:
|
|
3742 |
{
|
|
3743 |
LOGGSMU3("CSmsUserData::AddInformationElementL5 category = %d, identifier = %d",category,aIdentifier);
|
|
3744 |
break;
|
|
3745 |
}
|
|
3746 |
case TSmsInformationElementCategories::ECtrlMandatoryInEveryPDUButWithValueSpecificToPDU:
|
|
3747 |
{
|
|
3748 |
LOGGSMU3("CSmsUserData::AddInformationElementL6 category = %d, identifier = %d",category,aIdentifier);
|
|
3749 |
User::Leave(KErrAlreadyExists);
|
|
3750 |
// currently the email header is updated in:
|
|
3751 |
// void CSmsMessage::DecodeBufferL(CArrayPtr<CSmsPDU>& aSmsPDUArray,CSmsBufferBase& aBuffer)
|
|
3752 |
break;
|
|
3753 |
}
|
|
3754 |
default:
|
|
3755 |
{
|
|
3756 |
LOGGSMU3("CSmsUserData::AddInformationElementL8 category = %d, identifier = %d",category,aIdentifier);
|
|
3757 |
User::Leave(KErrNotSupported);
|
|
3758 |
break;
|
|
3759 |
}
|
|
3760 |
}
|
|
3761 |
}
|
|
3762 |
}
|
|
3763 |
}
|
|
3764 |
|
|
3765 |
CSmsInformationElement* informationElement=CSmsInformationElement::NewL(aIdentifier,aData);
|
|
3766 |
CleanupStack::PushL(informationElement);
|
|
3767 |
iInformationElementArray.AppendL(informationElement);
|
|
3768 |
CleanupStack::Pop();
|
|
3769 |
SetHeaderPresent(ETrue);
|
|
3770 |
} // CSmsUserData::UpdateInformationElementArrayL
|
|
3771 |
|
|
3772 |
|
|
3773 |
void CSmsUserData::AddEmsInformationElementL(CEmsInformationElement* aIe)
|
|
3774 |
{
|
|
3775 |
LOGGSMU1("CSmsUserData::AddEmsInformationElementL()");
|
|
3776 |
|
|
3777 |
// Before using an EmsInformationElement polymorphically as an SmsIE,
|
|
3778 |
// we need to make sure that the IE has been encoded
|
|
3779 |
aIe->EncodeInformationElementL();
|
|
3780 |
iInformationElementArray.AppendL(aIe);
|
|
3781 |
SetHeaderPresent(ETrue);
|
|
3782 |
} // CSmsUserData::AddEmsInformationElementL
|
|
3783 |
|
|
3784 |
|
|
3785 |
/**
|
|
3786 |
* Removes an information element at the specified index.
|
|
3787 |
*
|
|
3788 |
* @param aIndex Information element index
|
|
3789 |
* @capability None
|
|
3790 |
*/
|
|
3791 |
EXPORT_C void CSmsUserData::RemoveInformationElement(TInt aIndex)
|
|
3792 |
{
|
|
3793 |
LOGGSMU1("CSmsUserData::RemoveInformationElement()");
|
|
3794 |
// Since iInformationElementArray[aIndex] pointer is removed from iInformationElementArray, there is no double free issue.
|
|
3795 |
// coverity[double_free]
|
|
3796 |
delete iInformationElementArray[aIndex];
|
|
3797 |
iInformationElementArray[aIndex] = NULL;
|
|
3798 |
iInformationElementArray.Delete(aIndex);
|
|
3799 |
|
|
3800 |
if (NumInformationElements()==0)
|
|
3801 |
{
|
|
3802 |
SetHeaderPresent(EFalse);
|
|
3803 |
}
|
|
3804 |
} // CSmsUserData::RemoveInformationElement
|
|
3805 |
|
|
3806 |
|
|
3807 |
TInt CSmsUserData::MaxPackedUDUnitsInBodyRemaining() const
|
|
3808 |
{
|
|
3809 |
LOGGSMU1("CSmsUserData::MaxPackedUDUnitsInBodyRemaining()");
|
|
3810 |
|
|
3811 |
TInt totalHeaderLengthInUDLUnits=TotalHeaderLengthInUDLUnits();
|
|
3812 |
TInt maxPackedUDUnitsInBody=0;
|
|
3813 |
if (iDataCodingScheme.TextCompressed()||(iDataCodingScheme.Alphabet()!=TSmsDataCodingScheme::ESmsAlphabet7Bit))
|
|
3814 |
{
|
|
3815 |
maxPackedUDUnitsInBody=KSmsMaxUserDataSize-totalHeaderLengthInUDLUnits;
|
|
3816 |
if (iDataCodingScheme.Alphabet()==TSmsDataCodingScheme::ESmsAlphabetUCS2)
|
|
3817 |
{
|
|
3818 |
// Cannot split unicode character across PDU boundary
|
|
3819 |
maxPackedUDUnitsInBody&=~1;
|
|
3820 |
}
|
|
3821 |
}
|
|
3822 |
else // 7-bit
|
|
3823 |
{
|
|
3824 |
maxPackedUDUnitsInBody=(8*KSmsMaxUserDataSize)/7-totalHeaderLengthInUDLUnits;
|
|
3825 |
}
|
|
3826 |
|
|
3827 |
if (iBody)
|
|
3828 |
return maxPackedUDUnitsInBody-=iBody->Length();
|
|
3829 |
return maxPackedUDUnitsInBody;
|
|
3830 |
} // CSmsUserData::MaxPackedUDUnitsInBodyRemaining
|
|
3831 |
|
|
3832 |
|
|
3833 |
TInt CSmsUserData::MaxPackedUDUnitsInBodyRemaining(TUint aIELen) const
|
|
3834 |
{
|
|
3835 |
LOGGSMU1("CSmsUserData::MaxPackedUDUnitsInBodyRemaining()");
|
|
3836 |
|
|
3837 |
TInt totalHeaderLengthInUDLUnits=TotalHeaderLengthInUDLUnits(aIELen);
|
|
3838 |
TInt maxPackedUDUnitsInBody=0;
|
|
3839 |
if (iDataCodingScheme.TextCompressed()||(iDataCodingScheme.Alphabet()!=TSmsDataCodingScheme::ESmsAlphabet7Bit))
|
|
3840 |
{
|
|
3841 |
maxPackedUDUnitsInBody=KSmsMaxUserDataSize-totalHeaderLengthInUDLUnits;
|
|
3842 |
if (iDataCodingScheme.Alphabet()==TSmsDataCodingScheme::ESmsAlphabetUCS2)
|
|
3843 |
{
|
|
3844 |
// Cannot split unicode character across PDU boundary
|
|
3845 |
maxPackedUDUnitsInBody&=~1;
|
|
3846 |
}
|
|
3847 |
}
|
|
3848 |
else // 7-bit
|
|
3849 |
{
|
|
3850 |
maxPackedUDUnitsInBody=(8*KSmsMaxUserDataSize)/7-totalHeaderLengthInUDLUnits;
|
|
3851 |
}
|
|
3852 |
|
|
3853 |
if (iBody)
|
|
3854 |
return maxPackedUDUnitsInBody-=iBody->Length();
|
|
3855 |
return maxPackedUDUnitsInBody;
|
|
3856 |
} // CSmsUserData::MaxPackedUDUnitsInBodyRemaining
|
|
3857 |
|
|
3858 |
|
|
3859 |
/**
|
|
3860 |
* @capability None
|
|
3861 |
*/
|
|
3862 |
EXPORT_C TInt CSmsUserData::MaxBodyLengthInChars() const
|
|
3863 |
{
|
|
3864 |
LOGGSMU1("CSmsUserData::MaxBodyLengthInChars()");
|
|
3865 |
|
|
3866 |
TInt totalheaderlengthinudlunits=TotalHeaderLengthInUDLUnits();
|
|
3867 |
TInt maxbodylengthinchars=0;
|
|
3868 |
if (iDataCodingScheme.TextCompressed())
|
|
3869 |
{
|
|
3870 |
maxbodylengthinchars=KSmsMaxUserDataSize-totalheaderlengthinudlunits;
|
|
3871 |
}
|
|
3872 |
else
|
|
3873 |
{
|
|
3874 |
switch (iDataCodingScheme.Alphabet())
|
|
3875 |
{
|
|
3876 |
case (TSmsDataCodingScheme::ESmsAlphabet7Bit):
|
|
3877 |
{
|
|
3878 |
maxbodylengthinchars=(8*KSmsMaxUserDataSize)/7-totalheaderlengthinudlunits;
|
|
3879 |
break;
|
|
3880 |
}
|
|
3881 |
case (TSmsDataCodingScheme::ESmsAlphabet8Bit):
|
|
3882 |
{
|
|
3883 |
maxbodylengthinchars=KSmsMaxUserDataSize-totalheaderlengthinudlunits;
|
|
3884 |
break;
|
|
3885 |
}
|
|
3886 |
case (TSmsDataCodingScheme::ESmsAlphabetUCS2):
|
|
3887 |
{
|
|
3888 |
maxbodylengthinchars=(KSmsMaxUserDataSize-totalheaderlengthinudlunits)/2;
|
|
3889 |
break;
|
|
3890 |
}
|
|
3891 |
default:
|
|
3892 |
LOGGSMU1("CSmsUserData::MaxBodyLengthInChars() WARNING! default case has been reached");
|
|
3893 |
break;
|
|
3894 |
}
|
|
3895 |
}
|
|
3896 |
return maxbodylengthinchars;
|
|
3897 |
} // CSmsUserData::MaxBodyLengthInChars
|
|
3898 |
|
|
3899 |
|
|
3900 |
/**
|
|
3901 |
* Gets the unpacked User Data Elements.
|
|
3902 |
*
|
|
3903 |
* @return Unpacked User Data Elements
|
|
3904 |
* @capability None
|
|
3905 |
*/
|
|
3906 |
EXPORT_C TPtrC8 CSmsUserData::Body() const
|
|
3907 |
{
|
|
3908 |
LOGGSMU1("CSmsUserData::Body()");
|
|
3909 |
|
|
3910 |
return iBody->Des();
|
|
3911 |
} // CSmsUserData::Body
|
|
3912 |
|
|
3913 |
|
|
3914 |
/**
|
|
3915 |
* Sets the User Data (unpacked).
|
|
3916 |
*
|
|
3917 |
* @param aBody Unpacked User Data Elements
|
|
3918 |
* @capability None
|
|
3919 |
*/
|
|
3920 |
EXPORT_C void CSmsUserData::SetBodyL(const TDesC8& aBody)
|
|
3921 |
{
|
|
3922 |
LOGGSMU1("CSmsUserData::SetBodyL()");
|
|
3923 |
|
|
3924 |
//Some tests fail with this line in, despite it being a valid condition!
|
|
3925 |
//__ASSERT_DEBUG(aBody.Length() <= MaxBodyLengthInChars(), User::Leave(KErrTooBig));
|
|
3926 |
|
|
3927 |
NewBodyL(aBody.Length());
|
|
3928 |
iBody->Des().Copy(aBody);
|
|
3929 |
} // CSmsUserData::SetBodyL
|
|
3930 |
|
|
3931 |
|
|
3932 |
void CSmsUserData::AppendBodyL(const TDesC8& aBody)
|
|
3933 |
{
|
|
3934 |
LOGGSMU1("CSmsUserData::AppendBodyL()");
|
|
3935 |
|
|
3936 |
if (iBody)
|
|
3937 |
{
|
|
3938 |
//Some tests fail with this line in, despite it being a valid condition!
|
|
3939 |
//__ASSERT_DEBUG(aBody.Length() + iBody->Length() <= MaxBodyLengthInChars(), User::Leave(KErrTooBig));
|
|
3940 |
|
|
3941 |
iBody = iBody->ReAllocL(aBody.Length()+iBody->Length());
|
|
3942 |
iBody->Des().Append(aBody);
|
|
3943 |
}
|
|
3944 |
else
|
|
3945 |
{
|
|
3946 |
SetBodyL(aBody);
|
|
3947 |
}
|
|
3948 |
} // CSmsUserData::AppendBodyL
|
|
3949 |
|
|
3950 |
|
|
3951 |
/**
|
|
3952 |
* Tests if the character is supported by the current character set.
|
|
3953 |
* This function can be used with 7bit and 8bit alphabets.
|
|
3954 |
*
|
|
3955 |
* @param aChar Character to investigate.
|
|
3956 |
*
|
|
3957 |
* @return ETrue if the character is supported.
|
|
3958 |
*
|
|
3959 |
* @note Since the function is based on the old behaviour (pre-PREQ2090)
|
|
3960 |
* it does not accept a downgraded character or alternative encoding
|
|
3961 |
* as being supported.
|
|
3962 |
*
|
|
3963 |
* @capability None
|
|
3964 |
*/
|
|
3965 |
EXPORT_C TBool CSmsUserData::IsSupportedL(TChar aChar)
|
|
3966 |
{
|
|
3967 |
LOGGSMU1("CSmsUserData::IsSupportedL()");
|
|
3968 |
|
|
3969 |
CSmsAlphabetConverter* converter=CSmsAlphabetConverter::NewLC(iCharacterSetConverter,iFs,iDataCodingScheme.Alphabet(),IsBinaryData());
|
|
3970 |
TBool result=converter->IsSupportedL(aChar);
|
|
3971 |
CleanupStack::PopAndDestroy();
|
|
3972 |
|
|
3973 |
return result;
|
|
3974 |
} // CSmsUserData::IsSupportedL
|
|
3975 |
|
|
3976 |
|
|
3977 |
/**
|
|
3978 |
* Tests if the descriptor text is supported by the current character set.
|
|
3979 |
* This function can be used with 7bit and 8bit alphabets.
|
|
3980 |
*
|
|
3981 |
* @param aDes Text string to check.
|
|
3982 |
* @param aNumberOfUnconvertibleCharacters Exit param for the number of
|
|
3983 |
* characters unconvertible.
|
|
3984 |
* @param aIndexOfFirstUnconvertibleCharacter Exit param for the first
|
|
3985 |
* unconverted character.
|
|
3986 |
*
|
|
3987 |
* @return ETrue if the character is supported.
|
|
3988 |
*
|
|
3989 |
* @capability None
|
|
3990 |
*/
|
|
3991 |
EXPORT_C TBool CSmsUserData::IsSupportedL(const TDesC& aDes, TInt& aNumberOfUnconvertibleCharacters,
|
|
3992 |
TInt& aIndexOfFirstUnconvertibleCharacter) const
|
|
3993 |
{
|
|
3994 |
LOGGSMU1("[1] CSmsUserData::IsSupportedL()");
|
|
3995 |
|
|
3996 |
CSmsAlphabetConverter* converter=CSmsAlphabetConverter::NewLC(iCharacterSetConverter,iFs,iDataCodingScheme.Alphabet(),IsBinaryData());
|
|
3997 |
TBool result=converter->IsSupportedL(aDes, aNumberOfUnconvertibleCharacters,
|
|
3998 |
aIndexOfFirstUnconvertibleCharacter);
|
|
3999 |
CleanupStack::PopAndDestroy();
|
|
4000 |
|
|
4001 |
return result;
|
|
4002 |
} // CSmsUserData::IsSupportedL
|
|
4003 |
|
|
4004 |
|
|
4005 |
/**
|
|
4006 |
* Tests if the descriptor text is supported by the current character set.
|
|
4007 |
* This function can be used with 7bit and 8bit alphabets.
|
|
4008 |
*
|
|
4009 |
* @param aDes Text string to check.
|
|
4010 |
* @param aEncoding Alternative encoding method.
|
|
4011 |
* @param aNumberOfUnconvertibleCharacters Exit param for the number of
|
|
4012 |
* characters unconvertible.
|
|
4013 |
* @param aNumberOfDowngradedCharacters Exit param for the number of
|
|
4014 |
* downgraded characters.
|
|
4015 |
* @param aNumberRequiringAlternativeEncoding Exit param for the number of
|
|
4016 |
* characters requiring use of
|
|
4017 |
* the alternative encoder.
|
|
4018 |
* @param aIndexOfFirstUnconvertibleCharacter Exit param for the first
|
|
4019 |
* unconverted character.
|
|
4020 |
*
|
|
4021 |
* @return ETrue if the character is supported.
|
|
4022 |
*
|
|
4023 |
* @capability None
|
|
4024 |
*/
|
|
4025 |
EXPORT_C TBool CSmsUserData::IsSupportedL(const TDesC& aDes, TSmsEncoding aEncoding,
|
|
4026 |
TInt& aNumberOfUnconvertibleCharacters,
|
|
4027 |
TInt& aNumberOfDowngradedCharacters,
|
|
4028 |
TInt& aNumberRequiringAlternativeEncoding,
|
|
4029 |
TInt& aIndexOfFirstUnconvertibleCharacter) const
|
|
4030 |
{
|
|
4031 |
LOGGSMU1("[2] CSmsUserData::IsSupportedL()");
|
|
4032 |
|
|
4033 |
CSmsAlphabetConverter* converter=CSmsAlphabetConverter::NewLC(iCharacterSetConverter,iFs,iDataCodingScheme.Alphabet(),IsBinaryData());
|
|
4034 |
TBool result=converter->IsSupportedL(aDes, aEncoding,
|
|
4035 |
aNumberOfUnconvertibleCharacters,
|
|
4036 |
aNumberOfDowngradedCharacters,
|
|
4037 |
aNumberRequiringAlternativeEncoding,
|
|
4038 |
aIndexOfFirstUnconvertibleCharacter);
|
|
4039 |
CleanupStack::PopAndDestroy();
|
|
4040 |
|
|
4041 |
return result;
|
|
4042 |
} // CSmsUserData::IsSupportedL
|
|
4043 |
|
|
4044 |
|
|
4045 |
TUint8* CSmsUserData::EncodeL(TUint8* aPtr) const
|
|
4046 |
{
|
|
4047 |
LOGGSMU1("CSmsUserData::EncodeL()");
|
|
4048 |
|
|
4049 |
__ASSERT_DEBUG(0<=MaxPackedUDUnitsInBodyRemaining(),Panic(KGsmuPanicUserDataBodyTooLong));
|
|
4050 |
// Encode the user data length
|
|
4051 |
TInt totalHeaderLengthInUDLUnits=TotalHeaderLengthInUDLUnits();
|
|
4052 |
TSmsOctet userDataLength=totalHeaderLengthInUDLUnits+TSmsOctet(BodyLengthInUDLUnits());
|
|
4053 |
aPtr=userDataLength.EncodeL(aPtr);
|
|
4054 |
// Encode any user data header
|
|
4055 |
if (HeaderPresent())
|
|
4056 |
{
|
|
4057 |
TSmsOctet headerLength=HeaderLength();
|
|
4058 |
aPtr=headerLength.EncodeL(aPtr);
|
|
4059 |
TInt numInformationElements=NumInformationElements();
|
|
4060 |
for (TInt i=0; i<numInformationElements; i++)
|
|
4061 |
aPtr=iInformationElementArray[i]->EncodeL(aPtr);
|
|
4062 |
}
|
|
4063 |
// Pack the user data body
|
|
4064 |
TInt startBit=0;
|
|
4065 |
if (iDataCodingScheme.Alphabet()==TSmsDataCodingScheme::ESmsAlphabet7Bit)
|
|
4066 |
startBit=(totalHeaderLengthInUDLUnits*7)%8;
|
|
4067 |
TSmsAlphabetPacker packer(iDataCodingScheme.Alphabet(),IsBinaryData(),startBit);
|
|
4068 |
TPtr8 ptr((TUint8*)aPtr,0,packer.PackedOctetsRequiredL(Body().Length()));
|
|
4069 |
aPtr+=packer.PackL(ptr,Body());
|
|
4070 |
return aPtr;
|
|
4071 |
} // CSmsUserData::EncodeL
|
|
4072 |
|
|
4073 |
|
|
4074 |
void CSmsUserData::DecodeL(TGsmuLex8& aPdu)
|
|
4075 |
{
|
|
4076 |
DecodeL(aPdu, EFalse);
|
|
4077 |
}
|
|
4078 |
|
|
4079 |
void CSmsUserData::DecodeL(TGsmuLex8& aPdu, TBool aAcceptTruncation)
|
|
4080 |
{
|
|
4081 |
LOGGSMU1("CSmsUserData::DecodeL()");
|
|
4082 |
|
|
4083 |
// Reset current data
|
|
4084 |
iInformationElementArray.ResetAndDestroy();
|
|
4085 |
// Decode the user data
|
|
4086 |
TSmsOctet userDataLength;
|
|
4087 |
userDataLength.DecodeL(aPdu);
|
|
4088 |
TSmsOctet headerLength;
|
|
4089 |
// Decode any user data header
|
|
4090 |
TBool headerPresent=HeaderPresent();
|
|
4091 |
/*
|
|
4092 |
if (headerPresent || IsHeaderPresent(aPtr,dataLength))
|
|
4093 |
*/
|
|
4094 |
if (headerPresent)
|
|
4095 |
{
|
|
4096 |
headerLength.DecodeL(aPdu);
|
|
4097 |
if ((1+headerLength)>KSmsMaxUserDataSize)
|
|
4098 |
User::Leave(KErrGsmSMSTpduNotSupported);
|
|
4099 |
while (HeaderLength()<headerLength)
|
|
4100 |
{
|
|
4101 |
CSmsInformationElement* informationelement=CSmsInformationElement::NewL();
|
|
4102 |
CleanupStack::PushL(informationelement);
|
|
4103 |
informationelement->DecodeL(aPdu);
|
|
4104 |
iInformationElementArray.AppendL(informationelement);
|
|
4105 |
CleanupStack::Pop(informationelement);
|
|
4106 |
}
|
|
4107 |
if (HeaderLength()!=headerLength)
|
|
4108 |
User::Leave(KErrGsmSMSTpduNotSupported);
|
|
4109 |
}
|
|
4110 |
// Decode the body - make sure we have enough buffer
|
|
4111 |
TInt headerLengthInUDLUnits=TotalHeaderLengthInUDLUnits();
|
|
4112 |
TInt bodyLengthInUDLUnits=userDataLength-headerLengthInUDLUnits;
|
|
4113 |
|
|
4114 |
if(bodyLengthInUDLUnits <=0)
|
|
4115 |
{
|
|
4116 |
NewBodyL(0);
|
|
4117 |
return;
|
|
4118 |
}
|
|
4119 |
|
|
4120 |
NewBodyL(bodyLengthInUDLUnits);
|
|
4121 |
|
|
4122 |
// Unpack the body
|
|
4123 |
TInt startBit=0;
|
|
4124 |
if (iDataCodingScheme.Alphabet()==TSmsDataCodingScheme::ESmsAlphabet7Bit)
|
|
4125 |
startBit=(headerLengthInUDLUnits*7)%8;
|
|
4126 |
TSmsAlphabetPacker unpacker(iDataCodingScheme.Alphabet(),IsBinaryData(),startBit);
|
|
4127 |
TInt bodyLengthInOctets=unpacker.PackedOctetsRequiredL(bodyLengthInUDLUnits);
|
|
4128 |
TPtr8 destPtr((TUint8*)iBody->Des().Ptr(),0,bodyLengthInUDLUnits);
|
|
4129 |
|
|
4130 |
const TPtrC8 sourcePtr(aPdu.NextWithNoIncL(bodyLengthInOctets,aAcceptTruncation));
|
|
4131 |
if ( aAcceptTruncation && sourcePtr.Length() < bodyLengthInOctets)
|
|
4132 |
{
|
|
4133 |
// field was truncated in an acceptable situation (User Data in Status Report PDU)
|
|
4134 |
bodyLengthInUDLUnits = unpacker.NumUDUnitsL(sourcePtr.Length());
|
|
4135 |
}
|
|
4136 |
unpacker.UnpackL(sourcePtr,destPtr,bodyLengthInUDLUnits);
|
|
4137 |
|
|
4138 |
//@note No need to call aPdu.IncL() because CSmsUserData is always at the end of a PDU
|
|
4139 |
} // CSmsUserData::DecodeL
|
|
4140 |
|
|
4141 |
|
|
4142 |
void CSmsUserData::InternalizeL(RReadStream& aStream)
|
|
4143 |
{
|
|
4144 |
iInformationElementArray.ResetAndDestroy();
|
|
4145 |
TInt numiformationelements=aStream.ReadInt32L();
|
|
4146 |
// The "header present" flag must mirror whether information elements are present, and
|
|
4147 |
// the parental iFirstOctet should already be set by its InternalizeL()
|
|
4148 |
__ASSERT_DEBUG(((!HeaderPresent() && numiformationelements == 0) || (HeaderPresent() && numiformationelements > 0)), Panic(KGsmuPanicInformationElementIndexOutOfRange));
|
|
4149 |
for (TInt i=0; i<numiformationelements; i++)
|
|
4150 |
{
|
|
4151 |
CSmsInformationElement* informationelement=CSmsInformationElement::NewL();
|
|
4152 |
CleanupStack::PushL(informationelement);
|
|
4153 |
aStream >> *informationelement;
|
|
4154 |
iInformationElementArray.AppendL(informationelement);
|
|
4155 |
CleanupStack::Pop();
|
|
4156 |
}
|
|
4157 |
delete iBody;
|
|
4158 |
iBody=NULL;
|
|
4159 |
iBody=HBufC8::NewL(aStream,KSmsMaxUserDataLengthInChars);
|
|
4160 |
} // CSmsUserData::InternalizeL
|
|
4161 |
|
|
4162 |
|
|
4163 |
void CSmsUserData::ExternalizeL(RWriteStream& aStream) const
|
|
4164 |
{
|
|
4165 |
TInt numiformationelements=iInformationElementArray.Count();
|
|
4166 |
aStream.WriteInt32L(numiformationelements);
|
|
4167 |
for (TInt i=0; i<numiformationelements; i++)
|
|
4168 |
aStream << *iInformationElementArray[i];
|
|
4169 |
aStream << *iBody;
|
|
4170 |
} // CSmsUserData::ExternalizeL
|
|
4171 |
|
|
4172 |
|
|
4173 |
CSmsUserData::CSmsUserData(CCnvCharacterSetConverter& aCharacterSetConverter,RFs& aFs,TSmsFirstOctet& aFirstOctet,const TSmsDataCodingScheme& aDataCodingScheme):
|
|
4174 |
iCharacterSetConverter(aCharacterSetConverter),
|
|
4175 |
iFs(aFs),
|
|
4176 |
iFirstOctet(aFirstOctet),
|
|
4177 |
iDataCodingScheme(aDataCodingScheme),
|
|
4178 |
iInformationElementArray(8)
|
|
4179 |
{
|
|
4180 |
} // CSmsUserData::CSmsUserData
|
|
4181 |
|
|
4182 |
|
|
4183 |
void CSmsUserData::ConstructL()
|
|
4184 |
{
|
|
4185 |
LOGGSMU1("CSmsUserData::ConstructL()");
|
|
4186 |
|
|
4187 |
NewBodyL(0);
|
|
4188 |
} // CSmsUserData::ConstructL
|
|
4189 |
|
|
4190 |
|
|
4191 |
/**
|
|
4192 |
* Duplicates this CSmsUserData object.
|
|
4193 |
*
|
|
4194 |
* @return Pointer to the newly created CSmsUserData object.
|
|
4195 |
*/
|
|
4196 |
CSmsUserData* CSmsUserData::DuplicateL(TSmsFirstOctet& aFirstOctet,
|
|
4197 |
const TSmsDataCodingScheme& aDataCodingScheme) const
|
|
4198 |
{
|
|
4199 |
LOGGSMU1("CSmsUserData::DuplicateL()");
|
|
4200 |
|
|
4201 |
CSmsUserData* userdata = CSmsUserData::NewL(iCharacterSetConverter, iFs,
|
|
4202 |
aFirstOctet, aDataCodingScheme);
|
|
4203 |
CleanupStack::PushL(userdata);
|
|
4204 |
|
|
4205 |
userdata->SetBodyL(Body());
|
|
4206 |
|
|
4207 |
for (TInt ie = 0; ie < iInformationElementArray.Count(); ie++)
|
|
4208 |
{
|
|
4209 |
CSmsInformationElement* oldIE = iInformationElementArray[ie];
|
|
4210 |
|
|
4211 |
if (CEmsFactory::Supported(oldIE->Identifier()))
|
|
4212 |
{
|
|
4213 |
CEmsInformationElement* newIE = static_cast<CEmsInformationElement*>(oldIE)->DuplicateL();
|
|
4214 |
|
|
4215 |
CleanupStack::PushL(newIE);
|
|
4216 |
userdata->AddEmsInformationElementL(newIE);
|
|
4217 |
CleanupStack::Pop(newIE);
|
|
4218 |
}
|
|
4219 |
else
|
|
4220 |
{
|
|
4221 |
userdata->UpdateInformationElementArrayL(oldIE->Identifier(), oldIE->Data());
|
|
4222 |
}
|
|
4223 |
}
|
|
4224 |
|
|
4225 |
CleanupStack::Pop();
|
|
4226 |
|
|
4227 |
return userdata;
|
|
4228 |
} // CSmsUserData::DuplicateL
|
|
4229 |
|
|
4230 |
|
|
4231 |
TInt CSmsUserData::HeaderLength() const
|
|
4232 |
{
|
|
4233 |
LOGGSMU1("CSmsUserData::HeaderLength()");
|
|
4234 |
|
|
4235 |
TInt numinformationelements=NumInformationElements();
|
|
4236 |
TInt headerlength=0;
|
|
4237 |
for (TInt i=0; i<numinformationelements; i++)
|
|
4238 |
headerlength+=iInformationElementArray[i]->Length();
|
|
4239 |
return headerlength;
|
|
4240 |
} // CSmsUserData::HeaderLength
|
|
4241 |
|
|
4242 |
|
|
4243 |
TInt CSmsUserData::TotalHeaderLengthInUDLUnits() const
|
|
4244 |
{
|
|
4245 |
LOGGSMU1("CSmsUserData::TotalHeaderLengthInUDLUnits()");
|
|
4246 |
|
|
4247 |
TInt totalheaderlengthinudlunits=0;
|
|
4248 |
if (iInformationElementArray.Count()>0)
|
|
4249 |
{
|
|
4250 |
TInt totalheaderlength=1+HeaderLength();
|
|
4251 |
if (iDataCodingScheme.TextCompressed())
|
|
4252 |
{
|
|
4253 |
totalheaderlengthinudlunits=totalheaderlength;
|
|
4254 |
}
|
|
4255 |
else
|
|
4256 |
{
|
|
4257 |
switch(iDataCodingScheme.Alphabet())
|
|
4258 |
{
|
|
4259 |
case (TSmsDataCodingScheme::ESmsAlphabet7Bit):
|
|
4260 |
{
|
|
4261 |
totalheaderlengthinudlunits=((8*totalheaderlength)+6)/7; // Rounds up
|
|
4262 |
break;
|
|
4263 |
}
|
|
4264 |
case (TSmsDataCodingScheme::ESmsAlphabet8Bit):
|
|
4265 |
case (TSmsDataCodingScheme::ESmsAlphabetUCS2):
|
|
4266 |
{
|
|
4267 |
totalheaderlengthinudlunits=totalheaderlength;
|
|
4268 |
break;
|
|
4269 |
}
|
|
4270 |
default:
|
|
4271 |
LOGGSMU1("CSmsUserData::TotalHeaderLengthInUDLUnits() WARNING default case has been reached");
|
|
4272 |
break;
|
|
4273 |
}
|
|
4274 |
}
|
|
4275 |
}
|
|
4276 |
return totalheaderlengthinudlunits;
|
|
4277 |
} // CSmsUserData::TotalHeaderLengthInUDLUnits
|
|
4278 |
|
|
4279 |
|
|
4280 |
TInt CSmsUserData::TotalHeaderLengthInUDLUnits(TInt aIElen) const
|
|
4281 |
{
|
|
4282 |
LOGGSMU1("CSmsUserData::TotalHeaderLengthInUDLUnits()");
|
|
4283 |
|
|
4284 |
TInt totalheaderlengthinudlunits=0;
|
|
4285 |
TInt totalheaderlength=aIElen;
|
|
4286 |
|
|
4287 |
if (iInformationElementArray.Count()>0)
|
|
4288 |
totalheaderlength+=HeaderLength();
|
|
4289 |
|
|
4290 |
if(totalheaderlength)totalheaderlength+=1; //UDHL
|
|
4291 |
|
|
4292 |
if (iDataCodingScheme.TextCompressed())
|
|
4293 |
{
|
|
4294 |
totalheaderlengthinudlunits=totalheaderlength;
|
|
4295 |
}
|
|
4296 |
else
|
|
4297 |
{
|
|
4298 |
switch(iDataCodingScheme.Alphabet())
|
|
4299 |
{
|
|
4300 |
case (TSmsDataCodingScheme::ESmsAlphabet7Bit):
|
|
4301 |
{
|
|
4302 |
totalheaderlengthinudlunits=((8*totalheaderlength)+6)/7; // Rounds up
|
|
4303 |
break;
|
|
4304 |
}
|
|
4305 |
case (TSmsDataCodingScheme::ESmsAlphabet8Bit):
|
|
4306 |
case (TSmsDataCodingScheme::ESmsAlphabetUCS2):
|
|
4307 |
{
|
|
4308 |
totalheaderlengthinudlunits=totalheaderlength;
|
|
4309 |
break;
|
|
4310 |
}
|
|
4311 |
default:
|
|
4312 |
break;
|
|
4313 |
}
|
|
4314 |
}
|
|
4315 |
return totalheaderlengthinudlunits;
|
|
4316 |
} // CSmsUserData::TotalHeaderLengthInUDLUnits
|
|
4317 |
|
|
4318 |
|
|
4319 |
TInt CSmsUserData::BodyLengthInUDLUnits() const
|
|
4320 |
{
|
|
4321 |
LOGGSMU1("CSmsUserData::BodyLengthInUDLUnits()");
|
|
4322 |
|
|
4323 |
return iBody->Des().Length();
|
|
4324 |
} // CSmsUserData::BodyLengthInUDLUnits
|
|
4325 |
|
|
4326 |
|
|
4327 |
void CSmsUserData::NewBodyL(TInt aLength)
|
|
4328 |
{
|
|
4329 |
LOGGSMU1("CSmsUserData::NewBodyL()");
|
|
4330 |
|
|
4331 |
|
|
4332 |
HBufC8* body=HBufC8::NewL(aLength);
|
|
4333 |
delete iBody;
|
|
4334 |
iBody=body;
|
|
4335 |
iBody->Des().SetLength(aLength);
|
|
4336 |
|
|
4337 |
} // CSmsUserData::NewBodyL
|
|
4338 |
|
|
4339 |
|
|
4340 |
TBool CSmsUserData::HeaderPresent() const
|
|
4341 |
{
|
|
4342 |
LOGGSMU1("CSmsUserData::HeaderPresent()");
|
|
4343 |
|
|
4344 |
return (iFirstOctet&TSmsFirstOctet::ESmsUDHIMask)==TSmsFirstOctet::ESmsUDHIHeaderPresent;
|
|
4345 |
} // CSmsUserData::HeaderPresent
|
|
4346 |
|
|
4347 |
|
|
4348 |
void CSmsUserData::SetHeaderPresent(TBool aHeaderPresent)
|
|
4349 |
{
|
|
4350 |
LOGGSMU1("CSmsUserData::SetHeaderPresent()");
|
|
4351 |
|
|
4352 |
iFirstOctet=aHeaderPresent? (iFirstOctet&(~TSmsFirstOctet::ESmsUDHIMask))|TSmsFirstOctet::ESmsUDHIHeaderPresent: (iFirstOctet&(~TSmsFirstOctet::ESmsUDHIMask))|TSmsFirstOctet::ESmsUDHIHeaderNotPresent;
|
|
4353 |
} // CSmsUserData::SetHeaderPresent
|
|
4354 |
|
|
4355 |
|
|
4356 |
TBool CSmsUserData::IsBinaryData() const
|
|
4357 |
{
|
|
4358 |
LOGGSMU1("CSmsUserData::IsBinaryData()");
|
|
4359 |
|
|
4360 |
TInt index=0;
|
|
4361 |
return (iDataCodingScheme.TextCompressed()) ||
|
|
4362 |
((iDataCodingScheme.Alphabet()==TSmsDataCodingScheme::ESmsAlphabet8Bit) &&
|
|
4363 |
(InformationElementIndex(CSmsInformationElement::ESmsIEIApplicationPortAddressing8Bit,index) ||
|
|
4364 |
InformationElementIndex(CSmsInformationElement::ESmsIEIApplicationPortAddressing16Bit,index)));
|
|
4365 |
} // CSmsUserData::IsBinaryData
|
|
4366 |
|
|
4367 |
|
|
4368 |
/**
|
|
4369 |
* Converts type of number and numbering plan identification information
|
|
4370 |
* from the type of address parameter to the NMobilePhone::TMobileTON
|
|
4371 |
* and NMobilePhone::TMobileNPI format.
|
|
4372 |
*
|
|
4373 |
* @return aTon The number type
|
|
4374 |
* @return aNpi The numbering plan
|
|
4375 |
*
|
|
4376 |
* @capability None
|
|
4377 |
*/
|
|
4378 |
EXPORT_C void TGsmSmsTypeOfAddress::ConvertToETelMM(NMobilePhone::TMobileTON& aTon,NMobilePhone::TMobileNPI& aNpi) const
|
|
4379 |
{
|
|
4380 |
LOGGSMU1("TGsmSmsTypeOfAddress::ConvertToETelMM()");
|
|
4381 |
|
|
4382 |
switch (TON())
|
|
4383 |
{
|
|
4384 |
case EGsmSmsTONInternationalNumber:
|
|
4385 |
{
|
|
4386 |
aTon = (NMobilePhone::EInternationalNumber);
|
|
4387 |
break;
|
|
4388 |
}
|
|
4389 |
case EGsmSmsTONNationalNumber:
|
|
4390 |
{
|
|
4391 |
aTon = (NMobilePhone::ENationalNumber);
|
|
4392 |
break;
|
|
4393 |
}
|
|
4394 |
case EGsmSmsTONNetworkSpecificNumber:
|
|
4395 |
{
|
|
4396 |
aTon = (NMobilePhone::ENetworkSpecificNumber);
|
|
4397 |
break;
|
|
4398 |
}
|
|
4399 |
case EGsmSmsTONSubscriberNumber:
|
|
4400 |
{
|
|
4401 |
aTon = (NMobilePhone::ESubscriberNumber);
|
|
4402 |
break;
|
|
4403 |
}
|
|
4404 |
case EGsmSmsTONAlphaNumeric:
|
|
4405 |
{
|
|
4406 |
aTon = (NMobilePhone::EAlphanumericNumber);
|
|
4407 |
break;
|
|
4408 |
}
|
|
4409 |
case EGsmSmsTONAbbreviatedNumber:
|
|
4410 |
{
|
|
4411 |
aTon = (NMobilePhone::EAbbreviatedNumber);
|
|
4412 |
break;
|
|
4413 |
}
|
|
4414 |
|
|
4415 |
default:
|
|
4416 |
{
|
|
4417 |
aTon = (NMobilePhone::EUnknownNumber);
|
|
4418 |
break;
|
|
4419 |
}
|
|
4420 |
}
|
|
4421 |
|
|
4422 |
switch (NPI())
|
|
4423 |
{
|
|
4424 |
case EGsmSmsNPIISDNTelephoneNumberingPlan:
|
|
4425 |
{
|
|
4426 |
aNpi = (NMobilePhone::EIsdnNumberPlan);
|
|
4427 |
break;
|
|
4428 |
}
|
|
4429 |
case EGsmSmsNPIDataNumberingPlan:
|
|
4430 |
{
|
|
4431 |
aNpi = (NMobilePhone::EDataNumberPlan);
|
|
4432 |
break;
|
|
4433 |
}
|
|
4434 |
case EGsmSmsNPITelexNumberingPlan:
|
|
4435 |
{
|
|
4436 |
aNpi = (NMobilePhone::ETelexNumberPlan);
|
|
4437 |
break;
|
|
4438 |
}
|
|
4439 |
case EGsmSmsNPINationalNumberingPlan:
|
|
4440 |
{
|
|
4441 |
aNpi = (NMobilePhone::ENationalNumberPlan);
|
|
4442 |
break;
|
|
4443 |
}
|
|
4444 |
case EGsmSmsNPIPrivateNumberingPlan:
|
|
4445 |
{
|
|
4446 |
aNpi = (NMobilePhone::EPrivateNumberPlan);
|
|
4447 |
break;
|
|
4448 |
}
|
|
4449 |
case EGsmSmsNPIERMESNumberingPlan:
|
|
4450 |
{
|
|
4451 |
aNpi = (NMobilePhone::EERMESNumberPlan);
|
|
4452 |
break;
|
|
4453 |
}
|
|
4454 |
|
|
4455 |
default:
|
|
4456 |
{
|
|
4457 |
aNpi = (NMobilePhone::EUnknownNumberingPlan);
|
|
4458 |
break;
|
|
4459 |
}
|
|
4460 |
}
|
|
4461 |
} // NMobilePhone::TMobileNPI
|
|
4462 |
|
|
4463 |
|
|
4464 |
/**
|
|
4465 |
* Converts type of number and numbering plan identification information
|
|
4466 |
* from the NMobilePhone::TMobileTON and NMobilePhone::TMobileNPI format
|
|
4467 |
* to the type of address parameter.
|
|
4468 |
*
|
|
4469 |
* @param aTon The number type
|
|
4470 |
* @param aNpi The numbering plan
|
|
4471 |
*
|
|
4472 |
* @capability None
|
|
4473 |
*/
|
|
4474 |
EXPORT_C void TGsmSmsTypeOfAddress::SetFromETelMM(NMobilePhone::TMobileTON aTon,NMobilePhone::TMobileNPI aNpi)
|
|
4475 |
{
|
|
4476 |
LOGGSMU1("TGsmSmsTypeOfAddress::SetFromETelMM()");
|
|
4477 |
|
|
4478 |
switch (aTon)
|
|
4479 |
{
|
|
4480 |
case NMobilePhone::EInternationalNumber:
|
|
4481 |
{
|
|
4482 |
SetTON( EGsmSmsTONInternationalNumber );
|
|
4483 |
break;
|
|
4484 |
}
|
|
4485 |
case NMobilePhone::ENationalNumber:
|
|
4486 |
{
|
|
4487 |
SetTON( EGsmSmsTONNationalNumber );
|
|
4488 |
break;
|
|
4489 |
}
|
|
4490 |
case NMobilePhone::ENetworkSpecificNumber:
|
|
4491 |
{
|
|
4492 |
SetTON( EGsmSmsTONNetworkSpecificNumber );
|
|
4493 |
break;
|
|
4494 |
}
|
|
4495 |
case NMobilePhone::ESubscriberNumber:
|
|
4496 |
{
|
|
4497 |
SetTON( EGsmSmsTONSubscriberNumber );
|
|
4498 |
break;
|
|
4499 |
}
|
|
4500 |
case NMobilePhone::EAlphanumericNumber:
|
|
4501 |
{
|
|
4502 |
SetTON( EGsmSmsTONAlphaNumeric );
|
|
4503 |
break;
|
|
4504 |
}
|
|
4505 |
case NMobilePhone::EAbbreviatedNumber:
|
|
4506 |
{
|
|
4507 |
SetTON( EGsmSmsTONAbbreviatedNumber );
|
|
4508 |
break;
|
|
4509 |
}
|
|
4510 |
|
|
4511 |
default:
|
|
4512 |
{
|
|
4513 |
SetTON( EGsmSmsTONUnknown );
|
|
4514 |
break;
|
|
4515 |
}
|
|
4516 |
}
|
|
4517 |
|
|
4518 |
switch (aNpi)
|
|
4519 |
{
|
|
4520 |
case NMobilePhone::EIsdnNumberPlan:
|
|
4521 |
{
|
|
4522 |
SetNPI( EGsmSmsNPIISDNTelephoneNumberingPlan );
|
|
4523 |
break;
|
|
4524 |
}
|
|
4525 |
case NMobilePhone::EDataNumberPlan:
|
|
4526 |
{
|
|
4527 |
SetNPI( EGsmSmsNPIDataNumberingPlan );
|
|
4528 |
break;
|
|
4529 |
}
|
|
4530 |
case NMobilePhone::ETelexNumberPlan:
|
|
4531 |
{
|
|
4532 |
SetNPI( EGsmSmsNPITelexNumberingPlan );
|
|
4533 |
break;
|
|
4534 |
}
|
|
4535 |
case NMobilePhone::ENationalNumberPlan:
|
|
4536 |
{
|
|
4537 |
SetNPI( EGsmSmsNPINationalNumberingPlan );
|
|
4538 |
break;
|
|
4539 |
}
|
|
4540 |
case NMobilePhone::EPrivateNumberPlan:
|
|
4541 |
{
|
|
4542 |
SetNPI( EGsmSmsNPIPrivateNumberingPlan );
|
|
4543 |
break;
|
|
4544 |
}
|
|
4545 |
case NMobilePhone::EERMESNumberPlan:
|
|
4546 |
{
|
|
4547 |
SetNPI( EGsmSmsNPIERMESNumberingPlan );
|
|
4548 |
break;
|
|
4549 |
}
|
|
4550 |
|
|
4551 |
default:
|
|
4552 |
{
|
|
4553 |
SetNPI( EGsmSmsNPIUnknown );
|
|
4554 |
break;
|
|
4555 |
}
|
|
4556 |
}
|
|
4557 |
} // NMobilePhone::TMobileTON
|
|
4558 |
|
|
4559 |
|
|
4560 |
/**
|
|
4561 |
* @publishedAll
|
|
4562 |
*
|
|
4563 |
* Indicates whether this message is a Voice Mail Notification
|
|
4564 |
* or a Voice Mail Deletion Confirmation.
|
|
4565 |
*
|
|
4566 |
* @return
|
|
4567 |
* TVoiceMailInfoType, indicating whether this message is a Voice Mail
|
|
4568 |
* Notification or a Voice Mail Deletion Confirmation.
|
|
4569 |
*
|
|
4570 |
* @capability None
|
|
4571 |
*/
|
|
4572 |
EXPORT_C TVoiceMailInfoType CEnhancedVoiceMailBoxInformation::Type() const
|
|
4573 |
{
|
|
4574 |
LOGGSMU1("CEnhancedVoiceMailBoxInformation::Type()");
|
|
4575 |
|
|
4576 |
return iType;
|
|
4577 |
} // CEnhancedVoiceMailBoxInformation::Type
|
|
4578 |
|
|
4579 |
|
|
4580 |
/**
|
|
4581 |
* @publishedAll
|
|
4582 |
*
|
|
4583 |
* Sets the subscriber profile per 23.040 v6.5 Section 9.2.3.24.13.1.
|
|
4584 |
*
|
|
4585 |
* @param aProfile
|
|
4586 |
* The required subscriber profile
|
|
4587 |
*
|
|
4588 |
* @capability None
|
|
4589 |
*/
|
|
4590 |
EXPORT_C void CEnhancedVoiceMailBoxInformation::SetProfile(TSmsMessageProfileType aProfile)
|
|
4591 |
{
|
|
4592 |
LOGGSMU1("CEnhancedVoiceMailBoxInformation::SetProfile()");
|
|
4593 |
|
|
4594 |
iProfile = aProfile;
|
|
4595 |
} // CEnhancedVoiceMailBoxInformation::SetProfile
|
|
4596 |
|
|
4597 |
|
|
4598 |
/**
|
|
4599 |
* @publishedAll
|
|
4600 |
*
|
|
4601 |
* Gets the subscriber profile per 23.040 v6.5 Section 9.2.3.24.13.1.
|
|
4602 |
*
|
|
4603 |
* @param aProfile
|
|
4604 |
* The current subscriber profile
|
|
4605 |
*
|
|
4606 |
* @capability None
|
|
4607 |
*/
|
|
4608 |
EXPORT_C TSmsMessageProfileType CEnhancedVoiceMailBoxInformation::Profile() const
|
|
4609 |
{
|
|
4610 |
LOGGSMU1("CEnhancedVoiceMailBoxInformation::Profile()");
|
|
4611 |
|
|
4612 |
return iProfile;
|
|
4613 |
} // CEnhancedVoiceMailBoxInformation::Profile
|
|
4614 |
|
|
4615 |
|
|
4616 |
/**
|
|
4617 |
* @publishedAll
|
|
4618 |
*
|
|
4619 |
* Configures the storage directive
|
|
4620 |
*
|
|
4621 |
* @param aIsStored
|
|
4622 |
* Set to True if the SM is to be stored in the ME or USIM,
|
|
4623 |
* False is the SM is to be discarded.
|
|
4624 |
*
|
|
4625 |
* @capability None
|
|
4626 |
*/
|
|
4627 |
EXPORT_C void CEnhancedVoiceMailBoxInformation::SetStorage(TBool aIsStored)
|
|
4628 |
{
|
|
4629 |
LOGGSMU1("CEnhancedVoiceMailBoxInformation::SetStorage()");
|
|
4630 |
|
|
4631 |
iStorage = aIsStored;
|
|
4632 |
} // CEnhancedVoiceMailBoxInformation::SetStorage
|
|
4633 |
|
|
4634 |
|
|
4635 |
/**
|
|
4636 |
* @publishedAll
|
|
4637 |
*
|
|
4638 |
* Indicates whether the SM is to be stored or discarded
|
|
4639 |
*
|
|
4640 |
* @return
|
|
4641 |
* True if the SM is to be stored in the ME or USIM,
|
|
4642 |
* False is the SM is to be discarded.
|
|
4643 |
*
|
|
4644 |
* @capability None
|
|
4645 |
*/
|
|
4646 |
EXPORT_C TBool CEnhancedVoiceMailBoxInformation::Store() const
|
|
4647 |
{
|
|
4648 |
LOGGSMU1("CEnhancedVoiceMailBoxInformation::Store()");
|
|
4649 |
|
|
4650 |
return iStorage;
|
|
4651 |
} // CEnhancedVoiceMailBoxInformation::Store
|
|
4652 |
|
|
4653 |
|
|
4654 |
/**
|
|
4655 |
* @publishedAll
|
|
4656 |
*
|
|
4657 |
* Used to set or reset the voice mail status to almost full.
|
|
4658 |
*
|
|
4659 |
* @param aIsStored
|
|
4660 |
* Set to True the voice mail system is almost full.
|
|
4661 |
* Set to False otherwise.
|
|
4662 |
*
|
|
4663 |
* @capability None
|
|
4664 |
*/
|
|
4665 |
EXPORT_C void CEnhancedVoiceMailBoxInformation::SetAlmostMaximumCapacity(TBool aIsAlmostFull)
|
|
4666 |
{
|
|
4667 |
LOGGSMU1("CEnhancedVoiceMailBoxInformation::SetAlmostMaximumCapacity()");
|
|
4668 |
|
|
4669 |
iAlmostFull = aIsAlmostFull;
|
|
4670 |
} // CEnhancedVoiceMailBoxInformation::SetAlmostMaximumCapacity
|
|
4671 |
|
|
4672 |
|
|
4673 |
/**
|
|
4674 |
* @publishedAll
|
|
4675 |
*
|
|
4676 |
* Indicates whether the voice mail system is almost at full capacity.
|
|
4677 |
*
|
|
4678 |
* @return
|
|
4679 |
* True, if the voice mail system is almost full.
|
|
4680 |
* False otherwise.
|
|
4681 |
*
|
|
4682 |
* @capability None
|
|
4683 |
*/
|
|
4684 |
EXPORT_C TBool CEnhancedVoiceMailBoxInformation::AlmostMaximumCapacity() const
|
|
4685 |
{
|
|
4686 |
LOGGSMU1("CEnhancedVoiceMailBoxInformation::AlmostMaximumCapacity()");
|
|
4687 |
|
|
4688 |
return iAlmostFull;
|
|
4689 |
} // CEnhancedVoiceMailBoxInformation::AlmostMaximumCapacity
|
|
4690 |
|
|
4691 |
|
|
4692 |
/**
|
|
4693 |
* @publishedAll
|
|
4694 |
*
|
|
4695 |
* Used to set or reset the voice mail status to full.
|
|
4696 |
*
|
|
4697 |
* @param aIsStored
|
|
4698 |
* Set to True the voice mail system is full.
|
|
4699 |
* Set to False otherwise.
|
|
4700 |
*
|
|
4701 |
* @capability None
|
|
4702 |
*/
|
|
4703 |
EXPORT_C void CEnhancedVoiceMailBoxInformation::SetMaximumCapacity(TBool aIsFull)
|
|
4704 |
{
|
|
4705 |
LOGGSMU1("CEnhancedVoiceMailBoxInformation::SetMaximumCapacity()");
|
|
4706 |
|
|
4707 |
iFull = aIsFull;
|
|
4708 |
} // CEnhancedVoiceMailBoxInformation::SetMaximumCapacity
|
|
4709 |
|
|
4710 |
|
|
4711 |
/**
|
|
4712 |
* @publishedAll
|
|
4713 |
*
|
|
4714 |
* Indicates whether the voice mail status is full.
|
|
4715 |
*
|
|
4716 |
* @return
|
|
4717 |
* True if the voice mail system is almost full.
|
|
4718 |
* False otherwise.
|
|
4719 |
*
|
|
4720 |
* @capability None
|
|
4721 |
*/
|
|
4722 |
EXPORT_C TBool CEnhancedVoiceMailBoxInformation::MaximumCapacity() const
|
|
4723 |
{
|
|
4724 |
LOGGSMU1("CEnhancedVoiceMailBoxInformation::MaximumCapacity()");
|
|
4725 |
|
|
4726 |
return iFull;
|
|
4727 |
} // CEnhancedVoiceMailBoxInformation::MaximumCapacity
|
|
4728 |
|
|
4729 |
|
|
4730 |
/**
|
|
4731 |
* @publishedAll
|
|
4732 |
*
|
|
4733 |
* Indicates whether the message contains extension bytes
|
|
4734 |
*
|
|
4735 |
* @return
|
|
4736 |
* True if the message contains extension bytes.
|
|
4737 |
* False otherwise.
|
|
4738 |
*
|
|
4739 |
* @capability None
|
|
4740 |
*/
|
|
4741 |
EXPORT_C TBool CEnhancedVoiceMailBoxInformation::ExtensionIndicator() const
|
|
4742 |
{
|
|
4743 |
LOGGSMU1("CEnhancedVoiceMailBoxInformation::ExtensionIndicator()");
|
|
4744 |
|
|
4745 |
return iExtensionIndicator;
|
|
4746 |
} // CEnhancedVoiceMailBoxInformation::ExtensionIndicator
|
|
4747 |
|
|
4748 |
|
|
4749 |
void CEnhancedVoiceMailBoxInformation::NewBufferL(TInt aLength)
|
|
4750 |
{
|
|
4751 |
LOGGSMU2("CEnhancedVoiceMailBoxInformation::NewBufferL, length = %d",aLength);
|
|
4752 |
|
|
4753 |
HBufC* buffer=HBufC::NewL(aLength);
|
|
4754 |
delete iAccessAddress;
|
|
4755 |
iAccessAddress=buffer;
|
|
4756 |
iAccessAddress->Des().SetLength(aLength);
|
|
4757 |
iAccessAddress->Des().FillZ();
|
|
4758 |
} // CEnhancedVoiceMailBoxInformation::NewBufferL
|
|
4759 |
|
|
4760 |
|
|
4761 |
/**
|
|
4762 |
* @publishedAll
|
|
4763 |
*
|
|
4764 |
* Used to set the voice mail box number, overwriting any pre-existing number.
|
|
4765 |
*
|
|
4766 |
* @param aAddress
|
|
4767 |
* The voice mail box address.
|
|
4768 |
*
|
|
4769 |
* @capability None
|
|
4770 |
*/
|
|
4771 |
EXPORT_C void CEnhancedVoiceMailBoxInformation::SetAccessAddressL(const TDesC& aAddress)
|
|
4772 |
{
|
|
4773 |
LOGGSMU1("CEnhancedVoiceMailBoxInformation::SetAccessAddressL()");
|
|
4774 |
|
|
4775 |
TInt length=aAddress.Length();
|
|
4776 |
NewBufferL(length);
|
|
4777 |
iAccessAddress->Des().Copy(aAddress);
|
|
4778 |
|
|
4779 |
const TGsmSmsTypeOfNumber typeofnumber=length && (iAccessAddress->Des()[0]=='+')? EGsmSmsTONInternationalNumber: EGsmSmsTONUnknown;
|
|
4780 |
iTypeOfAddress.SetTON(typeofnumber);
|
|
4781 |
} // CEnhancedVoiceMailBoxInformation::SetAccessAddressL
|
|
4782 |
|
|
4783 |
|
|
4784 |
/**
|
|
4785 |
* @publishedAll
|
|
4786 |
*
|
|
4787 |
* Retrieves the voice mail box number.
|
|
4788 |
*
|
|
4789 |
* @return
|
|
4790 |
* A pointer to the voice mail box number.
|
|
4791 |
*
|
|
4792 |
* @capability None
|
|
4793 |
*/
|
|
4794 |
EXPORT_C TPtrC CEnhancedVoiceMailBoxInformation::AccessAddress() const
|
|
4795 |
{
|
|
4796 |
LOGGSMU1("CEnhancedVoiceMailBoxInformation::AccessAddress()");
|
|
4797 |
|
|
4798 |
TPtrC ptr;
|
|
4799 |
if (iAccessAddress)
|
|
4800 |
ptr.Set(iAccessAddress->Des());
|
|
4801 |
return ptr;
|
|
4802 |
} // CEnhancedVoiceMailBoxInformation::AccessAddress
|
|
4803 |
|
|
4804 |
|
|
4805 |
/**
|
|
4806 |
* @publishedAll
|
|
4807 |
*
|
|
4808 |
* Used to set the voice mail box number as a parsed address
|
|
4809 |
*
|
|
4810 |
* @param aParsedAddress
|
|
4811 |
* The parsed address to be used as the voice mail box number.
|
|
4812 |
*
|
|
4813 |
* @capability None
|
|
4814 |
*/
|
|
4815 |
EXPORT_C void CEnhancedVoiceMailBoxInformation::SetParsedAccessAddressL(const TGsmSmsTelNumber& aParsedAddress)
|
|
4816 |
{
|
|
4817 |
LOGGSMU1("CEnhancedVoiceMailBoxInformation::SetParsedAccessAddressL()");
|
|
4818 |
|
|
4819 |
iTypeOfAddress=aParsedAddress.iTypeOfAddress;
|
|
4820 |
DoSetParsedAddressL(aParsedAddress.iTelNumber);
|
|
4821 |
} // CEnhancedVoiceMailBoxInformation::SetParsedAccessAddressL
|
|
4822 |
|
|
4823 |
|
|
4824 |
/**
|
|
4825 |
* @publishedAll
|
|
4826 |
*
|
|
4827 |
* Used to get the voice mail box number as a parsed address.
|
|
4828 |
*
|
|
4829 |
* @param aParsedAddress
|
|
4830 |
* An output parameter which is set to the parsed address.
|
|
4831 |
*
|
|
4832 |
* @capability None
|
|
4833 |
*/
|
|
4834 |
EXPORT_C void CEnhancedVoiceMailBoxInformation::ParsedAccessAddress(TGsmSmsTelNumber& aParsedAddress) const
|
|
4835 |
{
|
|
4836 |
LOGGSMU1("CEnhancedVoiceMailBoxInformation::ParsedAccessAddress()");
|
|
4837 |
|
|
4838 |
aParsedAddress.iTypeOfAddress = iTypeOfAddress;
|
|
4839 |
|
|
4840 |
TInt maxparsedlength=aParsedAddress.iTelNumber.MaxLength();
|
|
4841 |
|
|
4842 |
if (iTypeOfAddress.TON()==EGsmSmsTONAlphaNumeric)
|
|
4843 |
{
|
|
4844 |
TInt parsedlength=AccessAddress().Length();
|
|
4845 |
if (parsedlength>maxparsedlength)
|
|
4846 |
parsedlength=maxparsedlength;
|
|
4847 |
aParsedAddress.iTelNumber.Copy(AccessAddress().Mid(0,parsedlength));
|
|
4848 |
}
|
|
4849 |
else
|
|
4850 |
{
|
|
4851 |
aParsedAddress.iTelNumber.SetLength(maxparsedlength);
|
|
4852 |
|
|
4853 |
TInt length=iAccessAddress->Des().Length();
|
|
4854 |
TInt parsedlength=0;
|
|
4855 |
for (TInt i=0; (i<length) && (parsedlength<maxparsedlength); i++)
|
|
4856 |
{
|
|
4857 |
TText ch=iAccessAddress->Des()[i];
|
|
4858 |
if ((ch>='0') && (ch<='9'))
|
|
4859 |
{
|
|
4860 |
aParsedAddress.iTelNumber[parsedlength]=(TUint8) ch;
|
|
4861 |
parsedlength++;
|
|
4862 |
}
|
|
4863 |
}
|
|
4864 |
|
|
4865 |
aParsedAddress.iTelNumber.SetLength(parsedlength);
|
|
4866 |
}
|
|
4867 |
} // CEnhancedVoiceMailBoxInformation::ParsedAccessAddress
|
|
4868 |
|
|
4869 |
|
|
4870 |
void CEnhancedVoiceMailBoxInformation::DoSetParsedAddressL(const TDesC& aAddress)
|
|
4871 |
{
|
|
4872 |
LOGGSMU1("CEnhancedVoiceMailBoxInformation::DoSetParsedAddressL()");
|
|
4873 |
|
|
4874 |
TInt length=aAddress.Length();
|
|
4875 |
if ((iTypeOfAddress.TON()==EGsmSmsTONInternationalNumber) &&
|
|
4876 |
(length && (aAddress[0]!='+')))
|
|
4877 |
{
|
|
4878 |
NewBufferL(length+1);
|
|
4879 |
iAccessAddress->Des()[0]='+';
|
|
4880 |
TPtr ptr((TText*) (iAccessAddress->Des().Ptr()+1),length,length);
|
|
4881 |
ptr.Copy(aAddress);
|
|
4882 |
}
|
|
4883 |
else
|
|
4884 |
{
|
|
4885 |
NewBufferL(length);
|
|
4886 |
iAccessAddress->Des().Copy(aAddress);
|
|
4887 |
}
|
|
4888 |
} // CEnhancedVoiceMailBoxInformation::DoSetParsedAddressL
|
|
4889 |
|
|
4890 |
|
|
4891 |
/**
|
|
4892 |
* @publishedAll
|
|
4893 |
*
|
|
4894 |
* Sets the number of voice messages to a value in the range 0 to 255.
|
|
4895 |
*
|
|
4896 |
* @param aNumber
|
|
4897 |
* The number of voice messages.
|
|
4898 |
*
|
|
4899 |
* @capability None
|
|
4900 |
*/
|
|
4901 |
EXPORT_C void CEnhancedVoiceMailBoxInformation::SetNumberOfVoiceMessages(TUint8 aNumber)
|
|
4902 |
{
|
|
4903 |
LOGGSMU1("CEnhancedVoiceMailBoxInformation::SetNumberOfVoiceMessages()");
|
|
4904 |
|
|
4905 |
iNumberOfVoiceMessages=aNumber;
|
|
4906 |
} // CEnhancedVoiceMailBoxInformation::SetNumberOfVoiceMessages
|
|
4907 |
|
|
4908 |
|
|
4909 |
/**
|
|
4910 |
* @publishedAll
|
|
4911 |
*
|
|
4912 |
* Retrieves the number of voice messages that are unread.
|
|
4913 |
*
|
|
4914 |
* @return
|
|
4915 |
* The number of unread voice messages.
|
|
4916 |
*
|
|
4917 |
* @capability None
|
|
4918 |
*/
|
|
4919 |
EXPORT_C TUint8 CEnhancedVoiceMailBoxInformation::NumberOfVoiceMessages() const
|
|
4920 |
{
|
|
4921 |
LOGGSMU1("CEnhancedVoiceMailBoxInformation::NumberOfVoiceMessages()");
|
|
4922 |
|
|
4923 |
return iNumberOfVoiceMessages;
|
|
4924 |
} // CEnhancedVoiceMailBoxInformation::NumberOfVoiceMessages
|
|
4925 |
|
|
4926 |
|
|
4927 |
TUint8* CEnhancedVoiceMailBoxInformation::EncodeL(TUint8* aPtr, CCnvCharacterSetConverter& aCharacterSetConverter, RFs& aFs) const
|
|
4928 |
{
|
|
4929 |
*aPtr = (((TUint8) iType) & EMask1Bit ) +
|
|
4930 |
((((TUint8) iProfile) & EMask2Bits) << 2) +
|
|
4931 |
((((TUint8) iStorage) & EMask1Bit ) << 4) +
|
|
4932 |
((((TUint8) iAlmostFull) & EMask1Bit ) << 5) +
|
|
4933 |
((((TUint8) iFull) & EMask1Bit ) << 6) +
|
|
4934 |
(((TUint8) iExtensionIndicator ) << 7);
|
|
4935 |
|
|
4936 |
LOGGSMU2("CEnhancedVoiceMailBoxInformation::EncodeL 1st byte = %d",*aPtr);
|
|
4937 |
aPtr++;
|
|
4938 |
|
|
4939 |
// Create an address object to encode the mail box access address into the
|
|
4940 |
// format required by 23.040 v6.5.0 section 9.1.2.5.
|
|
4941 |
CSmsAddress* address = CSmsAddress::NewL(aCharacterSetConverter,aFs);
|
|
4942 |
CleanupStack::PushL(address);
|
|
4943 |
TPtrC accessAddressPtr;
|
|
4944 |
if (iAccessAddress)
|
|
4945 |
{
|
|
4946 |
accessAddressPtr.Set(iAccessAddress->Des());
|
|
4947 |
}
|
|
4948 |
address->SetRawAddressL(iTypeOfAddress,accessAddressPtr);
|
|
4949 |
aPtr = address->EncodeL(aPtr);
|
|
4950 |
CleanupStack::PopAndDestroy(address);
|
|
4951 |
|
|
4952 |
*aPtr = (TUint8) iNumberOfVoiceMessages;
|
|
4953 |
aPtr++;
|
|
4954 |
|
|
4955 |
return aPtr;
|
|
4956 |
} // CEnhancedVoiceMailBoxInformation::EncodeL
|
|
4957 |
|
|
4958 |
|
|
4959 |
void CEnhancedVoiceMailBoxInformation::DecodeL(TGsmuLex8& aVoiceMailInfo, CCnvCharacterSetConverter& aCharacterSetConverter, RFs& aFs)
|
|
4960 |
{
|
|
4961 |
TUint8 Byte1 = aVoiceMailInfo.GetL();
|
|
4962 |
|
|
4963 |
iType = (TVoiceMailInfoType) (Byte1 & EMask1Bit);
|
|
4964 |
iProfile = (TSmsMessageProfileType ) ((Byte1 >> 2) & EMask2Bits);
|
|
4965 |
iStorage = (TBool) ((Byte1 >> 4) & EMask1Bit);
|
|
4966 |
iAlmostFull = (TBool) ((Byte1 >> 5) & EMask1Bit);
|
|
4967 |
iFull = (TBool) ((Byte1 >> 6) & EMask1Bit);
|
|
4968 |
iExtensionIndicator = (TBool) ((Byte1 >> 7) & EMask1Bit);
|
|
4969 |
|
|
4970 |
LOGGSMU2("CEnhancedVoiceMailBoxInformation::DecodeL 1st byte = %d", Byte1);
|
|
4971 |
|
|
4972 |
// Create an address object to deccode the mail box access address from the
|
|
4973 |
// format required by 23.040 v6.5.0 section 9.1.2.5.
|
|
4974 |
CSmsAddress* decodedAddress = CSmsAddress::NewL(aCharacterSetConverter,aFs);
|
|
4975 |
CleanupStack::PushL(decodedAddress);
|
|
4976 |
|
|
4977 |
// CSmsAddress::DecodeL is also used to decode source and destination addresses.
|
|
4978 |
// CSmsAddress::DecodeL expects internally that alphanumeric addresses will be size
|
|
4979 |
// CSmsAddress::KSmsAddressMaxAddressValueLength=10.
|
|
4980 |
// Need to add padding bytes to bring the address field up to the maximum size.
|
|
4981 |
const TPtrC8 remainder(aVoiceMailInfo.Remainder());
|
|
4982 |
|
|
4983 |
if (remainder.Length() < CSmsAddress::KSmsAddressMaxAddressLength)
|
|
4984 |
{
|
|
4985 |
TBuf8<CSmsAddress::KSmsAddressMaxAddressLength> data;
|
|
4986 |
data = remainder;
|
|
4987 |
TInt actualLength = data.Length();
|
|
4988 |
data.SetLength(CSmsAddress::KSmsAddressMaxAddressLength);
|
|
4989 |
|
|
4990 |
for (TUint8 j = actualLength; j < CSmsAddress::KSmsAddressMaxAddressLength; j++)
|
|
4991 |
{
|
|
4992 |
data[j] = 0;
|
|
4993 |
}
|
|
4994 |
|
|
4995 |
TGsmuLex8 encodedAddress(data);
|
|
4996 |
decodedAddress->DecodeL(encodedAddress);
|
|
4997 |
// might want to check that aVoiceMailInfo can be incremented
|
|
4998 |
// by encodedAddress.Offset.
|
|
4999 |
aVoiceMailInfo.Inc(encodedAddress.Offset());
|
|
5000 |
}
|
|
5001 |
else
|
|
5002 |
{
|
|
5003 |
decodedAddress->DecodeL(aVoiceMailInfo);
|
|
5004 |
}
|
|
5005 |
|
|
5006 |
TInt length=(decodedAddress->Address()).Length();
|
|
5007 |
NewBufferL(length);
|
|
5008 |
iAccessAddress->Des().Copy((decodedAddress->Address().Ptr()),length);
|
|
5009 |
|
|
5010 |
iTypeOfAddress = decodedAddress->TypeOfAddress();
|
|
5011 |
|
|
5012 |
CleanupStack::PopAndDestroy(decodedAddress);
|
|
5013 |
|
|
5014 |
iNumberOfVoiceMessages = aVoiceMailInfo.GetL();
|
|
5015 |
LOGGSMU2("CEnhancedVoiceMailBoxInformation::DecodeL iNumberOfVoiceMessages = %d", iNumberOfVoiceMessages);
|
|
5016 |
} // CEnhancedVoiceMailBoxInformation::DecodeL
|
|
5017 |
|
|
5018 |
|
|
5019 |
CEnhancedVoiceMailBoxInformation::CEnhancedVoiceMailBoxInformation()
|
|
5020 |
{
|
|
5021 |
LOGGSMU1("CEnhancedVoiceMailBoxInformation::CEnhancedVoiceMailBoxInformation()");
|
|
5022 |
|
|
5023 |
// Consider changing this over to a Panic.
|
|
5024 |
iType = EGsmSmsVoiceMailNotification;
|
|
5025 |
iOctet1Bit1 = EFalse;
|
|
5026 |
iProfile = EGsmSmsProfileId1;
|
|
5027 |
iStorage = EFalse;
|
|
5028 |
iAlmostFull = EFalse;
|
|
5029 |
iFull = EFalse;
|
|
5030 |
iExtensionIndicator = EFalse;
|
|
5031 |
iTypeOfAddress = 0;
|
|
5032 |
} // CEnhancedVoiceMailBoxInformation::CEnhancedVoiceMailBoxInformation
|
|
5033 |
|
|
5034 |
|
|
5035 |
CEnhancedVoiceMailBoxInformation::CEnhancedVoiceMailBoxInformation(TVoiceMailInfoType aTVoiceMailInfoType)
|
|
5036 |
{
|
|
5037 |
LOGGSMU1("CEnhancedVoiceMailBoxInformation::CEnhancedVoiceMailBoxInformation()");
|
|
5038 |
|
|
5039 |
iType = aTVoiceMailInfoType;
|
|
5040 |
iOctet1Bit1 = EFalse;
|
|
5041 |
iProfile = EGsmSmsProfileId1;
|
|
5042 |
iStorage = EFalse;
|
|
5043 |
iAlmostFull = EFalse;
|
|
5044 |
iFull = EFalse;
|
|
5045 |
iExtensionIndicator = EFalse;
|
|
5046 |
iTypeOfAddress = 0;
|
|
5047 |
} // CEnhancedVoiceMailBoxInformation::CEnhancedVoiceMailBoxInformation
|
|
5048 |
|
|
5049 |
|
|
5050 |
/**
|
|
5051 |
* @internalComponent
|
|
5052 |
*
|
|
5053 |
* Prevent clients from using the copy constructor by including it in the class definition
|
|
5054 |
* but making it protected and not exporting it.
|
|
5055 |
*
|
|
5056 |
* @capability None
|
|
5057 |
*/
|
|
5058 |
CEnhancedVoiceMailBoxInformation::CEnhancedVoiceMailBoxInformation(const CEnhancedVoiceMailBoxInformation&)
|
|
5059 |
{
|
|
5060 |
// Ignore in code coverage - not intended to be used
|
|
5061 |
BULLSEYE_OFF
|
|
5062 |
LOGGSMU1("CEnhancedVoiceMailBoxInformation::CEnhancedVoiceMailBoxInformation");
|
|
5063 |
Panic(KGsmuPanicMethodBodyNotImplemented);
|
|
5064 |
BULLSEYE_RESTORE
|
|
5065 |
}
|
|
5066 |
|
|
5067 |
/**
|
|
5068 |
* @internalComponent
|
|
5069 |
*
|
|
5070 |
* Prevent clients from using the equality operator by including it in the class definition
|
|
5071 |
* but making it protected and not exporting it.
|
|
5072 |
*
|
|
5073 |
* @capability None
|
|
5074 |
*/
|
|
5075 |
TBool CEnhancedVoiceMailBoxInformation::operator==(const CEnhancedVoiceMailBoxInformation&)
|
|
5076 |
{
|
|
5077 |
// Ignore in code coverage - not intended to be used
|
|
5078 |
BULLSEYE_OFF
|
|
5079 |
LOGGSMU1("CEnhancedVoiceMailBoxInformation::operator==");
|
|
5080 |
Panic(KGsmuPanicMethodBodyNotImplemented);
|
|
5081 |
return EFalse;
|
|
5082 |
BULLSEYE_RESTORE
|
|
5083 |
}
|
|
5084 |
|
|
5085 |
/**
|
|
5086 |
* @internalComponent
|
|
5087 |
*
|
|
5088 |
* Prevent clients from using the assignment operator by including it in the class definition
|
|
5089 |
* but making it protected and not exporting it.
|
|
5090 |
*
|
|
5091 |
* @capability None
|
|
5092 |
*/
|
|
5093 |
void CEnhancedVoiceMailBoxInformation::operator=(const CEnhancedVoiceMailBoxInformation&)
|
|
5094 |
{
|
|
5095 |
// Ignore in code coverage - not intended to be used
|
|
5096 |
BULLSEYE_OFF
|
|
5097 |
LOGGSMU1("CEnhancedVoiceMailBoxInformation::operator=");
|
|
5098 |
Panic(KGsmuPanicMethodBodyNotImplemented);
|
|
5099 |
BULLSEYE_RESTORE
|
|
5100 |
}
|
|
5101 |
|
|
5102 |
void CEnhancedVoiceMailBoxInformation::ConstructL()
|
|
5103 |
{
|
|
5104 |
LOGGSMU1("CEnhancedVoiceMailBoxInformation::ConstructL()");
|
|
5105 |
|
|
5106 |
NewBufferL(0);
|
|
5107 |
} // CEnhancedVoiceMailBoxInformation::ConstructL
|
|
5108 |
|
|
5109 |
|
|
5110 |
CEnhancedVoiceMailBoxInformation::~CEnhancedVoiceMailBoxInformation()
|
|
5111 |
{
|
|
5112 |
LOGGSMU1("CEnhancedVoiceMailBoxInformation::~CEnhancedVoiceMailBoxInformation");
|
|
5113 |
delete iAccessAddress;
|
|
5114 |
} // CEnhancedVoiceMailBoxInformation::ConstructL
|
|
5115 |
|
|
5116 |
|
|
5117 |
CEnhancedVoiceMailBoxInformation* CEnhancedVoiceMailBoxInformation::NewL()
|
|
5118 |
{
|
|
5119 |
LOGGSMU1("CEnhancedVoiceMailBoxInformation::NewL()");
|
|
5120 |
|
|
5121 |
CEnhancedVoiceMailBoxInformation* aCEnhancedVoiceMailBoxInformation=new(ELeave) CEnhancedVoiceMailBoxInformation();
|
|
5122 |
CleanupStack::PushL(aCEnhancedVoiceMailBoxInformation);
|
|
5123 |
aCEnhancedVoiceMailBoxInformation->ConstructL();
|
|
5124 |
CleanupStack::Pop(aCEnhancedVoiceMailBoxInformation);
|
|
5125 |
return aCEnhancedVoiceMailBoxInformation;
|
|
5126 |
} // CEnhancedVoiceMailBoxInformation::NewL
|
|
5127 |
|
|
5128 |
|
|
5129 |
/**
|
|
5130 |
* @publishedAll
|
|
5131 |
*
|
|
5132 |
* Sets the message id to a value between 0 and 65535.
|
|
5133 |
*
|
|
5134 |
* @param aNumber
|
|
5135 |
* The message id
|
|
5136 |
*
|
|
5137 |
* @capability None
|
|
5138 |
*/
|
|
5139 |
EXPORT_C void CVoiceMailNotification::SetMessageId(TUint16 aMessageId)
|
|
5140 |
{
|
|
5141 |
LOGGSMU1("CVoiceMailNotification::SetMessageId()");
|
|
5142 |
|
|
5143 |
iMessageId = aMessageId;
|
|
5144 |
} // CVoiceMailNotification::SetMessageId
|
|
5145 |
|
|
5146 |
|
|
5147 |
/**
|
|
5148 |
* @publishedAll
|
|
5149 |
*
|
|
5150 |
* Retrieves the message id, a value in the range 0 to 65535.
|
|
5151 |
*
|
|
5152 |
* @return
|
|
5153 |
* The message id,
|
|
5154 |
*
|
|
5155 |
* @capability None
|
|
5156 |
*/
|
|
5157 |
EXPORT_C TUint16 CVoiceMailNotification::MessageId() const
|
|
5158 |
{
|
|
5159 |
LOGGSMU1("CVoiceMailNotification::MessageId()");
|
|
5160 |
|
|
5161 |
return iMessageId;
|
|
5162 |
} // CVoiceMailNotification::MessageId
|
|
5163 |
|
|
5164 |
|
|
5165 |
/**
|
|
5166 |
* @publishedAll
|
|
5167 |
*
|
|
5168 |
* Sets the voice mail message length to a value between 0 and 255
|
|
5169 |
*
|
|
5170 |
* @param aLength
|
|
5171 |
* The voice mail message length.
|
|
5172 |
*
|
|
5173 |
* @capability None
|
|
5174 |
*/
|
|
5175 |
EXPORT_C void CVoiceMailNotification::SetMessageLength(TUint8 aLength)
|
|
5176 |
{
|
|
5177 |
LOGGSMU1("CVoiceMailNotification::SetMessageLength()");
|
|
5178 |
|
|
5179 |
iMessageLength=aLength;
|
|
5180 |
} // CVoiceMailNotification::SetMessageLength
|
|
5181 |
|
|
5182 |
|
|
5183 |
/**
|
|
5184 |
* @publishedAll
|
|
5185 |
*
|
|
5186 |
* Retrieves the voice mail message length, a value in the range 0 to 255.
|
|
5187 |
*
|
|
5188 |
* @return
|
|
5189 |
* The voice mail message length.
|
|
5190 |
*
|
|
5191 |
* @capability None
|
|
5192 |
*/
|
|
5193 |
EXPORT_C TUint8 CVoiceMailNotification::MessageLength() const
|
|
5194 |
{
|
|
5195 |
LOGGSMU1("CVoiceMailNotification::MessageLength()");
|
|
5196 |
|
|
5197 |
return iMessageLength;
|
|
5198 |
} // CVoiceMailNotification::MessageLength
|
|
5199 |
|
|
5200 |
|
|
5201 |
/**
|
|
5202 |
* @publishedAll
|
|
5203 |
*
|
|
5204 |
* Sets the number of days that the voice message will be retained to
|
|
5205 |
* a value between 0 and 31. Values in excess of 31 will be capped at
|
|
5206 |
* 31.
|
|
5207 |
*
|
|
5208 |
* @param aDays
|
|
5209 |
* The number of retention days.
|
|
5210 |
*
|
|
5211 |
* @capability None
|
|
5212 |
*/
|
|
5213 |
EXPORT_C void CVoiceMailNotification::SetRetentionDays(TUint8 aDays)
|
|
5214 |
{
|
|
5215 |
LOGGSMU1("CVoiceMailNotification::SetRetentionDays()");
|
|
5216 |
|
|
5217 |
if (aDays > 31)
|
|
5218 |
{
|
|
5219 |
iRetentionDays = 31;
|
|
5220 |
}
|
|
5221 |
else
|
|
5222 |
{
|
|
5223 |
iRetentionDays = aDays;
|
|
5224 |
}
|
|
5225 |
} // CVoiceMailNotification::SetRetentionDays
|
|
5226 |
|
|
5227 |
|
|
5228 |
/**
|
|
5229 |
* @publishedAll
|
|
5230 |
*
|
|
5231 |
* Retrieves the number of days the voice message will be retained.
|
|
5232 |
*
|
|
5233 |
* @return
|
|
5234 |
* The number of days the voice message will be retained.
|
|
5235 |
*
|
|
5236 |
* @capability None
|
|
5237 |
*/
|
|
5238 |
EXPORT_C TUint8 CVoiceMailNotification::RetentionDays() const
|
|
5239 |
{
|
|
5240 |
LOGGSMU1("CVoiceMailNotification::RetentionDays()");
|
|
5241 |
|
|
5242 |
return iRetentionDays;
|
|
5243 |
} // CVoiceMailNotification::RetentionDays
|
|
5244 |
|
|
5245 |
|
|
5246 |
/**
|
|
5247 |
* @publishedAll
|
|
5248 |
*
|
|
5249 |
* Sets the message priority to urgent
|
|
5250 |
*
|
|
5251 |
* @param aPriority
|
|
5252 |
* Set to True if the priority is urgent,
|
|
5253 |
* Otherwise set to False.
|
|
5254 |
*
|
|
5255 |
* @capability None
|
|
5256 |
*/
|
|
5257 |
EXPORT_C void CVoiceMailNotification::SetPriorityIndication(TBool aPriority)
|
|
5258 |
{
|
|
5259 |
LOGGSMU1("CVoiceMailNotification::SetPriorityIndication()");
|
|
5260 |
|
|
5261 |
iPriorityIndication=aPriority;
|
|
5262 |
} // CVoiceMailNotification::SetPriorityIndication
|
|
5263 |
|
|
5264 |
|
|
5265 |
/**
|
|
5266 |
* @publishedAll
|
|
5267 |
*
|
|
5268 |
* Retrieves the priority indication.
|
|
5269 |
*
|
|
5270 |
* @return
|
|
5271 |
* True if the priority is urgent,
|
|
5272 |
* False otherwise.
|
|
5273 |
*
|
|
5274 |
* @capability None
|
|
5275 |
*/
|
|
5276 |
EXPORT_C TBool CVoiceMailNotification::PriorityIndication() const
|
|
5277 |
{
|
|
5278 |
LOGGSMU1("CVoiceMailNotification::PriorityIndication()");
|
|
5279 |
|
|
5280 |
return iPriorityIndication;
|
|
5281 |
} // CVoiceMailNotification::PriorityIndication
|
|
5282 |
|
|
5283 |
|
|
5284 |
/**
|
|
5285 |
* @publishedAll
|
|
5286 |
*
|
|
5287 |
* Indicates whether the voice mail notification contains extension bytes.
|
|
5288 |
*
|
|
5289 |
* @return
|
|
5290 |
* True if the voice mail notification contains extension bytes.
|
|
5291 |
* False otherwise.
|
|
5292 |
*
|
|
5293 |
* @capability None
|
|
5294 |
*/
|
|
5295 |
EXPORT_C TBool CVoiceMailNotification::MessageExtensionIndication() const
|
|
5296 |
{
|
|
5297 |
LOGGSMU1("CVoiceMailNotification::MessageExtensionIndication()");
|
|
5298 |
|
|
5299 |
return iMessageExtensionIndicator;
|
|
5300 |
} // CVoiceMailNotification::MessageExtensionIndication
|
|
5301 |
|
|
5302 |
|
|
5303 |
void CVoiceMailNotification::NewBufferL(TInt aLength)
|
|
5304 |
{
|
|
5305 |
LOGGSMU1("CVoiceMailNotification::NewBufferL()");
|
|
5306 |
|
|
5307 |
HBufC* buffer=HBufC::NewL(aLength);
|
|
5308 |
delete iCallingLineIdentity;
|
|
5309 |
iCallingLineIdentity=buffer;
|
|
5310 |
iCallingLineIdentity->Des().SetLength(aLength);
|
|
5311 |
iCallingLineIdentity->Des().FillZ();
|
|
5312 |
} // CVoiceMailNotification::NewBufferL
|
|
5313 |
|
|
5314 |
|
|
5315 |
/**
|
|
5316 |
* @publishedAll
|
|
5317 |
*
|
|
5318 |
* Used to set the calling line idenity
|
|
5319 |
*
|
|
5320 |
* @param aLineIdentity
|
|
5321 |
*
|
|
5322 |
* @capability None
|
|
5323 |
*/
|
|
5324 |
EXPORT_C void CVoiceMailNotification::SetCallingLineIdentityL(TDesC& aLineIdentity)
|
|
5325 |
{
|
|
5326 |
LOGGSMU1("CVoiceMailNotification::SetCallingLineIdentityL()");
|
|
5327 |
|
|
5328 |
TInt length=aLineIdentity.Length();
|
|
5329 |
NewBufferL(length);
|
|
5330 |
iCallingLineIdentity->Des().Copy(aLineIdentity);
|
|
5331 |
|
|
5332 |
const TGsmSmsTypeOfNumber typeofnumber=length && (iCallingLineIdentity->Des()[0]=='+')? EGsmSmsTONInternationalNumber: EGsmSmsTONUnknown;
|
|
5333 |
iTypeOfAddress.SetTON(typeofnumber);
|
|
5334 |
} // CVoiceMailNotification::SetCallingLineIdentityL
|
|
5335 |
|
|
5336 |
|
|
5337 |
/**
|
|
5338 |
* @publishedAll
|
|
5339 |
*
|
|
5340 |
* Retrieves the Calling Line Identity
|
|
5341 |
*
|
|
5342 |
* @return
|
|
5343 |
* A pointer to the Calling Line Identity.
|
|
5344 |
*
|
|
5345 |
* @capability None
|
|
5346 |
*/
|
|
5347 |
EXPORT_C TPtrC CVoiceMailNotification::CallingLineIdentity() const
|
|
5348 |
{
|
|
5349 |
LOGGSMU1("CVoiceMailNotification::CallingLineIdentity()");
|
|
5350 |
|
|
5351 |
TPtrC ptr;
|
|
5352 |
if (iCallingLineIdentity)
|
|
5353 |
ptr.Set(iCallingLineIdentity->Des());
|
|
5354 |
return ptr;
|
|
5355 |
} // CVoiceMailNotification::CallingLineIdentity
|
|
5356 |
|
|
5357 |
|
|
5358 |
/**
|
|
5359 |
* @publishedAll
|
|
5360 |
*
|
|
5361 |
* Set the Calling Line Id as a parsed address.
|
|
5362 |
*
|
|
5363 |
* @param aParsedAddress
|
|
5364 |
* The Calling Line Id as a parsed address.
|
|
5365 |
*
|
|
5366 |
* @capability None
|
|
5367 |
*/
|
|
5368 |
EXPORT_C void CVoiceMailNotification::SetParsedCallingLineIdentityL(TGsmSmsTelNumber& aParsedAddress)
|
|
5369 |
{
|
|
5370 |
LOGGSMU1("CVoiceMailNotification::SetParsedCallingLineIdentityL()");
|
|
5371 |
|
|
5372 |
iTypeOfAddress=aParsedAddress.iTypeOfAddress;
|
|
5373 |
DoSetParsedAddressL(aParsedAddress.iTelNumber);
|
|
5374 |
} // CVoiceMailNotification::SetParsedCallingLineIdentityL
|
|
5375 |
|
|
5376 |
|
|
5377 |
/**
|
|
5378 |
* @publishedAll
|
|
5379 |
*
|
|
5380 |
* Gets the Calling Line Id as a parsed address.
|
|
5381 |
*
|
|
5382 |
* @param aParsedAddress
|
|
5383 |
* An output parameter which is to be set to the parsed calling line ID.
|
|
5384 |
*
|
|
5385 |
* @capability None
|
|
5386 |
*/
|
|
5387 |
EXPORT_C void CVoiceMailNotification::ParsedCallingLineIdentity(TGsmSmsTelNumber& aParsedAddress) const
|
|
5388 |
{
|
|
5389 |
LOGGSMU1("CVoiceMailNotification::ParsedCallingLineIdentity()");
|
|
5390 |
|
|
5391 |
aParsedAddress.iTypeOfAddress = iTypeOfAddress;
|
|
5392 |
|
|
5393 |
TInt maxparsedlength=aParsedAddress.iTelNumber.MaxLength();
|
|
5394 |
|
|
5395 |
if (iTypeOfAddress.TON()==EGsmSmsTONAlphaNumeric)
|
|
5396 |
{
|
|
5397 |
TInt parsedlength=CallingLineIdentity().Length();
|
|
5398 |
if (parsedlength>maxparsedlength)
|
|
5399 |
parsedlength=maxparsedlength;
|
|
5400 |
aParsedAddress.iTelNumber.Copy(CallingLineIdentity().Mid(0,parsedlength));
|
|
5401 |
}
|
|
5402 |
else
|
|
5403 |
{
|
|
5404 |
aParsedAddress.iTelNumber.SetLength(maxparsedlength);
|
|
5405 |
|
|
5406 |
TInt length=iCallingLineIdentity->Des().Length();
|
|
5407 |
TInt parsedlength=0;
|
|
5408 |
for (TInt i=0; (i<length) && (parsedlength<maxparsedlength); i++)
|
|
5409 |
{
|
|
5410 |
TText ch=iCallingLineIdentity->Des()[i];
|
|
5411 |
if ((ch>='0') && (ch<='9'))
|
|
5412 |
{
|
|
5413 |
aParsedAddress.iTelNumber[parsedlength]=(TUint8) ch;
|
|
5414 |
parsedlength++;
|
|
5415 |
}
|
|
5416 |
}
|
|
5417 |
|
|
5418 |
aParsedAddress.iTelNumber.SetLength(parsedlength);
|
|
5419 |
}
|
|
5420 |
} // CVoiceMailNotification::ParsedCallingLineIdentity
|
|
5421 |
|
|
5422 |
|
|
5423 |
void CVoiceMailNotification::NewExtensionL(TInt aLength)
|
|
5424 |
{
|
|
5425 |
LOGGSMU1("CVoiceMailNotification::NewExtensionL()");
|
|
5426 |
|
|
5427 |
HBufC* buffer=HBufC::NewL(aLength);
|
|
5428 |
delete iExtension;
|
|
5429 |
iExtension=buffer;
|
|
5430 |
iExtension->Des().SetLength(aLength);
|
|
5431 |
iExtension->Des().FillZ();
|
|
5432 |
} // CVoiceMailNotification::NewExtensionL
|
|
5433 |
|
|
5434 |
|
|
5435 |
/*void CVoiceMailNotification::SetExtension(TDesC& aExtension)
|
|
5436 |
{
|
|
5437 |
LOGGSMU1("CVoiceMailNotification::SetExtension()");
|
|
5438 |
|
|
5439 |
TInt length=aExtension.Length();
|
|
5440 |
NewExtensionL(length);
|
|
5441 |
iExtension->Des().Copy(aExtension);
|
|
5442 |
} // CVoiceMailNotification::SetExtension
|
|
5443 |
|
|
5444 |
TPtrC CVoiceMailNotification::Extension() const
|
|
5445 |
{
|
|
5446 |
LOGGSMU1("CVoiceMailNotification::Extension()");
|
|
5447 |
|
|
5448 |
TPtrC ptr;
|
|
5449 |
if (iExtension)
|
|
5450 |
ptr.Set(iExtension->Des());
|
|
5451 |
return ptr;
|
|
5452 |
}*/
|
|
5453 |
|
|
5454 |
|
|
5455 |
/**
|
|
5456 |
* @internalComponent
|
|
5457 |
*
|
|
5458 |
* Determines the size of the encoded Voice Mail Notification.
|
|
5459 |
*
|
|
5460 |
* @param aCharacterSetConverter A reference to a character set converter.
|
|
5461 |
* @param aFs A reference to the file server.
|
|
5462 |
* @return The size of the encoded Voice Mail Notification
|
|
5463 |
*
|
|
5464 |
* @capability None
|
|
5465 |
*/
|
|
5466 |
TUint8 CVoiceMailNotification::SizeL(CCnvCharacterSetConverter& aCharacterSetConverter, RFs& aFs)
|
|
5467 |
{
|
|
5468 |
LOGGSMU1("CVoiceMailNotification::SizeL()");
|
|
5469 |
|
|
5470 |
const TUint8 KTotalSizeOfFixedLengthAttributes = 4;
|
|
5471 |
TUint8 size = KTotalSizeOfFixedLengthAttributes;
|
|
5472 |
|
|
5473 |
// need to find the size of the calling line ID.
|
|
5474 |
CSmsAddress* address = CSmsAddress::NewL(aCharacterSetConverter,aFs);
|
|
5475 |
CleanupStack::PushL(address);
|
|
5476 |
|
|
5477 |
TPtrC callingLineIdentityPtr;
|
|
5478 |
if (iCallingLineIdentity)
|
|
5479 |
{
|
|
5480 |
callingLineIdentityPtr.Set(iCallingLineIdentity->Des());
|
|
5481 |
}
|
|
5482 |
|
|
5483 |
address->SetRawAddressL(iTypeOfAddress,callingLineIdentityPtr);
|
|
5484 |
|
|
5485 |
size += address->SizeL();
|
|
5486 |
CleanupStack::PopAndDestroy(address);
|
|
5487 |
|
|
5488 |
return size;
|
|
5489 |
} // CVoiceMailNotification::SizeL
|
|
5490 |
|
|
5491 |
|
|
5492 |
TUint8* CVoiceMailNotification::EncodeL(TUint8* aPtr, CCnvCharacterSetConverter& aCharacterSetConverter, RFs& aFs) const
|
|
5493 |
{
|
|
5494 |
// When changes are made to this function that affect the
|
|
5495 |
// number of bytes that are encoded, this should be reflected in
|
|
5496 |
// CVoiceMailNotification::SizeL()
|
|
5497 |
LOGGSMU1("CVoiceMailNotification::EncodeL");
|
|
5498 |
|
|
5499 |
|
|
5500 |
*aPtr = (TUint8) (iMessageId >> 8); // Message Id MSB
|
|
5501 |
aPtr++;
|
|
5502 |
*aPtr = (TUint8) iMessageId; // Message Id LSB
|
|
5503 |
aPtr++;
|
|
5504 |
*aPtr = (TUint8) iMessageLength;
|
|
5505 |
aPtr++;
|
|
5506 |
*aPtr = ((TUint8) (iRetentionDays & EMask5Bits)) +
|
|
5507 |
(((TUint8) iPriorityIndication) << 6) +
|
|
5508 |
(((TUint8) iMessageExtensionIndicator) << 7);
|
|
5509 |
aPtr++;
|
|
5510 |
|
|
5511 |
CSmsAddress* address = CSmsAddress::NewL(aCharacterSetConverter,aFs);
|
|
5512 |
CleanupStack::PushL(address);
|
|
5513 |
|
|
5514 |
TPtrC callingLineIdentityPtr;
|
|
5515 |
if (iCallingLineIdentity)
|
|
5516 |
{
|
|
5517 |
callingLineIdentityPtr.Set(iCallingLineIdentity->Des());
|
|
5518 |
}
|
|
5519 |
|
|
5520 |
address->SetRawAddressL(iTypeOfAddress,callingLineIdentityPtr);
|
|
5521 |
|
|
5522 |
aPtr = address->EncodeL(aPtr);
|
|
5523 |
CleanupStack::PopAndDestroy(address);
|
|
5524 |
|
|
5525 |
return aPtr;
|
|
5526 |
} // CVoiceMailNotification::EncodeL
|
|
5527 |
|
|
5528 |
|
|
5529 |
void CVoiceMailNotification::DecodeL(TGsmuLex8& aVoiceMailInfo, CCnvCharacterSetConverter& aCharacterSetConverter, RFs& aFs)
|
|
5530 |
{
|
|
5531 |
LOGGSMU1("CVoiceMailNotification::DecodeL");
|
|
5532 |
|
|
5533 |
iMessageId = (((TUint16) aVoiceMailInfo.GetL()) << 8);
|
|
5534 |
iMessageId += ((TUint16) aVoiceMailInfo.GetL());
|
|
5535 |
|
|
5536 |
iMessageLength=aVoiceMailInfo.GetL();
|
|
5537 |
|
|
5538 |
TUint8 currentByte = aVoiceMailInfo.GetL();
|
|
5539 |
|
|
5540 |
iRetentionDays = currentByte & EMask5Bits;
|
|
5541 |
iPriorityIndication = ((currentByte >> 6) & EMask1Bit);
|
|
5542 |
iMessageExtensionIndicator = ((currentByte >> 7) & EMask1Bit);
|
|
5543 |
|
|
5544 |
CSmsAddress* decodedAddress = CSmsAddress::NewL(aCharacterSetConverter,aFs);
|
|
5545 |
CleanupStack::PushL(decodedAddress);
|
|
5546 |
|
|
5547 |
const TPtrC8 remainder(aVoiceMailInfo.Remainder());
|
|
5548 |
// The address information element makes an assumption that aVoiceMail must
|
|
5549 |
// be of size CSmsAddress::KSmsAddressMaxAddressLength
|
|
5550 |
// Provide padding to ensure that this is the case.
|
|
5551 |
if (remainder.Length() < CSmsAddress::KSmsAddressMaxAddressLength)
|
|
5552 |
{
|
|
5553 |
TBuf8<CSmsAddress::KSmsAddressMaxAddressLength> data;
|
|
5554 |
data = remainder;
|
|
5555 |
TInt actualLength = data.Length();
|
|
5556 |
data.SetLength(CSmsAddress::KSmsAddressMaxAddressLength);
|
|
5557 |
|
|
5558 |
for (TUint8 j = actualLength; j < CSmsAddress::KSmsAddressMaxAddressLength; j++)
|
|
5559 |
{
|
|
5560 |
data[j] = 0;
|
|
5561 |
}
|
|
5562 |
|
|
5563 |
TGsmuLex8 encodedAddress(data);
|
|
5564 |
decodedAddress->DecodeL(encodedAddress);
|
|
5565 |
// Should be the last piece of data to be decoded
|
|
5566 |
// The next line is included for completeness.
|
|
5567 |
aVoiceMailInfo.Inc(encodedAddress.Offset());
|
|
5568 |
}
|
|
5569 |
else
|
|
5570 |
{
|
|
5571 |
decodedAddress->DecodeL(aVoiceMailInfo);
|
|
5572 |
}
|
|
5573 |
|
|
5574 |
TInt length=(decodedAddress->Address()).Length();
|
|
5575 |
NewBufferL(length);
|
|
5576 |
iCallingLineIdentity->Des().Copy((decodedAddress->Address().Ptr()),length);
|
|
5577 |
|
|
5578 |
iTypeOfAddress = decodedAddress->TypeOfAddress();
|
|
5579 |
|
|
5580 |
CleanupStack::PopAndDestroy(decodedAddress);
|
|
5581 |
|
|
5582 |
if (iMessageExtensionIndicator)
|
|
5583 |
{
|
|
5584 |
TUint8 extensionLength = aVoiceMailInfo.GetL();
|
|
5585 |
aVoiceMailInfo.Inc(extensionLength);
|
|
5586 |
}
|
|
5587 |
} // CVoiceMailNotification::DecodeL
|
|
5588 |
|
|
5589 |
|
|
5590 |
/**
|
|
5591 |
* @internalComponent
|
|
5592 |
*
|
|
5593 |
* Prevent clients from using the copy constructor by including it in the class definition
|
|
5594 |
* but making it protected and not exporting it.
|
|
5595 |
*
|
|
5596 |
* @capability None
|
|
5597 |
*/
|
|
5598 |
CVoiceMailNotification::CVoiceMailNotification(const CVoiceMailNotification&)
|
|
5599 |
{
|
|
5600 |
// Ignore in code coverage - not intended to be used
|
|
5601 |
BULLSEYE_OFF
|
|
5602 |
LOGGSMU1("CVoiceMailNotification::CVoiceMailNotification");
|
|
5603 |
Panic(KGsmuPanicMethodBodyNotImplemented);
|
|
5604 |
BULLSEYE_RESTORE
|
|
5605 |
}
|
|
5606 |
|
|
5607 |
/**
|
|
5608 |
* @internalComponent
|
|
5609 |
*
|
|
5610 |
* Prevent clients from using the equality operator by including it in the class definition
|
|
5611 |
* but making it protected and not exporting it.
|
|
5612 |
*
|
|
5613 |
* @capability None
|
|
5614 |
*/
|
|
5615 |
TBool CVoiceMailNotification::operator==(const CVoiceMailNotification&)
|
|
5616 |
{
|
|
5617 |
// Ignore in code coverage - not intended to be used
|
|
5618 |
BULLSEYE_OFF
|
|
5619 |
LOGGSMU1("CVoiceMailNotification::operator==");
|
|
5620 |
Panic(KGsmuPanicMethodBodyNotImplemented);
|
|
5621 |
return EFalse;
|
|
5622 |
BULLSEYE_RESTORE
|
|
5623 |
}
|
|
5624 |
|
|
5625 |
/**
|
|
5626 |
* @internalComponent
|
|
5627 |
*
|
|
5628 |
* Prevent clients from using the assignment operator by including it in the class definition
|
|
5629 |
* but making it protected and not exporting it.
|
|
5630 |
*
|
|
5631 |
* @capability None
|
|
5632 |
*/
|
|
5633 |
void CVoiceMailNotification::operator=(const CVoiceMailNotification&)
|
|
5634 |
{
|
|
5635 |
// Ignore in code coverage - not intended to be used
|
|
5636 |
BULLSEYE_OFF
|
|
5637 |
LOGGSMU1("CVoiceMailNotification::operator=");
|
|
5638 |
Panic(KGsmuPanicMethodBodyNotImplemented);
|
|
5639 |
BULLSEYE_RESTORE
|
|
5640 |
}
|
|
5641 |
|
|
5642 |
CVoiceMailNotification::CVoiceMailNotification()
|
|
5643 |
{
|
|
5644 |
LOGGSMU1("CVoiceMailNotification::CVoiceMailNotification()");
|
|
5645 |
|
|
5646 |
iMessageId = 0;
|
|
5647 |
iMessageLength = 0;
|
|
5648 |
iRetentionDays = 0;
|
|
5649 |
iOctetN8Bit1 = EFalse;
|
|
5650 |
iPriorityIndication = EFalse;
|
|
5651 |
iMessageExtensionIndicator = EFalse;
|
|
5652 |
iTypeOfAddress = 0;
|
|
5653 |
} // CVoiceMailNotification::CVoiceMailNotification
|
|
5654 |
|
|
5655 |
|
|
5656 |
/**
|
|
5657 |
* @publishedAll
|
|
5658 |
*
|
|
5659 |
* Class Destructor
|
|
5660 |
*
|
|
5661 |
* @capability None
|
|
5662 |
*/
|
|
5663 |
EXPORT_C CVoiceMailNotification::~CVoiceMailNotification()
|
|
5664 |
{
|
|
5665 |
LOGGSMU1("CVoiceMailNotification::~CVoiceMailNotification");
|
|
5666 |
delete iCallingLineIdentity;
|
|
5667 |
delete iExtension;
|
|
5668 |
} // CVoiceMailNotification::CVoiceMailNotification
|
|
5669 |
|
|
5670 |
|
|
5671 |
void CVoiceMailNotification::ConstructL()
|
|
5672 |
{
|
|
5673 |
LOGGSMU1("CVoiceMailNotification::ConstructL()");
|
|
5674 |
|
|
5675 |
NewBufferL(0);
|
|
5676 |
NewExtensionL(0);
|
|
5677 |
} // CVoiceMailNotification::ConstructL
|
|
5678 |
|
|
5679 |
|
|
5680 |
/**
|
|
5681 |
* @publishedAll
|
|
5682 |
*
|
|
5683 |
* Class construction method.
|
|
5684 |
*
|
|
5685 |
* @capability None
|
|
5686 |
*/
|
|
5687 |
EXPORT_C CVoiceMailNotification* CVoiceMailNotification::NewL()
|
|
5688 |
{
|
|
5689 |
LOGGSMU1("CVoiceMailNotification::NewL()");
|
|
5690 |
|
|
5691 |
CVoiceMailNotification* aCVoiceMailNotification=new(ELeave) CVoiceMailNotification();
|
|
5692 |
CleanupStack::PushL(aCVoiceMailNotification);
|
|
5693 |
aCVoiceMailNotification->ConstructL();
|
|
5694 |
CleanupStack::Pop(aCVoiceMailNotification);
|
|
5695 |
return aCVoiceMailNotification;
|
|
5696 |
} // CVoiceMailNotification::NewL
|
|
5697 |
|
|
5698 |
|
|
5699 |
void CVoiceMailNotification::DoSetParsedAddressL(const TDesC& aAddress)
|
|
5700 |
{
|
|
5701 |
LOGGSMU1("CVoiceMailNotification::DoSetParsedAddressL()");
|
|
5702 |
|
|
5703 |
TInt length=aAddress.Length();
|
|
5704 |
if ((iTypeOfAddress.TON()==EGsmSmsTONInternationalNumber) &&
|
|
5705 |
(length && (aAddress[0]!='+')))
|
|
5706 |
{
|
|
5707 |
NewBufferL(length+1);
|
|
5708 |
iCallingLineIdentity->Des()[0]='+';
|
|
5709 |
TPtr ptr((TText*) (iCallingLineIdentity->Des().Ptr()+1),length,length);
|
|
5710 |
ptr.Copy(aAddress);
|
|
5711 |
}
|
|
5712 |
else
|
|
5713 |
{
|
|
5714 |
NewBufferL(length);
|
|
5715 |
iCallingLineIdentity->Des().Copy(aAddress);
|
|
5716 |
}
|
|
5717 |
} // CVoiceMailNotification::DoSetParsedAddressL
|
|
5718 |
|
|
5719 |
|
|
5720 |
/**
|
|
5721 |
* @publishedAll
|
|
5722 |
*
|
|
5723 |
* Retrieves the number of voice message notifications contained in
|
|
5724 |
* this information. The range is 0 to 15.
|
|
5725 |
*
|
|
5726 |
* @return
|
|
5727 |
* The number of voice message notifications in this information element.
|
|
5728 |
*
|
|
5729 |
* @capability None
|
|
5730 |
*/
|
|
5731 |
EXPORT_C TUint8 CEnhancedVoiceMailNotification::NumberOfVoiceMails()
|
|
5732 |
{
|
|
5733 |
LOGGSMU1("CEnhancedVoiceMailNotification::NumberOfVoiceMails()");
|
|
5734 |
|
|
5735 |
return (TUint8) iNotifications->Count();
|
|
5736 |
} // CEnhancedVoiceMailNotification::NumberOfVoiceMails
|
|
5737 |
|
|
5738 |
|
|
5739 |
/*void CEnhancedVoiceMailNotification::SetExtension(TDesC& aExtension)
|
|
5740 |
{
|
|
5741 |
LOGGSMU1("CEnhancedVoiceMailNotification::SetExtension()");
|
|
5742 |
|
|
5743 |
TInt length=aExtension.Length();
|
|
5744 |
NewExtensionL(length);
|
|
5745 |
iExtension->Des().Copy(aExtension);
|
|
5746 |
} // CEnhancedVoiceMailNotification::SetExtension
|
|
5747 |
|
|
5748 |
TPtrC CEnhancedVoiceMailNotification::Extension() const
|
|
5749 |
{
|
|
5750 |
LOGGSMU1("CEnhancedVoiceMailNotification::Extension()");
|
|
5751 |
|
|
5752 |
TPtrC ptr;
|
|
5753 |
if (iExtension)
|
|
5754 |
ptr.Set(iExtension->Des());
|
|
5755 |
return ptr;
|
|
5756 |
}*/
|
|
5757 |
|
|
5758 |
|
|
5759 |
/**
|
|
5760 |
* @publishedAll
|
|
5761 |
*
|
|
5762 |
* Provides a reference to the collection that is used to contain the Voice Mail Notifications.
|
|
5763 |
* A maximum of 15 voice mail confirmations is supported. If more that 15 voice mails notifications are added
|
|
5764 |
* the CEnhancedVoiceMailNotification will not be added to the CSmsMessage by the CSmsEnhancedVoiceMailOperations
|
|
5765 |
* class.
|
|
5766 |
*
|
|
5767 |
* @return
|
|
5768 |
* A reference to the collection that is used to contain the Voice Mail Notifications.
|
|
5769 |
*
|
|
5770 |
* @capability None
|
|
5771 |
*/
|
|
5772 |
EXPORT_C RPointerArray<CVoiceMailNotification>& CEnhancedVoiceMailNotification::GetVoiceMailNotifications()
|
|
5773 |
{
|
|
5774 |
LOGGSMU1("CEnhancedVoiceMailNotification::GetVoiceMailNotifications()");
|
|
5775 |
|
|
5776 |
return *iNotifications;
|
|
5777 |
} // CEnhancedVoiceMailNotification::GetVoiceMailNotifications
|
|
5778 |
|
|
5779 |
|
|
5780 |
void CEnhancedVoiceMailNotification::NewExtensionL(TInt aLength)
|
|
5781 |
{
|
|
5782 |
LOGGSMU1("CEnhancedVoiceMailNotification::NewExtensionL()");
|
|
5783 |
|
|
5784 |
HBufC* buffer=HBufC::NewL(aLength);
|
|
5785 |
delete iExtension;
|
|
5786 |
iExtension=buffer;
|
|
5787 |
iExtension->Des().SetLength(aLength);
|
|
5788 |
iExtension->Des().FillZ();
|
|
5789 |
} // CEnhancedVoiceMailNotification::NewExtensionL
|
|
5790 |
|
|
5791 |
|
|
5792 |
/**
|
|
5793 |
* @publishedAll
|
|
5794 |
*
|
|
5795 |
* Class construction method.
|
|
5796 |
*
|
|
5797 |
* @capability None
|
|
5798 |
*/
|
|
5799 |
EXPORT_C CEnhancedVoiceMailNotification* CEnhancedVoiceMailNotification::NewL()
|
|
5800 |
{
|
|
5801 |
LOGGSMU1("CEnhancedVoiceMailNotification::NewL()");
|
|
5802 |
|
|
5803 |
CEnhancedVoiceMailNotification* aCEnhancedVoiceMailNotification=new(ELeave) CEnhancedVoiceMailNotification();
|
|
5804 |
CleanupStack::PushL(aCEnhancedVoiceMailNotification);
|
|
5805 |
aCEnhancedVoiceMailNotification->CEnhancedVoiceMailBoxInformation::ConstructL();
|
|
5806 |
aCEnhancedVoiceMailNotification->ConstructL();
|
|
5807 |
CleanupStack::Pop(aCEnhancedVoiceMailNotification);
|
|
5808 |
return aCEnhancedVoiceMailNotification;
|
|
5809 |
} // CEnhancedVoiceMailNotification::NewL
|
|
5810 |
|
|
5811 |
|
|
5812 |
CEnhancedVoiceMailNotification::CEnhancedVoiceMailNotification() : CEnhancedVoiceMailBoxInformation(EGsmSmsVoiceMailNotification)
|
|
5813 |
{
|
|
5814 |
} // CEnhancedVoiceMailNotification::CEnhancedVoiceMailNotification
|
|
5815 |
|
|
5816 |
|
|
5817 |
/**
|
|
5818 |
* @internalComponent
|
|
5819 |
*
|
|
5820 |
* Prevent clients from using the copy constructor by including it in the class definition
|
|
5821 |
* but making it protected and not exporting it.
|
|
5822 |
*
|
|
5823 |
* @capability None
|
|
5824 |
*/
|
|
5825 |
CEnhancedVoiceMailNotification::CEnhancedVoiceMailNotification(const CEnhancedVoiceMailNotification&)
|
|
5826 |
{
|
|
5827 |
// Ignore in code coverage - not intended to be used
|
|
5828 |
BULLSEYE_OFF
|
|
5829 |
LOGGSMU1("CEnhancedVoiceMailNotification::CEnhancedVoiceMailNotification");
|
|
5830 |
Panic(KGsmuPanicMethodBodyNotImplemented);
|
|
5831 |
BULLSEYE_RESTORE
|
|
5832 |
}
|
|
5833 |
|
|
5834 |
/**
|
|
5835 |
* @internalComponent
|
|
5836 |
*
|
|
5837 |
* Prevent clients from using the equality operator by including it in the class definition
|
|
5838 |
* but making it protected and not exporting it.
|
|
5839 |
*
|
|
5840 |
* @capability None
|
|
5841 |
*/
|
|
5842 |
TBool CEnhancedVoiceMailNotification::operator==(const CEnhancedVoiceMailNotification&)
|
|
5843 |
{
|
|
5844 |
// Ignore in code coverage - not intended to be used
|
|
5845 |
BULLSEYE_OFF
|
|
5846 |
LOGGSMU1("CEnhancedVoiceMailNotification::operator==");
|
|
5847 |
Panic(KGsmuPanicMethodBodyNotImplemented);
|
|
5848 |
return EFalse;
|
|
5849 |
BULLSEYE_RESTORE
|
|
5850 |
}
|
|
5851 |
|
|
5852 |
/**
|
|
5853 |
* @internalComponent
|
|
5854 |
*
|
|
5855 |
* Prevent clients from using the assignment operator by including it in the class definition
|
|
5856 |
* but making it protected and not exporting it.
|
|
5857 |
*
|
|
5858 |
* @capability None
|
|
5859 |
*/
|
|
5860 |
void CEnhancedVoiceMailNotification::operator=(const CEnhancedVoiceMailNotification&)
|
|
5861 |
{
|
|
5862 |
// Ignore in code coverage - not intended to be used
|
|
5863 |
BULLSEYE_OFF
|
|
5864 |
LOGGSMU1("CEnhancedVoiceMailNotification::operator=");
|
|
5865 |
Panic(KGsmuPanicMethodBodyNotImplemented);
|
|
5866 |
BULLSEYE_RESTORE
|
|
5867 |
}
|
|
5868 |
|
|
5869 |
/**
|
|
5870 |
* @publishedAll
|
|
5871 |
*
|
|
5872 |
* Class destructor.
|
|
5873 |
*
|
|
5874 |
* @capability None
|
|
5875 |
*/
|
|
5876 |
EXPORT_C CEnhancedVoiceMailNotification::~CEnhancedVoiceMailNotification()
|
|
5877 |
{
|
|
5878 |
LOGGSMU1("CEnhancedVoiceMailNotification::~CEnhancedVoiceMailNotification");
|
|
5879 |
delete iExtension;
|
|
5880 |
iNotifications->ResetAndDestroy();
|
|
5881 |
iNotifications->Close();
|
|
5882 |
delete iNotifications;
|
|
5883 |
} // CEnhancedVoiceMailNotification::operator
|
|
5884 |
|
|
5885 |
|
|
5886 |
void CEnhancedVoiceMailNotification::ConstructL()
|
|
5887 |
{
|
|
5888 |
LOGGSMU1("CEnhancedVoiceMailNotification::ConstructL()");
|
|
5889 |
|
|
5890 |
NewExtensionL(0);
|
|
5891 |
iNotifications = new (ELeave) RPointerArray<CVoiceMailNotification>(KMaxNumberOfNotifications);
|
|
5892 |
} // CEnhancedVoiceMailNotification::ConstructL
|
|
5893 |
|
|
5894 |
|
|
5895 |
TUint8* CEnhancedVoiceMailNotification::EncodeL(TUint8* aCurrentPtr, CCnvCharacterSetConverter& aCharacterSetConverter, RFs& aFs) const
|
|
5896 |
{
|
|
5897 |
LOGGSMU1("CEnhancedVoiceMailNotification::EncodeL");
|
|
5898 |
|
|
5899 |
TUint8* startPtr = aCurrentPtr;
|
|
5900 |
|
|
5901 |
aCurrentPtr = CEnhancedVoiceMailBoxInformation::EncodeL(aCurrentPtr, aCharacterSetConverter, aFs);
|
|
5902 |
|
|
5903 |
TUint8 count = (TUint8) iNotifications->Count();
|
|
5904 |
if (count > KMaxNumberOfNotifications)
|
|
5905 |
{
|
|
5906 |
User::Leave(KErrArgument);
|
|
5907 |
}
|
|
5908 |
|
|
5909 |
*aCurrentPtr = (count & KSmsNotificationBitMask);
|
|
5910 |
aCurrentPtr++;
|
|
5911 |
|
|
5912 |
TInt16 spaceAlreadyAllocated = 0; // handle architectures whose address space increments and whose address space decrements.
|
|
5913 |
(aCurrentPtr > startPtr) ? (spaceAlreadyAllocated = aCurrentPtr - startPtr) : (spaceAlreadyAllocated = startPtr - aCurrentPtr);
|
|
5914 |
|
|
5915 |
TInt16 remainingSize = (TInt16)(CEnhancedVoiceMailNotification::KSmsMaxEnhancedVoiceMailSize - spaceAlreadyAllocated);
|
|
5916 |
for (TUint i = 0; i < count; i++)
|
|
5917 |
{
|
|
5918 |
remainingSize -= (TInt16)(*iNotifications)[i]->SizeL(aCharacterSetConverter,aFs);
|
|
5919 |
if (remainingSize < 0)
|
|
5920 |
{
|
|
5921 |
User::Leave(KErrArgument);
|
|
5922 |
}
|
|
5923 |
|
|
5924 |
aCurrentPtr = (*iNotifications)[i]->EncodeL(aCurrentPtr, aCharacterSetConverter, aFs);
|
|
5925 |
}
|
|
5926 |
|
|
5927 |
return aCurrentPtr;
|
|
5928 |
} // CEnhancedVoiceMailNotification::EncodeL
|
|
5929 |
|
|
5930 |
|
|
5931 |
void CEnhancedVoiceMailNotification::DecodeL(TGsmuLex8& aVoiceMailInfo, CCnvCharacterSetConverter& aCharacterSetConverter, RFs& aFs)
|
|
5932 |
{
|
|
5933 |
LOGGSMU1("CEnhancedVoiceMailNotification::DecodeL");
|
|
5934 |
|
|
5935 |
CEnhancedVoiceMailBoxInformation::DecodeL(aVoiceMailInfo, aCharacterSetConverter, aFs);
|
|
5936 |
|
|
5937 |
TUint8 numberOfNotifications = (aVoiceMailInfo.GetL() & KSmsNotificationBitMask);
|
|
5938 |
|
|
5939 |
if (iExtensionIndicator)
|
|
5940 |
{
|
|
5941 |
TUint8 extensionLength = aVoiceMailInfo.GetL();
|
|
5942 |
aVoiceMailInfo.Inc(extensionLength);
|
|
5943 |
}
|
|
5944 |
|
|
5945 |
for (TUint8 i = 0; i < numberOfNotifications; i++)
|
|
5946 |
{
|
|
5947 |
CVoiceMailNotification* voiceMailNotification = CVoiceMailNotification::NewL();
|
|
5948 |
CleanupStack::PushL(voiceMailNotification);
|
|
5949 |
voiceMailNotification->DecodeL(aVoiceMailInfo, aCharacterSetConverter, aFs);
|
|
5950 |
iNotifications->AppendL(voiceMailNotification);
|
|
5951 |
CleanupStack::Pop(voiceMailNotification);
|
|
5952 |
}
|
|
5953 |
} // CEnhancedVoiceMailNotification::DecodeL
|
|
5954 |
|
|
5955 |
|
|
5956 |
/**
|
|
5957 |
* @publishedAll
|
|
5958 |
*
|
|
5959 |
* Sets the message ID of the specific Voice Mail message
|
|
5960 |
* whose deletion is being confirmed.
|
|
5961 |
*
|
|
5962 |
* @param aMessageId
|
|
5963 |
* The message ID of the specific voice mail message whose deletion
|
|
5964 |
* is being confirmed.
|
|
5965 |
*
|
|
5966 |
* @capability None
|
|
5967 |
*/
|
|
5968 |
EXPORT_C void CVoiceMailDeletion::SetMessageId(TUint16 aMessageId)
|
|
5969 |
{
|
|
5970 |
LOGGSMU1("CVoiceMailDeletion::SetMessageId()");
|
|
5971 |
|
|
5972 |
iMessageId=aMessageId;
|
|
5973 |
} // CVoiceMailDeletion::SetMessageId
|
|
5974 |
|
|
5975 |
|
|
5976 |
/**
|
|
5977 |
* @publishedAll
|
|
5978 |
*
|
|
5979 |
* Retrieves the message ID of the Voice Mail message
|
|
5980 |
* whose deletion is being confirmed, range 0 to 65535.
|
|
5981 |
*
|
|
5982 |
* @return
|
|
5983 |
* The message ID of the Voice Mail message whose deletion
|
|
5984 |
* is being confirmed, range 0 to 65535.
|
|
5985 |
*
|
|
5986 |
* @capability None
|
|
5987 |
*/
|
|
5988 |
EXPORT_C TUint16 CVoiceMailDeletion::MessageId() const
|
|
5989 |
{
|
|
5990 |
LOGGSMU1("CVoiceMailDeletion::MessageId()");
|
|
5991 |
|
|
5992 |
return iMessageId;
|
|
5993 |
} // CVoiceMailDeletion::MessageId
|
|
5994 |
|
|
5995 |
|
|
5996 |
/**
|
|
5997 |
* @publishedAll
|
|
5998 |
*
|
|
5999 |
* Indicates whether the voice mail deletion contains extension bytes.
|
|
6000 |
*
|
|
6001 |
* @return
|
|
6002 |
* True if the voice mail deletion contains extension bytes.
|
|
6003 |
* False otherwise.
|
|
6004 |
*
|
|
6005 |
* @capability None
|
|
6006 |
*/
|
|
6007 |
EXPORT_C TBool CVoiceMailDeletion::MessageExtensionIndication() const
|
|
6008 |
{
|
|
6009 |
LOGGSMU1("CVoiceMailDeletion::MessageExtensionIndication()");
|
|
6010 |
|
|
6011 |
return iExtensionIndicator;
|
|
6012 |
} // CVoiceMailDeletion::MessageExtensionIndication
|
|
6013 |
|
|
6014 |
|
|
6015 |
TUint8 CVoiceMailDeletion::SizeL()
|
|
6016 |
{
|
|
6017 |
LOGGSMU1("CVoiceMailDeletion::SizeL()");
|
|
6018 |
|
|
6019 |
const TUint8 KSizeOfVoiceMailDeletion = 3;
|
|
6020 |
return KSizeOfVoiceMailDeletion;
|
|
6021 |
} // CVoiceMailDeletion::SizeL
|
|
6022 |
|
|
6023 |
|
|
6024 |
TUint8* CVoiceMailDeletion::EncodeL(TUint8* aPtr) const
|
|
6025 |
{
|
|
6026 |
// When changes are made which affect the
|
|
6027 |
// number of bytes encoded, this should be
|
|
6028 |
// reflected in VoiceMailDeletion::SizeL()
|
|
6029 |
LOGGSMU1("CVoiceMailDeletion::EncodeL");
|
|
6030 |
|
|
6031 |
*aPtr = (TUint8) (iMessageId >> 8);
|
|
6032 |
aPtr++;
|
|
6033 |
*aPtr = (TUint8) iMessageId;
|
|
6034 |
aPtr++;
|
|
6035 |
*aPtr = ((TUint8) iExtensionIndicator) << 7;
|
|
6036 |
aPtr++;
|
|
6037 |
return aPtr;
|
|
6038 |
} // CVoiceMailDeletion::EncodeL
|
|
6039 |
|
|
6040 |
|
|
6041 |
void CVoiceMailDeletion::DecodeL(TGsmuLex8& aVoiceMailInfo)
|
|
6042 |
{
|
|
6043 |
LOGGSMU1("CVoiceMailDeletion::DecodeL");
|
|
6044 |
|
|
6045 |
iMessageId = (((TUint16) aVoiceMailInfo.GetL()) << 8) +
|
|
6046 |
((TUint16) aVoiceMailInfo.GetL());
|
|
6047 |
iExtensionIndicator = (aVoiceMailInfo.GetL() >> 7);
|
|
6048 |
|
|
6049 |
if (iExtensionIndicator)
|
|
6050 |
{
|
|
6051 |
TUint8 extensionLength = aVoiceMailInfo.GetL();
|
|
6052 |
aVoiceMailInfo.Inc(extensionLength);
|
|
6053 |
}
|
|
6054 |
} // CVoiceMailDeletion::DecodeL
|
|
6055 |
|
|
6056 |
|
|
6057 |
CVoiceMailDeletion::CVoiceMailDeletion()
|
|
6058 |
{
|
|
6059 |
iMessageId = 0;
|
|
6060 |
iExtensionIndicator = EFalse;
|
|
6061 |
} // CVoiceMailDeletion::CVoiceMailDeletion
|
|
6062 |
|
|
6063 |
|
|
6064 |
/**
|
|
6065 |
* @internalComponent
|
|
6066 |
*
|
|
6067 |
* Prevent clients from using the copy constructor by including it in the class definition
|
|
6068 |
* but making it protected and not exporting it.
|
|
6069 |
*
|
|
6070 |
* @capability None
|
|
6071 |
*/
|
|
6072 |
CVoiceMailDeletion::CVoiceMailDeletion(const CVoiceMailDeletion&)
|
|
6073 |
{
|
|
6074 |
// Ignore in code coverage - not intended to be used
|
|
6075 |
BULLSEYE_OFF
|
|
6076 |
LOGGSMU1("CVoiceMailDeletion::CVoiceMailDeletion");
|
|
6077 |
Panic(KGsmuPanicMethodBodyNotImplemented);
|
|
6078 |
BULLSEYE_RESTORE
|
|
6079 |
}
|
|
6080 |
|
|
6081 |
/**
|
|
6082 |
* @internalComponent
|
|
6083 |
*
|
|
6084 |
* Prevent clients from using the equality operator by including it in the class definition
|
|
6085 |
* but making it protected and not exporting it.
|
|
6086 |
*
|
|
6087 |
* @capability None
|
|
6088 |
*/
|
|
6089 |
TBool CVoiceMailDeletion::operator==(const CVoiceMailDeletion&)
|
|
6090 |
{
|
|
6091 |
// Ignore in code coverage - not intended to be used
|
|
6092 |
BULLSEYE_OFF
|
|
6093 |
LOGGSMU1("CVoiceMailDeletion::operator==");
|
|
6094 |
Panic(KGsmuPanicMethodBodyNotImplemented);
|
|
6095 |
return EFalse;
|
|
6096 |
BULLSEYE_RESTORE
|
|
6097 |
}
|
|
6098 |
|
|
6099 |
/**
|
|
6100 |
* @internalComponent
|
|
6101 |
*
|
|
6102 |
* Prevent clients from using the assignment operator by including it in the class definition
|
|
6103 |
* but making it protected and not exporting it.
|
|
6104 |
*
|
|
6105 |
* @capability None
|
|
6106 |
*/
|
|
6107 |
void CVoiceMailDeletion::operator=(const CVoiceMailDeletion&)
|
|
6108 |
{
|
|
6109 |
// Ignore in code coverage - not intended to be used
|
|
6110 |
BULLSEYE_OFF
|
|
6111 |
LOGGSMU1("CVoiceMailDeletion::operator=");
|
|
6112 |
Panic(KGsmuPanicMethodBodyNotImplemented);
|
|
6113 |
BULLSEYE_RESTORE
|
|
6114 |
}
|
|
6115 |
|
|
6116 |
/**
|
|
6117 |
* @publishedAll
|
|
6118 |
*
|
|
6119 |
* Class destructor.
|
|
6120 |
*
|
|
6121 |
* @capability None
|
|
6122 |
*/
|
|
6123 |
EXPORT_C CVoiceMailDeletion::~CVoiceMailDeletion()
|
|
6124 |
{
|
|
6125 |
LOGGSMU1("CVoiceMailDeletion::~CVoiceMailDeletion");
|
|
6126 |
|
|
6127 |
delete iExtension;
|
|
6128 |
} // CVoiceMailDeletion::operator
|
|
6129 |
|
|
6130 |
|
|
6131 |
void CVoiceMailDeletion::ConstructL()
|
|
6132 |
{
|
|
6133 |
LOGGSMU1("CVoiceMailDeletion::ConstructL()");
|
|
6134 |
|
|
6135 |
NewBufferL(0);
|
|
6136 |
} // CVoiceMailDeletion::ConstructL
|
|
6137 |
|
|
6138 |
|
|
6139 |
void CVoiceMailDeletion::NewBufferL(TInt aLength)
|
|
6140 |
{
|
|
6141 |
LOGGSMU1("CVoiceMailDeletion::NewBufferL()");
|
|
6142 |
|
|
6143 |
HBufC* buffer=HBufC::NewL(aLength);
|
|
6144 |
delete iExtension;
|
|
6145 |
iExtension=buffer;
|
|
6146 |
iExtension->Des().SetLength(aLength);
|
|
6147 |
iExtension->Des().FillZ();
|
|
6148 |
} // CVoiceMailDeletion::NewBufferL
|
|
6149 |
|
|
6150 |
|
|
6151 |
/**
|
|
6152 |
* @publishedAll
|
|
6153 |
*
|
|
6154 |
* Class constructor
|
|
6155 |
*
|
|
6156 |
* @capability None
|
|
6157 |
*/
|
|
6158 |
EXPORT_C CVoiceMailDeletion* CVoiceMailDeletion::NewL()
|
|
6159 |
{
|
|
6160 |
LOGGSMU1("CVoiceMailDeletion::NewL()");
|
|
6161 |
|
|
6162 |
CVoiceMailDeletion* voiceMailDeletion=new(ELeave) CVoiceMailDeletion();
|
|
6163 |
CleanupStack::PushL(voiceMailDeletion);
|
|
6164 |
voiceMailDeletion->ConstructL();
|
|
6165 |
CleanupStack::Pop(voiceMailDeletion);
|
|
6166 |
return voiceMailDeletion;
|
|
6167 |
} // CVoiceMailDeletion::NewL
|
|
6168 |
|
|
6169 |
|
|
6170 |
/*
|
|
6171 |
void CVoiceMailDeletion::SetExtension(TDesC& aExtension)
|
|
6172 |
{
|
|
6173 |
LOGGSMU1("CVoiceMailDeletion::SetExtension()");
|
|
6174 |
|
|
6175 |
TInt length=aExtension.Length();
|
|
6176 |
NewBufferL(length);
|
|
6177 |
iExtension->Des().Copy(aExtension);
|
|
6178 |
} // CVoiceMailDeletion::SetExtension
|
|
6179 |
|
|
6180 |
|
|
6181 |
TPtrC CVoiceMailDeletion::Extension() const
|
|
6182 |
{
|
|
6183 |
LOGGSMU1("CVoiceMailDeletion::Extension()");
|
|
6184 |
|
|
6185 |
TPtrC ptr;
|
|
6186 |
if (iExtension)
|
|
6187 |
ptr.Set(iExtension->Des());
|
|
6188 |
return ptr;
|
|
6189 |
}*/
|
|
6190 |
|
|
6191 |
|
|
6192 |
void CEnhancedVoiceMailDeleteConfirmations::NewExtensionL(TInt aLength)
|
|
6193 |
{
|
|
6194 |
LOGGSMU1("CEnhancedVoiceMailDeleteConfirmations::NewExtensionL()");
|
|
6195 |
|
|
6196 |
HBufC* buffer=HBufC::NewL(aLength);
|
|
6197 |
delete iExtension;
|
|
6198 |
iExtension=buffer;
|
|
6199 |
iExtension->Des().SetLength(aLength);
|
|
6200 |
iExtension->Des().FillZ();
|
|
6201 |
} // CEnhancedVoiceMailDeleteConfirmations::NewExtensionL
|
|
6202 |
|
|
6203 |
|
|
6204 |
CEnhancedVoiceMailDeleteConfirmations::CEnhancedVoiceMailDeleteConfirmations() : CEnhancedVoiceMailBoxInformation(EGsmSmsVoiceMailDeleteConfirmation)
|
|
6205 |
{
|
|
6206 |
//NOP
|
|
6207 |
} // CEnhancedVoiceMailDeleteConfirmations::CEnhancedVoiceMailDeleteConfirmations
|
|
6208 |
|
|
6209 |
|
|
6210 |
/**
|
|
6211 |
* @publishedAll
|
|
6212 |
*
|
|
6213 |
* Class destructor
|
|
6214 |
*
|
|
6215 |
* @capability None
|
|
6216 |
*/
|
|
6217 |
EXPORT_C CEnhancedVoiceMailDeleteConfirmations::~CEnhancedVoiceMailDeleteConfirmations()
|
|
6218 |
{
|
|
6219 |
LOGGSMU1("CEnhancedVoiceMailDeleteConfirmations::~CEnhancedVoiceMailDeleteConfirmations");
|
|
6220 |
|
|
6221 |
delete iExtension;
|
|
6222 |
iVoiceMailDeletions->ResetAndDestroy();
|
|
6223 |
iVoiceMailDeletions->Close();
|
|
6224 |
delete iVoiceMailDeletions;
|
|
6225 |
} // CEnhancedVoiceMailDeleteConfirmations::CEnhancedVoiceMailDeleteConfirmations
|
|
6226 |
|
|
6227 |
|
|
6228 |
/**
|
|
6229 |
* @internalComponent
|
|
6230 |
*
|
|
6231 |
* Prevent clients from using the copy constructor by including it in the class definition
|
|
6232 |
* but making it protected and not exporting it.
|
|
6233 |
*
|
|
6234 |
* @capability None
|
|
6235 |
*/
|
|
6236 |
CEnhancedVoiceMailDeleteConfirmations::CEnhancedVoiceMailDeleteConfirmations(const CEnhancedVoiceMailDeleteConfirmations&)
|
|
6237 |
{
|
|
6238 |
// Ignore in code coverage - not intended to be used
|
|
6239 |
BULLSEYE_OFF
|
|
6240 |
LOGGSMU1("CEnhancedVoiceMailDeleteConfirmations::CEnhancedVoiceMailDeleteConfirmations");
|
|
6241 |
Panic(KGsmuPanicMethodBodyNotImplemented);
|
|
6242 |
BULLSEYE_RESTORE
|
|
6243 |
}
|
|
6244 |
|
|
6245 |
/**
|
|
6246 |
* @internalComponent
|
|
6247 |
*
|
|
6248 |
* Prevent clients from using the equality operator by including it in the class definition
|
|
6249 |
* but making it protected and not exporting it.
|
|
6250 |
*
|
|
6251 |
* @capability None
|
|
6252 |
*/
|
|
6253 |
TBool CEnhancedVoiceMailDeleteConfirmations::operator==(const CEnhancedVoiceMailDeleteConfirmations&)
|
|
6254 |
{
|
|
6255 |
// Ignore in code coverage - not intended to be used
|
|
6256 |
BULLSEYE_OFF
|
|
6257 |
LOGGSMU1("CEnhancedVoiceMailDeleteConfirmations::operator==");
|
|
6258 |
Panic(KGsmuPanicMethodBodyNotImplemented);
|
|
6259 |
return EFalse;
|
|
6260 |
BULLSEYE_RESTORE
|
|
6261 |
}
|
|
6262 |
|
|
6263 |
/**
|
|
6264 |
* @internalComponent
|
|
6265 |
*
|
|
6266 |
* Prevent clients from using the assignment operator by including it in the class definition
|
|
6267 |
* but making it protected and not exporting it.
|
|
6268 |
*
|
|
6269 |
* @capability None
|
|
6270 |
*/
|
|
6271 |
void CEnhancedVoiceMailDeleteConfirmations::operator=(const CEnhancedVoiceMailDeleteConfirmations&)
|
|
6272 |
{
|
|
6273 |
// Ignore in code coverage - not intended to be used
|
|
6274 |
BULLSEYE_OFF
|
|
6275 |
LOGGSMU1("CEnhancedVoiceMailDeleteConfirmations::operator=");
|
|
6276 |
Panic(KGsmuPanicMethodBodyNotImplemented);
|
|
6277 |
BULLSEYE_RESTORE
|
|
6278 |
}
|
|
6279 |
|
|
6280 |
void CEnhancedVoiceMailDeleteConfirmations::ConstructL()
|
|
6281 |
{
|
|
6282 |
LOGGSMU1("CEnhancedVoiceMailDeleteConfirmations::ConstructL()");
|
|
6283 |
|
|
6284 |
NewExtensionL(0);
|
|
6285 |
|
|
6286 |
iVoiceMailDeletions = new (ELeave) RPointerArray<CVoiceMailDeletion>(15);
|
|
6287 |
} // CEnhancedVoiceMailDeleteConfirmations::ConstructL
|
|
6288 |
|
|
6289 |
|
|
6290 |
/**
|
|
6291 |
* @publishedAll
|
|
6292 |
*
|
|
6293 |
* Class constructor
|
|
6294 |
*
|
|
6295 |
* @capability None
|
|
6296 |
*/
|
|
6297 |
EXPORT_C CEnhancedVoiceMailDeleteConfirmations* CEnhancedVoiceMailDeleteConfirmations::NewL()
|
|
6298 |
{
|
|
6299 |
LOGGSMU1("CEnhancedVoiceMailDeleteConfirmations::NewL()");
|
|
6300 |
|
|
6301 |
CEnhancedVoiceMailDeleteConfirmations* aCEnhancedVoiceMailDeleteConfirmations=new(ELeave) CEnhancedVoiceMailDeleteConfirmations();
|
|
6302 |
CleanupStack::PushL(aCEnhancedVoiceMailDeleteConfirmations);
|
|
6303 |
aCEnhancedVoiceMailDeleteConfirmations->CEnhancedVoiceMailBoxInformation::ConstructL();
|
|
6304 |
aCEnhancedVoiceMailDeleteConfirmations->ConstructL();
|
|
6305 |
CleanupStack::Pop(aCEnhancedVoiceMailDeleteConfirmations);
|
|
6306 |
return aCEnhancedVoiceMailDeleteConfirmations;
|
|
6307 |
} // CEnhancedVoiceMailDeleteConfirmations::NewL
|
|
6308 |
|
|
6309 |
|
|
6310 |
/**
|
|
6311 |
* @publishedAll
|
|
6312 |
*
|
|
6313 |
* Indicates the number of message IDs that follow in this IE.
|
|
6314 |
*
|
|
6315 |
* @return
|
|
6316 |
* The number of message IDs that follow.
|
|
6317 |
*
|
|
6318 |
* @capability None
|
|
6319 |
*/
|
|
6320 |
EXPORT_C TUint8 CEnhancedVoiceMailDeleteConfirmations::NumberOfDeletes()
|
|
6321 |
{
|
|
6322 |
LOGGSMU1("CEnhancedVoiceMailDeleteConfirmations::NumberOfDeletes()");
|
|
6323 |
|
|
6324 |
return iVoiceMailDeletions->Count();
|
|
6325 |
} // CEnhancedVoiceMailDeleteConfirmations::NumberOfDeletes
|
|
6326 |
|
|
6327 |
|
|
6328 |
/**
|
|
6329 |
* @publishedAll
|
|
6330 |
*
|
|
6331 |
* Provides a reference to the collection that is used to contain the Voice Mail Deletion
|
|
6332 |
* notifications. Up to 31 instances of CVoiceMailDeletion can be stored. If more than
|
|
6333 |
* 31 instances are added, the CEnhancedVoiceMailDeleteConfirmations will not be added to
|
|
6334 |
* the CSmsMessage.
|
|
6335 |
*
|
|
6336 |
* @return
|
|
6337 |
* A reference to the collection that is used to contain the Voice Mail Deletion
|
|
6338 |
* notifications.
|
|
6339 |
*
|
|
6340 |
* @capability None
|
|
6341 |
*/
|
|
6342 |
EXPORT_C RPointerArray<CVoiceMailDeletion>& CEnhancedVoiceMailDeleteConfirmations::GetVoiceMailDeletions()
|
|
6343 |
{
|
|
6344 |
LOGGSMU1("CEnhancedVoiceMailDeleteConfirmations::GetVoiceMailDeletions()");
|
|
6345 |
|
|
6346 |
return *iVoiceMailDeletions;
|
|
6347 |
} // CEnhancedVoiceMailDeleteConfirmations::GetVoiceMailDeletions
|
|
6348 |
|
|
6349 |
|
|
6350 |
/*
|
|
6351 |
void CEnhancedVoiceMailDeleteConfirmations::SetExtension(TDesC& aExtension)
|
|
6352 |
{
|
|
6353 |
LOGGSMU1("CEnhancedVoiceMailDeleteConfirmations::SetExtension()");
|
|
6354 |
|
|
6355 |
TInt length=aExtension.Length();
|
|
6356 |
NewBufferL(length);
|
|
6357 |
iExtension->Des().Copy(aExtension);
|
|
6358 |
} // CEnhancedVoiceMailDeleteConfirmations::SetExtension
|
|
6359 |
|
|
6360 |
|
|
6361 |
TPtrC CEnhancedVoiceMailDeleteConfirmations::Extension() const
|
|
6362 |
{
|
|
6363 |
LOGGSMU1("CEnhancedVoiceMailDeleteConfirmations::Extension()");
|
|
6364 |
|
|
6365 |
TPtrC ptr;
|
|
6366 |
if (iExtension)
|
|
6367 |
{
|
|
6368 |
ptr.Set(iExtension->Des());
|
|
6369 |
}
|
|
6370 |
return ptr;
|
|
6371 |
}*/
|
|
6372 |
|
|
6373 |
|
|
6374 |
TUint8* CEnhancedVoiceMailDeleteConfirmations::EncodeL(TUint8* aCurrentPtr, CCnvCharacterSetConverter& aCharacterSetConverter, RFs& aFs) const
|
|
6375 |
{
|
|
6376 |
LOGGSMU1("CEnhancedVoiceMailDeleteConfirmations::EncodeL");
|
|
6377 |
|
|
6378 |
TUint8* startPtr = aCurrentPtr;
|
|
6379 |
|
|
6380 |
aCurrentPtr = CEnhancedVoiceMailBoxInformation::EncodeL(aCurrentPtr, aCharacterSetConverter, aFs);
|
|
6381 |
|
|
6382 |
TUint8 count = ((TUint8)iVoiceMailDeletions->Count());
|
|
6383 |
|
|
6384 |
if (count > KMaxNumberOfNotifications)
|
|
6385 |
{
|
|
6386 |
User::Leave(KErrArgument);
|
|
6387 |
}
|
|
6388 |
|
|
6389 |
*aCurrentPtr= (count & KSmsNotificationBitMask);
|
|
6390 |
aCurrentPtr++;
|
|
6391 |
|
|
6392 |
TInt16 spaceAlreadyAllocated; // handle architectures whose address space increments and whose address space decrements.
|
|
6393 |
(aCurrentPtr > startPtr) ? (spaceAlreadyAllocated = aCurrentPtr - startPtr) : (spaceAlreadyAllocated = startPtr - aCurrentPtr);
|
|
6394 |
|
|
6395 |
// allow space for id and length bytes
|
|
6396 |
TInt16 remainingSize = (TInt16)(CEnhancedVoiceMailBoxInformation::KSmsMaxEnhancedVoiceMailSize - spaceAlreadyAllocated);
|
|
6397 |
|
|
6398 |
for (TUint i = 0; i < count; i++)
|
|
6399 |
{
|
|
6400 |
remainingSize -= (TInt16)(*iVoiceMailDeletions)[i]->SizeL();
|
|
6401 |
if (remainingSize < 0)
|
|
6402 |
{
|
|
6403 |
User::Leave(KErrArgument);
|
|
6404 |
}
|
|
6405 |
|
|
6406 |
aCurrentPtr = (*iVoiceMailDeletions)[i]->EncodeL(aCurrentPtr);
|
|
6407 |
}
|
|
6408 |
|
|
6409 |
return aCurrentPtr;
|
|
6410 |
} // CEnhancedVoiceMailDeleteConfirmations::EncodeL
|
|
6411 |
|
|
6412 |
|
|
6413 |
void CEnhancedVoiceMailDeleteConfirmations::DecodeL(TGsmuLex8& aVoiceMailInfo, CCnvCharacterSetConverter& aCharacterSetConverter, RFs& aFs)
|
|
6414 |
{
|
|
6415 |
LOGGSMU1("CEnhancedVoiceMailDeleteConfirmations::DecodeL");
|
|
6416 |
|
|
6417 |
CEnhancedVoiceMailBoxInformation::DecodeL(aVoiceMailInfo, aCharacterSetConverter, aFs);
|
|
6418 |
|
|
6419 |
TUint numberOfVMDeletions = (aVoiceMailInfo.GetL() & KSmsNotificationBitMask);
|
|
6420 |
|
|
6421 |
if (iExtensionIndicator)
|
|
6422 |
{
|
|
6423 |
TUint8 extensionLength = aVoiceMailInfo.GetL();
|
|
6424 |
aVoiceMailInfo.Inc(extensionLength);
|
|
6425 |
}
|
|
6426 |
|
|
6427 |
for (TUint8 i = 0; i < numberOfVMDeletions; i++)
|
|
6428 |
{
|
|
6429 |
// Create a Voice Mail Deletion
|
|
6430 |
CVoiceMailDeletion* voiceMailDeletion = CVoiceMailDeletion::NewL();
|
|
6431 |
CleanupStack::PushL(voiceMailDeletion);
|
|
6432 |
voiceMailDeletion->DecodeL(aVoiceMailInfo);
|
|
6433 |
CleanupStack::Pop(voiceMailDeletion);
|
|
6434 |
iVoiceMailDeletions->Append(voiceMailDeletion);
|
|
6435 |
}
|
|
6436 |
} // CEnhancedVoiceMailDeleteConfirmations::DecodeL
|