17 |
17 |
18 #ifndef CSPCENREPLISTENER_H |
18 #ifndef CSPCENREPLISTENER_H |
19 #define CSPCENREPLISTENER_H |
19 #define CSPCENREPLISTENER_H |
20 |
20 |
21 // INCLUDE FILES |
21 // INCLUDE FILES |
|
22 #include <glib.h> |
22 #include <e32base.h> |
23 #include <e32base.h> |
23 #include <centralrepository.h> |
24 #include <centralrepository.h> |
24 |
25 |
25 namespace TMS { |
26 namespace TMS { |
26 |
27 |
27 // Forward declarations |
28 // Forward declarations |
28 //class CRepository; |
29 class MCSPCenRepObserver; |
29 class MCSPCenRepObserver; |
|
30 |
|
31 // BASE CLASS |
|
32 |
30 |
33 // CLASS DECLARATION |
31 /** |
|
32 * TMSCenRepListener manages getting notification on CenRep key changes. |
|
33 */ |
|
34 class TMSCenRepListener : public CActive |
|
35 { |
|
36 public: |
34 |
37 |
35 /** |
38 /** |
36 * CSPCenRepListener manages getting notification on CenRep key changes. |
39 * Two-phased construction. |
|
40 * |
|
41 * @param aUid cenrep Uid |
|
42 * @param aKey key to be listened |
|
43 * @param aObserver observer for key change. |
|
44 * @return instance of the class |
37 */ |
45 */ |
38 class CSPCenRepListener : public CActive |
46 static TMSCenRepListener* NewL(TUid aUid, TUint32 aKey, |
39 { |
47 MCSPCenRepObserver* aObserver); |
40 public: |
|
41 |
48 |
42 /** |
49 /** |
43 * Two-phased construction. |
50 * Destructor. |
44 * |
51 */ |
45 * @param aUid cenrep Uid |
52 virtual ~TMSCenRepListener(); |
46 * @param aKey key to be listened |
|
47 * @param aObserver observer for key change. |
|
48 * @return instance of the class |
|
49 */ |
|
50 static CSPCenRepListener* NewL(TUid aUid, TUint32 aKey, |
|
51 MCSPCenRepObserver* aObserver); |
|
52 |
53 |
53 /** |
54 public: |
54 * Destructor. |
|
55 */ |
|
56 virtual ~CSPCenRepListener(); |
|
57 |
55 |
58 public: |
56 /** |
|
57 * Gets the current value of the monitored setting |
|
58 * @param aValue the current value of the monitored setting |
|
59 * @return gint Symbian OS error code from central repository |
|
60 */ |
|
61 gint Get(gint& aValue); |
59 |
62 |
60 /** |
63 gint Set(gint aValue); |
61 * Gets the current value of the monitored setting |
|
62 * @param aValue the current value of the monitored setting |
|
63 * @return TInt Symbian OS error code from central repository |
|
64 */ |
|
65 TInt Get(TInt& aValue); |
|
66 |
|
67 TInt Set( TInt aValue ); |
|
68 |
64 |
69 protected: |
65 protected: |
70 // From CActive |
66 // From CActive |
|
67 void DoCancel(); |
|
68 gint RunError(TInt aError); |
|
69 void RunL(); |
71 |
70 |
72 void DoCancel(); |
71 private: |
73 TInt RunError(TInt aError); |
|
74 void RunL(); |
|
75 |
72 |
76 private: |
73 /** |
|
74 * Constructor |
|
75 * @param aUid cenrep Uid |
|
76 * @param aKey key to be listened |
|
77 * @param aObserver observer for key change. |
|
78 */ |
|
79 TMSCenRepListener(TUid aUid, TUint32 aKey, MCSPCenRepObserver* aObserver); |
77 |
80 |
78 /** |
81 /** |
79 * Constructor |
82 * Private constructing. |
80 * @param aUid cenrep Uid |
83 */ |
81 * @param aKey key to be listened |
84 void ConstructL(); |
82 * @param aObserver observer for key change. |
|
83 */ |
|
84 CSPCenRepListener(TUid aUid, TUint32 aKey, |
|
85 MCSPCenRepObserver* aObserver); |
|
86 |
85 |
87 /** |
86 /** |
88 * Private constructing. |
87 * Submits a notification request |
89 */ |
88 */ |
90 void ConstructL(); |
89 void SubmitNotifyRequestL(); |
91 |
90 |
92 /** |
91 private: |
93 * Submits a notification request |
92 // Owned by this object |
94 */ |
|
95 void SubmitNotifyRequestL(); |
|
96 |
93 |
97 private: |
94 /** |
98 // Owned by this object |
95 * UID of CR key. |
|
96 */ |
|
97 TUid iUid; |
99 |
98 |
100 /** |
99 /** |
101 * UID of CR key. |
100 * Repository access. |
102 */ |
101 * Own. |
103 TUid iUid; |
102 */ |
|
103 CRepository* iRepository; |
104 |
104 |
105 /** |
105 /** |
106 * Repository access. |
106 * Identification number of the monitored setting. |
107 * Own. |
107 */ |
108 */ |
108 TUint32 iMonitorSetting; |
109 CRepository* iRepository; |
|
110 |
109 |
111 /** |
110 MCSPCenRepObserver* iObserver; |
112 * Identification number of the monitored setting. |
111 }; |
113 */ |
|
114 TUint32 iMonitorSetting; |
|
115 |
|
116 MCSPCenRepObserver* iObserver; |
|
117 }; |
|
118 |
112 |
119 } //namespace TMS |
113 } //namespace TMS |
|
114 |
120 #endif // CSPCENREPLISTENER_H |
115 #endif // CSPCENREPLISTENER_H |