|
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __DOMAIN_OBSERVER_H__ |
|
17 #define __DOMAIN_OBSERVER_H__ |
|
18 |
|
19 #include <e32std.h> |
|
20 |
|
21 #include <domaindefs.h> |
|
22 #include <domainmanager.h> |
|
23 |
|
24 |
|
25 /** |
|
26 @internalTechnology |
|
27 |
|
28 An interface to the domain manager for an observer. |
|
29 |
|
30 To make use of this class, an application must derive from it and implement the pure vitual functions |
|
31 to handle transition event notifications. |
|
32 */ |
|
33 class MHierarchyObserver |
|
34 { |
|
35 public: |
|
36 /** |
|
37 When the observer is active, then upon any successful transition, this will be called indicating |
|
38 the Id of the transitioned domain and the state of the domain after the transition. Clients are |
|
39 expected to use this for debugging purpose. |
|
40 */ |
|
41 virtual void TransProgEvent(TDmDomainId aDomainId, TDmDomainState aState) = 0; |
|
42 /** |
|
43 When observer is active, then upon any failing transition, this will be called indicating |
|
44 the Id of the domain, the state of the domain for the transition and the error occured. |
|
45 Clients are expected to use this for debugging purpose. |
|
46 */ |
|
47 virtual void TransFailEvent(TDmDomainId aDomainId, TDmDomainState aState, TInt aError) = 0; |
|
48 /** |
|
49 When observer is active, then upon any request for transition, this will be called indicating |
|
50 the Id of the domain and the desired state of the domain. |
|
51 Clients are expected to use this for debugging purpose. |
|
52 */ |
|
53 virtual void TransReqEvent(TDmDomainId aDomainId, TDmDomainState aState) = 0; |
|
54 }; |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 /** |
|
60 @internalTechnology |
|
61 |
|
62 An abstract class to allow a domain controller to interface to the domain manager. |
|
63 |
|
64 To make use of this class an application must derive from it. |
|
65 */ |
|
66 class CHierarchyObserver: public CActive |
|
67 { |
|
68 public: |
|
69 /** |
|
70 @internalAll |
|
71 */ |
|
72 IMPORT_C static CHierarchyObserver* NewL(MHierarchyObserver& aHierarchyObserver,TDmHierarchyId aHierarchyId); |
|
73 /** |
|
74 @internalAll |
|
75 */ |
|
76 IMPORT_C ~CHierarchyObserver(); |
|
77 /** |
|
78 @internalAll |
|
79 */ |
|
80 IMPORT_C TInt StartObserver(TDmDomainId aDomainId, TDmNotifyType aNotifyType); |
|
81 /** |
|
82 @internalAll |
|
83 */ |
|
84 IMPORT_C TInt StopObserver(); |
|
85 /** |
|
86 @internalAll |
|
87 */ |
|
88 IMPORT_C TInt ObserverDomainCount(); |
|
89 |
|
90 private: |
|
91 CHierarchyObserver(MHierarchyObserver& aHierarchyObserver,TDmHierarchyId aHierarchyId); |
|
92 void RunL(); |
|
93 void DoCancel(); |
|
94 void GetNotification(); |
|
95 TInt GetEvents(); |
|
96 |
|
97 private: |
|
98 RDmManagerSession iSession; |
|
99 TDmHierarchyId iHierarchyId; |
|
100 MHierarchyObserver& iObserver; |
|
101 TDmNotifyType iNotifyType; |
|
102 TDmDomainId iDomainId; |
|
103 TBool iObserverStarted; |
|
104 RArray<const TTransInfo> iTransitionEvents; |
|
105 }; |
|
106 |
|
107 #endif |