|
1 /* |
|
2 * Copyright (c) 2006-2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 /** |
|
22 @file |
|
23 @internalTechnology |
|
24 */ |
|
25 |
|
26 #ifndef HWRMPSCHANGEOBSERVER_H |
|
27 #define HWRMPSCHANGEOBSERVER_H |
|
28 |
|
29 // INCLUDES |
|
30 #include <e32base.h> |
|
31 #include <e32property.h> |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 // None |
|
35 |
|
36 /** |
|
37 * An interface the developer implements for handling notification events. |
|
38 * |
|
39 */ |
|
40 class MHWRMPSChangeObserver |
|
41 { |
|
42 public: |
|
43 |
|
44 /** |
|
45 * Called when the PS value changes. |
|
46 * Note that if the value changes |
|
47 * very rapidly, some state transitions might be missed. |
|
48 * It is however guaranteed that latest state is always obtained. |
|
49 * |
|
50 * @param aUid Uid of the changed property |
|
51 * @param aKey Property identifier |
|
52 * @param aValue Indicates latest value |
|
53 */ |
|
54 virtual void PSValueChanged(const TUid& aUid, TUint32 aKey, TInt aValue) = 0; |
|
55 }; |
|
56 |
|
57 /** |
|
58 * Active object wrapper for Publish and Subscribe one-shot notification handling. |
|
59 * Listens for changes in light status and notifies the client. |
|
60 * |
|
61 */ |
|
62 class CHWRMPSChangeObserver : public CActive |
|
63 { |
|
64 public: |
|
65 |
|
66 /** |
|
67 * This is a two-phase constructor method that is used to |
|
68 * create a new instance of CHWRMPSChangeObserver. |
|
69 * A newly created instance immediately starts listening to PS value changes. |
|
70 * |
|
71 * @param aCallback Reference to a callback instance. |
|
72 * @param aUid Uid of the changed property |
|
73 * @param aKey Property identifier |
|
74 * @return A pointer to a new instance of the CHWRMPSChangeObserver class. |
|
75 */ |
|
76 static CHWRMPSChangeObserver* NewL(MHWRMPSChangeObserver& aCallback, |
|
77 const TUid& aUid, |
|
78 TUint32 aKey); |
|
79 |
|
80 /** |
|
81 * This is a two-phase constructor method that is used to |
|
82 * create a new instance of CHWRMPSChangeObserver. |
|
83 * A newly created instance immediately starts listening to PS value changes. |
|
84 * Leaves the constructed instance to cleanup stack. |
|
85 * |
|
86 * @param aCallback Reference to a callback instance. |
|
87 * @param aUid Uid of the changed property |
|
88 * @param aKey Property identifier |
|
89 * @return A pointer to a new instance of the CHWRMPSChangeObserver class. |
|
90 */ |
|
91 static CHWRMPSChangeObserver* NewLC(MHWRMPSChangeObserver& aCallback, |
|
92 const TUid& aUid, |
|
93 TUint32 aKey); |
|
94 |
|
95 /** |
|
96 * Destructor. |
|
97 */ |
|
98 virtual ~CHWRMPSChangeObserver(); |
|
99 |
|
100 protected: |
|
101 |
|
102 // From CActive |
|
103 void RunL(); |
|
104 TInt RunError(TInt aError); |
|
105 void DoCancel(); |
|
106 |
|
107 private: |
|
108 |
|
109 /** |
|
110 * Constructor |
|
111 * |
|
112 * @param aCallback Reference to a callback instance. |
|
113 * @param aUid Uid of the changed property |
|
114 * @param aKey Property identifier |
|
115 */ |
|
116 CHWRMPSChangeObserver(MHWRMPSChangeObserver& aCallback, |
|
117 const TUid& aUid, |
|
118 TUint32 aKey); |
|
119 |
|
120 /** |
|
121 * By default Symbian 2nd phase constructor is private. |
|
122 */ |
|
123 void ConstructL(); |
|
124 |
|
125 /* |
|
126 * Order notification |
|
127 */ |
|
128 void OrderNotification(); |
|
129 |
|
130 private: |
|
131 |
|
132 MHWRMPSChangeObserver& iCallback; // not owned by this class |
|
133 RProperty iProperty; // P&S property |
|
134 TUid iUid; // Uid of the property |
|
135 TUint32 iKey; // Property identifier |
|
136 |
|
137 }; |
|
138 |
|
139 #endif // HWRMVIBRASTATUSOBSERVER_H |
|
140 |
|
141 // End of File |