|
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 "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: Async command storage class for DRM::DrmAutomatedUsageImpl |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <utf.h> |
|
22 |
|
23 #include "drmautomatedusagedata.h" |
|
24 |
|
25 // ============================ MEMBER FUNCTIONS =============================== |
|
26 |
|
27 |
|
28 // ----------------------------------------------------------------------------- |
|
29 // DRM::CDrmAutomatedUsageData::NewL |
|
30 // Two-Phase constructor |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 DRM::CDrmAutomatedUsageData* DRM::CDrmAutomatedUsageData::NewL( |
|
34 const ContentAccess::CData& aData, |
|
35 ContentAccess::TIntent aIntent, |
|
36 DRM::TDrmAutomatedType aAutomatedType, |
|
37 DRM::MDrmAsyncObserver* aObserver, |
|
38 DRM::TDrmAutomatedServiceType aServiceType, |
|
39 TOperation aOperation ) |
|
40 { |
|
41 DRM::CDrmAutomatedUsageData* self( NewLC( aData, |
|
42 aIntent, |
|
43 aAutomatedType, |
|
44 aObserver, |
|
45 aServiceType, |
|
46 aOperation ) ); |
|
47 CleanupStack::Pop( self ); |
|
48 return self; |
|
49 } |
|
50 |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // DRM::CDrmAutomatedUsageData::NewLC |
|
54 // Two-Phase constructor |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 DRM::CDrmAutomatedUsageData* DRM::CDrmAutomatedUsageData::NewLC( |
|
58 const ContentAccess::CData& aData, |
|
59 ContentAccess::TIntent aIntent, |
|
60 DRM::TDrmAutomatedType aAutomatedType, |
|
61 DRM::MDrmAsyncObserver* aObserver, |
|
62 DRM::TDrmAutomatedServiceType aServiceType, |
|
63 TOperation aOperation ) |
|
64 { |
|
65 DRM::CDrmAutomatedUsageData* self( |
|
66 new (ELeave) DRM::CDrmAutomatedUsageData( aIntent, |
|
67 aAutomatedType, |
|
68 aObserver, |
|
69 aServiceType, |
|
70 aOperation ) ); |
|
71 CleanupStack::PushL( self ); |
|
72 self->ConstructL( aData ); |
|
73 return self; |
|
74 } |
|
75 |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // DRM::CDrmAutomatedUsageData::NewL |
|
79 // Two-Phase constructor |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 DRM::CDrmAutomatedUsageData* DRM::CDrmAutomatedUsageData::NewL( |
|
83 const TDesC& aUniqueId, |
|
84 ContentAccess::TIntent aIntent, |
|
85 DRM::TDrmAutomatedType aAutomatedType, |
|
86 DRM::MDrmAsyncObserver* aObserver, |
|
87 DRM::TDrmAutomatedServiceType aServiceType, |
|
88 TOperation aOperation ) |
|
89 { |
|
90 DRM::CDrmAutomatedUsageData* self( NewLC( aUniqueId, |
|
91 aIntent, |
|
92 aAutomatedType, |
|
93 aObserver, |
|
94 aServiceType, |
|
95 aOperation ) ); |
|
96 CleanupStack::Pop( self ); |
|
97 return self; |
|
98 } |
|
99 |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // DRM::CDrmAutomatedUsageData::NewLC |
|
103 // Two-Phase constructor |
|
104 // ----------------------------------------------------------------------------- |
|
105 // |
|
106 DRM::CDrmAutomatedUsageData* DRM::CDrmAutomatedUsageData::NewLC( |
|
107 const TDesC& aUniqueId, |
|
108 ContentAccess::TIntent aIntent, |
|
109 DRM::TDrmAutomatedType aAutomatedType, |
|
110 DRM::MDrmAsyncObserver* aObserver, |
|
111 DRM::TDrmAutomatedServiceType aServiceType, |
|
112 TOperation aOperation ) |
|
113 { |
|
114 DRM::CDrmAutomatedUsageData* self( |
|
115 new (ELeave) DRM::CDrmAutomatedUsageData( aIntent, |
|
116 aAutomatedType, |
|
117 aObserver, |
|
118 aServiceType, |
|
119 aOperation ) ); |
|
120 CleanupStack::PushL( self ); |
|
121 self->ConstructL( aUniqueId ); |
|
122 return self; |
|
123 } |
|
124 |
|
125 |
|
126 // ----------------------------------------------------------------------------- |
|
127 // Constructor |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 DRM::CDrmAutomatedUsageData::CDrmAutomatedUsageData( |
|
131 ContentAccess::TIntent aIntent, |
|
132 DRM::TDrmAutomatedType aAutomatedType, |
|
133 DRM::MDrmAsyncObserver* aObserver, |
|
134 DRM::TDrmAutomatedServiceType aServiceType, |
|
135 TOperation aOperation ) : iOperation( aOperation ), |
|
136 iIntent( aIntent ), |
|
137 iAutomatedType( aAutomatedType ), |
|
138 iObserver( aObserver ), |
|
139 iServiceType( aServiceType ) |
|
140 { |
|
141 } |
|
142 |
|
143 // ----------------------------------------------------------------------------- |
|
144 // Copy constructor |
|
145 // ----------------------------------------------------------------------------- |
|
146 // |
|
147 DRM::CDrmAutomatedUsageData::CDrmAutomatedUsageData( |
|
148 const DRM::CDrmAutomatedUsageData& ) |
|
149 { |
|
150 } |
|
151 |
|
152 // ----------------------------------------------------------------------------- |
|
153 // Destructor |
|
154 // ----------------------------------------------------------------------------- |
|
155 // |
|
156 DRM::CDrmAutomatedUsageData::~CDrmAutomatedUsageData() |
|
157 { |
|
158 delete iUniqueId; |
|
159 delete iUniqueId8; |
|
160 } |
|
161 |
|
162 // ----------------------------------------------------------------------------- |
|
163 // DRM::CDrmAutomatedUsageData::ConstructL |
|
164 // Second phase constructor |
|
165 // ----------------------------------------------------------------------------- |
|
166 // |
|
167 void DRM::CDrmAutomatedUsageData::ConstructL( |
|
168 const ContentAccess::CData& aData ) |
|
169 { |
|
170 TPtr value( NULL, 0 ); |
|
171 HBufC* uniqueId( HBufC::NewLC( ContentAccess::KMaxCafContentName ) ); |
|
172 value.Set( uniqueId->Des() ); |
|
173 |
|
174 User::LeaveIfError(aData.GetStringAttribute( ContentAccess::EContentID, |
|
175 value ) ); |
|
176 |
|
177 iUniqueId8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( value ); |
|
178 iUniqueId = uniqueId->AllocL(); |
|
179 CleanupStack::PopAndDestroy( uniqueId ); |
|
180 SetOperationId(); |
|
181 } |
|
182 |
|
183 // ----------------------------------------------------------------------------- |
|
184 // DRM::CDrmAutomatedUsageData::ConstructL |
|
185 // Second phase constructor |
|
186 // ----------------------------------------------------------------------------- |
|
187 // |
|
188 void DRM::CDrmAutomatedUsageData::ConstructL( const TDesC& aUniqueId ) |
|
189 { |
|
190 iUniqueId = aUniqueId.AllocL(); |
|
191 iUniqueId8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( aUniqueId ); |
|
192 SetOperationId(); |
|
193 } |
|
194 |
|
195 // ----------------------------------------------------------------------------- |
|
196 // DRM::CDrmAutomatedUsageData::SetOperationId |
|
197 // Calculates unique operationId related to this object's parameters |
|
198 // ----------------------------------------------------------------------------- |
|
199 // |
|
200 void DRM::CDrmAutomatedUsageData::SetOperationId() |
|
201 { |
|
202 iOperationId = reinterpret_cast< TInt >( this ); |
|
203 } |
|
204 // End of File |