drm_plat/drm_utility_api/inc/drmhandleerrorobserver.h
changeset 0 95b198f216e5
equal deleted inserted replaced
-1:000000000000 0:95b198f216e5
       
     1 /*
       
     2 * Copyright (c) 2006-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:  Observer interface for HandleError
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MDRMHANDLEERROROBSERVER_H
       
    20 #define MDRMHANDLEERROROBSERVER_H
       
    21 
       
    22 #include <drmasyncobserver.h>
       
    23 #include <drmutilitytypes.h>
       
    24 
       
    25 namespace DRM
       
    26     {
       
    27 
       
    28     /**
       
    29      *  An interface containing callbacks for CDrmUiHandling::HandleError().
       
    30      *
       
    31      *  By implementing these methods observer can get more information about
       
    32      *  what kind of rights are available and can also override the default
       
    33      *  behaviour.
       
    34      *
       
    35      *  @code
       
    36      *      #include <DrmUiHandling.h>
       
    37      *      #include <DrmHandleErrorObserver.h>
       
    38      *
       
    39      *      using namespace DRM;
       
    40      *
       
    41      *      // Call NewLC() to create an instance of CDrmUiHandling.
       
    42      *      CDrmUiHandling* drmUiHandler = CDrmUiHandling::NewLC();
       
    43      *
       
    44      *      // Handling the error got when tried to read the file
       
    45      *      drmHandlerError = drmUiHandler->HandleErrorL( file, error, this );
       
    46      *
       
    47      *      // delete the created instance of CDrmUiHandling
       
    48      *      CleanupStack::PopAndDestroy( drmUiHandler );
       
    49      *
       
    50      *      ...
       
    51      *
       
    52      *      // implement callbacks
       
    53      *      TEmbeddedPreviewAction CMyClass::EmbeddedPreviewAvailable( const TDesC& aUniqueId )
       
    54      *          {
       
    55      *          return EEmbeddedPreviewActionDefault;
       
    56      *          }
       
    57      *
       
    58      *      TPreviewRightsAction CMyClass::PreviewRightsUrlAvailable( const TDesC& aPreviewRightsUrl )
       
    59      *          {
       
    60      *          return EPreviewRightsActionDefault;
       
    61      *          }
       
    62      *
       
    63      *      TSilentRightsAction CMyClass::SilentRightsUrlAvailable( const TDesC& aSilentRightsUrl )
       
    64      *          {
       
    65      *          return ESilentRightsActionDefault;
       
    66      *          }
       
    67      *
       
    68      *      void CMyClass::PreviewRightsAvailable()
       
    69      *          {
       
    70      *          // play the content, since preview rights were retrieved
       
    71      *          }
       
    72      *
       
    73      *      void CMyClass::SilentRightsAvailable()
       
    74      *          {
       
    75      *          // play the content, since silent rights were retrieved
       
    76      *          }
       
    77      *
       
    78      *      void CMyClass::PlayEmbeddedPreviewSelected( const TDesC& aUniqueId )
       
    79      *          {
       
    80      *          // play embedded preview part
       
    81      *          ...
       
    82      *          }
       
    83      *  @endcode
       
    84      *
       
    85      *  @since S60 v5.0
       
    86      *  @see CDrmUiHandling::HandleError
       
    87      */
       
    88 class MDrmHandleErrorObserver : public MDrmAsyncObserver
       
    89     {
       
    90 
       
    91 public:
       
    92 
       
    93     /**
       
    94      * Called when content has embedded preview part. If
       
    95      * EEmbeddedPreviewActionDefault is returned,
       
    96      * PlayEmbeddedPreviewSelected is called if user selects to play
       
    97      * embedded preview.
       
    98      *
       
    99      * @since S60 v5.0
       
   100      * @param[in] aOperationId  Identifier of the asynchronous operation
       
   101      *                          which was returned when the asynchronous
       
   102      *                          operation was initiated, Zero(0) if it
       
   103      *                          is a call back from a synchronous
       
   104      *                          operation
       
   105      * @param[in]   aUniqueId   Unique ID of embedded preview part.
       
   106      * @param[in]   aRightsStatus Status of the rights as defined per
       
   107      *                            TDrmRightsInfo
       
   108      * @param[in]   aReason     Rejection reason, a bitvector which
       
   109      *                          states for what reasons rights have
       
   110      *                          been rejected from use using
       
   111      *                          TRejectionType
       
   112      *
       
   113      * @return  EEmbeddedPreviewActionDefault DRM Utility asks if user
       
   114      *          wants to play preview or acquire new rights
       
   115      *          EUEmbeddedPreviewActionDefaultAudio DRM Utility asks if user
       
   116      *          wants to play preview or acquire new rights for audio
       
   117      *          EUEmbeddedPreviewActionDefaultVideo DRM Utility asks if user
       
   118      *          wants to play preview or acquire new rights for video
       
   119      *          EEmbeddedPreviewActionFetchRights  DRM Utility acquires
       
   120      *          new rights, no queries shown by DRM Utility
       
   121      *          EEmbeddedPreviewActionPlayPreview  Observer takes care
       
   122      *          of playing embedded preview
       
   123      */
       
   124     virtual TEmbeddedPreviewAction EmbeddedPreviewAvailable(
       
   125             TInt aOperationId,
       
   126             const TDesC& aUniqueId,
       
   127             TInt aRightsStatus,
       
   128             TInt aReason ) = 0;
       
   129 
       
   130     /**
       
   131      * Called if preview rights can be acquired for content.
       
   132      *
       
   133      * @since S60 v5.0
       
   134      * @param[in] aOperationId  Identifier of the asynchronous operation
       
   135      *                          which was returned when the asynchronous
       
   136      *                          operation was initiated, Zero(0) if it
       
   137      *                          is a call back from a synchronous
       
   138      *                          operation
       
   139      * @param[in]   aPreviewRightsUrl   URL from where preview rights can
       
   140      *                                  be fetched.
       
   141      * @param[in]   aRightsStatus Status of the rights as defined per
       
   142      *                            TDrmRightsInfo
       
   143      * @param[in]   aReason     Rejection reason, a bitvector which
       
   144      *                          states for what reasons rights have
       
   145      *                          been rejected from use using
       
   146      *                          TRejectionType
       
   147      *
       
   148      * @return  EPreviewRightsActionDefault DRM Utility asks if user
       
   149      *          wants to acquire preview rights or normal rights
       
   150      *          EUPreviewRightsActionDefaultAudio DRM Utility asks if user
       
   151      *          wants to acquire preview rights or normal rights for audio and 
       
   152      *          acquires them
       
   153      *          EUPreviewRightsActionDefaultVideo DRM Utility asks if user 
       
   154      *          wants to acquire preview rights or normal rights for video and
       
   155      *          acquires them
       
   156      *          EPreviewRightsActionFetchRights DRM Utility acquires normal
       
   157      *          rights, no queries shown by DRM utility
       
   158      *          EPreviewRightsActionFetchPreviewRights Observer takes care
       
   159      *          of acquiring preview rights
       
   160      */
       
   161     virtual TPreviewRightsAction PreviewRightsUrlAvailable(
       
   162             TInt aOperationId,
       
   163             const TDesC& aPreviewRightsUrl,
       
   164             TInt aRightsStatus,
       
   165             TInt aReason ) = 0;
       
   166 
       
   167     /**
       
   168      * Called if silent rights can be acquired for content.
       
   169      *
       
   170      * @since S60 v5.0
       
   171      * @param[in] aOperationId  Identifier of the asynchronous operation
       
   172      *                          which was returned when the asynchronous
       
   173      *                          operation was initiated, Zero(0) if it
       
   174      *                          is a call back from a synchronous
       
   175      *                          operation
       
   176      * @param[in]   aSilentRightsUrl    URL from where silent rights can
       
   177      *                                  be fetched.
       
   178      * @param[in]   aRightsStatus Status of the rights as defined per
       
   179      *                            TDrmRightsInfo
       
   180      * @param[in]   aReason     Rejection reason, a bitvector which
       
   181      *                          states for what reasons rights have
       
   182      *                          been rejected from use using
       
   183      *                          TRejectionType
       
   184      *
       
   185      * @return  ESilentRightsActionDefault DRM Utility performs the
       
   186      *          default silent rights handling
       
   187      *          ESilentRightsActionFetchRights DRM Utility acquires normal
       
   188      *          rights
       
   189      *          ESilentRightsActionFetchSilentRights   Observer takes care
       
   190      *          of acquiring silent rights
       
   191      */
       
   192     virtual TSilentRightsAction SilentRightsUrlAvailable(
       
   193             TInt aOperationId,
       
   194             const TDesC& aSilentRightsUrl,
       
   195             TInt aRightsStatus,
       
   196             TInt aReason ) = 0;
       
   197 
       
   198     /**
       
   199      * Called if only rights-issuer URL or domain rights-issuer URL is
       
   200      * available.
       
   201      *
       
   202      * @since S60 v5.0
       
   203      * @param[in] aOperationId  Identifier of the asynchronous operation
       
   204      *                          which was returned when the asynchronous
       
   205      *                          operation was initiated, Zero(0) if it
       
   206      *                          is a call back from a synchronous
       
   207      *                          operation
       
   208      * @param[in]   aRightsUrl          URL from where rights can
       
   209      *                                  be fetched.
       
   210      * @param[in]   aRightsStatus Status of the rights as defined per
       
   211      *                            TDrmRightsInfo
       
   212      * @param[in]   aReason     Rejection reason, a bitvector which
       
   213      *                          states for what reasons rights have
       
   214      *                          been rejected from use using
       
   215      *                          TRejectionType
       
   216      * @param[in]   aUrlType    The type of url available in TDrmUiUrlType
       
   217      *
       
   218      * @return  ERightsActionDefault DRM Utility performs the
       
   219      *          default rights handling
       
   220      *          ERightsActionFetchRights DRM Utility acquires normal
       
   221      *          rights
       
   222      */
       
   223     virtual TRightsAction RightsUrlAvailable(
       
   224             TInt aOperationId,
       
   225             const TDesC& aRightsUrl,
       
   226             TInt aRightsStatus,
       
   227             TInt aReason,
       
   228             TInt aUrlType ) = 0;
       
   229 
       
   230     /**
       
   231      * Called when preview rights have been acquired for content.
       
   232      *
       
   233      * @since S60 v5.0
       
   234      * @param[in] aOperationId  Identifier of the asynchronous operation
       
   235      *                          which was returned when the asynchronous
       
   236      *                          operation was initiated, Zero(0) if it
       
   237      *                          is a call back from a synchronous
       
   238      *                          operation
       
   239      * @param[in] aError        Return status of the requested URI type
       
   240      *                          KErrNone if successful and rights are
       
   241      *                          available
       
   242      *                          KErrCANoRights if the rights are not
       
   243      *                          available
       
   244      *                          KErrNotFound if the requested URI type was
       
   245      *                          not available
       
   246      */
       
   247     virtual void PreviewRightsAvailable(
       
   248             TInt aOperationId,
       
   249             TInt aError ) = 0;
       
   250 
       
   251     /**
       
   252      * Called when silent rights have been acquired for content.
       
   253      *
       
   254      * @since S60 v5.0
       
   255      * @param[in] aOperationId  Identifier of the asynchronous operation
       
   256      *                          which was returned when the asynchronous
       
   257      *                          operation was initiated, Zero(0) if it
       
   258      *                          is a call back from a synchronous
       
   259      *                          operation
       
   260      * @param[in] aError        Return status of the requested URI type
       
   261      *                          KErrNone if successful and rights are
       
   262      *                          available
       
   263      *                          KErrCANoRights if the rights are not
       
   264      *                          available
       
   265      *                          KErrNotFound if the requested URI type was
       
   266      *                          not available
       
   267      */
       
   268     virtual void SilentRightsAvailable(
       
   269             TInt aOperationId,
       
   270             TInt aError ) = 0;
       
   271 
       
   272     /**
       
   273      * Called when rights have been acquired for content.
       
   274      *
       
   275      * @param[in] aOperationId  Identifier of the asynchronous operation
       
   276      *                          which was returned when the asynchronous
       
   277      *                          operation was initiated, Zero(0) if it
       
   278      *                          is a call back from a synchronous
       
   279      *                          operation
       
   280      * @param[in] aError        Return status of the requested URI type
       
   281      *                          KErrNone if successful and rights are
       
   282      *                          available
       
   283      *                          KErrCANoRights if the rights are not
       
   284      *                          available
       
   285      *                          KErrNotFound if the requested URI type was
       
   286      *                          not available
       
   287      * @since S60 v5.0
       
   288      */
       
   289     virtual void RightsAvailable(
       
   290             TInt aOperationId,
       
   291             TInt aError ) = 0;
       
   292 
       
   293     /**
       
   294      * Called if user selected to play embedded preview part.
       
   295      *
       
   296      * @since S60 v5.0
       
   297      * @param[in] aOperationId  Identifier of the asynchronous operation
       
   298      *                          which was returned when the asynchronous
       
   299      *                          operation was initiated, Zero(0) if it
       
   300      *                          is a call back from a synchronous
       
   301      *                          operation
       
   302      * @param[in]   aUniqueId   Unique ID of embedded preview part.
       
   303      */
       
   304     virtual void PlayEmbeddedPreviewSelected(
       
   305             TInt aOperationId,
       
   306             const TDesC& aUniqueId ) = 0;
       
   307 
       
   308 protected:
       
   309 
       
   310     };
       
   311     }
       
   312 
       
   313 #endif // MDRMHANDLEERROROBSERVER_H