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