--- a/idlefw/inc/framework/aistatemanager.h Mon Mar 08 21:43:47 2010 +0000
+++ b/idlefw/inc/framework/aistatemanager.h Sun Mar 14 13:11:02 2010 +0000
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 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"
@@ -11,41 +11,204 @@
*
* Contributors:
*
-* Description: State manager base class
+* Description: State Manager
*
*/
-#ifndef M_AISTATEMANAGER_H
-#define M_AISTATEMANAGER_H
+#ifndef _AISTATEMANAGER_H
+#define _AISTATEMANAGER_H
+
+// System includes
+#include <e32base.h>
+#include <babitflags.h>
-#include "aipluginstatemachine.h"
+// User includes
+#include <aifwdefs.h>
+#include "aistateobserver.h"
+
+// Forward declarations
+class CAiPluginFactory;
+class CHsContentPublisher;
+class THsPublisherInfo;
/**
- * description
+ * State Manager
*
- * @lib aifw
- * @since S60 3.2
+ * @ingroup group_aifw
+ * @lib aifw.lib
+ * @since S60 5.0
*/
-class MAiStateManager
+NONSHARABLE_CLASS( CAiStateManager ) : public CBase,
+ public MAiStateObserver
{
+private:
+ // Data types
+ enum TState
+ {
+ ESuspended = 0,
+ EAlive,
+ };
- public:
+ enum TFlags
+ {
+ EIsForeground = 0,
+ EIsLightsOn,
+ EIsOnline,
+ EShutdown
+ };
+
+public:
+ // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CAiStateManager* NewL( CAiPluginFactory& aFactory );
+
+ /**
+ * Two-phased constructor. Leaving on stack
+ */
+ static CAiStateManager* NewLC( CAiPluginFactory& aFactory );
+
+ /**
+ * Destructor
+ */
+ ~CAiStateManager();
+
+private:
+ // private constructors
+
+ /**
+ * Leaving constructor
+ */
+ void ConstructL();
+
+ /**
+ * C++ default constructor
+ */
+ CAiStateManager( CAiPluginFactory& aFactory );
+
+private:
+ // from MAiStateObserver
+
+ /**
+ * @see MAiStateObserver
+ */
+ void NotifyStateChange(
+ TAiFwState aReason );
+
+ /**
+ * @see MAiStateObserver
+ */
+ TInt NotifyLoadPlugin( const THsPublisherInfo& aInfo,
+ TAiFwLoadReason aReason );
+
+ /**
+ * @see MAiStateObserver
+ */
+ void NotifyDestroyPlugin( const THsPublisherInfo& aInfo,
+ TAiFwDestroyReason aReason );
+
+ /**
+ * @see MAiStateObserver
+ */
+ void NotifyUpdatePlugins();
- /**
- * System status observers use this method to report status variable
- * changes to state manager.
- *
- * @param TAiStateChanges aState the state that has changed.
- */
- virtual void ReportStateChange( TAiStateChanges aState ) = 0;
+ /**
+ * @see MAiStateObserver
+ */
+ TBool OnlineStateInUse() const;
+
+private:
+ // new functions
+
+ /**
+ * Evaluates next state
+ *
+ * @since S60 5.2
+ * @return Next state
+ */
+ TState EvaluateNextState() const;
+
+ /**
+ * Process state change for all plugins
+ *
+ * @since S60 5.2
+ * @param aNextState Next state where plugins are driven
+ */
+ void ProcessStateChange( TState aNextState );
+
+ /**
+ * Process general theme state change for all plugins
+ *
+ * @since S60 5.2
+ */
+ void ProcessGeneralThemeChange();
+
+ /**
+ * Process backup/restore state change for all plugins
+ *
+ * @since S60 5.2
+ * @param aStarted ETrue when backup started
+ */
+ void ProcessBackupRestore( TBool aStarted );
+
+ /**
+ * Process online / offline state change for all plugins
+ *
+ * @since S60 5.2
+ */
+ void ProcessOnlineStateChange();
- protected:
+ /**
+ * Runs plugin startup sequence
+ *
+ * @since S60 5.2
+ * @param aPlugin Plugin to start
+ * @param aReason Start reason
+ */
+ void StartPlugin( CHsContentPublisher& aPlugin,
+ CHsContentPublisher::TStartReason aReason );
+
+ /**
+ * Runs plugin shutdown sequence
+ *
+ * @since S60 5.2
+ * @param aPlugin Plugin to stop
+ * @param aReason Stop reason
+ */
+ void StopPlugin( CHsContentPublisher& aPlugin,
+ CHsContentPublisher::TStopReason aReason );
+
+ /**
+ * Destroys all plugins from plugin factory
+ *
+ * @since S60 5.2
+ */
+ void DestroyPlugins();
+
+private:
+ // data
- ~MAiStateManager(){}
+ /** Plugin Factory, Not owned */
+ CAiPluginFactory& iFactory;
+ /** Current state */
+ TState iCurrentState;
+ /** Flags */
+ TBitFlags32 iFlags;
+ /** Halted flag */
+ TBool iHalt;
+private:
+ // friend classes
+
+#ifdef _AIFW_UNIT_TEST
+ friend class UT_AiStateManager;
+#endif
};
-
-#endif // M_AISTATEMANAGER_H
+
+#endif // _AISTATEMANAGER_H
-// End of File.
+// End of file
+