drm_plat/drm_utility_api/inc/drmautomatedusageobserver.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:  Observer for automated usage UI notifications
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MDRMAUTOMATEDUSAGEOBSERVER_H
       
    20 #define MDRMAUTOMATEDUSAGEOBSERVER_H
       
    21 
       
    22 
       
    23 #include <caf/caftypes.h>
       
    24 
       
    25 #include <drmutilitytypes.h>
       
    26 
       
    27 namespace DRM
       
    28     {
       
    29 
       
    30 
       
    31 /**
       
    32 *  Observer for DRM automated usage
       
    33 *
       
    34 *  In order to be able to get notifications of drm automated usage events
       
    35 *  client must implement this interface
       
    36 *
       
    37 *  Usage:
       
    38 *  @code
       
    39 *        // Call NewL() to create an instance of CDrmAutomatedUsage. 
       
    40 *        iDrmAutomatedUsage = DRM::CDrmAutomatedUsage::NewL();
       
    41 *        
       
    42 *        // register to listen automated usage events
       
    43 *        iDrmAutomatedUsage->RegisterEventObserverL( this );
       
    44 *        
       
    45 *        // Implement automated usage callback
       
    46 *        DRM::TAutomatedUsageAction CMyClass::AutomatedUsageEvent( 
       
    47 *            DRM::TAutomatedUsageEvent aAutomatedUsageEvent,
       
    48 *            const TDesC& aUniqueId,
       
    49 *            ContentAccess::TIntent aIntent )
       
    50 *            {
       
    51 *            if ( aAutomatedUsageEvent == DRM::EAutomatedContentExpired )
       
    52 *                {
       
    53 *                // some automated content expired
       
    54 *                
       
    55 *                // check unique id if we are interested about this content
       
    56 *                if ( !aUniqueId.Compare( myUniqueId ) )
       
    57 *                    {
       
    58 *                    // in this example we let utility to handle situation
       
    59 *                    return DRM::EAUActionDefault;
       
    60 *                    }
       
    61 *                }
       
    62 *                return DRM::EAUActionIgnore;
       
    63 *            }
       
    64 *  @endcode
       
    65 *
       
    66 *
       
    67 *  @lib drmautomatedusage.lib
       
    68 *  @since S60 5.0
       
    69 */
       
    70 class MDrmAutomatedUsageObserver
       
    71     {
       
    72 public:
       
    73 
       
    74     /**
       
    75     * Callback for automated usage events
       
    76     *
       
    77     * @since S60 5.0
       
    78     * @param aAutomatedUsageEvent   Automated usage event type
       
    79     * @param aUniqueId              Unique ID of the content related to event
       
    80     * @param aType                  Type of the automated content related to
       
    81     *                               the event
       
    82     *
       
    83     * @return action how to proceed
       
    84     *
       
    85     * @see ContentAccess::TIntent
       
    86     * @see DRM::TAutomatedUsageAction
       
    87     * @see DRM::TAutomatedUsageEvent
       
    88     */
       
    89     virtual TAutomatedUsageAction AutomatedUsageEvent(
       
    90         TAutomatedUsageEvent aAutomatedUsageEvent,
       
    91         const TDesC& aUniqueId,
       
    92         const TDrmAutomatedType aType,
       
    93         const TDrmAutomatedServiceType aServiceType,
       
    94         ContentAccess::TIntent aIntent = ContentAccess::EUnknown ) = 0;
       
    95 
       
    96     /**
       
    97     * Callback for drm utility handled event keycodes.
       
    98     *
       
    99     * @since S60 5.0
       
   100     * @param aAutomatedUsageEvent   Automated usage event type
       
   101     * @param aUniqueId              Unique ID of the content under event
       
   102     * @apram aKeycode               button/key code returned from user
       
   103     *                               interaction
       
   104     * @return action how to proceed
       
   105     *
       
   106     * @see DRM::TAutomatedUsageEvent
       
   107     */
       
   108     virtual void AutomatedUsageKeyCode(
       
   109         TAutomatedUsageEvent aAutomatedUsageEvent,
       
   110         const TDesC& aUniqueId,
       
   111         TInt aKeyCode ) = 0;
       
   112     };
       
   113 }
       
   114 
       
   115 #endif // MDRMAUTOMATEDUSAGEOBSERVER_H