mpx/commonframework/common/inc/mpxdrmmediawmaagent.h
changeset 0 a2952bb97e68
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Wma DRM media agent
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CMPXDRMMEDIAWMAAGENT_H
       
    21 #define CMPXDRMMEDIAWMAAGENT_H
       
    22 
       
    23 #include <caf/data.h>
       
    24 #include <caf/manager.h>
       
    25 #include <caf/rightsmanager.h>
       
    26 #include "mpxdrmmediaagent.h"
       
    27 
       
    28 
       
    29 // DATA TYPES
       
    30 enum TMPXWmaDrmLicenseType
       
    31     {
       
    32     EMPXWmaDrmUnlimited,
       
    33     EMPXWmaDrmTime,
       
    34     EMPXWmaDrmCount,
       
    35     EMPXWmaDrmDuration,
       
    36     EMPXWmaDrmTimeCount
       
    37     };
       
    38 
       
    39 // FORWARD DECLARATIONS
       
    40 class CMPXMedia;
       
    41 
       
    42 /**
       
    43 * CMPXDrmMediaWmaAgent class declaration
       
    44 * 
       
    45 * @lib mpxcommon.lib
       
    46 * @since S60 3.1
       
    47 */
       
    48 NONSHARABLE_CLASS(CMPXDrmMediaWmaAgent) : public CMPXDrmMediaAgent
       
    49     {
       
    50 public:     // Constructors and Destructors
       
    51     /**
       
    52     *  Two-phase constructor
       
    53     *
       
    54     *  @return object created
       
    55     */
       
    56     static CMPXDrmMediaWmaAgent* NewL();
       
    57 
       
    58     /**
       
    59     *  Two-phase constructor
       
    60     *
       
    61     *  @return object created
       
    62     */
       
    63     static CMPXDrmMediaWmaAgent* NewLC();
       
    64 
       
    65     /**
       
    66     *  Destructor
       
    67     */
       
    68     virtual ~CMPXDrmMediaWmaAgent();
       
    69 
       
    70 public:     // New Functions
       
    71     /**
       
    72     *  From MMPXDrmMediaAgent
       
    73     *  Initialize using a filename
       
    74     *
       
    75     *  @param aFileName file name
       
    76     */
       
    77     void InitL(const TDesC& aFileName);
       
    78 
       
    79     /**
       
    80     *  From MMPXDrmMediaAgent
       
    81     *  Initialize using a file handle
       
    82     *
       
    83     *  @param aFile file handle
       
    84     */
       
    85     void InitL(RFile& aFile);
       
    86 
       
    87     /**
       
    88     *  From MMPXDrmMediaAgent
       
    89     *  Gets media object
       
    90     *
       
    91     *  @param aAttributes attributes to retreive
       
    92     *  @return CMPXMedia object with the specified attributes
       
    93     */
       
    94     const CMPXMedia& GetMediaL(TUint aAttributes);
       
    95 
       
    96     /**
       
    97     *  From MMPXDrmMediaAgent
       
    98     *  Consumes the rights for the current media according
       
    99     *  to the specified consume type
       
   100     *
       
   101     *  @param aType Type of consumption to execute
       
   102     */
       
   103     void ConsumeL(TDrmConsumeType aType);
       
   104 
       
   105     /**
       
   106     *  Closes and uninitializes the agent and cleans up member variables
       
   107     *
       
   108     *  @return void
       
   109     */
       
   110     void Close();
       
   111 
       
   112 private:    // Constructors
       
   113     /**
       
   114     *  C++ default constructor.
       
   115     */
       
   116     CMPXDrmMediaWmaAgent();
       
   117 
       
   118     /**
       
   119     * 2nd phase contructor
       
   120     */
       
   121     void ConstructL();
       
   122     
       
   123 private:    // New Functions
       
   124     /**
       
   125     * Creates a new media object
       
   126     */
       
   127     void CreateMediaL();
       
   128 
       
   129     /**
       
   130     * Gets the rights status
       
   131     */
       
   132     void GetRightsStatusL();
       
   133 
       
   134     /**
       
   135     * Gets the rights type attribute if not already obtained
       
   136     */
       
   137     void GetRightsTypeL();
       
   138 
       
   139     /**
       
   140     * Gets the count attribute if not already obtained
       
   141     */
       
   142     void GetCountL();
       
   143 
       
   144     /**
       
   145     * Gets the start time attribute if not already obtained
       
   146     */
       
   147     void GetStartTimeL();
       
   148 
       
   149     /**
       
   150     * Gets the end time attribute if not already obtained
       
   151     */
       
   152     void GetEndTimeL();
       
   153 
       
   154     /**
       
   155     * Gets the interval attribute if not already obtained
       
   156     */
       
   157     void GetIntervalL();
       
   158 
       
   159     /**
       
   160     * Gets the sending allowed attribute if not already obtained
       
   161     */
       
   162     void GetSendingAllowedL();
       
   163 
       
   164     /**
       
   165     * Gets the can set automated attribute if not already obtained
       
   166     */
       
   167     void GetCanSetAutomatedL();
       
   168     
       
   169     /**
       
   170     * Get Rights Description for WMDRM protected files
       
   171     * @return Error code:
       
   172     *           KErrNone:       Description returned.
       
   173     *           KErrNotFound:   No description available.
       
   174     **/
       
   175     TInt GetWmdrmRightsDescriptionL();
       
   176 
       
   177     /**
       
   178     * Retrieve and format TTime for WMDRM protected files
       
   179     * @param aTimeTypeDelimeter Time delimeter, starttime or endtime.
       
   180     * @param aTime Time.
       
   181     * @return Error code:
       
   182     *           KErrNone:       Time returned.
       
   183     *           KErrNotFound:   Not time available for given delimeter.
       
   184     **/
       
   185     TInt GetWmdrmTimeL( const TDesC& aTimeTypeDelimeter, TTime& aTime );
       
   186 
       
   187     /**
       
   188     * Gets whether the DRM object is about to expire or not
       
   189     */
       
   190     void GetAboutToExpireL();
       
   191 
       
   192 private:    // Data
       
   193     HBufC* iFileName;   // owned
       
   194     CManager* iManager; // owned
       
   195     CRightsManager* iRightsManager; // owned
       
   196     HBufC* iRightsDescription;  // owned
       
   197     };
       
   198 
       
   199 
       
   200 #endif // CMPXDRMMEDIAWMAAGENT_H