wmdrm/wmdrmengine/wmdrmotaaccess/src/wmdrmotaaccess.cpp
branchRCL_3
changeset 24 8cdda00a45da
child 41 29f3cf766061
equal deleted inserted replaced
20:a20e54f39dd4 24:8cdda00a45da
       
     1 /*
       
     2 * Copyright (c) 2010 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 *  wmdrmotaaccess.cpp
       
    16 *
       
    17 */
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <ecom/ecom.h>
       
    21 
       
    22 #include <wmdrmotaaccess.h>
       
    23 #include <wmdrmotaaccessecominterface.h>
       
    24 
       
    25 // ---------------------------------------------------------------------------
       
    26 // CWmDrmOtaAccess::NewL
       
    27 // ---------------------------------------------------------------------------
       
    28 EXPORT_C CWmDrmOtaAccess* CWmDrmOtaAccess::NewL()
       
    29     {
       
    30     CWmDrmOtaAccess* self(CWmDrmOtaAccess::NewLC());
       
    31     CleanupStack::Pop(self);
       
    32     return self;
       
    33     }
       
    34 
       
    35 
       
    36 // ---------------------------------------------------------------------------
       
    37 // CWmDrmOtaAccess::NewLC
       
    38 // ---------------------------------------------------------------------------
       
    39 EXPORT_C CWmDrmOtaAccess* CWmDrmOtaAccess::NewLC()
       
    40     {
       
    41     CWmDrmOtaAccess* self(new (ELeave) CWmDrmOtaAccess);
       
    42     CleanupStack::PushL(self);
       
    43     self->ConstructL();
       
    44     return self;
       
    45     }
       
    46 
       
    47 
       
    48 // ---------------------------------------------------------------------------
       
    49 // CWmDrmOtaAccess::ConstructL
       
    50 // ---------------------------------------------------------------------------
       
    51 void CWmDrmOtaAccess::ConstructL()
       
    52     {
       
    53     iWmDrmOtaAccessEcomInterface = CWmDrmOtaAccessEcomInterface::NewL();
       
    54     }
       
    55 
       
    56 
       
    57 // ---------------------------------------------------------------------------
       
    58 // CWmDrmOtaAccess::CWmDrmOtaAccess
       
    59 // ---------------------------------------------------------------------------
       
    60 CWmDrmOtaAccess::CWmDrmOtaAccess()
       
    61     {
       
    62     }
       
    63 
       
    64 // ---------------------------------------------------------------------------
       
    65 // CWmDrmOtaAccess::~CWmDrmOtaAccess
       
    66 // ---------------------------------------------------------------------------
       
    67 EXPORT_C CWmDrmOtaAccess::~CWmDrmOtaAccess()
       
    68     {
       
    69     if (iWmDrmOtaAccessEcomInterface)
       
    70         {
       
    71         delete iWmDrmOtaAccessEcomInterface;
       
    72         }
       
    73     REComSession::FinalClose();
       
    74     }
       
    75 
       
    76 
       
    77 // ---------------------------------------------------------------------------
       
    78 // CWmDrmOtaAccess::GetLicenseChallengeL
       
    79 // ---------------------------------------------------------------------------
       
    80 EXPORT_C void CWmDrmOtaAccess::GetLicenseChallengeL( const TDesC8& aDrmHeader, 
       
    81                                                      HBufC8*& aChallenge )
       
    82     {
       
    83     // Ecom interface not available    
       
    84     if( !iWmDrmOtaAccessEcomInterface )
       
    85         {
       
    86         User::Leave( KErrNotReady );    
       
    87         }   
       
    88     
       
    89     iWmDrmOtaAccessEcomInterface->GetLicenseChallengeL( aDrmHeader, 
       
    90                                                         aChallenge );                                 
       
    91     }
       
    92 
       
    93 // ---------------------------------------------------------------------------
       
    94 // CWmDrmOtaAccess::GetLicenseChallengeL
       
    95 // ---------------------------------------------------------------------------
       
    96 EXPORT_C void CWmDrmOtaAccess::GetLicenseChallengeL( const TDesC8& aDrmHeader, 
       
    97                                                      HBufC8*& aChallenge, 
       
    98                                                      TRequestStatus& aStatus )
       
    99     {
       
   100     // Ecom interface not available    
       
   101     if( !iWmDrmOtaAccessEcomInterface )
       
   102         {
       
   103         User::Leave( KErrNotReady );    
       
   104         }   
       
   105     
       
   106     iWmDrmOtaAccessEcomInterface->GetLicenseChallengeL( aDrmHeader, 
       
   107                                                         aChallenge,
       
   108                                                         aStatus );                                 
       
   109     }                                                     
       
   110     
       
   111 // ---------------------------------------------------------------------------
       
   112 // CWmDrmOtaAccess::HandleLicenseResponseL
       
   113 // ---------------------------------------------------------------------------
       
   114 EXPORT_C void CWmDrmOtaAccess::HandleLicenseResponseL( const TDesC8& aResponse )
       
   115     {
       
   116     // Ecom interface not available    
       
   117     if( !iWmDrmOtaAccessEcomInterface )
       
   118         {
       
   119         User::Leave( KErrNotReady );    
       
   120         }   
       
   121     
       
   122     iWmDrmOtaAccessEcomInterface->HandleLicenseResponseL( aResponse );                                
       
   123     }    
       
   124 // ---------------------------------------------------------------------------
       
   125 // CWmDrmOtaAccess::HandleLicenseResponseL
       
   126 // ---------------------------------------------------------------------------
       
   127 EXPORT_C void CWmDrmOtaAccess::HandleLicenseResponseL( const TDesC8& aResponse, 
       
   128                                                        TRequestStatus& aStatus )
       
   129     {
       
   130     // Ecom interface not available    
       
   131     if( !iWmDrmOtaAccessEcomInterface )
       
   132         {
       
   133         User::Leave( KErrNotReady );    
       
   134         }   
       
   135     
       
   136     iWmDrmOtaAccessEcomInterface->HandleLicenseResponseL( aResponse,
       
   137                                                           aStatus );                                 
       
   138     }                                                           
       
   139 
       
   140 
       
   141 
       
   142     
       
   143 // End of file