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