|
1 /* |
|
2 * Copyright (c) 2004-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: Publish & Subscribe property change observer |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CCAPROPERTYOBSERVER_H |
|
20 #define CCAPROPERTYOBSERVER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> // CActive |
|
24 #include <e32property.h> // RProperty |
|
25 |
|
26 #include "MCAPropertyNotificationObserver.h" |
|
27 |
|
28 |
|
29 // CLASS DECLARATION |
|
30 |
|
31 /** |
|
32 * Implementation of the Publish & Subscribe property change observer |
|
33 * |
|
34 * @lib MGXMediaFileAPI.lib |
|
35 * @since 2.6 |
|
36 */ |
|
37 NONSHARABLE_CLASS( CCAPropertyObserver ) : public CActive |
|
38 { |
|
39 public: // Constructors and destructor |
|
40 |
|
41 /** |
|
42 * Two-phased constructor. |
|
43 * @param aObserver Observer to be informed when observed |
|
44 * property changes |
|
45 */ |
|
46 static CCAPropertyObserver* NewL( |
|
47 MCAPropertyNotificationObserver& aObserver ); |
|
48 |
|
49 /** |
|
50 * Destructor. |
|
51 */ |
|
52 virtual ~CCAPropertyObserver(); |
|
53 |
|
54 public: // New functions |
|
55 |
|
56 /** |
|
57 * Starts observing the given key for any changes |
|
58 * Notifies the observer when the property changes |
|
59 * @since 2.6 |
|
60 * @param aCategory, Category of the observed property |
|
61 * @param aKey, Observed property |
|
62 */ |
|
63 void ObservePropertyChangeL( TUid aCategory, TUint aKey ); |
|
64 |
|
65 /** |
|
66 * Stops observing the key given with call ObserverPropertyChangeL |
|
67 */ |
|
68 void CancelObserve( ); |
|
69 |
|
70 /** |
|
71 * Gets the uid this observer is observing |
|
72 * @return the category |
|
73 */ |
|
74 TUid Category(); |
|
75 |
|
76 /** |
|
77 * Gets the uid this observer is observing |
|
78 * @return the key |
|
79 */ |
|
80 TUint Key(); |
|
81 |
|
82 |
|
83 protected: // Functions from base classes |
|
84 |
|
85 /** |
|
86 * From CActive |
|
87 */ |
|
88 void RunL(); |
|
89 |
|
90 /** |
|
91 * From CActive |
|
92 */ |
|
93 void DoCancel(); |
|
94 |
|
95 private: |
|
96 |
|
97 /** |
|
98 * C++ default constructor. |
|
99 */ |
|
100 CCAPropertyObserver( MCAPropertyNotificationObserver& aObserver ); |
|
101 |
|
102 |
|
103 private: // Data |
|
104 |
|
105 // Owns: Observed property |
|
106 RProperty iProperty; |
|
107 |
|
108 // Observer to be informed when property changes |
|
109 MCAPropertyNotificationObserver& iObserver; |
|
110 |
|
111 // the category this observer is attached to |
|
112 TUid iCategory; |
|
113 // the key this observer is attached to |
|
114 TUint iKey; |
|
115 |
|
116 }; |
|
117 |
|
118 #endif // CCAPROPERTYOBSERVER_H |
|
119 |
|
120 // End of File |