1 /* |
|
2 * Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0"" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: system State monitor |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __FM_SYSTEMSTATE_MONITOR__ |
|
19 #define __FM_SYSTEMSTATE_MONITOR__ |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <ssm/ssmstateawaresession.h> |
|
23 |
|
24 /** |
|
25 * MFmSystemStateMonitorObserver |
|
26 * |
|
27 * Monitor component observer. |
|
28 * |
|
29 * @since S60 5.2 |
|
30 */ |
|
31 class MFmSystemStateMonitorObserver |
|
32 { |
|
33 public: |
|
34 /** |
|
35 * Called when the system State changed |
|
36 */ |
|
37 virtual void SystemStateChangedEvent() = 0; |
|
38 }; |
|
39 |
|
40 /** |
|
41 * CFmSystemStateMonitor |
|
42 * |
|
43 * Component for monitoring system state |
|
44 * |
|
45 * @since S60 5.2 |
|
46 */ |
|
47 class CFmSystemStateMonitor : public CActive |
|
48 { |
|
49 public: |
|
50 /** |
|
51 * Create new monitor |
|
52 * |
|
53 * @param aObserver monitor observer |
|
54 * @since S60 5.2 |
|
55 */ |
|
56 static CFmSystemStateMonitor* NewL( |
|
57 MFmSystemStateMonitorObserver& aObserver ); |
|
58 |
|
59 /** |
|
60 * Destructor |
|
61 * |
|
62 * @since S60 5.2 |
|
63 */ |
|
64 ~CFmSystemStateMonitor(); |
|
65 |
|
66 /** |
|
67 * Start monitor |
|
68 * |
|
69 * @param aStateToMonitor the state needs monitored |
|
70 * @since S60 5.2 |
|
71 */ |
|
72 void StartMonitor( TUint aStateToMonitor ); |
|
73 |
|
74 /** |
|
75 * Indicate system state is normal or not |
|
76 * |
|
77 * @since S60 5.2 |
|
78 * @return ETrue if system state is normal, EFalse if not |
|
79 */ |
|
80 TBool IsSystemStateNormal(); |
|
81 |
|
82 private: |
|
83 /** |
|
84 * C++ constructor |
|
85 * |
|
86 * @param aObserver monitor observer. |
|
87 * @since S60 5.2 |
|
88 */ |
|
89 CFmSystemStateMonitor( MFmSystemStateMonitorObserver& aObserver ); |
|
90 |
|
91 /** |
|
92 * Symbian 2nd phase constructor |
|
93 * |
|
94 * @since S60 5.2 |
|
95 */ |
|
96 void ConstructL(); |
|
97 |
|
98 private: // From CActive |
|
99 /** |
|
100 * From CActive |
|
101 */ |
|
102 void RunL(); |
|
103 |
|
104 /** |
|
105 * From CActive |
|
106 * @since S60 5.2 |
|
107 */ |
|
108 void DoCancel(); |
|
109 |
|
110 /** |
|
111 * From CActive |
|
112 * @since S60 5.2 |
|
113 */ |
|
114 TInt RunError( TInt aError ); |
|
115 |
|
116 private: |
|
117 // observer used to inform try schedule backup again when system state become normal |
|
118 MFmSystemStateMonitorObserver& iObserver; |
|
119 |
|
120 // State aware session. |
|
121 RSsmStateAwareSession iSAS; |
|
122 |
|
123 // State to monitor |
|
124 TUint iStateToMonitor; |
|
125 }; |
|
126 |
|
127 #endif // __FM_SYSTEMSTATE_MONITOR__ |
|