|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "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 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: used for sending download events from server to client* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <s32mem.h> |
|
23 #include "IptvDebug.h" |
|
24 |
|
25 #include "CIptvMyVideosGlobalFileId.h" |
|
26 #include "CIptvVodDlDownloadEvent.h" |
|
27 |
|
28 // EXTERNAL DATA STRUCTURES |
|
29 |
|
30 // EXTERNAL FUNCTION PROTOTYPES |
|
31 |
|
32 // CONSTANTS |
|
33 |
|
34 // MACROS |
|
35 |
|
36 // LOCAL CONSTANTS AND MACROS |
|
37 |
|
38 // MODULE DATA STRUCTURES |
|
39 |
|
40 // LOCAL FUNCTION PROTOTYPES |
|
41 |
|
42 // FORWARD DECLARATIONS |
|
43 |
|
44 // ============================= LOCAL FUNCTIONS =============================== |
|
45 |
|
46 // ============================ MEMBER FUNCTIONS =============================== |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CIptvVodDlDownloadEvent::CIptvVodDlDownloadEvent |
|
50 // C++ default constructor can NOT contain any code, that |
|
51 // might leave. |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 CIptvVodDlDownloadEvent::CIptvVodDlDownloadEvent() |
|
55 { |
|
56 } |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // CIptvVodDlDownloadEvent::ConstructL |
|
60 // Symbian 2nd phase constructor can leave. |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 void CIptvVodDlDownloadEvent::ConstructL() |
|
64 { |
|
65 iGlobalFileId = CIptvMyVideosGlobalFileId::NewL(); |
|
66 } |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // CIptvVodDlDownloadEvent::NewL |
|
70 // Two-phased constructor. |
|
71 // ----------------------------------------------------------------------------- |
|
72 // |
|
73 EXPORT_C CIptvVodDlDownloadEvent* CIptvVodDlDownloadEvent::NewL() |
|
74 { |
|
75 CIptvVodDlDownloadEvent* self = new( ELeave ) CIptvVodDlDownloadEvent; |
|
76 |
|
77 CleanupStack::PushL( self ); |
|
78 self->ConstructL(); |
|
79 CleanupStack::Pop(self); |
|
80 |
|
81 return self; |
|
82 } |
|
83 |
|
84 |
|
85 // Destructor |
|
86 EXPORT_C CIptvVodDlDownloadEvent::~CIptvVodDlDownloadEvent() |
|
87 { |
|
88 delete iGlobalFileId; |
|
89 } |
|
90 |
|
91 EXPORT_C void CIptvVodDlDownloadEvent::Destruct() |
|
92 { |
|
93 delete this; |
|
94 } |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // CIptvVodDlDownloadEvent::InternalizeL |
|
98 // ----------------------------------------------------------------------------- |
|
99 // |
|
100 EXPORT_C void CIptvVodDlDownloadEvent::InternalizeL(RReadStream& aStream) |
|
101 { |
|
102 iEvent = static_cast<TEvent>(aStream.ReadUint8L()); |
|
103 iGlobalFileIdIsValid = aStream.ReadUint8L(); |
|
104 iGlobalFileId->InternalizeL(aStream); |
|
105 iServiceIdAndContentIdAreValid = aStream.ReadUint8L(); |
|
106 iServiceId = aStream.ReadUint32L(); |
|
107 iContentId = aStream.ReadUint32L(); |
|
108 iContentIndex = aStream.ReadUint32L(); |
|
109 iProgress = aStream.ReadUint8L(); |
|
110 iState = aStream.ReadUint32L(); |
|
111 iError = static_cast<TIptvDlError>(aStream.ReadUint32L()); |
|
112 iGlobalError = aStream.ReadInt32L(); |
|
113 } |
|
114 |
|
115 // ----------------------------------------------------------------------------- |
|
116 // CIptvVodDlDownloadEvent::ExternalizeL |
|
117 // ----------------------------------------------------------------------------- |
|
118 // |
|
119 EXPORT_C void CIptvVodDlDownloadEvent::ExternalizeL(RWriteStream& aStream) |
|
120 { |
|
121 aStream.WriteUint8L(static_cast<TUint8>(iEvent)); |
|
122 aStream.WriteUint8L(iGlobalFileIdIsValid); |
|
123 iGlobalFileId->ExternalizeL(aStream); |
|
124 aStream.WriteUint8L(iServiceIdAndContentIdAreValid); |
|
125 aStream.WriteUint32L(iServiceId); |
|
126 aStream.WriteUint32L(iContentId); |
|
127 aStream.WriteUint32L(iContentIndex); |
|
128 aStream.WriteUint8L(iProgress); |
|
129 aStream.WriteUint32L(iState); |
|
130 aStream.WriteUint32L(static_cast<TUint32>(iError)); |
|
131 aStream.WriteInt32L(iGlobalError); |
|
132 } |
|
133 |
|
134 // ----------------------------------------------------------------------------- |
|
135 // CIptvVodDlDownloadEvent::CountExternalizeSize |
|
136 // ----------------------------------------------------------------------------- |
|
137 // |
|
138 EXPORT_C TUint32 CIptvVodDlDownloadEvent::CountExternalizeSize() |
|
139 { |
|
140 return 1 + //TUint8 iEvent |
|
141 1 + //TUint8 iGlobalFileIdIsValid |
|
142 iGlobalFileId->CountExternalizeSize() + |
|
143 1 + //TUint8 iServiceIdAndContentIdAreValid |
|
144 4 + //TUint32 iServiceId |
|
145 4 + //TUint32 iContentId |
|
146 4 + //TUint32 iContentIndex |
|
147 1 + //TUint8 iProgress |
|
148 4 + //TUint32 iState |
|
149 4 + //TUint32 iError |
|
150 4; //TInt iGlobalError |
|
151 } |
|
152 |
|
153 // ----------------------------------------------------------------------------- |
|
154 // CIptvVodDlDownloadEvent::GetCopy |
|
155 // ----------------------------------------------------------------------------- |
|
156 // |
|
157 EXPORT_C MIptvEvent* CIptvVodDlDownloadEvent::GetCopyL() |
|
158 { |
|
159 CIptvVodDlDownloadEvent* event = CIptvVodDlDownloadEvent::NewL(); |
|
160 |
|
161 event->iEvent = iEvent; |
|
162 event->iGlobalFileIdIsValid = iGlobalFileIdIsValid; |
|
163 event->iGlobalFileId->iFileId = iGlobalFileId->iFileId; |
|
164 event->iGlobalFileId->iDrive = iGlobalFileId->iDrive; |
|
165 event->iServiceIdAndContentIdAreValid = iServiceIdAndContentIdAreValid; |
|
166 event->iServiceId = iServiceId; |
|
167 event->iContentId = iContentId; |
|
168 event->iContentIndex = iContentIndex; |
|
169 event->iProgress = iProgress; |
|
170 event->iState = iState; |
|
171 event->iError = iError; |
|
172 event->iGlobalError = iGlobalError; |
|
173 |
|
174 return event; |
|
175 } |
|
176 |
|
177 // ----------------------------------------------------------------------------- |
|
178 // CIptvVodDlDownloadEvent::Set |
|
179 // ----------------------------------------------------------------------------- |
|
180 // |
|
181 EXPORT_C void CIptvVodDlDownloadEvent::Set(CIptvVodDlDownloadEvent& aEvent) |
|
182 { |
|
183 iEvent = aEvent.iEvent; |
|
184 iGlobalFileIdIsValid = aEvent.iGlobalFileIdIsValid; |
|
185 iGlobalFileId->iFileId = aEvent.iGlobalFileId->iFileId; |
|
186 iGlobalFileId->iDrive = aEvent.iGlobalFileId->iDrive; |
|
187 iServiceIdAndContentIdAreValid = aEvent.iServiceIdAndContentIdAreValid; |
|
188 iServiceId = aEvent.iServiceId; |
|
189 iContentId = aEvent.iContentId; |
|
190 iContentIndex = aEvent.iContentIndex; |
|
191 iProgress = aEvent.iProgress; |
|
192 iState = aEvent.iState; |
|
193 iError = aEvent.iError; |
|
194 iGlobalError = aEvent.iGlobalError; |
|
195 } |
|
196 |
|
197 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
198 |
|
199 // End of File |