|
1 /* |
|
2 * Copyright (c) 2002-2005 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: Notifies the changes in central repository values. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CSATCENREPCHANGENOTIFIER_H |
|
21 #define CSATCENREPCHANGENOTIFIER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include "MSatSystemStateChangeNotifier.h" |
|
26 |
|
27 // FORWARD DECLARATION |
|
28 class MSatSystemStateObserver; |
|
29 class CRepository; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * Notifies the changes in central repository values. |
|
35 * |
|
36 * @lib SatSystemState |
|
37 * @since Series 60 3.0 |
|
38 */ |
|
39 class CSatCenRepChangeNotifier : public CActive, |
|
40 public MSatSystemStateChangeNotifier |
|
41 { |
|
42 public: // Enums |
|
43 |
|
44 /** |
|
45 * Identifier for the value type that is being observered. |
|
46 */ |
|
47 enum TCenRepTypes |
|
48 { |
|
49 // Type is TInt |
|
50 ECRTypeInteger, |
|
51 // Type is TReal |
|
52 ECRTypeReal, |
|
53 // Type is TDesC8 |
|
54 ECRTypeDesC8, |
|
55 // Type is TDesC16 |
|
56 ECRTypeDesC16, |
|
57 // Type not defined |
|
58 ECRTypeUnknown |
|
59 }; |
|
60 |
|
61 public: // Constructors and destructor |
|
62 |
|
63 /** |
|
64 * Two-phased constructor. |
|
65 * @param aCenRepCategory This is the CR Category. |
|
66 * @param aCenRepId CR value id to be listened. |
|
67 * @param aObserver A class that is notified when value changes. |
|
68 * @param aCenRepType Identifies the base type of the observered value, |
|
69 * which can be TInt, TDesC or TReal. Default is Unknown. |
|
70 */ |
|
71 static CSatCenRepChangeNotifier* NewL( |
|
72 const TUid& aCenRepCategory, |
|
73 TUint32 aCenRepId, |
|
74 MSatSystemStateObserver& aObserver, |
|
75 TInt aCenRepType ); |
|
76 |
|
77 /** |
|
78 * Destructor. |
|
79 */ |
|
80 virtual ~CSatCenRepChangeNotifier(); |
|
81 |
|
82 public: // Functions from base classes |
|
83 |
|
84 /** |
|
85 * From MSatSystemStateChangeNotifier Request a notification of a |
|
86 * change in system state. |
|
87 */ |
|
88 void NotifyChangeL(); |
|
89 |
|
90 /** |
|
91 * From MSatSystemStateChangeNotifier Cancels the notification request. |
|
92 */ |
|
93 void CancelNotify(); |
|
94 |
|
95 protected: // Functions from base classes |
|
96 |
|
97 /** |
|
98 * From CActive |
|
99 */ |
|
100 void DoCancel(); |
|
101 |
|
102 /** |
|
103 * From CActive. |
|
104 */ |
|
105 void RunL(); |
|
106 |
|
107 private: // New methods |
|
108 |
|
109 /** |
|
110 * Makes the request and activates the active object. |
|
111 */ |
|
112 void ActivateL(); |
|
113 |
|
114 private: |
|
115 |
|
116 /** |
|
117 * C++ default constructor. |
|
118 * @param aCenRepCategory This is the CR Category. |
|
119 * @param aCenRepId CR value id to be listened. |
|
120 * @param aObserver A class that is notified when value changes. |
|
121 * @param aCenRepType Identifies the base type of the observered value |
|
122 */ |
|
123 CSatCenRepChangeNotifier( |
|
124 const TUid& aCenRepCategory, |
|
125 TUint32 aCenRepId, |
|
126 MSatSystemStateObserver& aObserver, |
|
127 TInt aCenRepType ); |
|
128 |
|
129 /** |
|
130 * By default Symbian 2nd phase constructor is private. |
|
131 */ |
|
132 void ConstructL(); |
|
133 |
|
134 private: // Data |
|
135 |
|
136 // Change observer. |
|
137 MSatSystemStateObserver& iObserver; |
|
138 |
|
139 // Central repository class. |
|
140 CRepository* iCenRepClient; |
|
141 |
|
142 // CenRep category |
|
143 TUid iCenRepCategory; |
|
144 |
|
145 // CenRep value to listen |
|
146 TUint32 iCenRepId; |
|
147 |
|
148 // CR value type |
|
149 TInt iCenRepType; |
|
150 |
|
151 }; |
|
152 |
|
153 #endif // CSATCENREPCHANGENOTIFIER_H |
|
154 |
|
155 // End of File |