|
1 /* |
|
2 * Copyright (c) 2006-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: Implementation class of DRM Rights Info API |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CDRMRIGHTSINFOIMPL_H |
|
20 #define CDRMRIGHTSINFOIMPL_H |
|
21 |
|
22 //*** system include files go here: |
|
23 #include <e32base.h> |
|
24 #include <f32file.h> |
|
25 #include <caf/caftypes.h> |
|
26 #include <drmrightsclient.h> |
|
27 #include <drmutilitytypes.h> |
|
28 |
|
29 namespace DRM |
|
30 { |
|
31 //*** Forward declarations |
|
32 class CDrmRightsInfoData; |
|
33 class MDrmAsyncObserver; |
|
34 class CDrmUtilityCommon; |
|
35 |
|
36 /** |
|
37 * Utility class for DRM related rights information handling |
|
38 * |
|
39 * @lib drmrightsinfoimpl.lib |
|
40 * @since S60 v5.0 |
|
41 */ |
|
42 NONSHARABLE_CLASS( CDrmRightsInfoImpl ) : public CActive |
|
43 { |
|
44 |
|
45 public: |
|
46 |
|
47 IMPORT_C static CDrmRightsInfoImpl* NewL(); |
|
48 |
|
49 IMPORT_C static CDrmRightsInfoImpl* NewLC(); |
|
50 |
|
51 virtual ~CDrmRightsInfoImpl(); |
|
52 |
|
53 |
|
54 /** |
|
55 * Checks the rights and their status for a specific unique id |
|
56 * |
|
57 * @param[in] aUniqueId : The unique identifier or the content |
|
58 * @param[in] aIntent : The intent for the rights to check |
|
59 * @param[out] aDetails : Details of the rights status |
|
60 * @return none |
|
61 * @leave System wide error code |
|
62 */ |
|
63 IMPORT_C void CheckRightsL( |
|
64 const TDesC& aUniqueId, |
|
65 ContentAccess::TIntent aIntent, |
|
66 TDrmRightsInfo& aDetails ); |
|
67 |
|
68 /** |
|
69 * Checks the rights and their status for a specific unique id |
|
70 * |
|
71 * @param[in] aUniqueId The unique identifier or the content |
|
72 * @param[in] aIntent The intent for the rights to check |
|
73 * @param[out] aDetails Details of the rights status |
|
74 * @param[in] aObserver Observer which gets reported of |
|
75 * the async operation |
|
76 * |
|
77 * @return Operation identifier |
|
78 * |
|
79 * @leave System wide error code |
|
80 */ |
|
81 IMPORT_C TInt CheckRightsAsyncL( |
|
82 const TDesC& aUniqueId, |
|
83 ContentAccess::TIntent aIntent, |
|
84 TDrmRightsInfo& aDetails, |
|
85 MDrmAsyncObserver& aObserver ); |
|
86 |
|
87 |
|
88 /** |
|
89 * Cancel an asyncronous operation |
|
90 * |
|
91 * @since S60 v5.0 |
|
92 * @param[in] aOperationId identifier of the async operation |
|
93 * to be cancelled |
|
94 * @return KErrNotFound if the operation has already been executed |
|
95 * or it does not exist |
|
96 */ |
|
97 IMPORT_C TInt CancelOperation( TInt aOperationId ); |
|
98 |
|
99 |
|
100 public: // From base classes |
|
101 |
|
102 |
|
103 protected: // Functions from base classes |
|
104 |
|
105 /** |
|
106 * From CActive Cancels async request. |
|
107 */ |
|
108 void DoCancel(); |
|
109 |
|
110 /** |
|
111 * From CActive Called when async request completes. |
|
112 */ |
|
113 void RunL(); |
|
114 |
|
115 /** |
|
116 * From CActive Called when RunL leaves |
|
117 */ |
|
118 TInt RunError( TInt aError ); |
|
119 |
|
120 private: |
|
121 |
|
122 CDrmRightsInfoImpl(); |
|
123 |
|
124 void ConstructL(); |
|
125 |
|
126 void PerformCheckRightsL( CDrmRightsInfoData& aData ); |
|
127 |
|
128 void AppendToQueue( CDrmRightsInfoData* aData ); |
|
129 |
|
130 CDrmRightsInfoData* PopFront(); |
|
131 |
|
132 |
|
133 private: // Data members |
|
134 |
|
135 // DrmUtilityCommon |
|
136 CDrmUtilityCommon* iDrmUtilityCommon; |
|
137 |
|
138 // Oma Drm client |
|
139 RDRMRightsClient iOmaClient; |
|
140 |
|
141 // WM Drm Client |
|
142 // RWMDrmClient iWmClient; |
|
143 |
|
144 // current request status: |
|
145 MDrmAsyncObserver* iObserver; |
|
146 TInt iOperationId; |
|
147 |
|
148 // Operation Queue: |
|
149 CDrmRightsInfoData* iFirst; |
|
150 CDrmRightsInfoData* iLast; |
|
151 |
|
152 // To prevent queue handling from being messed up by threads |
|
153 RSemaphore iSemaphore; |
|
154 }; |
|
155 |
|
156 } |
|
157 |
|
158 #endif // CDRMRIGHTSINFOIMPL_H |