commondrm/drmutility/inc/drmautomatedusagedata.h
changeset 0 95b198f216e5
equal deleted inserted replaced
-1:000000000000 0:95b198f216e5
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Data class for async operations
       
    15 *                in DrmAutomatedUsageImpl class
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef CDRMAUTOMATEDUSAGEDATA_H
       
    21 #define CDRMAUTOMATEDUSAGEDATA_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <caf/caftypes.h>
       
    25 #include <caf/data.h>
       
    26 #include <drmutilitytypes.h>
       
    27 
       
    28 namespace DRM
       
    29 {
       
    30 
       
    31 class MDrmAsyncObserver;
       
    32 
       
    33 /**
       
    34 *  DRM Automated Usage Data storage class
       
    35 *
       
    36 *  parameter container class used by DRM::CDrmAutomatedUsageImpl
       
    37 *
       
    38 *  @lib drmautomatedusageimpl.lib
       
    39 *
       
    40 *  @since S60 5.0
       
    41 *
       
    42 *  @see DRM::CDrmAutomatedUsageImpl
       
    43 */
       
    44 NONSHARABLE_CLASS( CDrmAutomatedUsageData ) : public CBase
       
    45     {
       
    46 
       
    47 public: // Members
       
    48     /**
       
    49     * Possible operations for atuomated content relresented by
       
    50     * object of this class
       
    51     */
       
    52     enum TOperation
       
    53         {
       
    54         ESetAutomated,
       
    55         ERemoveAutomated,
       
    56         EHandeError
       
    57         };
       
    58 
       
    59     /**
       
    60     * Creates a new CDrmAutomatedUsageData -object
       
    61     *
       
    62     * @since S60 5.0
       
    63     * @return A functional CDrmAutomatedUsageData -object
       
    64     * @leave System wide or DRM specific error code
       
    65     */
       
    66     static CDrmAutomatedUsageData* NewL(
       
    67         const ContentAccess::CData& aData,
       
    68         ContentAccess::TIntent aIntent,
       
    69         TDrmAutomatedType aAutomatedType,
       
    70         MDrmAsyncObserver* aObserver,
       
    71         TDrmAutomatedServiceType aServiceType,
       
    72         TOperation aOperation );
       
    73 
       
    74 
       
    75     /**
       
    76     * Creates a new CDrmAutomatedUsageData -object and leaves
       
    77     * it into the cleanup stack
       
    78     *
       
    79     * @since S60 5.0
       
    80     * @return A functional CDrmAutomatedUsageData -object
       
    81     * @leave System wide or DRM specific error code
       
    82     */
       
    83     static CDrmAutomatedUsageData* NewLC(
       
    84         const ContentAccess::CData& aData,
       
    85         ContentAccess::TIntent aIntent,
       
    86         TDrmAutomatedType aAutomatedType,
       
    87         MDrmAsyncObserver* aObserver,
       
    88         TDrmAutomatedServiceType aServiceType,
       
    89         TOperation aOperation );
       
    90 
       
    91     /**
       
    92     * Creates a new CDrmAutomatedUsageData -object
       
    93     *
       
    94     * @since S60 5.0
       
    95     * @return A functional CDrmAutomatedUsageData -object
       
    96     * @leave System wide or DRM specific error code
       
    97     */
       
    98     static CDrmAutomatedUsageData* NewL(
       
    99         const TDesC& aUniqueId,
       
   100         ContentAccess::TIntent aIntent,
       
   101         TDrmAutomatedType aAutomatedType,
       
   102         MDrmAsyncObserver* aObserver,
       
   103         TDrmAutomatedServiceType aServiceType,
       
   104         TOperation aOperation );
       
   105 
       
   106 
       
   107     /**
       
   108     * Creates a new CDrmAutomatedUsageData -object and leaves
       
   109     * it into the cleanup stack
       
   110     *
       
   111     * @since S60 5.0
       
   112     * @return A functional CDrmAutomatedUsageData -object
       
   113     * @leave System wide or DRM specific error code
       
   114     */
       
   115     static CDrmAutomatedUsageData* NewLC(
       
   116         const TDesC& aUniqueId,
       
   117         ContentAccess::TIntent aIntent,
       
   118         TDrmAutomatedType aAutomatedType,
       
   119         MDrmAsyncObserver* aObserver,
       
   120         TDrmAutomatedServiceType aServiceType,
       
   121         TOperation aOperation );
       
   122 
       
   123     /**
       
   124     * Destructor.
       
   125     */
       
   126     ~CDrmAutomatedUsageData();
       
   127 
       
   128 public: // Variables:
       
   129     // Operation code
       
   130     TOperation iOperation;
       
   131 
       
   132     // Operation id
       
   133     // Owned
       
   134     TInt iOperationId;
       
   135 
       
   136     // The content id requested as 16 bit descriptor
       
   137     // Owned
       
   138     HBufC16* iUniqueId;
       
   139 
       
   140     // The content id requested as 8 bit descriptor, this exists if it's
       
   141     // For internal DRM API
       
   142     // Owned
       
   143     HBufC8* iUniqueId8;
       
   144 
       
   145     // Intent
       
   146     // Owned
       
   147     ContentAccess::TIntent iIntent;
       
   148 
       
   149     // Desired automated content type for automated content
       
   150     // Owned
       
   151     TDrmAutomatedType iAutomatedType;
       
   152 
       
   153     // Observer pointer for notifying asynchronous operations
       
   154     // Not owned
       
   155     MDrmAsyncObserver* iObserver;
       
   156 
       
   157     // Desired automated content type for automated content
       
   158     TDrmAutomatedServiceType iServiceType;
       
   159 
       
   160 
       
   161 private:
       
   162 
       
   163     /**
       
   164     * C++ default constructor.
       
   165     */
       
   166     CDrmAutomatedUsageData(
       
   167         ContentAccess::TIntent aIntent,
       
   168         TDrmAutomatedType aAutomatedType,
       
   169         MDrmAsyncObserver* aObserver,
       
   170         TDrmAutomatedServiceType aServiceType,
       
   171         TOperation aOperation );
       
   172 
       
   173     /**
       
   174     * C++ copy constructor.
       
   175     */
       
   176     CDrmAutomatedUsageData( const CDrmAutomatedUsageData& );
       
   177 
       
   178     /**
       
   179     * 2nd phase constructor
       
   180     */
       
   181     void ConstructL( const ContentAccess::CData& aData );
       
   182 
       
   183     void ConstructL( const TDesC& aUniqueId );
       
   184 
       
   185     /**
       
   186     * Initialises operationId to unique value.
       
   187     */
       
   188     void SetOperationId();
       
   189     };
       
   190 }
       
   191 
       
   192 
       
   193 #endif // CDRMAUTOMATEDUSAGEDATA_H