1 eiknotapi.h |
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __EIKNOTAPI_H__ |
|
17 #define __EIKNOTAPI_H__ |
|
18 |
|
19 #include <e32std.h> |
|
20 #include <e32base.h> |
|
21 #include <f32file.h> |
|
22 |
|
23 /** Defines the second Uid value for plug in notifier DLLs. |
|
24 |
|
25 @publishedAll |
|
26 @released */ |
|
27 const TUid KUidNotifierPlugIn = {0x10005522}; |
|
28 const TUid KUidNotifierPlugInV2 = {0x101fdfae}; |
|
29 |
|
30 /** |
|
31 @publishedAll |
|
32 @released |
|
33 */ |
|
34 enum TEikNotExtStatus |
|
35 { |
|
36 EEikNotExtRequestCompleted = 0, |
|
37 EEikNotExtRequestQueued = 1 |
|
38 }; |
|
39 |
|
40 /** The Uid that identifies a screen change event. |
|
41 |
|
42 @see MEikSrvNotifierBase2::HandleSystemEventL() |
|
43 @internalTechnology */ |
|
44 const TUid KUidEventScreenModeChanged = {0x101F3648}; |
|
45 |
|
46 /** A set of flags that define the capabilities of the notifier. |
|
47 |
|
48 Capabilities are returned by calling MEikSrvNotifierBase2::NotifierCapabilites(). |
|
49 |
|
50 @publishedAll |
|
51 @released */ |
|
52 enum TNotifierCapabilities |
|
53 { |
|
54 /** The notifier has no special capabilities. */ |
|
55 ENoSpecialCapabilities = 0x00000000, |
|
56 /** The notifier can handle a change to the screen device. */ |
|
57 EScreenDeviceChangeSupported = 0x00000001, |
|
58 }; |
|
59 |
|
60 /** |
|
61 Interface to allow notifiers to manage their own startup/shutdown. This class is likely to be of most |
|
62 interest to notifiers that observe engines using publically available APIs rather than those that are run |
|
63 via RNotifier. |
|
64 |
|
65 @publishedAll |
|
66 @released |
|
67 */ |
|
68 class MEikSrvNotifierManager |
|
69 { |
|
70 public: |
|
71 virtual void StartNotifierL(TUid aNotifierUid, const TDesC8& aBuffer, TDes8& aResponse) = 0; |
|
72 virtual void CancelNotifier(TUid aNotifierUid) = 0; |
|
73 virtual void UpdateNotifierL(TUid aNotifierUid, const TDesC8& aBuffer, TDes8& aResponse) = 0; |
|
74 protected: |
|
75 IMPORT_C MEikSrvNotifierManager(); |
|
76 private: |
|
77 IMPORT_C virtual void MEikSrvNotifierManager_Reserved1(); |
|
78 IMPORT_C virtual void MEikSrvNotifierManager_Reserved2(); |
|
79 private: |
|
80 TInt iMEikSrvNotifierManager_Spare1; |
|
81 }; |
|
82 |
|
83 |
|
84 /** Interface to a plug-in server side notifier. |
|
85 |
|
86 Any number of MEikSrvNotifierBase2 objects can be included in a single DLL. |
|
87 All notifiers are loaded during device startup and are not destroyed until |
|
88 the Uikon server closes down. |
|
89 |
|
90 All notifiers run in the uikon server thread so are able to directly access |
|
91 server side status panes but cannot call any functions on REikAppUiSession. |
|
92 |
|
93 @publishedAll |
|
94 @released */ |
|
95 class MEikSrvNotifierBase2 |
|
96 { |
|
97 public: |
|
98 /** Defines a set of notifier priorities. The use and application of these values |
|
99 is implementation-dependent. */ |
|
100 enum TNotifierPriority |
|
101 { |
|
102 /** The highest priority value. */ |
|
103 ENotifierPriorityAbsolute = 500, |
|
104 /** The second highest priority value. */ |
|
105 ENotifierPriorityVHigh = 400, |
|
106 /** The third highest priority value. */ |
|
107 ENotifierPriorityHigh = 300, |
|
108 /** The fourth highest priority value. */ |
|
109 ENotifierPriorityLow = 200, |
|
110 /** The fifth highest priority value. */ |
|
111 ENotifierPriorityVLow = 100, |
|
112 /** The lowest priority value. */ |
|
113 ENotifierPriorityLowest = 0 |
|
114 }; |
|
115 public: |
|
116 /** Contains the notifier parameters. |
|
117 |
|
118 @see TNotifierPriority */ |
|
119 class TNotifierInfo |
|
120 { |
|
121 public: |
|
122 /** The Uid that identifies the notifier. */ |
|
123 TUid iUid; |
|
124 /** The Uid that identifies the channel to be used by the notifier (e.g. the screen, |
|
125 an LED etc) */ |
|
126 TUid iChannel; |
|
127 /** The notifier priority, typically chosen from the standard set. |
|
128 |
|
129 @see TNotifierPriority */ |
|
130 TInt iPriority; |
|
131 }; |
|
132 |
|
133 public: |
|
134 IMPORT_C MEikSrvNotifierBase2(); |
|
135 IMPORT_C virtual ~MEikSrvNotifierBase2(); |
|
136 public: |
|
137 /** Frees all resources owned by this notifier. |
|
138 |
|
139 This function is called by the notifier framework when all resources allocated |
|
140 by notifiers should be freed. As a minimum, this function should delete this |
|
141 object (i.e. delete this;). |
|
142 |
|
143 Note that it is important to implement this function correctly to avoid memory |
|
144 leaks. */ |
|
145 virtual void Release() = 0; |
|
146 /** Performs any initialisation that this notifier may require. |
|
147 |
|
148 The function is called when the notifier is loaded (when the plug-in DLL is |
|
149 loaded). It is called only once. |
|
150 |
|
151 As a minimum, the function should return a TNotifierInfo instance describing |
|
152 the notifier parameters. A good implementation would be to set this into a |
|
153 data member, and then to return it. This is because the same information is |
|
154 returned by Info(). |
|
155 |
|
156 The function is safe to leave from, so it is possible, although rarely necessary, |
|
157 to allocate objects as you would normally do in a ConstructL() function as |
|
158 part of two-phase construction. |
|
159 |
|
160 @return Describes the parameters of the notifier. */ |
|
161 virtual TNotifierInfo RegisterL() = 0; |
|
162 /** Gets the notifier parameters. |
|
163 |
|
164 This is usually the same information as returned by RegisterL() but can be |
|
165 varied at run time. |
|
166 |
|
167 @return Describes the parameters of the notifier. */ |
|
168 virtual TNotifierInfo Info() const = 0; |
|
169 /** Starts the notifier. |
|
170 |
|
171 This is called as a result of a client-side call to RNotifier::StartNotifier(), |
|
172 which the client uses to start a notifier from which it does not expect a |
|
173 response. |
|
174 |
|
175 The function is synchronous, but it should be implemented so that it completes |
|
176 as soon as possible, allowing the notifier framework to enforce its priority |
|
177 mechanism. |
|
178 |
|
179 It is not possible to to wait for a notifier to complete before returning |
|
180 from this function unless the notifier is likely to finish implementing its |
|
181 functionality immediately. |
|
182 |
|
183 @param aBuffer Data that can be passed from the client-side. The format and |
|
184 meaning of any data is implementation dependent. |
|
185 @return A pointer descriptor representing data that may be returned. The format |
|
186 and meaning of any data is implementation dependent. */ |
|
187 virtual TPtrC8 StartL(const TDesC8& aBuffer) = 0; |
|
188 /** Starts the notifier. |
|
189 |
|
190 This is called as a result of a client-side call to the asynchronous function |
|
191 RNotifier::StartNotifierAndGetResponse(). This means that the client is waiting, |
|
192 asynchronously, for the notifier to tell the client that it has finished its |
|
193 work. |
|
194 |
|
195 It is important to return from this function as soon as possible, and derived |
|
196 classes may find it useful to take a copy of the reply-slot number and |
|
197 the RMessage object. |
|
198 |
|
199 The implementation of a derived class must make sure that Complete() is called |
|
200 on the RMessage object when the notifier is deactivated. |
|
201 |
|
202 This function may be called multiple times if more than one client starts |
|
203 the notifier. |
|
204 |
|
205 @param aBuffer Data that can be passed from the client-side. The format and |
|
206 meaning of any data is implementation dependent. |
|
207 @param aReplySlot Identifies which message argument to use for the reply. |
|
208 This message argument will refer to a modifiable descriptor, a TDes8 type, |
|
209 into which data can be returned. The format and meaning of any returned data |
|
210 is implementation dependent. |
|
211 @param aMessage Encapsulates a client request. */ |
|
212 virtual void StartL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage) = 0; |
|
213 |
|
214 /** Cancels an active notifier. |
|
215 |
|
216 This is called as a result of a client-side call to RNotifier::CancelNotifier(). |
|
217 |
|
218 An implementation should free any relevant resources and complete any outstanding |
|
219 messages, if relevant. */ |
|
220 virtual void Cancel() = 0; |
|
221 /** Updates a currently active notifier with new data. |
|
222 |
|
223 This is called as a result of a client-side call to RNotifier::UpdateNotifier(). |
|
224 |
|
225 @param aBuffer Data that can be passed from the client-side. The format and |
|
226 meaning of any data is implementation dependent. |
|
227 @return A pointer descriptor representing data that may be returned. The format |
|
228 and meaning of any data is implementation dependent. */ |
|
229 virtual TPtrC8 UpdateL(const TDesC8& aBuffer) = 0; |
|
230 /** Updates a currently active notifier with new data. |
|
231 |
|
232 This is called as a result of a client-side call to the asynchronous function |
|
233 RNotifier::UpdateNotifierAndGetResponse(). This means that the client is waiting, |
|
234 asynchronously, for the notifier to tell the client that it has finished its |
|
235 work. |
|
236 |
|
237 It is important to return from this function as soon as possible, and derived |
|
238 classes may find it useful to take a copy of the reply-slot number and |
|
239 the RMessage object. |
|
240 |
|
241 The implementation of a derived class must make sure that Complete() is called |
|
242 on the RMessage object when the notifier is deactivated. |
|
243 |
|
244 This function may be called multiple times if more than one client updates |
|
245 the notifier. |
|
246 |
|
247 @param aBuffer Data that can be passed from the client-side. The format and |
|
248 meaning of any data is implementation dependent. |
|
249 @param aReplySlot Identifies which message argument to use for the reply. |
|
250 This message argument will refer to a modifiable descriptor, a TDes8 type, |
|
251 into which data can be returned. The format and meaning of any returned data |
|
252 is implementation dependent. |
|
253 @param aMessage Encapsulates a client request. */ |
|
254 IMPORT_C virtual void UpdateL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); |
|
255 public: |
|
256 void SetManager(MEikSrvNotifierManager* aManager); |
|
257 protected: |
|
258 MEikSrvNotifierManager* iManager; |
|
259 private: |
|
260 IMPORT_C virtual void MEikSrvNotifierBase2_Reserved_2(); |
|
261 public: // internal |
|
262 IMPORT_C virtual void HandleSystemEventL(TUid aEvent); |
|
263 IMPORT_C virtual TInt NotifierCapabilites(); |
|
264 private: |
|
265 TInt iNotBSpare; |
|
266 TInt iMEikSrvNotifierBase2_Spare; |
|
267 }; |
|
268 |
|
269 |
|
270 #endif // __EIKNOTAPI_H__ |