18 |
18 |
19 |
19 |
20 // INCLUDE FILES |
20 // INCLUDE FILES |
21 #include <e32std.h> |
21 #include <e32std.h> |
22 #include <e32math.h> |
22 #include <e32math.h> |
23 #include "drmhelpercommon.h" |
23 #include "DRMHelperCommon.h" |
24 #include "drmhelperserver.h" |
24 #include "DRMHelperServer.h" |
25 #include "rdrmhelperclient.h" |
25 #include "rdrmhelperclient.h" |
26 |
26 |
27 // LOCAL CONSTANTS AND MACROS |
27 // LOCAL CONSTANTS AND MACROS |
28 |
28 |
29 // Number of message slots to reserve for this client server session. |
29 // Number of message slots to reserve for this client server session. |
94 // return server version |
94 // return server version |
95 // ----------------------------------------------------------------------------- |
95 // ----------------------------------------------------------------------------- |
96 // |
96 // |
97 TVersion RDrmHelperClient::Version() const |
97 TVersion RDrmHelperClient::Version() const |
98 { |
98 { |
99 return ( TVersion( KDRMHSMajorVersionNumber, |
99 return ( TVersion( KDRMHSMajorVersionNumber, |
100 KDRMHSMinorVersionNumber, |
100 KDRMHSMinorVersionNumber, |
101 KDRMHSBuildVersionNumber ) ); |
101 KDRMHSBuildVersionNumber ) ); |
102 } |
102 } |
103 |
103 |
104 // ----------------------------------------------------------------------------- |
104 // ----------------------------------------------------------------------------- |
113 const ContentAccess::TIntent aIntent, |
113 const ContentAccess::TIntent aIntent, |
114 const DRM::TDrmAutomatedServiceType aServiceType ) const |
114 const DRM::TDrmAutomatedServiceType aServiceType ) const |
115 { |
115 { |
116 TInt ret( KErrNone ); |
116 TInt ret( KErrNone ); |
117 TInt drmHsServiceType( 0 ); |
117 TInt drmHsServiceType( 0 ); |
118 |
118 |
119 ret = AutomatedServiceTypeToHs( aServiceType, drmHsServiceType ); |
119 ret = AutomatedServiceTypeToHs( aServiceType, drmHsServiceType ); |
120 if ( ret ) |
120 if ( ret ) |
121 { |
121 { |
122 return ret; |
122 return ret; |
123 } |
123 } |
128 // Note : Using TPtr8 since this is binary information |
128 // Note : Using TPtr8 since this is binary information |
129 TPtrC8 descriptor( aUri ); |
129 TPtrC8 descriptor( aUri ); |
130 |
130 |
131 // This call waits for the server to complete the request before |
131 // This call waits for the server to complete the request before |
132 // proceeding. |
132 // proceeding. |
133 return SendReceive( ERegister, |
133 return SendReceive( ERegister, |
134 TIpcArgs( aIntent, |
134 TIpcArgs( aIntent, |
135 drmHsServiceType, |
135 drmHsServiceType, |
136 aAutomatedType, |
136 aAutomatedType, |
137 &descriptor ) ); |
137 &descriptor ) ); |
138 } |
138 } |
139 |
139 |
140 // ----------------------------------------------------------------------------- |
140 // ----------------------------------------------------------------------------- |
141 // RDrmHelperClient::RemoveAutomated |
141 // RDrmHelperClient::RemoveAutomated |
149 const ContentAccess::TIntent aIntent, |
149 const ContentAccess::TIntent aIntent, |
150 const DRM::TDrmAutomatedServiceType aServiceType ) const |
150 const DRM::TDrmAutomatedServiceType aServiceType ) const |
151 { |
151 { |
152 TInt ret( KErrNone ); |
152 TInt ret( KErrNone ); |
153 TInt drmHsServiceType( 0 ); |
153 TInt drmHsServiceType( 0 ); |
154 |
154 |
155 ret = AutomatedServiceTypeToHs( aServiceType, drmHsServiceType ); |
155 ret = AutomatedServiceTypeToHs( aServiceType, drmHsServiceType ); |
156 if( ret ) |
156 if( ret ) |
157 { |
157 { |
158 return ret; |
158 return ret; |
159 } |
159 } |
160 |
160 |
161 // Create descriptor to enable copying data between |
161 // Create descriptor to enable copying data between |
162 // client and server. Note: This can be local since |
162 // client and server. Note: This can be local since |
163 // this is a synchronous call. |
163 // this is a synchronous call. |
164 // Note : Using TPtr8 since this is binary information |
164 // Note : Using TPtr8 since this is binary information |
165 TPtrC8 descriptor( aUri ); |
165 TPtrC8 descriptor( aUri ); |
166 |
166 |
167 // This call waits for the server to complete the request before |
167 // This call waits for the server to complete the request before |
168 // proceeding. |
168 // proceeding. |
169 ret = SendReceive( ERemove, |
169 ret = SendReceive( ERemove, |
170 TIpcArgs( aIntent, |
170 TIpcArgs( aIntent, |
171 drmHsServiceType, |
171 drmHsServiceType, |
172 aAutomatedType, |
172 aAutomatedType, |
173 &descriptor ) ); |
173 &descriptor ) ); |
174 |
174 |
175 if ( ret == KErrNotFound ) |
175 if ( ret == KErrNotFound ) |
176 { |
176 { |
177 // content was never actually registered |
177 // content was never actually registered |
193 const DRM::TDrmAutomatedServiceType aServiceType ) const |
193 const DRM::TDrmAutomatedServiceType aServiceType ) const |
194 { |
194 { |
195 TPtrC8 descriptor( aUri ); |
195 TPtrC8 descriptor( aUri ); |
196 TInt ret( KErrNone ); |
196 TInt ret( KErrNone ); |
197 TInt drmHsServiceType( 0 ); |
197 TInt drmHsServiceType( 0 ); |
198 |
198 |
199 ret = AutomatedServiceTypeToHs( aServiceType, drmHsServiceType ); |
199 ret = AutomatedServiceTypeToHs( aServiceType, drmHsServiceType ); |
200 if ( ret ) |
200 if ( ret ) |
201 { |
201 { |
202 return ret; |
202 return ret; |
203 } |
203 } |
204 |
204 |
205 TBool automated( EFalse ); |
205 TBool automated( EFalse ); |
206 |
206 |
207 // This call waits for the server to complete the request before |
207 // This call waits for the server to complete the request before |
208 // proceeding. |
208 // proceeding. |
209 ret = SendReceive( ERemove, |
209 ret = SendReceive( ERemove, |
210 TIpcArgs( aIntent, |
210 TIpcArgs( aIntent, |
211 drmHsServiceType, |
211 drmHsServiceType, |
212 aAutomatedType, |
212 aAutomatedType, |
213 &descriptor ) ); |
213 &descriptor ) ); |
214 |
214 |
215 ret = IsAutomated( aUri, |
215 ret = IsAutomated( aUri, |
216 aAutomatedType, |
216 aAutomatedType, |
217 aIntent, |
217 aIntent, |
218 aServiceType, |
218 aServiceType, |
219 automated ); |
219 automated ); |
220 |
220 |
221 while ( automated ) |
221 while ( automated ) |
222 { |
222 { |
223 // unregister all |
223 // unregister all |
224 ret = SendReceive( ERemove, |
224 ret = SendReceive( ERemove, |
225 TIpcArgs( aIntent, |
225 TIpcArgs( aIntent, |
226 drmHsServiceType, |
226 drmHsServiceType, |
227 aAutomatedType, |
227 aAutomatedType, |
228 &descriptor ) ); |
228 &descriptor ) ); |
229 |
229 |
230 IsAutomated( aUri, aAutomatedType, aIntent, aServiceType, automated ); |
230 IsAutomated( aUri, aAutomatedType, aIntent, aServiceType, automated ); |
231 } |
231 } |
232 |
232 |
233 if ( ret == KErrNotFound ) |
233 if ( ret == KErrNotFound ) |
234 { |
234 { |
258 TBool& aAutomated ) const |
258 TBool& aAutomated ) const |
259 { |
259 { |
260 TPtr8 flag( reinterpret_cast< TUint8* >( &aAutomated ), 0, sizeof( TInt ) ); |
260 TPtr8 flag( reinterpret_cast< TUint8* >( &aAutomated ), 0, sizeof( TInt ) ); |
261 TInt ret( KErrNone ); |
261 TInt ret( KErrNone ); |
262 TInt drmHsServiceType( 0 ); |
262 TInt drmHsServiceType( 0 ); |
263 |
263 |
264 ret = AutomatedServiceTypeToHs( aServiceType, drmHsServiceType ); |
264 ret = AutomatedServiceTypeToHs( aServiceType, drmHsServiceType ); |
265 if ( ret ) |
265 if ( ret ) |
266 { |
266 { |
267 return ret; |
267 return ret; |
268 } |
268 } |
269 |
269 |
270 TInt type( CDRMHelperServer::EActive ); |
270 TInt type( CDRMHelperServer::EActive ); |
271 |
271 |
272 // Create descriptor to enable copying data between |
272 // Create descriptor to enable copying data between |
273 // client and server. Note: This can be local since |
273 // client and server. Note: This can be local since |
274 // this is a synchronous call. |
274 // this is a synchronous call. |
276 TPtrC8 descriptor( aUri ); |
276 TPtrC8 descriptor( aUri ); |
277 |
277 |
278 // This call waits for the server to complete the request before |
278 // This call waits for the server to complete the request before |
279 // proceeding. |
279 // proceeding. |
280 ret = SendReceive( EIsRegistered, |
280 ret = SendReceive( EIsRegistered, |
281 TIpcArgs( aIntent, |
281 TIpcArgs( aIntent, |
282 type, |
282 type, |
283 aAutomatedType, |
283 aAutomatedType, |
284 &descriptor ) ); |
284 &descriptor ) ); |
285 if ( !ret ) |
285 if ( !ret ) |
286 { |
286 { |
287 type = CDRMHelperServer::EPassive; |
287 type = CDRMHelperServer::EPassive; |
288 |
288 |
289 ret = SendReceive( EIsRegistered, |
289 ret = SendReceive( EIsRegistered, |
290 TIpcArgs( aIntent, |
290 TIpcArgs( aIntent, |
291 type, |
291 type, |
292 aAutomatedType, |
292 aAutomatedType, |
293 &descriptor ) ); |
293 &descriptor ) ); |
294 } |
294 } |
295 aAutomated = ret ? ETrue : EFalse; |
295 aAutomated = ret ? ETrue : EFalse; |
296 return KErrNone; |
296 return KErrNone; |
297 } |
297 } |
339 // |
339 // |
340 TInt RDrmHelperClient::CreateServerProcess() |
340 TInt RDrmHelperClient::CreateServerProcess() |
341 { |
341 { |
342 TInt result( 0 ); |
342 TInt result( 0 ); |
343 const TUidType serverUid( KNullUid, KNullUid, KServerUid3 ); |
343 const TUidType serverUid( KNullUid, KNullUid, KServerUid3 ); |
344 |
344 |
345 RProcess server; |
345 RProcess server; |
346 result = server.Create( KDRMHSServerFileName, _L(""), serverUid ); |
346 result = server.Create( KDRMHSServerFileName, _L(""), serverUid ); |
347 if ( result ) |
347 if ( result ) |
348 { |
348 { |
349 return result; |
349 return result; |