|
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: Managing of events that are registered to Mediator |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MEDIATORSERVEREVENTHANDLER_H |
|
20 #define MEDIATORSERVEREVENTHANDLER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 |
|
25 #include "MediatorCommon.h" |
|
26 #include "MediatorServerObjectHandler.h" |
|
27 #include "MediatorServiceDefs.h" |
|
28 |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class MMediatorServerEventObserver; |
|
32 class CMediatorServerObjectHandler; |
|
33 class CDomain; |
|
34 class CCategory; |
|
35 class CEvent; |
|
36 class CItem; |
|
37 class CCommand; |
|
38 |
|
39 // NAMESPACE |
|
40 using namespace MediatorService; |
|
41 |
|
42 // CLASS DECLARATION |
|
43 |
|
44 /** |
|
45 * Event handler class for Mediator Server. |
|
46 * |
|
47 * @lib MediatorServer |
|
48 * @since S60 3.1 |
|
49 */ |
|
50 class CMediatorServerEventHandler : public CActive |
|
51 { |
|
52 public: // Constructors and destructor |
|
53 |
|
54 /** |
|
55 * Two-phased constructor. |
|
56 * |
|
57 * @param aObjectHandler object handler |
|
58 * @return a new CMediatorServerEventHandler instance |
|
59 */ |
|
60 static CMediatorServerEventHandler* NewL( |
|
61 CMediatorServerObjectHandler& aObjectHandler ); |
|
62 |
|
63 /** |
|
64 * Destructor. |
|
65 */ |
|
66 virtual ~CMediatorServerEventHandler(); |
|
67 |
|
68 public: // New functions |
|
69 |
|
70 /** |
|
71 * Register list of new events. |
|
72 * Checks that no existing events are registered |
|
73 * @since S60 3.1 |
|
74 * @param aCategory information for the category |
|
75 * @param aEvents list of events to be registered |
|
76 * @param aSecureId secure Id of the client |
|
77 * @return none. |
|
78 */ |
|
79 void RegisterEventListL( TMediatorCategory aCategory, |
|
80 const REventList& aEvents, |
|
81 TSecureId aSecureId ); |
|
82 |
|
83 |
|
84 /** |
|
85 * Unregisters event(s) |
|
86 * |
|
87 * @since S60 3.1 |
|
88 * @param aCategory information for the category |
|
89 * @param aEvents list of events to be unregistered |
|
90 * @param aSecureId secure Id of the client |
|
91 * @return none. |
|
92 */ |
|
93 void UnregisterEventListL( TMediatorCategory aCategory, |
|
94 const REventList& aEvents, |
|
95 TSecureId aSecureId ); |
|
96 |
|
97 /** |
|
98 * Subscribes event(s) |
|
99 * |
|
100 * @since S60 3.1 |
|
101 * @param aCategory Information for the category |
|
102 * @param aEvents List of the events to be subscribed |
|
103 * @param aCaps Capabilities of the subscriber |
|
104 * @param aObserver Event observer instance |
|
105 * @return none. |
|
106 */ |
|
107 |
|
108 void SubscribeEventListL( TMediatorCategory aCategory, |
|
109 const REventList& aEvents, |
|
110 TCapabilitySet aCaps, |
|
111 MMediatorServerEventObserver* aObserver ); |
|
112 |
|
113 /** |
|
114 * Unsubscribes event(s) |
|
115 * |
|
116 * @since S60 3.1 |
|
117 * @param aCategory information for the category |
|
118 * @param aEvents List of the events to be unsubscribed. |
|
119 * @param aObserver Event observer instance |
|
120 * @return none. |
|
121 */ |
|
122 |
|
123 void UnsubscribeEventListL( TMediatorCategory aCategory, |
|
124 const REventList& aEvents, |
|
125 MMediatorServerEventObserver* aObserver ); |
|
126 |
|
127 /** |
|
128 * Raise Event |
|
129 * @since S60 3.1 |
|
130 * @param aCategory Information for the category |
|
131 * @param aEvent Event information |
|
132 * @param aData Event parameter data |
|
133 * @return none. |
|
134 */ |
|
135 |
|
136 void RaiseEventL( TMediatorCategory aCategory, |
|
137 MediatorService::TEvent aEvent, |
|
138 const TDesC8& aData ); |
|
139 |
|
140 /** |
|
141 * Returns count of events |
|
142 * @since S60 3.1 |
|
143 * @return event count |
|
144 */ |
|
145 TInt EventCount() { return iEventServiceList.Count(); } |
|
146 |
|
147 private: // From CActive |
|
148 |
|
149 /** |
|
150 * From CActive::RunL |
|
151 */ |
|
152 void RunL(); |
|
153 |
|
154 /** |
|
155 * From CActive::DoCancel() |
|
156 */ |
|
157 void DoCancel(); |
|
158 |
|
159 private: |
|
160 |
|
161 /** |
|
162 * C++ default constructor. |
|
163 * |
|
164 * @param aObjectHandler object handler |
|
165 */ |
|
166 CMediatorServerEventHandler( |
|
167 CMediatorServerObjectHandler& aObjectHandler ); |
|
168 |
|
169 /** |
|
170 * By default Symbian 2nd phase constructor is private. |
|
171 */ |
|
172 void ConstructL(); |
|
173 |
|
174 private: // Data |
|
175 // List of buffered events |
|
176 RPointerArray<CEvent> iEventServiceList; |
|
177 |
|
178 // Handle to object handler |
|
179 CMediatorServerObjectHandler& iObjectHandler; |
|
180 |
|
181 }; |
|
182 |
|
183 #endif // MEDIATORSERVEREVENTHANDLER_H |
|
184 |
|
185 // End of File |