1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/inc/mmf/ControllerFramework/mmfcontrollerframework.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,826 @@
1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +
1.20 +#ifndef __MMFCONTROLLERFRAMEWORK_H__
1.21 +#define __MMFCONTROLLERFRAMEWORK_H__
1.22 +
1.23 +#include <e32base.h>
1.24 +#include <e32std.h>
1.25 +#include <f32file.h>
1.26 +#include <mmf/common/mmfutilities.h>
1.27 +#include <mmf/common/mmfcontrollerframeworkbase.h>
1.28 +#include <mmf/common/mmfipc.h>
1.29 +
1.30 +// fwd ref
1.31 +class CMMFControllerImplementationInformation;
1.32 +class CLogonMonitor;
1.33 +
1.34 +_LIT(KMMFControllerProxyServerName, "MMFControllerProxyServer-");
1.35 +
1.36 +/**
1.37 +@publishedAll
1.38 +@released
1.39 +
1.40 +Signals that the message is destined for the controller
1.41 +*/
1.42 +const TInt KMMFObjectHandleController = -2;
1.43 +
1.44 +/**
1.45 +@publishedAll
1.46 +@released
1.47 +
1.48 +Null, or invalid, object handle
1.49 +*/
1.50 +const TInt KMMFObjectHandleNull = 0;
1.51 +
1.52 +/**
1.53 +@publishedAll
1.54 +@released
1.55 +
1.56 +Describes the destination of a message in the controller framework.
1.57 +
1.58 +The destination is defined by a UID describing the interface and an integer object handle.
1.59 +The controller framework uses this information when it receives a message to decide where
1.60 +to send the message.
1.61 +
1.62 +The controller plugin and controller proxy use the special constant handles
1.63 +KMMFObjectHandleControllerProxy and KMMFObjectHandleController for
1.64 +efficiency.
1.65 +
1.66 +@since 7.0s
1.67 +*/
1.68 +class TMMFMessageDestination
1.69 + {
1.70 +public:
1.71 +
1.72 + /**
1.73 + Default constructor.
1.74 +
1.75 + Assigns a null UID to the interface, and a null handle to the handle.
1.76 +
1.77 + @since 7.0s
1.78 + */
1.79 + IMPORT_C TMMFMessageDestination();
1.80 +
1.81 + /**
1.82 + Constructor for sending messages to the controller plugin.
1.83 +
1.84 + Assigns KMMFObjectHandleController to the destination handle.
1.85 +
1.86 + @param aInterfaceId
1.87 + The UID of the interface of this message destination.
1.88 +
1.89 + @since 7.0s
1.90 + */
1.91 + IMPORT_C TMMFMessageDestination(TUid aInterfaceId);
1.92 +
1.93 + /**
1.94 + Full constructor.
1.95 +
1.96 + @param aInterfaceId
1.97 + The UID of the interface of this message destination.
1.98 + @param aDestinationHandle
1.99 + The handle of the destination object in the controller framework.
1.100 +
1.101 + @since 7.0s
1.102 + */
1.103 + IMPORT_C TMMFMessageDestination(TUid aInterfaceId, TInt aDestinationHandle);
1.104 +
1.105 + /**
1.106 + Copy constructor.
1.107 +
1.108 + @param aOther
1.109 + The TMMFMessageDestination object to be copied.
1.110 +
1.111 + @since 7.0s
1.112 + */
1.113 + IMPORT_C TMMFMessageDestination(const TMMFMessageDestination& aOther);
1.114 +
1.115 + /**
1.116 + Returns the UID of the interface of the message destination.
1.117 +
1.118 + @return The interface UID.
1.119 +
1.120 + @since 7.0s
1.121 + */
1.122 + IMPORT_C TUid InterfaceId() const;
1.123 +
1.124 + /**
1.125 + Returns the handle of the destination object in the controller framework.
1.126 +
1.127 + @return The destination handle.
1.128 +
1.129 + @since 7.0s
1.130 + */
1.131 + IMPORT_C TInt DestinationHandle() const;
1.132 +
1.133 + /**
1.134 + Compares two destinations.
1.135 +
1.136 + @param aOther
1.137 + The object to be compared with this object.
1.138 +
1.139 + @return A boolean indicating if the objects are the same. ETrue if the objects are the same,
1.140 + EFalse if the objects are different.
1.141 +
1.142 + @since 7.0s
1.143 + */
1.144 + IMPORT_C TBool operator==(const TMMFMessageDestination& aOther) const;
1.145 +
1.146 +private:
1.147 + TUid iInterfaceId;
1.148 + TInt iDestinationHandle;
1.149 + /**
1.150 + This member is internal and not intended for use.
1.151 + */
1.152 + TInt iReserved1;
1.153 + TInt iReserved2;
1.154 + TInt iReserved3;
1.155 + };
1.156 +
1.157 +/**
1.158 +@publishedAll
1.159 +@released
1.160 +
1.161 +Package buffer for TMMFMessageDestination
1.162 +*/
1.163 +typedef TPckgBuf<TMMFMessageDestination> TMMFMessageDestinationPckg;
1.164 +
1.165 +
1.166 +/**
1.167 +@publishedAll
1.168 +@released
1.169 +
1.170 +Encapsulation of an RMessage or an RMessage2 to provide protection to controller plugins
1.171 +from the changes occurring with secure APIs.
1.172 +
1.173 +Adds required destination information to the message so the controller framework
1.174 +can determine which object the message is for.
1.175 +
1.176 +Adds capability to check whether the message has been completed.
1.177 +
1.178 +Allows two descriptors to be read from the client, and one descriptor to be copied to the client.
1.179 +
1.180 +@see RMMFControllerProxy::SendSync
1.181 +@see RMMFControllerProxy::SendAsync
1.182 +
1.183 +@since 7.0s
1.184 +*/
1.185 +class TMMFMessage
1.186 + {
1.187 +friend class CMMFControllerProxySession;
1.188 +friend class CMMFDevSoundSession;
1.189 +public:
1.190 +
1.191 + /**
1.192 + Copy constructor.
1.193 +
1.194 + A controller plugin should use this to take a copy of the message when it must wait for some
1.195 + other event before completing it.
1.196 +
1.197 + @param aMessage
1.198 + The message object to copy.
1.199 +
1.200 + @since 7.0s
1.201 + */
1.202 + IMPORT_C TMMFMessage(const TMMFMessage& aMessage);
1.203 +
1.204 + /**
1.205 + Returns the destination of the message.
1.206 +
1.207 + @return The destination of the message, consisting of a UID defining the interface and the
1.208 + handle of the destination object.
1.209 +
1.210 + @since 7.0s
1.211 + */
1.212 + IMPORT_C const TMMFMessageDestination& Destination();
1.213 +
1.214 + /**
1.215 + Returns an integer describing the function being called. Equivalent to
1.216 + RMessage::Function().
1.217 +
1.218 + @return The function being called over IPC.
1.219 +
1.220 + @see RMessage::Function()
1.221 +
1.222 + @since 7.0s
1.223 + */
1.224 + IMPORT_C TInt Function();
1.225 +
1.226 + /**
1.227 + Returns the size of the first descriptor that can be copied over from the client.
1.228 +
1.229 + Use this to create a descriptor of appropriate size before reading the data from the client.
1.230 +
1.231 + @return The size of data 1.
1.232 + @since 7.0s
1.233 + */
1.234 + IMPORT_C TInt SizeOfData1FromClient();
1.235 +
1.236 + /**
1.237 + Copy the first descriptor from the client.
1.238 +
1.239 + @param aDes
1.240 + A descriptor defining the area of memory into which the data from the client
1.241 + will be copied. Note, the descriptor must be of sufficient size.
1.242 +
1.243 + @return One of the system-wide error codes. In particular, KErrBadDescriptor will be returned
1.244 + if the client did not provide a valid descriptor.
1.245 +
1.246 + @since 7.0s
1.247 + */
1.248 + IMPORT_C TInt ReadData1FromClient(TDes8& aDes);
1.249 +
1.250 + /**
1.251 + Copy the first descriptor from the client.
1.252 +
1.253 + This functino can leave with one of the system-wide error codes. In particular, the leave code
1.254 + KErrBadDescriptor will be used if the client did not provide a valid descriptor.
1.255 +
1.256 + @param aDes
1.257 + A descriptor defining the area of memory into which the data from the client
1.258 + will be copied. Note, the descriptor must be of sufficient size.
1.259 +
1.260 + @since 7.0s
1.261 + */
1.262 + IMPORT_C void ReadData1FromClientL(TDes8& aDes);
1.263 +
1.264 +
1.265 + /**
1.266 + Returns the size of the second descriptor that can be copied over from the client.
1.267 +
1.268 + Use this to create a descriptor of appropriate size before reading the data from the client.
1.269 +
1.270 + @return The size of data 2.
1.271 +
1.272 + @since 7.0s
1.273 + */
1.274 + IMPORT_C TInt SizeOfData2FromClient();
1.275 +
1.276 + /**
1.277 + Copies the second descriptor from the client.
1.278 +
1.279 + @param aDes
1.280 + A descriptor defining the area of memory into which the data from the client
1.281 + will be copied. Note, the descriptor must be of sufficient size.
1.282 +
1.283 + @return One of the system-wide error codes. In particular, KErrBadDescriptor will be returned
1.284 + if the client did not provide a valid descriptor.
1.285 +
1.286 + @since 7.0s
1.287 + */
1.288 + IMPORT_C TInt ReadData2FromClient(TDes8& aDes);
1.289 +
1.290 + /**
1.291 + Copies the second descriptor from the client.
1.292 +
1.293 + This function can leave with one of the system-wide error codes. In particular, the leave code
1.294 + KErrBadDescriptor will be used if the client did not provide a valid descriptor.
1.295 +
1.296 + @param aDes
1.297 + A descriptor defining the area of memory into which the data from the client
1.298 + will be copied. Note, the descriptor must be of sufficient size.
1.299 +
1.300 + @since 7.0s
1.301 + */
1.302 + IMPORT_C void ReadData2FromClientL(TDes8& aDes);
1.303 +
1.304 + /**
1.305 + Copies data back to the client.
1.306 +
1.307 + @param aDes
1.308 + The data to be copied back to the client. Note that the client must
1.309 + have already created a descriptor of sufficient size for the data to be
1.310 + copied into.
1.311 +
1.312 + @return One of the system-wide error codes. In particular, the error code KErrBadDescriptor will
1.313 + be returned if the client did not provide a valid descriptor.
1.314 +
1.315 + @since 7.0s
1.316 + */
1.317 + IMPORT_C TInt WriteDataToClient(const TDesC8& aDes);
1.318 +
1.319 + /**
1.320 + Copies the data back to the client.
1.321 +
1.322 + This function can leave with one of the system-wide error codes. In particular, the leave code
1.323 + KErrBadDescriptor will be used if the client did not provide a valid descriptor.
1.324 +
1.325 + @param aDes
1.326 + The data to be copied back to the client. Note that the client must have already
1.327 + created a descriptor of sufficient size for the data to be copied into.
1.328 +
1.329 + @since 7.0s
1.330 + */
1.331 + IMPORT_C void WriteDataToClientL(const TDesC8& aDes);
1.332 +
1.333 + /**
1.334 + Signals to the client that its request has been completed.
1.335 +
1.336 + Equivalent to RMessage::Complete.
1.337 +
1.338 + @param aReason
1.339 + The result code to be given back to the client.
1.340 +
1.341 + @since 7.0s
1.342 + */
1.343 + IMPORT_C void Complete(TInt aReason);
1.344 +
1.345 + IMPORT_C void AdoptFileHandleFromClientL(TInt aFsHandleIndex, TInt aFileHandleIndex, RFile& aFile);
1.346 +
1.347 + /**
1.348 + Checks whether this message has already been completed.
1.349 +
1.350 + @return A boolean indicating if the message has been completed. ETrue if the message has been
1.351 + completed, EFalse if not.
1.352 +
1.353 + @since 7.0s
1.354 + */
1.355 + IMPORT_C TBool IsCompleted();
1.356 +
1.357 + /**
1.358 + Constructs a TMMFMessage from an RMmfIpcMessage.
1.359 +
1.360 + @param aMessage
1.361 + The handle to the remote message.
1.362 +
1.363 + @since 7.0s
1.364 + */
1.365 + IMPORT_C TMMFMessage(const RMmfIpcMessage& aMessage);
1.366 +
1.367 + /**
1.368 + Gets the destination info from the client.
1.369 +
1.370 + @since 7.0s
1.371 + */
1.372 + IMPORT_C void FetchDestinationL();
1.373 +private:
1.374 +#ifdef __MMF_USE_IPC_V2__
1.375 + /**
1.376 + The encapsulated message
1.377 + */
1.378 + RMessagePtr2 iMessage;
1.379 + /**
1.380 + The encapsulated function
1.381 + */
1.382 + TInt iFunction;
1.383 + /**
1.384 + Private padding to preserve BC with earlier versions
1.385 + */
1.386 + TInt iDummyPadding[6];
1.387 +#else
1.388 + /**
1.389 + The RMessage encapsulated by this object.
1.390 + */
1.391 + RMessage iMessage;
1.392 +#endif // __MMF_USE_IPC_V2__
1.393 +
1.394 + /**
1.395 + The destination of this message.
1.396 + */
1.397 + TMMFMessageDestination iDestination;
1.398 +
1.399 + /**
1.400 + Defines know about object completion state.
1.401 + */
1.402 + TBool iAmCompleted;
1.403 + };
1.404 +
1.405 +/**
1.406 +@publishedAll
1.407 +
1.408 +Mixin class used by CLogonMonitor to inform about its state
1.409 +
1.410 +@since 9.3
1.411 +*/
1.412 +class MLogonMonitorObserver
1.413 + {
1.414 +public:
1.415 + /**
1.416 + The monitored thread has been terminated.
1.417 + */
1.418 + virtual void ThreadTerminated() = 0;
1.419 + };
1.420 +
1.421 +/**
1.422 +@publishedAll
1.423 +
1.424 +RSessionBase-based client class to handle the creation of the controller thread and
1.425 +message sending over IPC.
1.426 +
1.427 +The controller proxy is responsible for sending and recieving messages over IPC; it does not
1.428 +care exactly what those messages are.
1.429 +
1.430 +Note the fact that, although this is an internal component, its size cannot be changed because
1.431 +it's embedded in a publishedAll class (RMMFController) and the size of the latter would also be
1.432 +changed raising a binary compatibility problem.
1.433 +
1.434 +@since 7.0s
1.435 +*/
1.436 +NONSHARABLE_CLASS(RMMFControllerProxy) : public RMmfSessionBase, public MLogonMonitorObserver
1.437 + {
1.438 +public:
1.439 +
1.440 + /**
1.441 + Constructor.
1.442 + @since 7.0s
1.443 + */
1.444 + IMPORT_C RMMFControllerProxy();
1.445 +
1.446 + /**
1.447 + Create a new thread and load a controller plugin into that thread.
1.448 +
1.449 + @param aControllerUid
1.450 + The UID of the controller plugin to be loaded.
1.451 + @param aUseSharedHeap
1.452 + If this value is EFalse each controller is created with its own heap. The alternative,
1.453 + if the value is ETrue, is that controllers share a special heap with other controllers
1.454 + created the same way. Each heap uses a chunk, so this avoids situations where the
1.455 + number of chunks per process is limited. The default behaviour is generally to be
1.456 + preferred, and should give lower overall memory usage. However, if many controllers are
1.457 + to be created for a particular thread, then ETrue should be provided to prevent running
1.458 + out of heaps or chunks.
1.459 +
1.460 + @return One of the system-wide error codes.
1.461 + @since 7.0s
1.462 + */
1.463 + IMPORT_C TInt LoadController(TUid aControllerUid, TBool aUseSharedHeap);
1.464 +
1.465 + /**
1.466 + Create a new thread and load a controller plugin into that thread.
1.467 +
1.468 + @param aControllerInfo
1.469 + A reference to a CMMFControllerImplementationInformation object
1.470 + used for determining the controller UID and heap size
1.471 + @param aUseSharedHeap
1.472 + If this value is EFalse each controller is created with its own heap. The alternative,
1.473 + if the value is ETrue, is that controllers share a special heap with other controllers
1.474 + created the same way. Each heap uses a chunk, so this avoids situations where the
1.475 + number of chunks per process is limited. The default behaviour is generally to be
1.476 + preferred, and should give lower overall memory usage. However, if many controllers are
1.477 + to be created for a particular thread, then ETrue should be provided to prevent running
1.478 + out of heaps or chunks.
1.479 +
1.480 + @return One of the system-wide error codes.
1.481 + @since 7.0s
1.482 + */
1.483 + IMPORT_C TInt LoadController(const CMMFControllerImplementationInformation& aControllerInfo, TBool aUseSharedHeap);
1.484 +
1.485 + /**
1.486 + Create a new thread in another process through Secure DRM Plugin server and load a controller plugin
1.487 + into that thread. The motivation of this model is to allow applications without DRM capability able
1.488 + to play protected content through MMF.
1.489 +
1.490 + @param aControllerUid
1.491 + The UID of the controller plugin to be loaded.
1.492 + @param aUseSharedHeap
1.493 + If this value is EFalse each controller is created with its own heap. The alternative,
1.494 + if the value is ETrue, is that controllers share a special heap with other controllers
1.495 + created the same way. Each heap uses a chunk, so this avoids situations where the
1.496 + number of chunks per process is limited. The default behaviour is generally to be
1.497 + preferred, and should give lower overall memory usage. However, if many controllers are
1.498 + to be created for a particular thread, then ETrue should be provided to prevent running
1.499 + out of heaps or chunks.
1.500 +
1.501 + @return One of the system-wide error codes.
1.502 + */
1.503 + IMPORT_C TInt LoadControllerInSecureDRMProcess(TUid aControllerUid, TBool aUseSharedHeap);
1.504 +
1.505 + /**
1.506 + Create a new thread in another process through Secure DRM Plugin server and load a controller plugin
1.507 + into that thread. The motivation of this model is to allow applications without DRM capability able
1.508 + to play protected content through MMF.
1.509 +
1.510 + @param aControllerInfo
1.511 + A reference to a CMMFControllerImplementationInformation object
1.512 + used for determining the controller UID and heap size
1.513 + @param aUseSharedHeap
1.514 + If this value is EFalse each controller is created with its own heap. The alternative,
1.515 + if the value is ETrue, is that controllers share a special heap with other controllers
1.516 + created the same way. Each heap uses a chunk, so this avoids situations where the
1.517 + number of chunks per process is limited. The default behaviour is generally to be
1.518 + preferred, and should give lower overall memory usage. However, if many controllers are
1.519 + to be created for a particular thread, then ETrue should be provided to prevent running
1.520 + out of heaps or chunks.
1.521 +
1.522 + @return One of the system-wide error codes.
1.523 + */
1.524 + IMPORT_C TInt LoadControllerInSecureDRMProcess(const CMMFControllerImplementationInformation& aControllerInfo, TBool aUseSharedHeap);
1.525 +
1.526 + /**
1.527 + Delete the controller plugin and close its thread.
1.528 +
1.529 + Clients must call Close() on the controller proxy, otherwise leaks will occur.
1.530 +
1.531 + @since 7.0s
1.532 + */
1.533 + IMPORT_C void Close();
1.534 +
1.535 + /**
1.536 + Send a message synchronously to the controller thread.
1.537 +
1.538 + The controller framework will analyze the message to determine its correct destination.
1.539 +
1.540 + Note: This method will not return until the controller framework has serviced the command.
1.541 +
1.542 + @param aDestination
1.543 + The destination of the message, consisting of the uid of
1.544 + the interface of this message.
1.545 + @param aFunction
1.546 + The function number to indicate which function is to be called
1.547 + on the interface defined in the aDestination parameter.
1.548 + @param aDataTo1
1.549 + A reference to the first chunk of data to be copied to the controller
1.550 + framework. The exact contents of the data are dependent on the
1.551 + interface being called. Can be NULL.
1.552 + @param aDataTo2
1.553 + A reference to the second chunk of data to be copied to the controller
1.554 + framework. The exact contents of the data are dependent on the
1.555 + interface being called. Can be NULL.
1.556 + @param aDataFrom
1.557 + A reference to an area of memory to which the controller framework will
1.558 + write any data to be passed back to the client. Can't be NULL.
1.559 +
1.560 + @return The result of the request. Exact range of values is dependent on the interface.
1.561 + @since 7.0s
1.562 + */
1.563 + IMPORT_C TInt SendSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom) const;
1.564 +
1.565 + /**
1.566 + Send a message synchronously to the controller thread.
1.567 +
1.568 + The controller framework will analyze the message to determine its correct destination.
1.569 +
1.570 + Note: This method will not return until the controller framework has serviced the command.
1.571 +
1.572 + @param aDestination
1.573 + The destination of the message, consisting of the uid of
1.574 + the interface of this message.
1.575 + @param aFunction
1.576 + The function number to indicate which function is to be called
1.577 + on the interface defined in the aDestination parameter.
1.578 + @param aDataTo1
1.579 + A reference to the first chunk of data to be copied to the controller
1.580 + framework. The exact contents of the data are dependent on the
1.581 + interface being called. Can be NULL.
1.582 + @param aDataTo2
1.583 + A reference to the second chunk of data to be copied to the controller
1.584 + framework. The exact contents of the data are dependent on the
1.585 + interface being called. Can be NULL.
1.586 +
1.587 + @return The result of the request. Exact range of values is dependent on the interface.
1.588 + @since 7.0s
1.589 + */
1.590 + IMPORT_C TInt SendSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2) const;
1.591 +
1.592 + /**
1.593 + Send a message asynchronously to the controller thread.
1.594 +
1.595 + The controller framework will analyze the message to determine its correct destination.
1.596 +
1.597 + Note: This method will return immediately. The RunL of the active object owning the
1.598 + aStatus parameter will be called when the command is completed by the
1.599 + controller framework.
1.600 +
1.601 + @param aDestination
1.602 + The destination of the message, consisting of the uid of
1.603 + the interface of this message.
1.604 + @param aFunction
1.605 + The function number to indicate which function is to be called
1.606 + on the interface defined in the aDestination parameter.
1.607 + @param aDataTo1
1.608 + A reference to the first chunk of data to be copied to the controller
1.609 + framework. The exact contents of the data are dependent on the
1.610 + interface being called. Can be NULL.
1.611 + @param aDataTo2
1.612 + A reference to the second chunk of data to be copied to the controller
1.613 + framework. The exact contents of the data are dependent on the
1.614 + interface being called. Can be NULL.
1.615 + @param aDataFrom
1.616 + A reference to an area of memory to which the controller framework will
1.617 + write any data to be passed back to the client. Can't be NULL.
1.618 + @param aStatus
1.619 + The TRequestStatus of an active object. This will contain the
1.620 + result of the request on completion. The exact range of
1.621 + result values is dependent on the interface.
1.622 +
1.623 + @since 7.0s
1.624 + */
1.625 + IMPORT_C void SendAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus) const;
1.626 +
1.627 + /**
1.628 + Send a message asynchronously to the controller thread.
1.629 +
1.630 + The controller framework will analyze the message to determine its correct destination.
1.631 +
1.632 + Note: This method will return immediately. The RunL of the active object owning the
1.633 + aStatus parameter will be called when the command is completed by the
1.634 + controller framework.
1.635 +
1.636 + @param aDestination
1.637 + The destination of the message, consisting of the uid of
1.638 + the interface of this message.
1.639 + @param aFunction
1.640 + The function number to indicate which function is to be called
1.641 + on the interface defined in the aDestination parameter.
1.642 + @param aDataTo1
1.643 + A reference to the first chunk of data to be copied to the controller
1.644 + framework. The exact contents of the data are dependent on the
1.645 + interface being called. Can be NULL.
1.646 + @param aDataTo2
1.647 + A reference to the second chunk of data to be copied to the controller
1.648 + framework. The exact contents of the data are dependent on the
1.649 + interface being called. Can be NULL.
1.650 + @param aStatus
1.651 + The TRequestStatus of an active object. This will contain the
1.652 + result of the request on completion. The exact range of
1.653 + result values is dependent on the interface.
1.654 +
1.655 + @since 7.0s
1.656 + */
1.657 + IMPORT_C void SendAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus) const;
1.658 +
1.659 + IMPORT_C TInt SendSync(TInt aFunction, const TIpcArgs& aIpcArgs) const;
1.660 + IMPORT_C void SendAsync(TInt aFunction, const TIpcArgs& aIpcArgs, TRequestStatus& aStatus) const;
1.661 + /**
1.662 + Register to receive events from the controller framework.
1.663 +
1.664 + Events can be generated at any time, and are generally associated with things that occur
1.665 + due to something happening internally within the controller. For example, an event will
1.666 + be generated if the controller stops playing due to reaching the end of a file.
1.667 +
1.668 + @param aEvent
1.669 + A reference to a TMMFEventPckg object that must be member data
1.670 + of the active object calling this method. The details of the event
1.671 + will be copied into this object when an event occurs.
1.672 + @param aStatus
1.673 + The TRequestStatus of the active object calling this method.
1.674 +
1.675 + @see TMMFEvent
1.676 + @see CMMFControllerEventMonitor
1.677 + @since 7.0s
1.678 + */
1.679 + IMPORT_C void ReceiveEvents(TMMFEventPckg& aEvent, TRequestStatus& aStatus);
1.680 +
1.681 + /**
1.682 + Cancel a previous registration to receive events from the controller framework.
1.683 +
1.684 + This must be called from the DoCancel() method of the active object using the
1.685 + ReceiveEvents() API.
1.686 +
1.687 + @return One of the standard system-wide error codes.
1.688 +
1.689 + @see TMMFEvent
1.690 + @since 7.0s
1.691 + */
1.692 + IMPORT_C TInt CancelReceiveEvents();
1.693 +
1.694 + /**
1.695 + Set the priority of the controller's sub thread.
1.696 +
1.697 + This can be used to increase the responsiveness of the audio plugin to minimise
1.698 + any lag in processing. This function should be used with care as it may have knock-on
1.699 + effects elsewhere in the system.
1.700 +
1.701 + @param aPriority
1.702 + The TThreadPriority that the thread should run under. The default is EPriorityNormal.
1.703 + @return TInt
1.704 + A standard error code: KErrNone if successful, KErrNotReady if the thread does not have a
1.705 + valid handle.
1.706 + */
1.707 + IMPORT_C TInt SetThreadPriority(const TThreadPriority& aPriority) const;
1.708 +
1.709 + /**
1.710 + The controller subthread has been terminated.
1.711 +
1.712 + This is called by CLogonMonitor when the the thread terminates
1.713 + */
1.714 + void ThreadTerminated();
1.715 +private:
1.716 + /**
1.717 + Creates the new thread
1.718 + */
1.719 + TInt DoCreateSubThread(RServer2* aServer2, TUint aMaxHeapSize, TBool aUseSharedHeap, TUint aStackSize);
1.720 +
1.721 + /**
1.722 + Determines the maximum heap size required by the selected controller
1.723 + */
1.724 + TUint ControllersMaxHeapSizeL(TUid aControllerUid);
1.725 +
1.726 + /**
1.727 + Load a controller by UID
1.728 +
1.729 + @param aControllerUid
1.730 + The UID of the controller plugin to be loaded.
1.731 + @param aControllerInfo
1.732 + A reference to a CMMFControllerImplementationInformation object
1.733 + used for determining the heap size and DRM server supporting state.
1.734 + @param aUseSharedHeap
1.735 + If this value is EFalse each controller is created with its own heap. The alternative,
1.736 + if the value is ETrue, is that controllers share a special heap with other controllers
1.737 + created the same way. Each heap uses a chunk, so this avoids situations where the
1.738 + number of chunks per process is limited. The default behaviour is generally to be
1.739 + preferred, and should give lower overall memory usage. However, if many controllers are
1.740 + to be created for a particular thread, then ETrue should be provided to prevent running
1.741 + out of heaps or chunks.
1.742 + @param aNoDRMCap
1.743 + The indicator supplied from user used to determine whether the user's process has DRM
1.744 + capability
1.745 + @return TInt
1.746 + One of the system-wide error codes.
1.747 + */
1.748 + TInt LoadController(TUid aControllerUid, const CMMFControllerImplementationInformation& aControllerInfo, TBool aUseSharedHeap,
1.749 + TBool aNoDRMCap = EFalse);
1.750 +
1.751 + /**
1.752 + Release heap - for use when a shared heap has been registered
1.753 + */
1.754 + void ReleaseHeap();
1.755 +
1.756 + /**
1.757 + Create a session to handle situation of playing DRM protected content in
1.758 + process with no DRM capability.
1.759 + DRM server process will be created, if not yet created. This server is responsible to
1.760 + manage and monitor all the MMF Controller servers created as seperate threads belong to
1.761 + DRM server process. Once the new MMF Controller server is running, a MMF Controller server
1.762 + session will be created and the handle is passing back.
1.763 + */
1.764 + TInt DoCreateSessionForNoDRMCapClient(TUint aMaxHeapSize, TBool aUseSharedHeap, TUint aStackSize);
1.765 +
1.766 +private:
1.767 + enum
1.768 + {
1.769 + /**
1.770 + Shared heap has been opened for this object, and must be closed
1.771 + */
1.772 + EFlagOpenedSharedHeap=0x01
1.773 + };
1.774 +
1.775 +private:
1.776 + /**
1.777 + The thread in which the controller plugin will run.
1.778 + */
1.779 + RThread iSubThread;
1.780 + /**
1.781 + Used to hold destination for messages from the controller proxy
1.782 + (not from clients calling SendSync/SendAsync!!)
1.783 + */
1.784 + TMMFMessageDestinationPckg iDestinationPckg;
1.785 + /**
1.786 + Used to determine the success of a logon. If the status is not pending, the logon has failed
1.787 + and the thread should be closed.
1.788 + */
1.789 + CLogonMonitor* iLogonAO;
1.790 + /**
1.791 + The priority at which the controller plugin thread runs.
1.792 + */
1.793 + TThreadPriority iThreadPriority;
1.794 + /**
1.795 + Flags field
1.796 + */
1.797 + TInt iFlags;
1.798 + /**
1.799 + This member is internal and not intended for use.
1.800 + */
1.801 + TInt iReserved1;
1.802 + };
1.803 +
1.804 +/**
1.805 +@publishedAll
1.806 +@released
1.807 +
1.808 +Mixin class to define an object capable of handling an event within the controller framework.
1.809 +*/
1.810 +class MAsyncEventHandler
1.811 + {
1.812 +public:
1.813 +
1.814 + /**
1.815 + Sends an event to the client.
1.816 +
1.817 + @param aEvent
1.818 + The event.
1.819 +
1.820 + @since 7.0s
1.821 + */
1.822 + virtual TInt SendEventToClient(const TMMFEvent& aEvent) = 0;
1.823 + };
1.824 +
1.825 +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
1.826 +#include <mmf/common/mmfcontrollerframeworkclasses.h>
1.827 +#endif
1.828 +
1.829 +#endif