dependencies/DRMNotifier.h
branchv5backport
changeset 31 a3e98f9c292b
equal deleted inserted replaced
30:f9f9f96b1873 31:a3e98f9c292b
       
     1 /*
       
     2 * Copyright (c) 2004-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:  This class handles registering and unregistering of
       
    15 *                DRM event observers to DRM notifier, and sending
       
    16 *                DRM notifications to other registered observers.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #ifndef CDRMNOTIFIER_H
       
    23 #define CDRMNOTIFIER_H
       
    24 
       
    25 //  INCLUDES
       
    26 #include <e32base.h>
       
    27 #include <DRMEventObserver.h>
       
    28 #include <DRMEvent.h>
       
    29 
       
    30 // CONSTANTS
       
    31 // MACROS
       
    32 // DATA TYPES
       
    33 // FUNCTION PROTOTYPES
       
    34 // FORWARD DECLARATIONS
       
    35 class CDRMEventHandler;
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 /**
       
    40  *  With this class an application can register to receive DRM related 
       
    41  *  notifications.
       
    42  *
       
    43  *  @lib DRMCommon.dll
       
    44  *  @since S60Rel2.6
       
    45  */
       
    46 class CDRMNotifier : public CBase
       
    47 {
       
    48 public:  // Constructors and destructor   
       
    49     /**
       
    50     * Two-phased constructor.
       
    51     */
       
    52     IMPORT_C static CDRMNotifier* NewL( void );
       
    53    
       
    54     /**
       
    55     * Two-phased constructor.
       
    56     */
       
    57     IMPORT_C static CDRMNotifier* NewLC( void );
       
    58    
       
    59     /**
       
    60     * Destructor.
       
    61     */
       
    62     IMPORT_C virtual ~CDRMNotifier();
       
    63    
       
    64 public: // New functions   
       
    65     /**
       
    66     * RegisterEventObserverL
       
    67     *
       
    68     * Registers a new event observer to DRM Notifier. Listens to all events
       
    69     * of the given type
       
    70     *
       
    71     * @since S60Rel2.6
       
    72     * @param aObserver Observer.
       
    73     * @param aEvent the type of event to listen to
       
    74     * @return none, leaves with Symbian OS error code if an error occurs
       
    75     */
       
    76     IMPORT_C void RegisterEventObserverL( MDRMEventObserver& aObserver , 
       
    77                                           const TDRMEventType& aEvent);   
       
    78     /**
       
    79     * UnRegisterEventObserverL
       
    80     *
       
    81     * Unregisters existing event observer from DRM Notifier.
       
    82     *
       
    83     * @since S60Rel2.6
       
    84     * @param aObserver Observer.
       
    85     * @param aEvent the type of event to unregister
       
    86     * @return none, leaves with Symbian OS error code if an error occurs
       
    87     */
       
    88     IMPORT_C void UnRegisterEventObserverL( MDRMEventObserver& aObserver, 
       
    89                                             const TDRMEventType& aEvent);
       
    90     /**
       
    91     * RegisterEventObserverL
       
    92     *
       
    93     * Registers a new event observer to DRM Notifier. Only recieves
       
    94     * notification when the rights accociated with the given content id
       
    95     * are handled
       
    96     *
       
    97     * @since S60Rel2.6
       
    98     * @param aObserver Observer
       
    99     * @param aEvent the type of event to listen to
       
   100     * @param aContentID the specific content id to listen to
       
   101     * @return none, leaves with Symbian OS error code if an error occurs
       
   102     */
       
   103     IMPORT_C void RegisterEventObserverL( MDRMEventObserver& aObserver , 
       
   104                                           const TDRMEventType& aEvent,
       
   105                                           const TDesC8& aContentID);
       
   106     /**
       
   107     * UnRegisterEventObserverL
       
   108     *
       
   109     * Unregisters existing event observer from DRM Notifier.
       
   110     *
       
   111     * @since S60Rel2.6
       
   112     * @param aObserver Observer.
       
   113     * @param aEvent the type of event to listen to
       
   114     * @param aContentID the specific content id to listen to
       
   115     * @return none, leaves with Symbian OS error code if an error occurs
       
   116     */
       
   117     IMPORT_C void UnRegisterEventObserverL( MDRMEventObserver& aObserver, 
       
   118                                             const TDRMEventType& aEvent,
       
   119                                             const TDesC8& aContentID);
       
   120 
       
   121     /**
       
   122     * SendEventL
       
   123     *
       
   124     * Sends a notification to registered observers
       
   125     *
       
   126     * @since S60Rel2.6
       
   127     * @param aEvent  the event to be sent
       
   128     * @param aStatus  the request status for the event, will be updated when
       
   129     *                 the event has been sent
       
   130     * @return none
       
   131     */
       
   132     IMPORT_C void SendEventL( MDRMEvent& aEvent, TRequestStatus& aStatus ); 
       
   133    
       
   134 private:
       
   135    
       
   136     /**
       
   137     * C++ default constructor.
       
   138     */
       
   139     CDRMNotifier( void );
       
   140 
       
   141     /**
       
   142     * First Phase constructor
       
   143     */
       
   144     void ConstructL();
       
   145    
       
   146     // Prohibit copy constructor if not deriving from CBase.
       
   147     CDRMNotifier( const CDRMNotifier& );
       
   148 
       
   149     // Prohibit assigment operator if not deriving from CBase.
       
   150     CDRMNotifier& operator=( const CDRMNotifier& );
       
   151 
       
   152   private:    // Data
       
   153    // Event handler.
       
   154    CDRMEventHandler* iEventHandler;
       
   155 };
       
   156 
       
   157 #endif      // CDRMNOTIFIER_H   
       
   158 
       
   159 // End of File
       
   160