menucontentsrv/srvinc/mcsdrmscanner.h
changeset 0 79c6a41cd166
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     1 /*
       
     2 * Copyright (c) 2008 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:  The API supports attributes not present in MCS from SAT Api
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __MCSDRMSCANNER_H__
       
    20 #define __MCSDRMSCANNER_H__
       
    21 
       
    22 #include <e32base.h>
       
    23 #include "menuengoperation.h"
       
    24 #include "mcsmenuitem.h"
       
    25 
       
    26 class CMenuSrvEngUtils;
       
    27 class CMenuSrvEng;
       
    28 class TAppItem;
       
    29 /**
       
    30  * Interface for updating Now Playing entry after Publish&Subscribe events.
       
    31  *
       
    32  * @since S60 v3.2
       
    33  */
       
    34 class MMcsDrmAppScanner
       
    35     {
       
    36     
       
    37 public:
       
    38         
       
    39     virtual void HandleDrmAppEvent() = 0;  
       
    40     };
       
    41 
       
    42 
       
    43 /**
       
    44  *  DRM Scanner Active Object.
       
    45  *  @lib mcsmenu.lib
       
    46  *  @since S60 v5.0
       
    47  */
       
    48 NONSHARABLE_CLASS( CMcsDrmScanner ) : 
       
    49     public CActive,
       
    50     public MMenuEngOperation
       
    51     {
       
    52     
       
    53 public:
       
    54 
       
    55     /**
       
    56      * Creates an instance of CMcsDrmScanner implementation.
       
    57      *
       
    58      * @since S60 v5.0
       
    59      */
       
    60     static CMcsDrmScanner* NewL( 
       
    61         MMcsDrmAppScanner& aObserver, 
       
    62         CMenuSrvEng& aSrvEng,
       
    63         CMenuSrvEngUtils& aUtils );
       
    64 
       
    65     /**
       
    66      * Destructor.
       
    67      */
       
    68     virtual ~CMcsDrmScanner();
       
    69 
       
    70     const RArray<TUid>& DrmExpiredAppArray();
       
    71     const RArray<TUid>& DrmProtectedAppArray();
       
    72     
       
    73     void Scan();
       
    74     
       
    75     void RemoveObserverAndScanL( TUid aUid );
       
    76     
       
    77 private:
       
    78    
       
    79    /**
       
    80     * Execute engine operation:
       
    81     */
       
    82     void RunMenuEngOperationL();
       
    83 
       
    84     /**
       
    85     * Error handling: ignore error.
       
    86     * @param aErr Error code.
       
    87     */
       
    88     void CompletedMenuEngOperation( TInt aErr );
       
    89     
       
    90     /**
       
    91      */
       
    92     void ScanDrmApplicationsL();
       
    93     
       
    94     /**
       
    95      */
       
    96     void GetMcsAppItemsL( RArray<TMenuItem>& aArray );
       
    97 
       
    98 private:
       
    99     /**
       
   100      * Constructor.
       
   101      *
       
   102      * @since S60 v5.0
       
   103      */
       
   104     CMcsDrmScanner( 
       
   105         MMcsDrmAppScanner& aObserver, 
       
   106         CMenuSrvEng& aSrvEng,
       
   107         CMenuSrvEngUtils& aUtils );
       
   108 
       
   109     /**
       
   110      * Symbian 2nd phase constructor.
       
   111      */
       
   112     void ConstructL();
       
   113 
       
   114 private: // From CActive.
       
   115     
       
   116     /**
       
   117      * From CActive.
       
   118      */
       
   119     void DoCancel();
       
   120         
       
   121     /**
       
   122      * From CActive.
       
   123      */
       
   124     void RunL();      
       
   125     
       
   126     /**
       
   127     * Error handling: ignore error.
       
   128     * @param aErr Error code.
       
   129     */
       
   130     TInt RunError( TInt aError );
       
   131     
       
   132 private: 
       
   133 
       
   134     void GetAppItemsL( 
       
   135         RArray<TMenuItem>& aItemArray, 
       
   136         RArray<TAppItem>& aAppItemArray );
       
   137         
       
   138     void GetUidsL( 
       
   139         RArray<TAppItem>& aAppItemArray, 
       
   140         RArray<TUid>& aUidArray );
       
   141         
       
   142     TBool RemoveNotExistingApps( 
       
   143         RArray<TUid>& aArrayToModify, 
       
   144         const RArray<TUid>& aUidArray );
       
   145 
       
   146     TBool RemoveChangedApps( );
       
   147     
       
   148     TBool RemoveMissingApps( const RArray<TUid>& aUidArray );
       
   149     
       
   150     TBool CheckDrmAppsL( const RArray<TAppItem>& aUidArray );
       
   151         
       
   152 private:    
       
   153 
       
   154   
       
   155         
       
   156 private:
       
   157 
       
   158 	
       
   159     /**
       
   160      * Interface for notifying changes.
       
   161      * Not own.
       
   162      */
       
   163     MMcsDrmAppScanner& iObserver;     
       
   164     
       
   165     
       
   166     CMenuSrvEng& iSrvEng;
       
   167     
       
   168     CMenuSrvEngUtils& iUtils;
       
   169     
       
   170     RArray<TUid> iNotProtectedAppArray;
       
   171     RArray<TUid> iDrmExpiredAppArray;
       
   172     RArray<TUid> iDrmProtectedAppArray;
       
   173 
       
   174     RArray<TUid> iChangedAppArray;
       
   175 
       
   176     
       
   177     TBool iOpStatus;
       
   178 
       
   179     };
       
   180 
       
   181 NONSHARABLE_CLASS( TAppItem )
       
   182     {
       
   183     public:
       
   184     TAppItem( TInt aId, TUid aUid ): iId(aId), iUid(aUid) {};
       
   185     
       
   186     TInt Id() const
       
   187     {
       
   188         return iId;
       
   189     };
       
   190     
       
   191     TUid Uid() const
       
   192     {
       
   193         return iUid;
       
   194     };
       
   195     
       
   196     private:
       
   197     TInt iId;
       
   198     TUid iUid;
       
   199     
       
   200     };
       
   201 
       
   202 
       
   203 #endif // __MCSDRMSCANNER_H__
       
   204 
       
   205 // End of File