|
1 /* |
|
2 * Copyright (c) 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: Listener for Publish and subscribe data. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef GSPUBSUBSLISTENER_H |
|
20 #define GSPUBSUBSLISTENER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <e32std.h> |
|
25 #include <e32property.h> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class MGSSettingPSObserver; |
|
29 |
|
30 // CLASS DECLARATION |
|
31 |
|
32 /** |
|
33 * RProperty poller. |
|
34 * |
|
35 * @lib gs.lib |
|
36 * @since Series 60 3.0 |
|
37 */ |
|
38 NONSHARABLE_CLASS( CGSPubSubsListener ) : public CActive |
|
39 { |
|
40 public: // Constructors and destructor |
|
41 |
|
42 /** |
|
43 * Two-phased constructor. |
|
44 * @param aUid the Uid to use |
|
45 * @param aKey item's key |
|
46 * @param aObserver callback interface for notification |
|
47 * @return instance of CGSPubSubsListener |
|
48 */ |
|
49 static CGSPubSubsListener* NewL( const TUid aUid, const TInt aKey, |
|
50 MGSSettingPSObserver* aObserver ); |
|
51 |
|
52 /** |
|
53 * Destructor. |
|
54 */ |
|
55 virtual ~CGSPubSubsListener(); |
|
56 |
|
57 public: // New functions. |
|
58 |
|
59 /** |
|
60 * Gets integer value from P & S. |
|
61 * @param aVal a value in return |
|
62 * @return error code |
|
63 */ |
|
64 TInt Get( TInt& aVal ); |
|
65 |
|
66 /** |
|
67 * Gets 8 bit string value from P&S. |
|
68 * @param aVal a value in return |
|
69 * @return error code |
|
70 */ |
|
71 TInt Get( TDes8& aVal ); |
|
72 |
|
73 /** |
|
74 * Gets 16 bit descriptor value from P&S. |
|
75 * @param aVal a value in return |
|
76 * @return error code |
|
77 */ |
|
78 TInt Get( TDes16& aVal ); |
|
79 |
|
80 private: // From CActive. |
|
81 |
|
82 /** @see CActive::RunL */ |
|
83 virtual void RunL(); |
|
84 |
|
85 /** @see CActive::Cancel */ |
|
86 virtual void DoCancel(); |
|
87 |
|
88 /** @see CActive::RunError */ |
|
89 virtual TInt RunError( TInt aError ); |
|
90 |
|
91 /** |
|
92 * Starts the listening (RunL). |
|
93 */ |
|
94 void StartListening(); |
|
95 |
|
96 private: |
|
97 |
|
98 /** |
|
99 * C++ default constructor. |
|
100 * @param aUid the Uid to use |
|
101 * @param aKey item's key |
|
102 * @param aObserver callback interface for notification |
|
103 */ |
|
104 CGSPubSubsListener( const TUid aUid, TInt aKey, |
|
105 MGSSettingPSObserver* aObserver ); |
|
106 |
|
107 /** |
|
108 * By default Symbian 2nd phase constructor is private. |
|
109 */ |
|
110 void ConstructL(); |
|
111 |
|
112 private: // Data |
|
113 |
|
114 // UID of the monitored item. |
|
115 TUid iUid; |
|
116 |
|
117 // ID of the monitored item. |
|
118 TInt iId; |
|
119 |
|
120 // Property to subscribe to. |
|
121 RProperty iProperty; |
|
122 |
|
123 // The notification interface. |
|
124 MGSSettingPSObserver* iCallback; |
|
125 }; |
|
126 |
|
127 #endif // GSPUBSUBSLISTENER_H |
|
128 |
|
129 // End of File |