musichomescreen/mcpmusicplayer/inc/applicationmonitor.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 17 Dec 2009 08:45:05 +0200
changeset 0 ff3acec5bc43
child 2 b70d77332e66
permissions -rw-r--r--
Revision: 200949 Kit: 200951

/*
* Copyright (c) 2008-2008 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:  Monitors an application for exit event.
*
*/


#ifndef C_APPLICATIONMONITOR_H
#define C_APPLICATIONMONITOR_H

#include <e32base.h>

class MApplicationMonitorObserver;
class RThread;

/**
 *  Application monitor class
 *
 *  @since S60 5.0
 */
NONSHARABLE_CLASS( CApplicationMonitor ) : public CActive
    {

public:

    /**
    * Two-phased constructor
    */
    static CApplicationMonitor* NewL( MApplicationMonitorObserver& aObserver);

    /**
    * Virtual destructor
    */
    virtual ~CApplicationMonitor();

    /**
    * Start monitoring a particular Application
    * @param aApplication to monitor
    * @param aRootAppIndication ETrue for RootApp and EFalse EmbeddedApp
    */
    void StartL(  TUid aAppUid , TBool aRootAppIndication = ETrue);
   
protected:
        
    /**
    * From CActive
    */
    void RunL();
    
    /**
    * From CActive
    */
    void DoCancel();

    /**
    *  From CActive
    */
    TInt RunError(TInt aError);    
            
private:
    
    /**
    * Private constructor
    */
    CApplicationMonitor( MApplicationMonitorObserver& aObserver);

    /**
    * 2nd phased constructor
    */
    void ConstructL();

private: // data
    MApplicationMonitorObserver&  iObserver;
    RThread iThread; 
    };

#endif // C_APPLICATIONMONITOR_H