|
1 /* |
|
2 * Copyright (c) 2004 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: Defines class CNcnSubscriber. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef NCNSUBSCRIBER_H |
|
21 #define NCNSUBSCRIBER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <e32property.h> |
|
26 #include "NcnPublishAndSubscribeObserver.h" |
|
27 |
|
28 // forward declarations |
|
29 class MNcnSubscribeHandler; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 /** |
|
33 * CNcnSubscriber is an acitve object that subscribes to a single |
|
34 * Publish and Subscribe Property and notifies about the Property changes. |
|
35 */ |
|
36 |
|
37 class CNcnSubscriber : public CActive |
|
38 { |
|
39 public: |
|
40 /** |
|
41 * Two-phased constructor. |
|
42 * |
|
43 * @param aPropertyResponder The object to be notified about Property changes |
|
44 * @param aCategory The category of the Property to be observed |
|
45 * @param aKey The subkey of the Property to be observed |
|
46 */ |
|
47 static CNcnSubscriber* NewL( MNcnSubscribeHandler& aPropertyResponder, const TUid& aCategory, TUint aKey ); |
|
48 |
|
49 /** |
|
50 * Destructor. |
|
51 */ |
|
52 ~CNcnSubscriber(); |
|
53 |
|
54 /** |
|
55 * Subscribes to the Property given in constructor |
|
56 */ |
|
57 void Subscribe(); |
|
58 |
|
59 private: |
|
60 /** |
|
61 * C++ default constructor. |
|
62 * |
|
63 * @param aPropertyResponder The object to be notified about Property changes |
|
64 * @param aCategory The category of the Property to be observed |
|
65 * @param aKey The subkey of the Property to be observed |
|
66 */ |
|
67 CNcnSubscriber( MNcnSubscribeHandler& aPropertyResponder, const TUid& aCategory, TUint aKey ); |
|
68 |
|
69 /** |
|
70 * By default Symbian 2nd phase constructor is private. |
|
71 */ |
|
72 void ConstructL(); |
|
73 |
|
74 public: // from CActive |
|
75 /** |
|
76 * RunL |
|
77 */ |
|
78 void RunL(); |
|
79 |
|
80 /** |
|
81 * RunError |
|
82 * @param aError the error returned |
|
83 * |
|
84 * @return error |
|
85 */ |
|
86 TInt RunError( TInt aError ); |
|
87 |
|
88 /** |
|
89 * DoCancel |
|
90 */ |
|
91 void DoCancel(); |
|
92 |
|
93 private: // Methods not implemented |
|
94 CNcnSubscriber( const CNcnSubscriber& ); // Copy constructor |
|
95 CNcnSubscriber& operator=( const CNcnSubscriber& );// Assigment operator |
|
96 |
|
97 private: // data |
|
98 |
|
99 // The object to be notified about Property changes |
|
100 MNcnSubscribeHandler& iPropertyResponder; |
|
101 |
|
102 // The property object that subscribes to the Property to be observed |
|
103 RProperty iProperty; |
|
104 |
|
105 // The category of the Property to be observed |
|
106 TUid iCategory; |
|
107 |
|
108 // The subkey of the Property to be observed |
|
109 TUint iKey; |
|
110 }; |
|
111 |
|
112 |
|
113 #endif // NCNSUBSCRIBER_H |
|
114 |
|
115 // End of File |