|
1 /* |
|
2 * Copyright (c) 2005, 2006 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: Central repository key watcher class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef USBCLASSCHANGEUIPLUGINCRWATCHER_H |
|
20 #define USBCLASSCHANGEUIPLUGINCRWATCHER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <centralrepository.h> |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class CRepository; |
|
27 |
|
28 /** |
|
29 * A callback interface for informing change of a setting in Central Repository |
|
30 */ |
|
31 class MUSBUICRSettingObserver |
|
32 { |
|
33 public: // New functions |
|
34 |
|
35 /** |
|
36 * Informs the observer that a setting has been changed. |
|
37 * @param aKey The changed key. |
|
38 * @return None. |
|
39 */ |
|
40 virtual void SettingChangedL( TUint32 aKey ) = 0; |
|
41 }; |
|
42 |
|
43 |
|
44 /** |
|
45 * CUSBClassChangeUIPluginCRWatcher detects a change of the value of the CR key. |
|
46 * CUSBClassChangeUIPluginCRWatcher provides CActive object that is used to |
|
47 * detect when the value of the selected key in Central Repository is changed |
|
48 * by the USBWatcher. One observer can be notified by one or more |
|
49 * USBClassChangeUIPluginCRWatcher objects, each watching different keys. |
|
50 */ |
|
51 class CUSBClassChangeUIPluginCRWatcher : public CActive |
|
52 { |
|
53 |
|
54 public: |
|
55 |
|
56 /** |
|
57 * Factory method NewL |
|
58 * @param aOwner The observer to be notified on the change. |
|
59 * @param aKey The Central Repository key to be watched. |
|
60 * @param aOneShot If false, the listening is restarted after change. |
|
61 * @return The new watcher object. |
|
62 */ |
|
63 static CUSBClassChangeUIPluginCRWatcher* NewL( |
|
64 MUSBUICRSettingObserver& aOwner, TUint32 aKey, |
|
65 TBool aOneShot = EFalse); |
|
66 |
|
67 /** |
|
68 * Starts listening for notifications. If already listening, nothing |
|
69 * happens. |
|
70 */ |
|
71 void StartListeningL(); |
|
72 |
|
73 /** |
|
74 * Stops listening for notifications. If already stopped, nothing |
|
75 * happens. |
|
76 * @param none |
|
77 * @return none |
|
78 */ |
|
79 void StopListening(); |
|
80 |
|
81 /** |
|
82 * C++ default constructor |
|
83 * @param aOwner The observer to be notified on the change. |
|
84 * @param aKey The Central Repository key to be watched. |
|
85 * @param aOneShot If false, the listening is restarted after change. |
|
86 */ |
|
87 CUSBClassChangeUIPluginCRWatcher( |
|
88 MUSBUICRSettingObserver& aOwner, TUint32 aKey, |
|
89 TBool aOneShot = EFalse); |
|
90 |
|
91 /** |
|
92 * Destructor. |
|
93 */ |
|
94 virtual ~CUSBClassChangeUIPluginCRWatcher(); |
|
95 |
|
96 private: |
|
97 |
|
98 /** |
|
99 * Constructor. |
|
100 * @param none |
|
101 */ |
|
102 |
|
103 void ConstructL(); |
|
104 |
|
105 /** |
|
106 * Implements CActive |
|
107 * If this is not a one-shot CR watcher, the listening is restarted. |
|
108 * @param none |
|
109 * @return none |
|
110 */ |
|
111 void RunL(); |
|
112 |
|
113 /** |
|
114 * Implements CActive |
|
115 * @param aError the error returned |
|
116 * @return error |
|
117 */ |
|
118 TInt RunError(TInt aError); |
|
119 |
|
120 /** |
|
121 * Implements CActive |
|
122 * @param none |
|
123 * @return none |
|
124 */ |
|
125 void DoCancel(); |
|
126 |
|
127 |
|
128 private: |
|
129 /** USB Watcher repository access */ |
|
130 CRepository* iPersonalityRepository; |
|
131 /** The observer to be notified */ |
|
132 MUSBUICRSettingObserver& iOwner; |
|
133 /** The repository key to be watcher */ |
|
134 TUint32 iKey; |
|
135 /** If iOneShot is false, listening is restarted on notification */ |
|
136 TBool iOneShot; |
|
137 }; |
|
138 |
|
139 |
|
140 #endif // USBCLASSCHANGEUIPLUGINCRWATCHER_H |
|
141 |
|
142 // End of File |