|
1 /* |
|
2 * Copyright (c) 2009 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: This file contains the header of CenRep Listener class. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef TMSCENREPLISTENER_H |
|
19 #define TMSCENREPLISTENER_H |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <glib.h> |
|
23 #include <e32base.h> |
|
24 #include <centralrepository.h> |
|
25 |
|
26 namespace TMS { |
|
27 |
|
28 // Forward declarations |
|
29 class TMSCenRepObserver; |
|
30 |
|
31 /** |
|
32 * TMSCenRepListener manages getting notification on CenRep key changes. |
|
33 */ |
|
34 class TMSCenRepListener : public CActive |
|
35 { |
|
36 public: |
|
37 |
|
38 /** |
|
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 |
|
45 */ |
|
46 static TMSCenRepListener* NewL(TUid aUid, TUint32 aKey, |
|
47 TMSCenRepObserver* aObserver); |
|
48 |
|
49 /** |
|
50 * Destructor. |
|
51 */ |
|
52 virtual ~TMSCenRepListener(); |
|
53 |
|
54 public: |
|
55 |
|
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); |
|
62 |
|
63 gint Set(gint aValue); |
|
64 |
|
65 protected: |
|
66 // From CActive |
|
67 void DoCancel(); |
|
68 gint RunError(TInt aError); |
|
69 void RunL(); |
|
70 |
|
71 private: |
|
72 |
|
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, TMSCenRepObserver* aObserver); |
|
80 |
|
81 /** |
|
82 * Private constructing. |
|
83 */ |
|
84 void ConstructL(); |
|
85 |
|
86 /** |
|
87 * Submits a notification request |
|
88 */ |
|
89 void SubmitNotifyRequestL(); |
|
90 |
|
91 private: |
|
92 // Owned by this object |
|
93 |
|
94 /** |
|
95 * UID of CR key. |
|
96 */ |
|
97 TUid iUid; |
|
98 |
|
99 /** |
|
100 * Repository access. |
|
101 * Own. |
|
102 */ |
|
103 CRepository* iRepository; |
|
104 |
|
105 /** |
|
106 * Identification number of the monitored setting. |
|
107 */ |
|
108 TUint32 iMonitorSetting; |
|
109 |
|
110 TMSCenRepObserver* iObserver; |
|
111 }; |
|
112 |
|
113 } //namespace TMS |
|
114 |
|
115 #endif // TMSCENREPLISTENER_H |