sl@0
|
1 |
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
|
sl@0
|
17 |
#ifndef __MMFCONTROLLERFRAMEWORK_H__
|
sl@0
|
18 |
#define __MMFCONTROLLERFRAMEWORK_H__
|
sl@0
|
19 |
|
sl@0
|
20 |
#include <e32base.h>
|
sl@0
|
21 |
#include <e32std.h>
|
sl@0
|
22 |
#include <f32file.h>
|
sl@0
|
23 |
#include <mmf/common/mmfutilities.h>
|
sl@0
|
24 |
#include <mmf/common/mmfcontrollerframeworkbase.h>
|
sl@0
|
25 |
#include <mmf/common/mmfipc.h>
|
sl@0
|
26 |
|
sl@0
|
27 |
// fwd ref
|
sl@0
|
28 |
class CMMFControllerImplementationInformation;
|
sl@0
|
29 |
class CLogonMonitor;
|
sl@0
|
30 |
|
sl@0
|
31 |
_LIT(KMMFControllerProxyServerName, "MMFControllerProxyServer-");
|
sl@0
|
32 |
|
sl@0
|
33 |
/**
|
sl@0
|
34 |
@publishedAll
|
sl@0
|
35 |
@released
|
sl@0
|
36 |
|
sl@0
|
37 |
Signals that the message is destined for the controller
|
sl@0
|
38 |
*/
|
sl@0
|
39 |
const TInt KMMFObjectHandleController = -2;
|
sl@0
|
40 |
|
sl@0
|
41 |
/**
|
sl@0
|
42 |
@publishedAll
|
sl@0
|
43 |
@released
|
sl@0
|
44 |
|
sl@0
|
45 |
Null, or invalid, object handle
|
sl@0
|
46 |
*/
|
sl@0
|
47 |
const TInt KMMFObjectHandleNull = 0;
|
sl@0
|
48 |
|
sl@0
|
49 |
/**
|
sl@0
|
50 |
@publishedAll
|
sl@0
|
51 |
@released
|
sl@0
|
52 |
|
sl@0
|
53 |
Describes the destination of a message in the controller framework.
|
sl@0
|
54 |
|
sl@0
|
55 |
The destination is defined by a UID describing the interface and an integer object handle.
|
sl@0
|
56 |
The controller framework uses this information when it receives a message to decide where
|
sl@0
|
57 |
to send the message.
|
sl@0
|
58 |
|
sl@0
|
59 |
The controller plugin and controller proxy use the special constant handles
|
sl@0
|
60 |
KMMFObjectHandleControllerProxy and KMMFObjectHandleController for
|
sl@0
|
61 |
efficiency.
|
sl@0
|
62 |
|
sl@0
|
63 |
@since 7.0s
|
sl@0
|
64 |
*/
|
sl@0
|
65 |
class TMMFMessageDestination
|
sl@0
|
66 |
{
|
sl@0
|
67 |
public:
|
sl@0
|
68 |
|
sl@0
|
69 |
/**
|
sl@0
|
70 |
Default constructor.
|
sl@0
|
71 |
|
sl@0
|
72 |
Assigns a null UID to the interface, and a null handle to the handle.
|
sl@0
|
73 |
|
sl@0
|
74 |
@since 7.0s
|
sl@0
|
75 |
*/
|
sl@0
|
76 |
IMPORT_C TMMFMessageDestination();
|
sl@0
|
77 |
|
sl@0
|
78 |
/**
|
sl@0
|
79 |
Constructor for sending messages to the controller plugin.
|
sl@0
|
80 |
|
sl@0
|
81 |
Assigns KMMFObjectHandleController to the destination handle.
|
sl@0
|
82 |
|
sl@0
|
83 |
@param aInterfaceId
|
sl@0
|
84 |
The UID of the interface of this message destination.
|
sl@0
|
85 |
|
sl@0
|
86 |
@since 7.0s
|
sl@0
|
87 |
*/
|
sl@0
|
88 |
IMPORT_C TMMFMessageDestination(TUid aInterfaceId);
|
sl@0
|
89 |
|
sl@0
|
90 |
/**
|
sl@0
|
91 |
Full constructor.
|
sl@0
|
92 |
|
sl@0
|
93 |
@param aInterfaceId
|
sl@0
|
94 |
The UID of the interface of this message destination.
|
sl@0
|
95 |
@param aDestinationHandle
|
sl@0
|
96 |
The handle of the destination object in the controller framework.
|
sl@0
|
97 |
|
sl@0
|
98 |
@since 7.0s
|
sl@0
|
99 |
*/
|
sl@0
|
100 |
IMPORT_C TMMFMessageDestination(TUid aInterfaceId, TInt aDestinationHandle);
|
sl@0
|
101 |
|
sl@0
|
102 |
/**
|
sl@0
|
103 |
Copy constructor.
|
sl@0
|
104 |
|
sl@0
|
105 |
@param aOther
|
sl@0
|
106 |
The TMMFMessageDestination object to be copied.
|
sl@0
|
107 |
|
sl@0
|
108 |
@since 7.0s
|
sl@0
|
109 |
*/
|
sl@0
|
110 |
IMPORT_C TMMFMessageDestination(const TMMFMessageDestination& aOther);
|
sl@0
|
111 |
|
sl@0
|
112 |
/**
|
sl@0
|
113 |
Returns the UID of the interface of the message destination.
|
sl@0
|
114 |
|
sl@0
|
115 |
@return The interface UID.
|
sl@0
|
116 |
|
sl@0
|
117 |
@since 7.0s
|
sl@0
|
118 |
*/
|
sl@0
|
119 |
IMPORT_C TUid InterfaceId() const;
|
sl@0
|
120 |
|
sl@0
|
121 |
/**
|
sl@0
|
122 |
Returns the handle of the destination object in the controller framework.
|
sl@0
|
123 |
|
sl@0
|
124 |
@return The destination handle.
|
sl@0
|
125 |
|
sl@0
|
126 |
@since 7.0s
|
sl@0
|
127 |
*/
|
sl@0
|
128 |
IMPORT_C TInt DestinationHandle() const;
|
sl@0
|
129 |
|
sl@0
|
130 |
/**
|
sl@0
|
131 |
Compares two destinations.
|
sl@0
|
132 |
|
sl@0
|
133 |
@param aOther
|
sl@0
|
134 |
The object to be compared with this object.
|
sl@0
|
135 |
|
sl@0
|
136 |
@return A boolean indicating if the objects are the same. ETrue if the objects are the same,
|
sl@0
|
137 |
EFalse if the objects are different.
|
sl@0
|
138 |
|
sl@0
|
139 |
@since 7.0s
|
sl@0
|
140 |
*/
|
sl@0
|
141 |
IMPORT_C TBool operator==(const TMMFMessageDestination& aOther) const;
|
sl@0
|
142 |
|
sl@0
|
143 |
private:
|
sl@0
|
144 |
TUid iInterfaceId;
|
sl@0
|
145 |
TInt iDestinationHandle;
|
sl@0
|
146 |
/**
|
sl@0
|
147 |
This member is internal and not intended for use.
|
sl@0
|
148 |
*/
|
sl@0
|
149 |
TInt iReserved1;
|
sl@0
|
150 |
TInt iReserved2;
|
sl@0
|
151 |
TInt iReserved3;
|
sl@0
|
152 |
};
|
sl@0
|
153 |
|
sl@0
|
154 |
/**
|
sl@0
|
155 |
@publishedAll
|
sl@0
|
156 |
@released
|
sl@0
|
157 |
|
sl@0
|
158 |
Package buffer for TMMFMessageDestination
|
sl@0
|
159 |
*/
|
sl@0
|
160 |
typedef TPckgBuf<TMMFMessageDestination> TMMFMessageDestinationPckg;
|
sl@0
|
161 |
|
sl@0
|
162 |
|
sl@0
|
163 |
/**
|
sl@0
|
164 |
@publishedAll
|
sl@0
|
165 |
@released
|
sl@0
|
166 |
|
sl@0
|
167 |
Encapsulation of an RMessage or an RMessage2 to provide protection to controller plugins
|
sl@0
|
168 |
from the changes occurring with secure APIs.
|
sl@0
|
169 |
|
sl@0
|
170 |
Adds required destination information to the message so the controller framework
|
sl@0
|
171 |
can determine which object the message is for.
|
sl@0
|
172 |
|
sl@0
|
173 |
Adds capability to check whether the message has been completed.
|
sl@0
|
174 |
|
sl@0
|
175 |
Allows two descriptors to be read from the client, and one descriptor to be copied to the client.
|
sl@0
|
176 |
|
sl@0
|
177 |
@see RMMFControllerProxy::SendSync
|
sl@0
|
178 |
@see RMMFControllerProxy::SendAsync
|
sl@0
|
179 |
|
sl@0
|
180 |
@since 7.0s
|
sl@0
|
181 |
*/
|
sl@0
|
182 |
class TMMFMessage
|
sl@0
|
183 |
{
|
sl@0
|
184 |
friend class CMMFControllerProxySession;
|
sl@0
|
185 |
friend class CMMFDevSoundSession;
|
sl@0
|
186 |
public:
|
sl@0
|
187 |
|
sl@0
|
188 |
/**
|
sl@0
|
189 |
Copy constructor.
|
sl@0
|
190 |
|
sl@0
|
191 |
A controller plugin should use this to take a copy of the message when it must wait for some
|
sl@0
|
192 |
other event before completing it.
|
sl@0
|
193 |
|
sl@0
|
194 |
@param aMessage
|
sl@0
|
195 |
The message object to copy.
|
sl@0
|
196 |
|
sl@0
|
197 |
@since 7.0s
|
sl@0
|
198 |
*/
|
sl@0
|
199 |
IMPORT_C TMMFMessage(const TMMFMessage& aMessage);
|
sl@0
|
200 |
|
sl@0
|
201 |
/**
|
sl@0
|
202 |
Returns the destination of the message.
|
sl@0
|
203 |
|
sl@0
|
204 |
@return The destination of the message, consisting of a UID defining the interface and the
|
sl@0
|
205 |
handle of the destination object.
|
sl@0
|
206 |
|
sl@0
|
207 |
@since 7.0s
|
sl@0
|
208 |
*/
|
sl@0
|
209 |
IMPORT_C const TMMFMessageDestination& Destination();
|
sl@0
|
210 |
|
sl@0
|
211 |
/**
|
sl@0
|
212 |
Returns an integer describing the function being called. Equivalent to
|
sl@0
|
213 |
RMessage::Function().
|
sl@0
|
214 |
|
sl@0
|
215 |
@return The function being called over IPC.
|
sl@0
|
216 |
|
sl@0
|
217 |
@see RMessage::Function()
|
sl@0
|
218 |
|
sl@0
|
219 |
@since 7.0s
|
sl@0
|
220 |
*/
|
sl@0
|
221 |
IMPORT_C TInt Function();
|
sl@0
|
222 |
|
sl@0
|
223 |
/**
|
sl@0
|
224 |
Returns the size of the first descriptor that can be copied over from the client.
|
sl@0
|
225 |
|
sl@0
|
226 |
Use this to create a descriptor of appropriate size before reading the data from the client.
|
sl@0
|
227 |
|
sl@0
|
228 |
@return The size of data 1.
|
sl@0
|
229 |
@since 7.0s
|
sl@0
|
230 |
*/
|
sl@0
|
231 |
IMPORT_C TInt SizeOfData1FromClient();
|
sl@0
|
232 |
|
sl@0
|
233 |
/**
|
sl@0
|
234 |
Copy the first descriptor from the client.
|
sl@0
|
235 |
|
sl@0
|
236 |
@param aDes
|
sl@0
|
237 |
A descriptor defining the area of memory into which the data from the client
|
sl@0
|
238 |
will be copied. Note, the descriptor must be of sufficient size.
|
sl@0
|
239 |
|
sl@0
|
240 |
@return One of the system-wide error codes. In particular, KErrBadDescriptor will be returned
|
sl@0
|
241 |
if the client did not provide a valid descriptor.
|
sl@0
|
242 |
|
sl@0
|
243 |
@since 7.0s
|
sl@0
|
244 |
*/
|
sl@0
|
245 |
IMPORT_C TInt ReadData1FromClient(TDes8& aDes);
|
sl@0
|
246 |
|
sl@0
|
247 |
/**
|
sl@0
|
248 |
Copy the first descriptor from the client.
|
sl@0
|
249 |
|
sl@0
|
250 |
This functino can leave with one of the system-wide error codes. In particular, the leave code
|
sl@0
|
251 |
KErrBadDescriptor will be used if the client did not provide a valid descriptor.
|
sl@0
|
252 |
|
sl@0
|
253 |
@param aDes
|
sl@0
|
254 |
A descriptor defining the area of memory into which the data from the client
|
sl@0
|
255 |
will be copied. Note, the descriptor must be of sufficient size.
|
sl@0
|
256 |
|
sl@0
|
257 |
@since 7.0s
|
sl@0
|
258 |
*/
|
sl@0
|
259 |
IMPORT_C void ReadData1FromClientL(TDes8& aDes);
|
sl@0
|
260 |
|
sl@0
|
261 |
|
sl@0
|
262 |
/**
|
sl@0
|
263 |
Returns the size of the second descriptor that can be copied over from the client.
|
sl@0
|
264 |
|
sl@0
|
265 |
Use this to create a descriptor of appropriate size before reading the data from the client.
|
sl@0
|
266 |
|
sl@0
|
267 |
@return The size of data 2.
|
sl@0
|
268 |
|
sl@0
|
269 |
@since 7.0s
|
sl@0
|
270 |
*/
|
sl@0
|
271 |
IMPORT_C TInt SizeOfData2FromClient();
|
sl@0
|
272 |
|
sl@0
|
273 |
/**
|
sl@0
|
274 |
Copies the second descriptor from the client.
|
sl@0
|
275 |
|
sl@0
|
276 |
@param aDes
|
sl@0
|
277 |
A descriptor defining the area of memory into which the data from the client
|
sl@0
|
278 |
will be copied. Note, the descriptor must be of sufficient size.
|
sl@0
|
279 |
|
sl@0
|
280 |
@return One of the system-wide error codes. In particular, KErrBadDescriptor will be returned
|
sl@0
|
281 |
if the client did not provide a valid descriptor.
|
sl@0
|
282 |
|
sl@0
|
283 |
@since 7.0s
|
sl@0
|
284 |
*/
|
sl@0
|
285 |
IMPORT_C TInt ReadData2FromClient(TDes8& aDes);
|
sl@0
|
286 |
|
sl@0
|
287 |
/**
|
sl@0
|
288 |
Copies the second descriptor from the client.
|
sl@0
|
289 |
|
sl@0
|
290 |
This function can leave with one of the system-wide error codes. In particular, the leave code
|
sl@0
|
291 |
KErrBadDescriptor will be used if the client did not provide a valid descriptor.
|
sl@0
|
292 |
|
sl@0
|
293 |
@param aDes
|
sl@0
|
294 |
A descriptor defining the area of memory into which the data from the client
|
sl@0
|
295 |
will be copied. Note, the descriptor must be of sufficient size.
|
sl@0
|
296 |
|
sl@0
|
297 |
@since 7.0s
|
sl@0
|
298 |
*/
|
sl@0
|
299 |
IMPORT_C void ReadData2FromClientL(TDes8& aDes);
|
sl@0
|
300 |
|
sl@0
|
301 |
/**
|
sl@0
|
302 |
Copies data back to the client.
|
sl@0
|
303 |
|
sl@0
|
304 |
@param aDes
|
sl@0
|
305 |
The data to be copied back to the client. Note that the client must
|
sl@0
|
306 |
have already created a descriptor of sufficient size for the data to be
|
sl@0
|
307 |
copied into.
|
sl@0
|
308 |
|
sl@0
|
309 |
@return One of the system-wide error codes. In particular, the error code KErrBadDescriptor will
|
sl@0
|
310 |
be returned if the client did not provide a valid descriptor.
|
sl@0
|
311 |
|
sl@0
|
312 |
@since 7.0s
|
sl@0
|
313 |
*/
|
sl@0
|
314 |
IMPORT_C TInt WriteDataToClient(const TDesC8& aDes);
|
sl@0
|
315 |
|
sl@0
|
316 |
/**
|
sl@0
|
317 |
Copies the data back to the client.
|
sl@0
|
318 |
|
sl@0
|
319 |
This function can leave with one of the system-wide error codes. In particular, the leave code
|
sl@0
|
320 |
KErrBadDescriptor will be used if the client did not provide a valid descriptor.
|
sl@0
|
321 |
|
sl@0
|
322 |
@param aDes
|
sl@0
|
323 |
The data to be copied back to the client. Note that the client must have already
|
sl@0
|
324 |
created a descriptor of sufficient size for the data to be copied into.
|
sl@0
|
325 |
|
sl@0
|
326 |
@since 7.0s
|
sl@0
|
327 |
*/
|
sl@0
|
328 |
IMPORT_C void WriteDataToClientL(const TDesC8& aDes);
|
sl@0
|
329 |
|
sl@0
|
330 |
/**
|
sl@0
|
331 |
Signals to the client that its request has been completed.
|
sl@0
|
332 |
|
sl@0
|
333 |
Equivalent to RMessage::Complete.
|
sl@0
|
334 |
|
sl@0
|
335 |
@param aReason
|
sl@0
|
336 |
The result code to be given back to the client.
|
sl@0
|
337 |
|
sl@0
|
338 |
@since 7.0s
|
sl@0
|
339 |
*/
|
sl@0
|
340 |
IMPORT_C void Complete(TInt aReason);
|
sl@0
|
341 |
|
sl@0
|
342 |
IMPORT_C void AdoptFileHandleFromClientL(TInt aFsHandleIndex, TInt aFileHandleIndex, RFile& aFile);
|
sl@0
|
343 |
|
sl@0
|
344 |
/**
|
sl@0
|
345 |
Checks whether this message has already been completed.
|
sl@0
|
346 |
|
sl@0
|
347 |
@return A boolean indicating if the message has been completed. ETrue if the message has been
|
sl@0
|
348 |
completed, EFalse if not.
|
sl@0
|
349 |
|
sl@0
|
350 |
@since 7.0s
|
sl@0
|
351 |
*/
|
sl@0
|
352 |
IMPORT_C TBool IsCompleted();
|
sl@0
|
353 |
|
sl@0
|
354 |
/**
|
sl@0
|
355 |
Constructs a TMMFMessage from an RMmfIpcMessage.
|
sl@0
|
356 |
|
sl@0
|
357 |
@param aMessage
|
sl@0
|
358 |
The handle to the remote message.
|
sl@0
|
359 |
|
sl@0
|
360 |
@since 7.0s
|
sl@0
|
361 |
*/
|
sl@0
|
362 |
IMPORT_C TMMFMessage(const RMmfIpcMessage& aMessage);
|
sl@0
|
363 |
|
sl@0
|
364 |
/**
|
sl@0
|
365 |
Gets the destination info from the client.
|
sl@0
|
366 |
|
sl@0
|
367 |
@since 7.0s
|
sl@0
|
368 |
*/
|
sl@0
|
369 |
IMPORT_C void FetchDestinationL();
|
sl@0
|
370 |
private:
|
sl@0
|
371 |
#ifdef __MMF_USE_IPC_V2__
|
sl@0
|
372 |
/**
|
sl@0
|
373 |
The encapsulated message
|
sl@0
|
374 |
*/
|
sl@0
|
375 |
RMessagePtr2 iMessage;
|
sl@0
|
376 |
/**
|
sl@0
|
377 |
The encapsulated function
|
sl@0
|
378 |
*/
|
sl@0
|
379 |
TInt iFunction;
|
sl@0
|
380 |
/**
|
sl@0
|
381 |
Private padding to preserve BC with earlier versions
|
sl@0
|
382 |
*/
|
sl@0
|
383 |
TInt iDummyPadding[6];
|
sl@0
|
384 |
#else
|
sl@0
|
385 |
/**
|
sl@0
|
386 |
The RMessage encapsulated by this object.
|
sl@0
|
387 |
*/
|
sl@0
|
388 |
RMessage iMessage;
|
sl@0
|
389 |
#endif // __MMF_USE_IPC_V2__
|
sl@0
|
390 |
|
sl@0
|
391 |
/**
|
sl@0
|
392 |
The destination of this message.
|
sl@0
|
393 |
*/
|
sl@0
|
394 |
TMMFMessageDestination iDestination;
|
sl@0
|
395 |
|
sl@0
|
396 |
/**
|
sl@0
|
397 |
Defines know about object completion state.
|
sl@0
|
398 |
*/
|
sl@0
|
399 |
TBool iAmCompleted;
|
sl@0
|
400 |
};
|
sl@0
|
401 |
|
sl@0
|
402 |
/**
|
sl@0
|
403 |
@publishedAll
|
sl@0
|
404 |
|
sl@0
|
405 |
Mixin class used by CLogonMonitor to inform about its state
|
sl@0
|
406 |
|
sl@0
|
407 |
@since 9.3
|
sl@0
|
408 |
*/
|
sl@0
|
409 |
class MLogonMonitorObserver
|
sl@0
|
410 |
{
|
sl@0
|
411 |
public:
|
sl@0
|
412 |
/**
|
sl@0
|
413 |
The monitored thread has been terminated.
|
sl@0
|
414 |
*/
|
sl@0
|
415 |
virtual void ThreadTerminated() = 0;
|
sl@0
|
416 |
};
|
sl@0
|
417 |
|
sl@0
|
418 |
/**
|
sl@0
|
419 |
@publishedAll
|
sl@0
|
420 |
|
sl@0
|
421 |
RSessionBase-based client class to handle the creation of the controller thread and
|
sl@0
|
422 |
message sending over IPC.
|
sl@0
|
423 |
|
sl@0
|
424 |
The controller proxy is responsible for sending and recieving messages over IPC; it does not
|
sl@0
|
425 |
care exactly what those messages are.
|
sl@0
|
426 |
|
sl@0
|
427 |
Note the fact that, although this is an internal component, its size cannot be changed because
|
sl@0
|
428 |
it's embedded in a publishedAll class (RMMFController) and the size of the latter would also be
|
sl@0
|
429 |
changed raising a binary compatibility problem.
|
sl@0
|
430 |
|
sl@0
|
431 |
@since 7.0s
|
sl@0
|
432 |
*/
|
sl@0
|
433 |
NONSHARABLE_CLASS(RMMFControllerProxy) : public RMmfSessionBase, public MLogonMonitorObserver
|
sl@0
|
434 |
{
|
sl@0
|
435 |
public:
|
sl@0
|
436 |
|
sl@0
|
437 |
/**
|
sl@0
|
438 |
Constructor.
|
sl@0
|
439 |
@since 7.0s
|
sl@0
|
440 |
*/
|
sl@0
|
441 |
IMPORT_C RMMFControllerProxy();
|
sl@0
|
442 |
|
sl@0
|
443 |
/**
|
sl@0
|
444 |
Create a new thread and load a controller plugin into that thread.
|
sl@0
|
445 |
|
sl@0
|
446 |
@param aControllerUid
|
sl@0
|
447 |
The UID of the controller plugin to be loaded.
|
sl@0
|
448 |
@param aUseSharedHeap
|
sl@0
|
449 |
If this value is EFalse each controller is created with its own heap. The alternative,
|
sl@0
|
450 |
if the value is ETrue, is that controllers share a special heap with other controllers
|
sl@0
|
451 |
created the same way. Each heap uses a chunk, so this avoids situations where the
|
sl@0
|
452 |
number of chunks per process is limited. The default behaviour is generally to be
|
sl@0
|
453 |
preferred, and should give lower overall memory usage. However, if many controllers are
|
sl@0
|
454 |
to be created for a particular thread, then ETrue should be provided to prevent running
|
sl@0
|
455 |
out of heaps or chunks.
|
sl@0
|
456 |
|
sl@0
|
457 |
@return One of the system-wide error codes.
|
sl@0
|
458 |
@since 7.0s
|
sl@0
|
459 |
*/
|
sl@0
|
460 |
IMPORT_C TInt LoadController(TUid aControllerUid, TBool aUseSharedHeap);
|
sl@0
|
461 |
|
sl@0
|
462 |
/**
|
sl@0
|
463 |
Create a new thread and load a controller plugin into that thread.
|
sl@0
|
464 |
|
sl@0
|
465 |
@param aControllerInfo
|
sl@0
|
466 |
A reference to a CMMFControllerImplementationInformation object
|
sl@0
|
467 |
used for determining the controller UID and heap size
|
sl@0
|
468 |
@param aUseSharedHeap
|
sl@0
|
469 |
If this value is EFalse each controller is created with its own heap. The alternative,
|
sl@0
|
470 |
if the value is ETrue, is that controllers share a special heap with other controllers
|
sl@0
|
471 |
created the same way. Each heap uses a chunk, so this avoids situations where the
|
sl@0
|
472 |
number of chunks per process is limited. The default behaviour is generally to be
|
sl@0
|
473 |
preferred, and should give lower overall memory usage. However, if many controllers are
|
sl@0
|
474 |
to be created for a particular thread, then ETrue should be provided to prevent running
|
sl@0
|
475 |
out of heaps or chunks.
|
sl@0
|
476 |
|
sl@0
|
477 |
@return One of the system-wide error codes.
|
sl@0
|
478 |
@since 7.0s
|
sl@0
|
479 |
*/
|
sl@0
|
480 |
IMPORT_C TInt LoadController(const CMMFControllerImplementationInformation& aControllerInfo, TBool aUseSharedHeap);
|
sl@0
|
481 |
|
sl@0
|
482 |
/**
|
sl@0
|
483 |
Create a new thread in another process through Secure DRM Plugin server and load a controller plugin
|
sl@0
|
484 |
into that thread. The motivation of this model is to allow applications without DRM capability able
|
sl@0
|
485 |
to play protected content through MMF.
|
sl@0
|
486 |
|
sl@0
|
487 |
@param aControllerUid
|
sl@0
|
488 |
The UID of the controller plugin to be loaded.
|
sl@0
|
489 |
@param aUseSharedHeap
|
sl@0
|
490 |
If this value is EFalse each controller is created with its own heap. The alternative,
|
sl@0
|
491 |
if the value is ETrue, is that controllers share a special heap with other controllers
|
sl@0
|
492 |
created the same way. Each heap uses a chunk, so this avoids situations where the
|
sl@0
|
493 |
number of chunks per process is limited. The default behaviour is generally to be
|
sl@0
|
494 |
preferred, and should give lower overall memory usage. However, if many controllers are
|
sl@0
|
495 |
to be created for a particular thread, then ETrue should be provided to prevent running
|
sl@0
|
496 |
out of heaps or chunks.
|
sl@0
|
497 |
|
sl@0
|
498 |
@return One of the system-wide error codes.
|
sl@0
|
499 |
*/
|
sl@0
|
500 |
IMPORT_C TInt LoadControllerInSecureDRMProcess(TUid aControllerUid, TBool aUseSharedHeap);
|
sl@0
|
501 |
|
sl@0
|
502 |
/**
|
sl@0
|
503 |
Create a new thread in another process through Secure DRM Plugin server and load a controller plugin
|
sl@0
|
504 |
into that thread. The motivation of this model is to allow applications without DRM capability able
|
sl@0
|
505 |
to play protected content through MMF.
|
sl@0
|
506 |
|
sl@0
|
507 |
@param aControllerInfo
|
sl@0
|
508 |
A reference to a CMMFControllerImplementationInformation object
|
sl@0
|
509 |
used for determining the controller UID and heap size
|
sl@0
|
510 |
@param aUseSharedHeap
|
sl@0
|
511 |
If this value is EFalse each controller is created with its own heap. The alternative,
|
sl@0
|
512 |
if the value is ETrue, is that controllers share a special heap with other controllers
|
sl@0
|
513 |
created the same way. Each heap uses a chunk, so this avoids situations where the
|
sl@0
|
514 |
number of chunks per process is limited. The default behaviour is generally to be
|
sl@0
|
515 |
preferred, and should give lower overall memory usage. However, if many controllers are
|
sl@0
|
516 |
to be created for a particular thread, then ETrue should be provided to prevent running
|
sl@0
|
517 |
out of heaps or chunks.
|
sl@0
|
518 |
|
sl@0
|
519 |
@return One of the system-wide error codes.
|
sl@0
|
520 |
*/
|
sl@0
|
521 |
IMPORT_C TInt LoadControllerInSecureDRMProcess(const CMMFControllerImplementationInformation& aControllerInfo, TBool aUseSharedHeap);
|
sl@0
|
522 |
|
sl@0
|
523 |
/**
|
sl@0
|
524 |
Delete the controller plugin and close its thread.
|
sl@0
|
525 |
|
sl@0
|
526 |
Clients must call Close() on the controller proxy, otherwise leaks will occur.
|
sl@0
|
527 |
|
sl@0
|
528 |
@since 7.0s
|
sl@0
|
529 |
*/
|
sl@0
|
530 |
IMPORT_C void Close();
|
sl@0
|
531 |
|
sl@0
|
532 |
/**
|
sl@0
|
533 |
Send a message synchronously to the controller thread.
|
sl@0
|
534 |
|
sl@0
|
535 |
The controller framework will analyze the message to determine its correct destination.
|
sl@0
|
536 |
|
sl@0
|
537 |
Note: This method will not return until the controller framework has serviced the command.
|
sl@0
|
538 |
|
sl@0
|
539 |
@param aDestination
|
sl@0
|
540 |
The destination of the message, consisting of the uid of
|
sl@0
|
541 |
the interface of this message.
|
sl@0
|
542 |
@param aFunction
|
sl@0
|
543 |
The function number to indicate which function is to be called
|
sl@0
|
544 |
on the interface defined in the aDestination parameter.
|
sl@0
|
545 |
@param aDataTo1
|
sl@0
|
546 |
A reference to the first chunk of data to be copied to the controller
|
sl@0
|
547 |
framework. The exact contents of the data are dependent on the
|
sl@0
|
548 |
interface being called. Can be NULL.
|
sl@0
|
549 |
@param aDataTo2
|
sl@0
|
550 |
A reference to the second chunk of data to be copied to the controller
|
sl@0
|
551 |
framework. The exact contents of the data are dependent on the
|
sl@0
|
552 |
interface being called. Can be NULL.
|
sl@0
|
553 |
@param aDataFrom
|
sl@0
|
554 |
A reference to an area of memory to which the controller framework will
|
sl@0
|
555 |
write any data to be passed back to the client. Can't be NULL.
|
sl@0
|
556 |
|
sl@0
|
557 |
@return The result of the request. Exact range of values is dependent on the interface.
|
sl@0
|
558 |
@since 7.0s
|
sl@0
|
559 |
*/
|
sl@0
|
560 |
IMPORT_C TInt SendSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom) const;
|
sl@0
|
561 |
|
sl@0
|
562 |
/**
|
sl@0
|
563 |
Send a message synchronously to the controller thread.
|
sl@0
|
564 |
|
sl@0
|
565 |
The controller framework will analyze the message to determine its correct destination.
|
sl@0
|
566 |
|
sl@0
|
567 |
Note: This method will not return until the controller framework has serviced the command.
|
sl@0
|
568 |
|
sl@0
|
569 |
@param aDestination
|
sl@0
|
570 |
The destination of the message, consisting of the uid of
|
sl@0
|
571 |
the interface of this message.
|
sl@0
|
572 |
@param aFunction
|
sl@0
|
573 |
The function number to indicate which function is to be called
|
sl@0
|
574 |
on the interface defined in the aDestination parameter.
|
sl@0
|
575 |
@param aDataTo1
|
sl@0
|
576 |
A reference to the first chunk of data to be copied to the controller
|
sl@0
|
577 |
framework. The exact contents of the data are dependent on the
|
sl@0
|
578 |
interface being called. Can be NULL.
|
sl@0
|
579 |
@param aDataTo2
|
sl@0
|
580 |
A reference to the second chunk of data to be copied to the controller
|
sl@0
|
581 |
framework. The exact contents of the data are dependent on the
|
sl@0
|
582 |
interface being called. Can be NULL.
|
sl@0
|
583 |
|
sl@0
|
584 |
@return The result of the request. Exact range of values is dependent on the interface.
|
sl@0
|
585 |
@since 7.0s
|
sl@0
|
586 |
*/
|
sl@0
|
587 |
IMPORT_C TInt SendSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2) const;
|
sl@0
|
588 |
|
sl@0
|
589 |
/**
|
sl@0
|
590 |
Send a message asynchronously to the controller thread.
|
sl@0
|
591 |
|
sl@0
|
592 |
The controller framework will analyze the message to determine its correct destination.
|
sl@0
|
593 |
|
sl@0
|
594 |
Note: This method will return immediately. The RunL of the active object owning the
|
sl@0
|
595 |
aStatus parameter will be called when the command is completed by the
|
sl@0
|
596 |
controller framework.
|
sl@0
|
597 |
|
sl@0
|
598 |
@param aDestination
|
sl@0
|
599 |
The destination of the message, consisting of the uid of
|
sl@0
|
600 |
the interface of this message.
|
sl@0
|
601 |
@param aFunction
|
sl@0
|
602 |
The function number to indicate which function is to be called
|
sl@0
|
603 |
on the interface defined in the aDestination parameter.
|
sl@0
|
604 |
@param aDataTo1
|
sl@0
|
605 |
A reference to the first chunk of data to be copied to the controller
|
sl@0
|
606 |
framework. The exact contents of the data are dependent on the
|
sl@0
|
607 |
interface being called. Can be NULL.
|
sl@0
|
608 |
@param aDataTo2
|
sl@0
|
609 |
A reference to the second chunk of data to be copied to the controller
|
sl@0
|
610 |
framework. The exact contents of the data are dependent on the
|
sl@0
|
611 |
interface being called. Can be NULL.
|
sl@0
|
612 |
@param aDataFrom
|
sl@0
|
613 |
A reference to an area of memory to which the controller framework will
|
sl@0
|
614 |
write any data to be passed back to the client. Can't be NULL.
|
sl@0
|
615 |
@param aStatus
|
sl@0
|
616 |
The TRequestStatus of an active object. This will contain the
|
sl@0
|
617 |
result of the request on completion. The exact range of
|
sl@0
|
618 |
result values is dependent on the interface.
|
sl@0
|
619 |
|
sl@0
|
620 |
@since 7.0s
|
sl@0
|
621 |
*/
|
sl@0
|
622 |
IMPORT_C void SendAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus) const;
|
sl@0
|
623 |
|
sl@0
|
624 |
/**
|
sl@0
|
625 |
Send a message asynchronously to the controller thread.
|
sl@0
|
626 |
|
sl@0
|
627 |
The controller framework will analyze the message to determine its correct destination.
|
sl@0
|
628 |
|
sl@0
|
629 |
Note: This method will return immediately. The RunL of the active object owning the
|
sl@0
|
630 |
aStatus parameter will be called when the command is completed by the
|
sl@0
|
631 |
controller framework.
|
sl@0
|
632 |
|
sl@0
|
633 |
@param aDestination
|
sl@0
|
634 |
The destination of the message, consisting of the uid of
|
sl@0
|
635 |
the interface of this message.
|
sl@0
|
636 |
@param aFunction
|
sl@0
|
637 |
The function number to indicate which function is to be called
|
sl@0
|
638 |
on the interface defined in the aDestination parameter.
|
sl@0
|
639 |
@param aDataTo1
|
sl@0
|
640 |
A reference to the first chunk of data to be copied to the controller
|
sl@0
|
641 |
framework. The exact contents of the data are dependent on the
|
sl@0
|
642 |
interface being called. Can be NULL.
|
sl@0
|
643 |
@param aDataTo2
|
sl@0
|
644 |
A reference to the second chunk of data to be copied to the controller
|
sl@0
|
645 |
framework. The exact contents of the data are dependent on the
|
sl@0
|
646 |
interface being called. Can be NULL.
|
sl@0
|
647 |
@param aStatus
|
sl@0
|
648 |
The TRequestStatus of an active object. This will contain the
|
sl@0
|
649 |
result of the request on completion. The exact range of
|
sl@0
|
650 |
result values is dependent on the interface.
|
sl@0
|
651 |
|
sl@0
|
652 |
@since 7.0s
|
sl@0
|
653 |
*/
|
sl@0
|
654 |
IMPORT_C void SendAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus) const;
|
sl@0
|
655 |
|
sl@0
|
656 |
IMPORT_C TInt SendSync(TInt aFunction, const TIpcArgs& aIpcArgs) const;
|
sl@0
|
657 |
IMPORT_C void SendAsync(TInt aFunction, const TIpcArgs& aIpcArgs, TRequestStatus& aStatus) const;
|
sl@0
|
658 |
/**
|
sl@0
|
659 |
Register to receive events from the controller framework.
|
sl@0
|
660 |
|
sl@0
|
661 |
Events can be generated at any time, and are generally associated with things that occur
|
sl@0
|
662 |
due to something happening internally within the controller. For example, an event will
|
sl@0
|
663 |
be generated if the controller stops playing due to reaching the end of a file.
|
sl@0
|
664 |
|
sl@0
|
665 |
@param aEvent
|
sl@0
|
666 |
A reference to a TMMFEventPckg object that must be member data
|
sl@0
|
667 |
of the active object calling this method. The details of the event
|
sl@0
|
668 |
will be copied into this object when an event occurs.
|
sl@0
|
669 |
@param aStatus
|
sl@0
|
670 |
The TRequestStatus of the active object calling this method.
|
sl@0
|
671 |
|
sl@0
|
672 |
@see TMMFEvent
|
sl@0
|
673 |
@see CMMFControllerEventMonitor
|
sl@0
|
674 |
@since 7.0s
|
sl@0
|
675 |
*/
|
sl@0
|
676 |
IMPORT_C void ReceiveEvents(TMMFEventPckg& aEvent, TRequestStatus& aStatus);
|
sl@0
|
677 |
|
sl@0
|
678 |
/**
|
sl@0
|
679 |
Cancel a previous registration to receive events from the controller framework.
|
sl@0
|
680 |
|
sl@0
|
681 |
This must be called from the DoCancel() method of the active object using the
|
sl@0
|
682 |
ReceiveEvents() API.
|
sl@0
|
683 |
|
sl@0
|
684 |
@return One of the standard system-wide error codes.
|
sl@0
|
685 |
|
sl@0
|
686 |
@see TMMFEvent
|
sl@0
|
687 |
@since 7.0s
|
sl@0
|
688 |
*/
|
sl@0
|
689 |
IMPORT_C TInt CancelReceiveEvents();
|
sl@0
|
690 |
|
sl@0
|
691 |
/**
|
sl@0
|
692 |
Set the priority of the controller's sub thread.
|
sl@0
|
693 |
|
sl@0
|
694 |
This can be used to increase the responsiveness of the audio plugin to minimise
|
sl@0
|
695 |
any lag in processing. This function should be used with care as it may have knock-on
|
sl@0
|
696 |
effects elsewhere in the system.
|
sl@0
|
697 |
|
sl@0
|
698 |
@param aPriority
|
sl@0
|
699 |
The TThreadPriority that the thread should run under. The default is EPriorityNormal.
|
sl@0
|
700 |
@return TInt
|
sl@0
|
701 |
A standard error code: KErrNone if successful, KErrNotReady if the thread does not have a
|
sl@0
|
702 |
valid handle.
|
sl@0
|
703 |
*/
|
sl@0
|
704 |
IMPORT_C TInt SetThreadPriority(const TThreadPriority& aPriority) const;
|
sl@0
|
705 |
|
sl@0
|
706 |
/**
|
sl@0
|
707 |
The controller subthread has been terminated.
|
sl@0
|
708 |
|
sl@0
|
709 |
This is called by CLogonMonitor when the the thread terminates
|
sl@0
|
710 |
*/
|
sl@0
|
711 |
void ThreadTerminated();
|
sl@0
|
712 |
private:
|
sl@0
|
713 |
/**
|
sl@0
|
714 |
Creates the new thread
|
sl@0
|
715 |
*/
|
sl@0
|
716 |
TInt DoCreateSubThread(RServer2* aServer2, TUint aMaxHeapSize, TBool aUseSharedHeap, TUint aStackSize);
|
sl@0
|
717 |
|
sl@0
|
718 |
/**
|
sl@0
|
719 |
Determines the maximum heap size required by the selected controller
|
sl@0
|
720 |
*/
|
sl@0
|
721 |
TUint ControllersMaxHeapSizeL(TUid aControllerUid);
|
sl@0
|
722 |
|
sl@0
|
723 |
/**
|
sl@0
|
724 |
Load a controller by UID
|
sl@0
|
725 |
|
sl@0
|
726 |
@param aControllerUid
|
sl@0
|
727 |
The UID of the controller plugin to be loaded.
|
sl@0
|
728 |
@param aControllerInfo
|
sl@0
|
729 |
A reference to a CMMFControllerImplementationInformation object
|
sl@0
|
730 |
used for determining the heap size and DRM server supporting state.
|
sl@0
|
731 |
@param aUseSharedHeap
|
sl@0
|
732 |
If this value is EFalse each controller is created with its own heap. The alternative,
|
sl@0
|
733 |
if the value is ETrue, is that controllers share a special heap with other controllers
|
sl@0
|
734 |
created the same way. Each heap uses a chunk, so this avoids situations where the
|
sl@0
|
735 |
number of chunks per process is limited. The default behaviour is generally to be
|
sl@0
|
736 |
preferred, and should give lower overall memory usage. However, if many controllers are
|
sl@0
|
737 |
to be created for a particular thread, then ETrue should be provided to prevent running
|
sl@0
|
738 |
out of heaps or chunks.
|
sl@0
|
739 |
@param aNoDRMCap
|
sl@0
|
740 |
The indicator supplied from user used to determine whether the user's process has DRM
|
sl@0
|
741 |
capability
|
sl@0
|
742 |
@return TInt
|
sl@0
|
743 |
One of the system-wide error codes.
|
sl@0
|
744 |
*/
|
sl@0
|
745 |
TInt LoadController(TUid aControllerUid, const CMMFControllerImplementationInformation& aControllerInfo, TBool aUseSharedHeap,
|
sl@0
|
746 |
TBool aNoDRMCap = EFalse);
|
sl@0
|
747 |
|
sl@0
|
748 |
/**
|
sl@0
|
749 |
Release heap - for use when a shared heap has been registered
|
sl@0
|
750 |
*/
|
sl@0
|
751 |
void ReleaseHeap();
|
sl@0
|
752 |
|
sl@0
|
753 |
/**
|
sl@0
|
754 |
Create a session to handle situation of playing DRM protected content in
|
sl@0
|
755 |
process with no DRM capability.
|
sl@0
|
756 |
DRM server process will be created, if not yet created. This server is responsible to
|
sl@0
|
757 |
manage and monitor all the MMF Controller servers created as seperate threads belong to
|
sl@0
|
758 |
DRM server process. Once the new MMF Controller server is running, a MMF Controller server
|
sl@0
|
759 |
session will be created and the handle is passing back.
|
sl@0
|
760 |
*/
|
sl@0
|
761 |
TInt DoCreateSessionForNoDRMCapClient(TUint aMaxHeapSize, TBool aUseSharedHeap, TUint aStackSize);
|
sl@0
|
762 |
|
sl@0
|
763 |
private:
|
sl@0
|
764 |
enum
|
sl@0
|
765 |
{
|
sl@0
|
766 |
/**
|
sl@0
|
767 |
Shared heap has been opened for this object, and must be closed
|
sl@0
|
768 |
*/
|
sl@0
|
769 |
EFlagOpenedSharedHeap=0x01
|
sl@0
|
770 |
};
|
sl@0
|
771 |
|
sl@0
|
772 |
private:
|
sl@0
|
773 |
/**
|
sl@0
|
774 |
The thread in which the controller plugin will run.
|
sl@0
|
775 |
*/
|
sl@0
|
776 |
RThread iSubThread;
|
sl@0
|
777 |
/**
|
sl@0
|
778 |
Used to hold destination for messages from the controller proxy
|
sl@0
|
779 |
(not from clients calling SendSync/SendAsync!!)
|
sl@0
|
780 |
*/
|
sl@0
|
781 |
TMMFMessageDestinationPckg iDestinationPckg;
|
sl@0
|
782 |
/**
|
sl@0
|
783 |
Used to determine the success of a logon. If the status is not pending, the logon has failed
|
sl@0
|
784 |
and the thread should be closed.
|
sl@0
|
785 |
*/
|
sl@0
|
786 |
CLogonMonitor* iLogonAO;
|
sl@0
|
787 |
/**
|
sl@0
|
788 |
The priority at which the controller plugin thread runs.
|
sl@0
|
789 |
*/
|
sl@0
|
790 |
TThreadPriority iThreadPriority;
|
sl@0
|
791 |
/**
|
sl@0
|
792 |
Flags field
|
sl@0
|
793 |
*/
|
sl@0
|
794 |
TInt iFlags;
|
sl@0
|
795 |
/**
|
sl@0
|
796 |
This member is internal and not intended for use.
|
sl@0
|
797 |
*/
|
sl@0
|
798 |
TInt iReserved1;
|
sl@0
|
799 |
};
|
sl@0
|
800 |
|
sl@0
|
801 |
/**
|
sl@0
|
802 |
@publishedAll
|
sl@0
|
803 |
@released
|
sl@0
|
804 |
|
sl@0
|
805 |
Mixin class to define an object capable of handling an event within the controller framework.
|
sl@0
|
806 |
*/
|
sl@0
|
807 |
class MAsyncEventHandler
|
sl@0
|
808 |
{
|
sl@0
|
809 |
public:
|
sl@0
|
810 |
|
sl@0
|
811 |
/**
|
sl@0
|
812 |
Sends an event to the client.
|
sl@0
|
813 |
|
sl@0
|
814 |
@param aEvent
|
sl@0
|
815 |
The event.
|
sl@0
|
816 |
|
sl@0
|
817 |
@since 7.0s
|
sl@0
|
818 |
*/
|
sl@0
|
819 |
virtual TInt SendEventToClient(const TMMFEvent& aEvent) = 0;
|
sl@0
|
820 |
};
|
sl@0
|
821 |
|
sl@0
|
822 |
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
|
sl@0
|
823 |
#include <mmf/common/mmfcontrollerframeworkclasses.h>
|
sl@0
|
824 |
#endif
|
sl@0
|
825 |
|
sl@0
|
826 |
#endif
|