|
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: Implementation class for WMDRM DLA App Client |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "wmdrmdlaappclient.h" |
|
21 #include "wmdrmdlaappconstants.h" |
|
22 |
|
23 #define _LOGGING_FILE L"wmdrmdlautils.txt" |
|
24 #include "logfn.h" |
|
25 |
|
26 // ======== LOCAL FUNCTIONS ======== |
|
27 |
|
28 // ======== MEMBER FUNCTIONS ======== |
|
29 |
|
30 // --------------------------------------------------------------------------- |
|
31 // RWmDrmDlaAppClient::~RWmDrmDlaAppClient |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 RWmDrmDlaAppClient::~RWmDrmDlaAppClient() |
|
35 { |
|
36 LOGFN( "RWmDrmDlaAppClient::~RWmDrmDlaAppClient" ); |
|
37 Close(); |
|
38 } |
|
39 |
|
40 // --------------------------------------------------------------------------- |
|
41 // RWmDrmDlaAppClient::SetIAP |
|
42 // --------------------------------------------------------------------------- |
|
43 // |
|
44 TInt RWmDrmDlaAppClient::SetIAP( TInt aIap ) |
|
45 { |
|
46 TInt err( KErrNone ); |
|
47 |
|
48 LOGFNR( "RWmDrmDlaAppClient::SetIAP", err ); |
|
49 |
|
50 TPckg<TInt> iapPckg( aIap ); |
|
51 err = SendReceive( ESetIAP, TIpcArgs( &iapPckg ) ); |
|
52 return err; |
|
53 } |
|
54 |
|
55 // --------------------------------------------------------------------------- |
|
56 // RWmDrmDlaAppClient::Post |
|
57 // --------------------------------------------------------------------------- |
|
58 // |
|
59 TInt RWmDrmDlaAppClient::Post( |
|
60 const TDesC& aPostUrl, |
|
61 const TDesC8& aPostContentType, |
|
62 const TDesC8& aPostData, |
|
63 const TDesC8& aPostContentBoundary ) |
|
64 { |
|
65 TInt err( KErrNone ); |
|
66 |
|
67 LOGFNR( "RWmDrmDlaAppClient::Post", err ); |
|
68 |
|
69 err = SendReceive( EPost, TIpcArgs( &aPostUrl, |
|
70 &aPostContentType, |
|
71 &aPostData, |
|
72 &aPostContentBoundary ) ); |
|
73 return err; |
|
74 } |
|
75 |
|
76 // --------------------------------------------------------------------------- |
|
77 // RWmDrmDlaAppClient::LicenseResponse |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 TInt RWmDrmDlaAppClient::LicenseResponse( HBufC8*& aLicenseResponse ) |
|
81 { |
|
82 TInt err( KErrNone ); |
|
83 TInt size( 0 ); |
|
84 TPckg<TInt> sizePckg( size ); |
|
85 |
|
86 LOGFNR( "RWmDrmDlaAppClient::LicenseResponse", err ); |
|
87 |
|
88 err = SendReceive( EGetLicenseResponseSize, TIpcArgs( &sizePckg ) ); |
|
89 if ( !err && size > 0 ) |
|
90 { |
|
91 TRAP( err, aLicenseResponse = HBufC8::NewL( size ) ); |
|
92 if ( !err ) |
|
93 { |
|
94 TPtr8 ptr( aLicenseResponse->Des() ); |
|
95 err = SendReceive( EGetLicenseResponse, TIpcArgs( &ptr ) ); |
|
96 if ( err ) |
|
97 { |
|
98 delete aLicenseResponse; |
|
99 aLicenseResponse = NULL; |
|
100 } |
|
101 } |
|
102 } |
|
103 return err; |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 // RWmDrmDlaAppClient::ServiceUid |
|
108 // --------------------------------------------------------------------------- |
|
109 // |
|
110 TUid RWmDrmDlaAppClient::ServiceUid() const |
|
111 { |
|
112 return KWmDrmDlaAppServiceId; |
|
113 } |