commondrm/drmutility/inc/DrmRightsInfoImpl.h
branchRCL_3
changeset 12 8a03a285ab14
parent 0 95b198f216e5
equal deleted inserted replaced
11:e16d72588c28 12:8a03a285ab14
    20 #define CDRMRIGHTSINFOIMPL_H
    20 #define CDRMRIGHTSINFOIMPL_H
    21 
    21 
    22 //*** system include files go here:
    22 //*** system include files go here:
    23 #include <e32base.h>
    23 #include <e32base.h>
    24 #include <f32file.h>
    24 #include <f32file.h>
    25 #include <caf/caftypes.h> 
    25 #include <caf/caftypes.h>
    26 #include <drmrightsclient.h>
    26 #include <DRMRightsClient.h>
    27 #include <drmutilitytypes.h>
    27 #include <drmutilitytypes.h>
    28 
    28 
    29 namespace DRM 
    29 namespace DRM
    30 {
    30 {
    31     //*** Forward declarations
    31     //*** Forward declarations
    32     class CDrmRightsInfoData;
    32     class CDrmRightsInfoData;
    33     class MDrmAsyncObserver;
    33     class MDrmAsyncObserver;
    34     class CDrmUtilityCommon;
    34     class CDrmUtilityCommon;
    35     
    35 
    36  /**
    36  /**
    37   *  Utility class for DRM related rights information handling
    37   *  Utility class for DRM related rights information handling
    38   *
    38   *
    39   *  @lib drmrightsinfoimpl.lib
    39   *  @lib drmrightsinfoimpl.lib
    40   *  @since S60 v5.0
    40   *  @since S60 v5.0
    41   */
    41   */
    42 NONSHARABLE_CLASS( CDrmRightsInfoImpl ) : public CActive
    42 NONSHARABLE_CLASS( CDrmRightsInfoImpl ) : public CActive
    43     {
    43     {
    44 
    44 
    45 public:
    45 public:
    46 	
    46 
    47     IMPORT_C static CDrmRightsInfoImpl* NewL();
    47     IMPORT_C static CDrmRightsInfoImpl* NewL();
    48 
    48 
    49     IMPORT_C static CDrmRightsInfoImpl* NewLC();
    49     IMPORT_C static CDrmRightsInfoImpl* NewLC();
    50 
    50 
    51     virtual ~CDrmRightsInfoImpl();
    51     virtual ~CDrmRightsInfoImpl();
    54     /**
    54     /**
    55      * Checks the rights and their status for a specific unique id
    55      * Checks the rights and their status for a specific unique id
    56      *
    56      *
    57      * @param[in]   aUniqueId : The unique identifier or the content
    57      * @param[in]   aUniqueId : The unique identifier or the content
    58      * @param[in]   aIntent : The intent for the rights to check
    58      * @param[in]   aIntent : The intent for the rights to check
    59      * @param[out]  aDetails : Details of the rights status 
    59      * @param[out]  aDetails : Details of the rights status
    60      * @return none
    60      * @return none
    61      * @leave System wide error code
    61      * @leave System wide error code
    62      */	
    62      */
    63     IMPORT_C void CheckRightsL( 
    63     IMPORT_C void CheckRightsL(
    64         const TDesC& aUniqueId, 
    64         const TDesC& aUniqueId,
    65         ContentAccess::TIntent aIntent,
    65         ContentAccess::TIntent aIntent,
    66         TDrmRightsInfo& aDetails );
    66         TDrmRightsInfo& aDetails );
    67 
    67 
    68     /**
    68     /**
    69      * Checks the rights and their status for a specific unique id
    69      * Checks the rights and their status for a specific unique id
    70      *
    70      *
    71      * @param[in]   aUniqueId   The unique identifier or the content
    71      * @param[in]   aUniqueId   The unique identifier or the content
    72      * @param[in]   aIntent     The intent for the rights to check
    72      * @param[in]   aIntent     The intent for the rights to check
    73      * @param[out]  aDetails    Details of the rights status 
    73      * @param[out]  aDetails    Details of the rights status
    74      * @param[in]   aObserver   Observer which gets reported of
    74      * @param[in]   aObserver   Observer which gets reported of
    75      *                          the async operation
    75      *                          the async operation
    76      *
    76      *
    77      * @return Operation identifier
    77      * @return Operation identifier
    78      *
    78      *
    79      * @leave System wide error code
    79      * @leave System wide error code
    80      */	
    80      */
    81     IMPORT_C TInt CheckRightsAsyncL( 
    81     IMPORT_C TInt CheckRightsAsyncL(
    82         const TDesC& aUniqueId, 
    82         const TDesC& aUniqueId,
    83         ContentAccess::TIntent aIntent,
    83         ContentAccess::TIntent aIntent,
    84         TDrmRightsInfo& aDetails,
    84         TDrmRightsInfo& aDetails,
    85         MDrmAsyncObserver& aObserver );
    85         MDrmAsyncObserver& aObserver );
    86 
    86 
    87 
    87 
    88     /**
    88     /**
    89      * Cancel an asyncronous operation
    89      * Cancel an asyncronous operation
    90      *
    90      *
    91      * @since S60 v5.0
    91      * @since S60 v5.0
    92      * @param[in]   aOperationId    identifier of the async operation
    92      * @param[in]   aOperationId    identifier of the async operation
    93      *                              to be cancelled      
    93      *                              to be cancelled
    94      * @return KErrNotFound if the operation has already been executed
    94      * @return KErrNotFound if the operation has already been executed
    95      *         or it does not exist
    95      *         or it does not exist
    96      */
    96      */
    97     IMPORT_C TInt CancelOperation( TInt aOperationId ); 
    97     IMPORT_C TInt CancelOperation( TInt aOperationId );
    98     
    98 
    99 
    99 
   100 public: // From base classes
   100 public: // From base classes
   101 
   101 
   102 
   102 
   103 protected: // Functions from base classes
   103 protected: // Functions from base classes
   104         
   104 
   105     /**
   105     /**
   106     * From CActive Cancels async request.
   106     * From CActive Cancels async request.
   107     */
   107     */
   108     void DoCancel();
   108     void DoCancel();
   109 
   109 
   113     void RunL();
   113     void RunL();
   114 
   114 
   115     /**
   115     /**
   116     * From CActive Called when RunL leaves
   116     * From CActive Called when RunL leaves
   117     */
   117     */
   118  	TInt RunError( TInt aError );
   118     TInt RunError( TInt aError );
   119 
   119 
   120 private:
   120 private:
   121 
   121 
   122     CDrmRightsInfoImpl();
   122     CDrmRightsInfoImpl();
   123 
   123 
   124     void ConstructL();
   124     void ConstructL();
   125 
   125 
   126     void PerformCheckRightsL( CDrmRightsInfoData& aData );
   126     void PerformCheckRightsL( CDrmRightsInfoData& aData );
   127 
   127 
   128     void AppendToQueue( CDrmRightsInfoData* aData );
   128     void AppendToQueue( CDrmRightsInfoData* aData );
   129     
   129 
   130     CDrmRightsInfoData* PopFront();
   130     CDrmRightsInfoData* PopFront();
   131 
   131 
   132 
   132 
   133 private: // Data members
   133 private: // Data members
   134 
   134 
   135     // DrmUtilityCommon
   135     // DrmUtilityCommon
   136     CDrmUtilityCommon* iDrmUtilityCommon;
   136     CDrmUtilityCommon* iDrmUtilityCommon;
   137     
   137 
   138     // Oma Drm client
   138     // Oma Drm client
   139     RDRMRightsClient iOmaClient;
   139     RDRMRightsClient iOmaClient;
   140     
   140 
   141     // WM Drm Client
   141     // WM Drm Client
   142     // RWMDrmClient iWmClient;
   142     // RWMDrmClient iWmClient;
   143     
   143 
   144     // current request status:
   144     // current request status:
   145     MDrmAsyncObserver* iObserver;
   145     MDrmAsyncObserver* iObserver;
   146     TInt iOperationId;
   146     TInt iOperationId;
   147     
   147 
   148     // Operation Queue:
   148     // Operation Queue:
   149     CDrmRightsInfoData* iFirst;
   149     CDrmRightsInfoData* iFirst;
   150     CDrmRightsInfoData* iLast;
   150     CDrmRightsInfoData* iLast;
   151     
   151 
   152     // To prevent queue handling from being messed up by threads
   152     // To prevent queue handling from being messed up by threads
   153     RSemaphore iSemaphore;
   153     RSemaphore iSemaphore;
   154     };
   154     };
   155     
   155 
   156 }
   156 }
   157 
   157 
   158 #endif // CDRMRIGHTSINFOIMPL_H
   158 #endif // CDRMRIGHTSINFOIMPL_H