idlefw/inc/framework/aiecomobserver.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 19 Feb 2010 23:07:29 +0200
branchRCL_3
changeset 9 d0529222e3f0
permissions -rw-r--r--
Revision: 201003 Kit: 201007

/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  CAiEcomObserver class implementation.
 *
*/


#ifndef AIECOMOBSERVER_H
#define AIECOMOBSERVER_H

// System includes
#include <e32base.h>	
#include <e32std.h>		
#include <ecom/ecom.h>

// User includes


// Class declaration
/**
 * 
 * Active Idle ECom observer
 *
 * @ingroup group_aifw
 * @lib aifw.lib 
 * @since S60 5.2 
 */
class MAiEcomObserver
    {
public:
    
    /**    
    * This is called when the IdleFw detects a change in ECom
    * plugin registrations (adding, removing or upgrading ECOM-plugins).
    * 
    * @since S60 5.2   
    */
    virtual void NotifyEcomRegistryChanged() = 0;    
    };


// Class declaration
/**
 * 
 * Active Idle ECom observer
 * 
 * @ingroup group_aifw
 * @lib aifw.lib 
 * @since S60 5.2 
 */
NONSHARABLE_CLASS( CAiEcomObserver ) : public CActive
    {
public:
    // constructors and destructor
    
    // Two-phased constructor.
    static CAiEcomObserver* NewL();

    // Two-phased constructor.
    static CAiEcomObserver* NewLC();

    // Cancel and destroy
    ~CAiEcomObserver();

public: 
    // New functions

    /**
     * Adds a new observer for plugin notifications.
     * @param aObserver Observer pointer.
     */
    void AddObserverL( MAiEcomObserver* aObserver );

private:
    // new functions

    // Start observing ecom notification
    void StartObserving();

    // Notifies observers
    void NotifyObservers();

private:
    // constructors
    
    /**
     * C++ default constructor
     */
    CAiEcomObserver();
    
    /**
     * 2nd phase constructor
     */
    void ConstructL();

private: 
    // from CActive

    /**
     * @see CActive
     */
    void RunL();

    /**
     * @see CActive
     */
    void DoCancel();
    
private:
    // data

    /** ECom session handle (must be closed, not deleted), Own */
    REComSession iEComSession;

    /** Own: Array of Observers - pointer not owned */
    RPointerArray< MAiEcomObserver > iObservers;
    
private:
    // friend classes
    
#ifdef _AIFW_UNIT_TEST
    friend class UT_AiEcomObserver;
#endif
    };

#endif // AIECOMOBSERVER_H

// End of file