|
1 /* |
|
2 * Copyright (c) 2003 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __MDRMHELPER_H__ |
|
20 #define __MDRMHELPER_H__ |
|
21 |
|
22 // INCLUDES |
|
23 // CONSTANTS |
|
24 // MACROS |
|
25 // DATA TYPES |
|
26 // FUNCTION PROTOTYPES |
|
27 // FORWARD DECLARATIONS |
|
28 class CDRMRightsConstraints; |
|
29 class TDataType; |
|
30 class CCoeEnv; |
|
31 |
|
32 // CLASS DECLARATION |
|
33 |
|
34 class MDRMHelper |
|
35 { |
|
36 public: |
|
37 |
|
38 enum TNotificationID |
|
39 { |
|
40 ETActivateTextId = 1, |
|
41 ETCountBasedErrorTextId = 2 , |
|
42 ETCountUsageReduceId = 3, |
|
43 ETCountUsageReduceMediaId = 4 |
|
44 }; |
|
45 |
|
46 enum TConsumeAction |
|
47 { |
|
48 EStart, |
|
49 EFinish, |
|
50 }; |
|
51 |
|
52 enum TOMALevel |
|
53 { |
|
54 EOMA_None, |
|
55 EOMA_1_0, |
|
56 EOMA_2_0 |
|
57 }; |
|
58 |
|
59 public: // New functions |
|
60 |
|
61 /** |
|
62 * Displays appropriate error note depending on error code. |
|
63 * @param aError: error code returned by DRM engine |
|
64 * @param aURI: URI of the file |
|
65 * @return |
|
66 * - Button code, if user selected "buy rights" or "launch rights |
|
67 * manager" in query. |
|
68 * - 0 if user selected "No", "Back" or "Cancel" (or whatever which |
|
69 * just dismiss the query) |
|
70 * - 0 if just a simple error note is displayed |
|
71 */ |
|
72 virtual TInt HandleErrorL( TInt aError, |
|
73 const TDesC8& aURI ) = 0; |
|
74 |
|
75 /** |
|
76 * Displays appropriate error note depending on error code. |
|
77 * @param aError: error code returned by DRM engine |
|
78 * @param aFileName: full path to file |
|
79 * @return |
|
80 * - Button code, if user selected "buy rights" or "launch rights |
|
81 * manager" in query. |
|
82 * - 0 if user selected "No", "Back" or "Cancel" (or whatever which |
|
83 * just dismiss the query) |
|
84 * - 0 if just a simple error note is displayed |
|
85 */ |
|
86 virtual TInt HandleErrorL( TInt aError, |
|
87 const TDesC& aFileName ) = 0; |
|
88 |
|
89 /** |
|
90 * Handle the general UI based error notes |
|
91 * @param aTextId The code for DRM general notification note. |
|
92 * @param aURI The DRM files URI, that caused the DRM error. |
|
93 * @return KErrnone if everything went ok, else wide scale of Symbian errors |
|
94 */ |
|
95 virtual TInt ShowDRMUINotificationL( TNotificationID aTextId, |
|
96 const TDesC8& aURI ) = 0; |
|
97 |
|
98 /** |
|
99 * Handle the general UI based error notes |
|
100 * @param aTextId The code for DRM general notification note. |
|
101 * @param aFileName The DRM file's name and path, that caused the DRM error. |
|
102 * @return KErrnone if everything went ok, else wide scale of Symbian errors |
|
103 */ |
|
104 virtual TInt ShowDRMUINotificationL( TNotificationID aTextId, |
|
105 const TDesC& aFileName ) = 0; |
|
106 |
|
107 /** |
|
108 * Set count limit for CheckRightsAmountL |
|
109 * @param aCounts: new count limit for displaying the note. |
|
110 * @return - |
|
111 */ |
|
112 virtual void SetCountLimitL( TUint aCounts ) = 0; |
|
113 |
|
114 /** |
|
115 * Set time limit in days for CheckRightsAmountL |
|
116 * @param aDays: new time limit for displaying the note. |
|
117 * @return - |
|
118 */ |
|
119 virtual void SetTimeLimitL( TUint aDays ) = 0; |
|
120 |
|
121 /** |
|
122 * Set percentage limit for CheckRightsAmountL. Applies to both counts and time. |
|
123 * @param aPercentage: new limit for displaying the note. |
|
124 * @return - |
|
125 */ |
|
126 virtual void SetPercentageLimitL( TUint aPercentage ) = 0; |
|
127 |
|
128 /** |
|
129 * Launches DRM Rights Manager UI embedded with details view related |
|
130 * to given content. |
|
131 * @param aURI: URI of the file |
|
132 * @return - |
|
133 */ |
|
134 virtual void LaunchDetailsViewEmbeddedL( |
|
135 const TDesC8& aURI ) = 0; |
|
136 |
|
137 /** |
|
138 * Launches DRM Rights Manager UI embedded with details view related |
|
139 * to given file. |
|
140 * @param aFileName: Full path to file |
|
141 * @return - |
|
142 */ |
|
143 virtual void LaunchDetailsViewEmbeddedL( |
|
144 const TDesC& aFileName ) = 0; |
|
145 |
|
146 /** |
|
147 * Gets details of rights object associated of given file. |
|
148 * @param aFileName: Full path to file |
|
149 * @param aIntent: bitmask of DRMCommon::EPlay, DRMCommon::EDisplay, |
|
150 * DRMCommon::EExecute and DRMCommon::EPrint |
|
151 * @param aExpired: (out) ETrue if rights are expired |
|
152 * @param aSendingAllowed: (out) ETrue if content can be sent |
|
153 * @param aPlay: (out) play constraints, must be deleted by caller |
|
154 * @param aDisplay: (out) display constraints, must be deleted by caller |
|
155 * @param aExecute: (out) execute constraints, must be deleted by caller |
|
156 * @param aPrint: (out) print constraints, must be deleted by caller |
|
157 * @return - |
|
158 */ |
|
159 virtual void GetRightsDetailsL( const TDesC& aFileName, |
|
160 TUint32 aIntent, TBool& aExpired, TBool& aSendingAllowed, |
|
161 CDRMRightsConstraints*& aPlay, |
|
162 CDRMRightsConstraints*& aDisplay, |
|
163 CDRMRightsConstraints*& aExecute, |
|
164 CDRMRightsConstraints*& aPrint ) = 0; |
|
165 |
|
166 /** |
|
167 * Checks whether some content can be used as automated content or not. |
|
168 * @param aURI: URI of the file |
|
169 * @param aValue: (out) result of the query |
|
170 * @return KErrnone if everything went ok, else wide scale of Symbian errors |
|
171 */ |
|
172 virtual TInt CanSetAutomated( const TDesC8& aURI, TBool& aValue ) = 0; |
|
173 |
|
174 /** |
|
175 * Checks whether some content can be used as automated content or not. |
|
176 * @param aFileName: Full path to the file |
|
177 * @param aValue: (out) result of the query |
|
178 * @return KErrnone if everything went ok, else wide scale of Symbian errors |
|
179 */ |
|
180 virtual TInt CanSetAutomated( const TDesC& aFilename, TBool& aValue ) = 0; |
|
181 |
|
182 /** |
|
183 * Registers some content for automated usage (e.g. default ring tone). |
|
184 * @param aURI: URI of the file |
|
185 * @return KErrnone if everything went ok, else wide scale of Symbian errors |
|
186 */ |
|
187 virtual TInt SetAutomated( const TDesC8& aURI ) = 0; |
|
188 |
|
189 /** |
|
190 * Registers some content for automated usage (e.g. default ring tone). |
|
191 * @param aFileName: Full path to the file |
|
192 * @return KErrnone if everything went ok, else wide scale of Symbian errors |
|
193 */ |
|
194 virtual TInt SetAutomated( const TDesC& aFilename ) = 0; |
|
195 |
|
196 /** |
|
197 * Removes automated content. Used to indicated that the given content is |
|
198 * not anymore used automaticallly by the device. |
|
199 * @param aURI: URI of the file |
|
200 * @return KErrnone if everything went ok, else wide scale of Symbian errors |
|
201 */ |
|
202 virtual TInt RemoveAutomated( const TDesC8& aURI ) = 0; |
|
203 |
|
204 /** |
|
205 * Removes automated content. Used to indicated that the given content is |
|
206 * not anymore used automaticallly by the device. |
|
207 * @param aFileName: Full path to the file |
|
208 * @return KErrnone if everything went ok, else wide scale of Symbian errors |
|
209 */ |
|
210 virtual TInt RemoveAutomated( const TDesC& aFilename ) = 0; |
|
211 |
|
212 /** |
|
213 * Sends an idle-signal to DRM Helper Server. This indicates |
|
214 * that the device is on idle state to the DRM Helper Server. |
|
215 * @return - |
|
216 */ |
|
217 virtual void IndicateIdle() = 0; |
|
218 |
|
219 /** |
|
220 * GetContentURIList |
|
221 * |
|
222 * Returns a list of all content URIs that have rights in the rights |
|
223 * database. |
|
224 * |
|
225 * @since 2.5 |
|
226 * @param aURIList: Out parameter for the URI list. |
|
227 * @return Ok if the URI list could be retreived. |
|
228 */ |
|
229 virtual TInt GetContentURIList( |
|
230 RPointerArray<HBufC8>*& aURIList) = 0; |
|
231 |
|
232 /** |
|
233 * DataTypesCount |
|
234 * |
|
235 * Returns the number of previously registered datatypes which are |
|
236 * supported by the DRM system and associated applications. |
|
237 * |
|
238 * @since 2.0 |
|
239 * @param aCount: Out parameter for the datatype count |
|
240 * @return EOk if the number of datatypes has been returned correctly |
|
241 */ |
|
242 virtual TInt DataTypesCount( |
|
243 TInt& aCount) = 0; |
|
244 |
|
245 /** |
|
246 * SupportedDataType |
|
247 * |
|
248 * Returns a specific datatype which has been registered before by giving an index |
|
249 * |
|
250 * @since 2.0 |
|
251 * @param aIndex: Number of the datatype to return |
|
252 * @param aDataType: Out parameter for the datatype |
|
253 * @return EOk if the datatype was returned correctly |
|
254 */ |
|
255 |
|
256 virtual TInt SupportedDataType( |
|
257 const TInt aIndex, TDataType& aDataType) = 0; |
|
258 |
|
259 /** |
|
260 * RegisterDataType |
|
261 * |
|
262 * Registers a datatype as a supported datatype. |
|
263 * |
|
264 * @since 2.0 |
|
265 * @param aDataType: Datatype to register |
|
266 * @return EOk if the datatype has been registered |
|
267 */ |
|
268 |
|
269 virtual TInt RegisterDataType( |
|
270 const TDataType& aDataType) = 0; |
|
271 |
|
272 /** |
|
273 * UnRegisterDataType |
|
274 * |
|
275 * Unregisters a datatype via its index. |
|
276 * |
|
277 * @since 2.5 |
|
278 * @param aIndex: Number of the datatype to unregister |
|
279 * @return EOk if the datatype has been unregistered |
|
280 */ |
|
281 |
|
282 virtual TInt UnRegisterDataType( |
|
283 const TInt aIndex) = 0; |
|
284 |
|
285 /** |
|
286 * SupportedDRMMethods |
|
287 * |
|
288 * Returns the supported DRM protection methods and the OMA compliance |
|
289 * level of the DRM engine |
|
290 * |
|
291 * @since 2.0 |
|
292 * @param aDRMMethod: Out parameter, bit mask containing any |
|
293 * combination of EForwardLock, ECombinedDelivery, |
|
294 * ESeparateDelivery etc. |
|
295 * @param aOMALevel: OMA compliance of the DRM engine |
|
296 * @return DRMCommon error code |
|
297 */ |
|
298 |
|
299 virtual TInt SupportedDRMMethods( |
|
300 TInt& aDRMMethod, TOMALevel& aOMALevel) = 0; |
|
301 |
|
302 /** |
|
303 * Consume |
|
304 * |
|
305 * Overrides any rights consumption. This function must only be used by |
|
306 * applications with user interaction and not by intermediate components. |
|
307 * The main use cases are signalling that content is to be installed |
|
308 * (including thumbnail generation), or that content is to be consumed. |
|
309 * They are characterized as calls to this function with the correct |
|
310 * intent (i.e. EPlay or EInstall) and the corresponding action (i.e. |
|
311 * telling whether the indicated intent is started or finished). |
|
312 * Calls to this function must be the result of a user interaction or |
|
313 * otherwise high level event. |
|
314 * |
|
315 * @since 2.5 |
|
316 * @param aContentURI: URI of the content which will be consumed |
|
317 * @param aRightsSpec: the consumption intent (EPlay, EDisplay, EPrint, |
|
318 * EExecute or EInstall) |
|
319 * @param anAction: the consumption action, telling whether the |
|
320 * content consumption starts or finishes. |
|
321 * @return EOk if consume action was successfully signalled to the engine. |
|
322 */ |
|
323 virtual TInt Consume( |
|
324 const TDesC8& aContentURI, |
|
325 TUint32 aRightsSpec, |
|
326 TConsumeAction anAction) = 0; |
|
327 |
|
328 /** |
|
329 * ConsumeFile |
|
330 * |
|
331 * Overrides any rights consumption. This function must only be used by |
|
332 * applications with user interaction and not by intermediate components. |
|
333 * The main use cases are signalling that content is to be installed |
|
334 * (including thumbnail generation), or that content is to be consumed. |
|
335 * They are characterized as calls to this function with the correct |
|
336 * intent (i.e. EPlay or EInstall) and the corresponding action (i.e. |
|
337 * telling whether the indicated intent is started or finished). |
|
338 * Calls to this function must be the result of a user interaction or |
|
339 * otherwise high level event. |
|
340 * |
|
341 * @since 2.5 |
|
342 * @param |
|
343 * @param aRightsSpec: the consumption intent (EPlay, EDisplay, EPrint, |
|
344 * EExecute or EInstall) |
|
345 * @param anAction: the consumption action, telling whether the |
|
346 * content consumption starts or finishes. |
|
347 * @return EOk if consume action was successfully signalled to the engine. |
|
348 */ |
|
349 virtual TInt ConsumeFile( |
|
350 const TDesC& aFileName, |
|
351 TUint32 aRightsSpec, |
|
352 TConsumeAction anAction) = 0; |
|
353 |
|
354 }; |
|
355 |
|
356 class MDRMHelperFactory |
|
357 { |
|
358 public: |
|
359 |
|
360 IMPORT_C static MDRMHelper* CreateL(CCoeEnv& aCoeEnv); |
|
361 IMPORT_C static MDRMHelper* CreateLC(CCoeEnv& aCoeEnv); |
|
362 |
|
363 IMPORT_C static MDRMHelper* CreateL(); |
|
364 IMPORT_C static MDRMHelper* CreateLC(); |
|
365 |
|
366 }; |
|
367 |
|
368 #endif // MDRMHELPER_H |
|
369 |
|
370 // End of File |