layouts/cdl/CdlEngine/inc/CdlChangeObserver.h
changeset 0 05e9090e2422
equal deleted inserted replaced
-1:000000000000 0:05e9090e2422
       
     1 /*
       
     2 * Copyright (c) 2009 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:
       
    15 *
       
    16 */
       
    17 #ifndef CDLCHANGEOBSERVER_H
       
    18 #define CDLCHANGEOBSERVER_H
       
    19 
       
    20 #include <e32base.h>
       
    21 #include "CdlEngine.h"
       
    22 #include "CdlClientServerStd.h"
       
    23 
       
    24 class RCdlSession;
       
    25 class CCdlEngine;
       
    26 
       
    27 /**
       
    28 * Active object that watches out for changes from the CDL server.
       
    29 */
       
    30 NONSHARABLE_CLASS(CCdlChangeMonitor) : public CActive
       
    31 	{
       
    32 public:
       
    33 	CCdlChangeMonitor(RCdlSession& aServer, CCdlEngine* aEngine);
       
    34 	~CCdlChangeMonitor();
       
    35 
       
    36 private:
       
    37 	void Queue();
       
    38 	void RunL();
       
    39 	void DoCancel();
       
    40 	void ProcessL();
       
    41 
       
    42 private:
       
    43 	RCdlSession& iServer;
       
    44 	CCdlEngine* iEngine;					// not owned
       
    45 	TPckgBuf<SCdlServerChange> iChange;
       
    46 	};
       
    47 
       
    48 /**
       
    49 * CCdlChangeObserver records all the UIDs that a particular observer is interested in
       
    50 */
       
    51 NONSHARABLE_CLASS(CCdlChangeObserver) : public CBase
       
    52 	{
       
    53 public:
       
    54 	static CCdlChangeObserver* NewLC(MCdlChangeObserver* aObserver, TUid aUid);
       
    55 	static CCdlChangeObserver* NewLC(MCdlChangeObserver* aObserver);
       
    56 	~CCdlChangeObserver();
       
    57 
       
    58 	MCdlChangeObserver* Observer() const;
       
    59 	void AddUidL(TUid aUid);
       
    60 
       
    61 	void HandleCustomisationChangeL(const CCdlUids& aUids);
       
    62 	void HandleAvailableRefsChangeL();
       
    63 
       
    64 private:
       
    65 	MCdlChangeObserver* iObserver;			// not owned
       
    66 	CCdlUids iUids;
       
    67 	};
       
    68 
       
    69 
       
    70 /**
       
    71 * Collection of CCdlChangeObserver objects.
       
    72 */
       
    73 NONSHARABLE_CLASS(CCdlChangeObservers) : public CBase
       
    74 	{
       
    75 public:
       
    76 	CCdlChangeObservers();
       
    77 	~CCdlChangeObservers();
       
    78 
       
    79 	void AddCustomisationChangeObserverL(MCdlChangeObserver* aObserver, TUid aUid);
       
    80 	void AddGeneralChangeObserverL(MCdlChangeObserver* aObserver);
       
    81 	void RemoveChangeObserver(MCdlChangeObserver* aObserver);
       
    82 
       
    83 	void HandleCustomisationChangeL(const CCdlUids& aUids);
       
    84 	void HandleAvailableRefsChangeL();
       
    85 
       
    86 private:
       
    87 	TInt FindIndex(MCdlChangeObserver* aObserver) const;
       
    88 
       
    89 private:
       
    90 	typedef CArrayPtrFlat<CCdlChangeObserver> CCdlChangeObserverArray;
       
    91 	CCdlChangeObserverArray iObservers;		// contained CCdlChangeObservers are owned
       
    92 	};
       
    93 
       
    94 
       
    95 #endif