|
1 // Copyright (c) 2008-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 // |
|
15 |
|
16 /** |
|
17 @internalComponent |
|
18 */ |
|
19 |
|
20 #include "ptpipdatatypes.h" |
|
21 #include "tptpipstartdatapayload.h" |
|
22 |
|
23 |
|
24 // Dataset element metadata. |
|
25 const TPTPIPTypeStartDataPayload::TElementInfo TPTPIPTypeStartDataPayload::iElementMetaData[ENumElements] = |
|
26 { |
|
27 {EMTPTypeUINT32, 0, KMTPTypeUINT32Size}, // Transaction Id |
|
28 {EMTPTypeUINT64, 4, KMTPTypeUINT64Size} // Total Data size |
|
29 }; |
|
30 |
|
31 /** |
|
32 Constructor. |
|
33 */ |
|
34 EXPORT_C TPTPIPTypeStartDataPayload::TPTPIPTypeStartDataPayload() : |
|
35 iElementInfo(iElementMetaData, ENumElements), |
|
36 iBuffer(KSize) |
|
37 { |
|
38 SetBuffer(iBuffer); |
|
39 } |
|
40 |
|
41 /** |
|
42 Resets the dataset. |
|
43 */ |
|
44 EXPORT_C void TPTPIPTypeStartDataPayload::Reset() |
|
45 { |
|
46 TMTPTypeFlatBase::Reset(); |
|
47 } |
|
48 |
|
49 /** |
|
50 Sets the transaction id. |
|
51 */ |
|
52 EXPORT_C void TPTPIPTypeStartDataPayload::SetUint32(TInt aElementId, TUint32 aData) |
|
53 { |
|
54 __ASSERT_DEBUG((aElementId == ETransactionId), User::Invariant()); |
|
55 TMTPTypeFlatBase::SetUint32(aElementId, aData); |
|
56 } |
|
57 |
|
58 /** |
|
59 Gets the transaction id |
|
60 */ |
|
61 EXPORT_C TUint32 TPTPIPTypeStartDataPayload::Uint32(TInt aElementId) const |
|
62 { |
|
63 __ASSERT_DEBUG((aElementId == ETransactionId), User::Invariant()); |
|
64 return TMTPTypeFlatBase::Uint32(aElementId); |
|
65 } |
|
66 |
|
67 /** |
|
68 Sets the 64 bit size of total data in the data phase. |
|
69 */ |
|
70 EXPORT_C void TPTPIPTypeStartDataPayload::SetUint64(TInt aElementId, TUint64 aData) |
|
71 { |
|
72 __ASSERT_DEBUG((aElementId == ETotalSize), User::Invariant()); |
|
73 TMTPTypeFlatBase::SetUint64(aElementId, aData); |
|
74 } |
|
75 |
|
76 /** |
|
77 Gets the 64 bit size of the total data in the data phase. |
|
78 */ |
|
79 EXPORT_C TUint64 TPTPIPTypeStartDataPayload::Uint64(TInt aElementId) const |
|
80 { |
|
81 __ASSERT_DEBUG((aElementId == ETotalSize), User::Invariant()); |
|
82 return TMTPTypeFlatBase::Uint64(aElementId); |
|
83 } |
|
84 |
|
85 /** |
|
86 todo |
|
87 */ |
|
88 EXPORT_C TInt TPTPIPTypeStartDataPayload::FirstReadChunk(TPtrC8& aChunk) const |
|
89 { |
|
90 TInt ret(TMTPTypeFlatBase::FirstReadChunk(aChunk)); |
|
91 return ret; |
|
92 } |
|
93 |
|
94 EXPORT_C TUint64 TPTPIPTypeStartDataPayload::Size() const |
|
95 { |
|
96 return KSize; |
|
97 } |
|
98 |
|
99 EXPORT_C TUint TPTPIPTypeStartDataPayload::Type() const |
|
100 { |
|
101 return EPTPIPTypeStartDataPayload; |
|
102 } |
|
103 |
|
104 EXPORT_C TBool TPTPIPTypeStartDataPayload::CommitRequired() const |
|
105 { |
|
106 return ETrue; |
|
107 } |
|
108 |
|
109 /** |
|
110 todo: nothing to do here? |
|
111 */ |
|
112 EXPORT_C MMTPType* TPTPIPTypeStartDataPayload::CommitChunkL(TPtr8& /*aChunk*/) |
|
113 { |
|
114 return NULL; |
|
115 } |
|
116 |
|
117 EXPORT_C const TMTPTypeFlatBase::TElementInfo& TPTPIPTypeStartDataPayload::ElementInfo(TInt aElementId) const |
|
118 { |
|
119 return iElementInfo[aElementId]; |
|
120 } |
|
121 |