|
1 /* |
|
2 * Copyright (c) 2010 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: Declarations for class TMSPubSubListener |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef TMSPUBSUBLISTENER_H |
|
19 #define TMSPUBSUBLISTENER_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 #include <e32std.h> |
|
24 #include <e32property.h> |
|
25 |
|
26 namespace TMS { |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class TMSPubSubObserver; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * RProperty poller. |
|
35 */ |
|
36 class TMSPubSubListener : public CActive |
|
37 { |
|
38 public: |
|
39 // Constructors and destructor |
|
40 |
|
41 /** |
|
42 * Two-phased constructor. |
|
43 * @param aUid the Uid to use |
|
44 * @param aKey item's key |
|
45 * @param aObserver callback interface for notification |
|
46 * @return instance of CSPPubSubListener |
|
47 */ |
|
48 static TMSPubSubListener* NewL(const TUid aUid, const TInt aKey, |
|
49 TMSPubSubObserver* aObserver); |
|
50 |
|
51 /** |
|
52 * Destructor. |
|
53 */ |
|
54 virtual ~TMSPubSubListener(); |
|
55 |
|
56 public: |
|
57 // 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: |
|
81 // New functions. |
|
82 |
|
83 /** |
|
84 * Starts the listening (RunL). |
|
85 */ |
|
86 void StartListening(); |
|
87 |
|
88 private: |
|
89 // From CActive. |
|
90 |
|
91 /** @see CActive::RunL */ |
|
92 virtual void RunL(); |
|
93 |
|
94 /** @see CActive::Cancel */ |
|
95 virtual void DoCancel(); |
|
96 |
|
97 /** @see CActive::RunError */ |
|
98 virtual TInt RunError(TInt aError); |
|
99 |
|
100 private: |
|
101 |
|
102 /** |
|
103 * Constructor of the listener. |
|
104 * @param aUid the Uid to use |
|
105 * @param aKey item's key |
|
106 * @param aObserver callback interface for notification |
|
107 */ |
|
108 TMSPubSubListener(const TUid aUid, TInt aKey, |
|
109 TMSPubSubObserver* aObserver); |
|
110 |
|
111 /** |
|
112 * By default Symbian 2nd phase constructor is private. |
|
113 */ |
|
114 void ConstructL(); |
|
115 |
|
116 private: |
|
117 // Data |
|
118 |
|
119 /** UID of the monitored item. */ |
|
120 TUid iUid; |
|
121 |
|
122 /** ID of the monitored item. */ |
|
123 TInt iId; |
|
124 |
|
125 /** Property to subscribe to. */ |
|
126 RProperty iProperty; |
|
127 |
|
128 /** Observer for PS notifications. */ |
|
129 TMSPubSubObserver* iObserver; |
|
130 }; |
|
131 |
|
132 } //namespace TMS |
|
133 |
|
134 #endif // TMSPUBSUBLISTENER_H |
|
135 |
|
136 // End of File |