sl@0: // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef __DOMAIN_OBSERVER_H__ sl@0: #define __DOMAIN_OBSERVER_H__ sl@0: sl@0: #include sl@0: sl@0: #include sl@0: #include sl@0: sl@0: sl@0: /** sl@0: @internalTechnology sl@0: sl@0: An interface to the domain manager for an observer. sl@0: sl@0: To make use of this class, an application must derive from it and implement the pure vitual functions sl@0: to handle transition event notifications. sl@0: */ sl@0: class MHierarchyObserver sl@0: { sl@0: public: sl@0: /** sl@0: When the observer is active, then upon any successful transition, this will be called indicating sl@0: the Id of the transitioned domain and the state of the domain after the transition. Clients are sl@0: expected to use this for debugging purpose. sl@0: */ sl@0: virtual void TransProgEvent(TDmDomainId aDomainId, TDmDomainState aState) = 0; sl@0: /** sl@0: When observer is active, then upon any failing transition, this will be called indicating sl@0: the Id of the domain, the state of the domain for the transition and the error occured. sl@0: Clients are expected to use this for debugging purpose. sl@0: */ sl@0: virtual void TransFailEvent(TDmDomainId aDomainId, TDmDomainState aState, TInt aError) = 0; sl@0: /** sl@0: When observer is active, then upon any request for transition, this will be called indicating sl@0: the Id of the domain and the desired state of the domain. sl@0: Clients are expected to use this for debugging purpose. sl@0: */ sl@0: virtual void TransReqEvent(TDmDomainId aDomainId, TDmDomainState aState) = 0; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @internalTechnology sl@0: sl@0: An abstract class to allow a domain controller to interface to the domain manager. sl@0: sl@0: To make use of this class an application must derive from it. sl@0: */ sl@0: class CHierarchyObserver: public CActive sl@0: { sl@0: public: sl@0: /** sl@0: @internalAll sl@0: */ sl@0: IMPORT_C static CHierarchyObserver* NewL(MHierarchyObserver& aHierarchyObserver,TDmHierarchyId aHierarchyId); sl@0: /** sl@0: @internalAll sl@0: */ sl@0: IMPORT_C ~CHierarchyObserver(); sl@0: /** sl@0: @internalAll sl@0: */ sl@0: IMPORT_C TInt StartObserver(TDmDomainId aDomainId, TDmNotifyType aNotifyType); sl@0: /** sl@0: @internalAll sl@0: */ sl@0: IMPORT_C TInt StopObserver(); sl@0: /** sl@0: @internalAll sl@0: */ sl@0: IMPORT_C TInt ObserverDomainCount(); sl@0: sl@0: private: sl@0: CHierarchyObserver(MHierarchyObserver& aHierarchyObserver,TDmHierarchyId aHierarchyId); sl@0: void RunL(); sl@0: void DoCancel(); sl@0: void GetNotification(); sl@0: TInt GetEvents(); sl@0: sl@0: private: sl@0: RDmManagerSession iSession; sl@0: TDmHierarchyId iHierarchyId; sl@0: MHierarchyObserver& iObserver; sl@0: TDmNotifyType iNotifyType; sl@0: TDmDomainId iDomainId; sl@0: TBool iObserverStarted; sl@0: RArray iTransitionEvents; sl@0: }; sl@0: sl@0: #endif