|
1 /* |
|
2 * Copyright (c) 2008 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: Dynamically loadable wrapper for Drm Service Api |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <drmserviceapi.h> |
|
20 #include "drmserviceapiwrapper.h" |
|
21 |
|
22 // CONSTANTS |
|
23 |
|
24 // ======== LOCAL FUNCTIONS ======== |
|
25 |
|
26 |
|
27 // ======== MEMBER FUNCTIONS ======== |
|
28 |
|
29 // --------------------------------------------------------------------------- |
|
30 // Constructor |
|
31 // --------------------------------------------------------------------------- |
|
32 // |
|
33 DRM::CDrmServiceApiWrapper::CDrmServiceApiWrapper() |
|
34 { |
|
35 } |
|
36 |
|
37 // --------------------------------------------------------------------------- |
|
38 // CDrmServiceApiWrapper::ConstructL |
|
39 // --------------------------------------------------------------------------- |
|
40 // |
|
41 void DRM::CDrmServiceApiWrapper::ConstructL() |
|
42 { |
|
43 iServiceApi = DRM::CDrmServiceApi::NewL(); |
|
44 } |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // CDrmServiceApiWrapper::NewL |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 DRM::CDrmServiceApiWrapper* DRM::CDrmServiceApiWrapper::NewL() |
|
51 { |
|
52 CDrmServiceApiWrapper* self = CDrmServiceApiWrapper::NewLC(); |
|
53 CleanupStack::Pop( self ); |
|
54 return self; |
|
55 } |
|
56 |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // CDrmServiceApiWrapper::NewLC |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 DRM::CDrmServiceApiWrapper* DRM::CDrmServiceApiWrapper::NewLC() |
|
63 { |
|
64 CDrmServiceApiWrapper* self = new( ELeave ) CDrmServiceApiWrapper(); |
|
65 CleanupStack::PushL( self ); |
|
66 self->ConstructL(); |
|
67 return self; |
|
68 } |
|
69 |
|
70 |
|
71 // --------------------------------------------------------------------------- |
|
72 // Destructor |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 DRM::CDrmServiceApiWrapper::~CDrmServiceApiWrapper() |
|
76 { |
|
77 delete iServiceApi; |
|
78 } |
|
79 |
|
80 |
|
81 // --------------------------------------------------------------------------- |
|
82 // CDrmServiceApiWrapper::GetSecureTime |
|
83 // --------------------------------------------------------------------------- |
|
84 // |
|
85 TInt DRM::CDrmServiceApiWrapper::GetSecureTime( |
|
86 TTime& aTime, |
|
87 TInt& aTimeZone, |
|
88 DRMClock::ESecurityLevel& aSecurityLevel ) const |
|
89 { |
|
90 return iServiceApi->GetSecureTime( aTime, aTimeZone, aSecurityLevel ); |
|
91 } |
|
92 |
|
93 // --------------------------------------------------------------------------- |
|
94 // CDrmServiceApiWrapper::UpdateSecureTime |
|
95 // --------------------------------------------------------------------------- |
|
96 // |
|
97 TInt DRM::CDrmServiceApiWrapper::UpdateSecureTime( const TTime& aTime, |
|
98 const TInt& aTimeZone ) |
|
99 { |
|
100 return iServiceApi->UpdateSecureTime( aTime, aTimeZone ); |
|
101 } |
|
102 |
|
103 // --------------------------------------------------------------------------- |
|
104 // CDrmServiceApiWrapper::GetDevicePublicKeyDerL |
|
105 // --------------------------------------------------------------------------- |
|
106 // |
|
107 void DRM::CDrmServiceApiWrapper::GetDevicePublicKeyDerL( HBufC8*& aPublicKey ) |
|
108 { |
|
109 iServiceApi->GetDevicePublicKeyDerL( aPublicKey ); |
|
110 } |
|
111 |
|
112 // --------------------------------------------------------------------------- |
|
113 // CDrmServiceApiWrapper::SignL |
|
114 // --------------------------------------------------------------------------- |
|
115 // |
|
116 void DRM::CDrmServiceApiWrapper::SignL( const TDesC8& aHash, HBufC8*& aSignature ) |
|
117 { |
|
118 iServiceApi->SignL( aHash, aSignature ); |
|
119 } |
|
120 |
|
121 |
|
122 // ======== GLOBAL FUNCTIONS ======== |
|
123 |
|
124 //------------------------------------------------------------------------------ |
|
125 // GateFunctionDrmServiceApiWrapper |
|
126 // DRM gate function |
|
127 //------------------------------------------------------------------------------ |
|
128 EXPORT_C TAny* GateFunctionDrmServiceApiWrapper() |
|
129 { |
|
130 DRM::CDrmServiceApiWrapper* launcher = NULL; |
|
131 TRAPD( err, launcher = DRM::CDrmServiceApiWrapper::NewL() ); |
|
132 if( err != KErrNone ) |
|
133 { |
|
134 return NULL; |
|
135 } |
|
136 |
|
137 return launcher; |
|
138 } |
|
139 |