24
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Sony Ericsson Mobile Communications AB
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Sony Ericsson Mobile Communications AB - initial contribution.
|
|
11 |
* Nokia Corporation - additional changes.
|
|
12 |
*
|
|
13 |
* Contributors:
|
|
14 |
*
|
|
15 |
* Description:
|
|
16 |
* Implements the Enhanced SMS User Prompt Information Element.
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
|
|
20 |
|
|
21 |
/**
|
|
22 |
* @file
|
|
23 |
*
|
|
24 |
* Implements CEmsObjectDistributionIE class
|
|
25 |
*/
|
|
26 |
|
|
27 |
#include <emsobjectdistributionie.h>
|
|
28 |
|
|
29 |
EXPORT_C CEmsObjectDistribution* CEmsObjectDistribution::NewL(TUint aObjectCount, TAttrs aAttr)
|
|
30 |
/**
|
|
31 |
* @capability None
|
|
32 |
*/
|
|
33 |
{
|
|
34 |
CEmsObjectDistribution* self = new (ELeave) CEmsObjectDistribution(aObjectCount, aAttr);
|
|
35 |
return self;
|
|
36 |
}
|
|
37 |
|
|
38 |
EXPORT_C CEmsInformationElement* CEmsObjectDistribution::DuplicateL() const
|
|
39 |
/**
|
|
40 |
* @capability None
|
|
41 |
*/
|
|
42 |
{
|
|
43 |
CEmsObjectDistribution* copy = new (ELeave) CEmsObjectDistribution();
|
|
44 |
CleanupStack::PushL(copy);
|
|
45 |
copy->CopyL(*this);
|
|
46 |
CleanupStack::Pop(copy);
|
|
47 |
return copy;
|
|
48 |
}
|
|
49 |
|
|
50 |
EXPORT_C void CEmsObjectDistribution::CopyL(const CEmsObjectDistribution& aSrc)
|
|
51 |
/**
|
|
52 |
* @capability None
|
|
53 |
*/
|
|
54 |
{
|
|
55 |
CEmsInformationElement::CopyL(aSrc);
|
|
56 |
iObjectCount = aSrc.iObjectCount;
|
|
57 |
iAttr = aSrc.iAttr;
|
|
58 |
}
|
|
59 |
|
|
60 |
EXPORT_C TUint CEmsObjectDistribution::ObjectCount() const
|
|
61 |
/**
|
|
62 |
* @capability None
|
|
63 |
*/
|
|
64 |
{
|
|
65 |
return iObjectCount;
|
|
66 |
}
|
|
67 |
|
|
68 |
EXPORT_C void CEmsObjectDistribution::SetObjectCount(TUint aObjectCount)
|
|
69 |
/**
|
|
70 |
* @capability None
|
|
71 |
*/
|
|
72 |
{
|
|
73 |
iObjectCount=aObjectCount;
|
|
74 |
}
|
|
75 |
|
|
76 |
EXPORT_C CEmsObjectDistribution::TAttrs CEmsObjectDistribution::Forwarding() const
|
|
77 |
/**
|
|
78 |
* @capability None
|
|
79 |
*/
|
|
80 |
{
|
|
81 |
return iAttr;
|
|
82 |
}
|
|
83 |
|
|
84 |
EXPORT_C void CEmsObjectDistribution::SetForwarding(TAttrs aAttr)
|
|
85 |
/**
|
|
86 |
* @capability None
|
|
87 |
*/
|
|
88 |
{
|
|
89 |
iAttr = aAttr;
|
|
90 |
}
|
|
91 |
|
|
92 |
CEmsObjectDistribution::CEmsObjectDistribution(TUint aObjectCount, TAttrs aAttr)
|
|
93 |
// pass in a false parameter for start position encoded
|
|
94 |
: CEmsInformationElement(CSmsInformationElement::ESmsEnhancedODI, EFalse), iObjectCount(aObjectCount), iAttr(aAttr)
|
|
95 |
{
|
|
96 |
iEncodedBodyLength=EIESize;
|
|
97 |
}
|
|
98 |
|
|
99 |
/**
|
|
100 |
* Encodes the information element into its raw format. (no IE id)
|
|
101 |
*
|
|
102 |
* @param aPtr the buffer to be used which is to contain the data
|
|
103 |
* @param TBool boolean to indicate if it is for serialisation or encoding
|
|
104 |
*/
|
|
105 |
void CEmsObjectDistribution::EncodeBodyL(TPtr8 aPtr, TBool) const
|
|
106 |
{
|
|
107 |
aPtr.Append(static_cast<TUint8>(iObjectCount));
|
|
108 |
aPtr.Append(iAttr);
|
|
109 |
}
|
|
110 |
|
|
111 |
/**
|
|
112 |
* Decodes the raw data out of an information element into this class.
|
|
113 |
*
|
|
114 |
* @param aPtr The raw predefined animation data
|
|
115 |
* @param TBool boolean to indicate if it is from serialisation
|
|
116 |
* @leave KErrArgument If the size of the data does not match what is expected.
|
|
117 |
*/
|
|
118 |
void CEmsObjectDistribution::DecodeBodyL(const TPtrC8 aPtr, TBool)
|
|
119 |
{
|
|
120 |
__ASSERT_ALWAYS(aPtr.Length() == EIESize, User::Leave(KErrArgument));
|
|
121 |
iObjectCount = static_cast<TUint8>(aPtr[0]);
|
|
122 |
iAttr = static_cast<TAttrs>(aPtr[1]);
|
|
123 |
}
|