sl@0: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: sl@0: #ifndef __MMFCONTROLLERFRAMEWORK_H__ sl@0: #define __MMFCONTROLLERFRAMEWORK_H__ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: // fwd ref sl@0: class CMMFControllerImplementationInformation; sl@0: class CLogonMonitor; sl@0: sl@0: _LIT(KMMFControllerProxyServerName, "MMFControllerProxyServer-"); sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Signals that the message is destined for the controller sl@0: */ sl@0: const TInt KMMFObjectHandleController = -2; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Null, or invalid, object handle sl@0: */ sl@0: const TInt KMMFObjectHandleNull = 0; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Describes the destination of a message in the controller framework. sl@0: sl@0: The destination is defined by a UID describing the interface and an integer object handle. sl@0: The controller framework uses this information when it receives a message to decide where sl@0: to send the message. sl@0: sl@0: The controller plugin and controller proxy use the special constant handles sl@0: KMMFObjectHandleControllerProxy and KMMFObjectHandleController for sl@0: efficiency. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: class TMMFMessageDestination sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: Default constructor. sl@0: sl@0: Assigns a null UID to the interface, and a null handle to the handle. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C TMMFMessageDestination(); sl@0: sl@0: /** sl@0: Constructor for sending messages to the controller plugin. sl@0: sl@0: Assigns KMMFObjectHandleController to the destination handle. sl@0: sl@0: @param aInterfaceId sl@0: The UID of the interface of this message destination. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C TMMFMessageDestination(TUid aInterfaceId); sl@0: sl@0: /** sl@0: Full constructor. sl@0: sl@0: @param aInterfaceId sl@0: The UID of the interface of this message destination. sl@0: @param aDestinationHandle sl@0: The handle of the destination object in the controller framework. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C TMMFMessageDestination(TUid aInterfaceId, TInt aDestinationHandle); sl@0: sl@0: /** sl@0: Copy constructor. sl@0: sl@0: @param aOther sl@0: The TMMFMessageDestination object to be copied. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C TMMFMessageDestination(const TMMFMessageDestination& aOther); sl@0: sl@0: /** sl@0: Returns the UID of the interface of the message destination. sl@0: sl@0: @return The interface UID. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C TUid InterfaceId() const; sl@0: sl@0: /** sl@0: Returns the handle of the destination object in the controller framework. sl@0: sl@0: @return The destination handle. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C TInt DestinationHandle() const; sl@0: sl@0: /** sl@0: Compares two destinations. sl@0: sl@0: @param aOther sl@0: The object to be compared with this object. sl@0: sl@0: @return A boolean indicating if the objects are the same. ETrue if the objects are the same, sl@0: EFalse if the objects are different. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C TBool operator==(const TMMFMessageDestination& aOther) const; sl@0: sl@0: private: sl@0: TUid iInterfaceId; sl@0: TInt iDestinationHandle; sl@0: /** sl@0: This member is internal and not intended for use. sl@0: */ sl@0: TInt iReserved1; sl@0: TInt iReserved2; sl@0: TInt iReserved3; sl@0: }; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Package buffer for TMMFMessageDestination sl@0: */ sl@0: typedef TPckgBuf TMMFMessageDestinationPckg; sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Encapsulation of an RMessage or an RMessage2 to provide protection to controller plugins sl@0: from the changes occurring with secure APIs. sl@0: sl@0: Adds required destination information to the message so the controller framework sl@0: can determine which object the message is for. sl@0: sl@0: Adds capability to check whether the message has been completed. sl@0: sl@0: Allows two descriptors to be read from the client, and one descriptor to be copied to the client. sl@0: sl@0: @see RMMFControllerProxy::SendSync sl@0: @see RMMFControllerProxy::SendAsync sl@0: sl@0: @since 7.0s sl@0: */ sl@0: class TMMFMessage sl@0: { sl@0: friend class CMMFControllerProxySession; sl@0: friend class CMMFDevSoundSession; sl@0: public: sl@0: sl@0: /** sl@0: Copy constructor. sl@0: sl@0: A controller plugin should use this to take a copy of the message when it must wait for some sl@0: other event before completing it. sl@0: sl@0: @param aMessage sl@0: The message object to copy. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C TMMFMessage(const TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Returns the destination of the message. sl@0: sl@0: @return The destination of the message, consisting of a UID defining the interface and the sl@0: handle of the destination object. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C const TMMFMessageDestination& Destination(); sl@0: sl@0: /** sl@0: Returns an integer describing the function being called. Equivalent to sl@0: RMessage::Function(). sl@0: sl@0: @return The function being called over IPC. sl@0: sl@0: @see RMessage::Function() sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C TInt Function(); sl@0: sl@0: /** sl@0: Returns the size of the first descriptor that can be copied over from the client. sl@0: sl@0: Use this to create a descriptor of appropriate size before reading the data from the client. sl@0: sl@0: @return The size of data 1. sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C TInt SizeOfData1FromClient(); sl@0: sl@0: /** sl@0: Copy the first descriptor from the client. sl@0: sl@0: @param aDes sl@0: A descriptor defining the area of memory into which the data from the client sl@0: will be copied. Note, the descriptor must be of sufficient size. sl@0: sl@0: @return One of the system-wide error codes. In particular, KErrBadDescriptor will be returned sl@0: if the client did not provide a valid descriptor. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C TInt ReadData1FromClient(TDes8& aDes); sl@0: sl@0: /** sl@0: Copy the first descriptor from the client. sl@0: sl@0: This functino can leave with one of the system-wide error codes. In particular, the leave code sl@0: KErrBadDescriptor will be used if the client did not provide a valid descriptor. sl@0: sl@0: @param aDes sl@0: A descriptor defining the area of memory into which the data from the client sl@0: will be copied. Note, the descriptor must be of sufficient size. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C void ReadData1FromClientL(TDes8& aDes); sl@0: sl@0: sl@0: /** sl@0: Returns the size of the second descriptor that can be copied over from the client. sl@0: sl@0: Use this to create a descriptor of appropriate size before reading the data from the client. sl@0: sl@0: @return The size of data 2. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C TInt SizeOfData2FromClient(); sl@0: sl@0: /** sl@0: Copies the second descriptor from the client. sl@0: sl@0: @param aDes sl@0: A descriptor defining the area of memory into which the data from the client sl@0: will be copied. Note, the descriptor must be of sufficient size. sl@0: sl@0: @return One of the system-wide error codes. In particular, KErrBadDescriptor will be returned sl@0: if the client did not provide a valid descriptor. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C TInt ReadData2FromClient(TDes8& aDes); sl@0: sl@0: /** sl@0: Copies the second descriptor from the client. sl@0: sl@0: This function can leave with one of the system-wide error codes. In particular, the leave code sl@0: KErrBadDescriptor will be used if the client did not provide a valid descriptor. sl@0: sl@0: @param aDes sl@0: A descriptor defining the area of memory into which the data from the client sl@0: will be copied. Note, the descriptor must be of sufficient size. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C void ReadData2FromClientL(TDes8& aDes); sl@0: sl@0: /** sl@0: Copies data back to the client. sl@0: sl@0: @param aDes sl@0: The data to be copied back to the client. Note that the client must sl@0: have already created a descriptor of sufficient size for the data to be sl@0: copied into. sl@0: sl@0: @return One of the system-wide error codes. In particular, the error code KErrBadDescriptor will sl@0: be returned if the client did not provide a valid descriptor. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C TInt WriteDataToClient(const TDesC8& aDes); sl@0: sl@0: /** sl@0: Copies the data back to the client. sl@0: sl@0: This function can leave with one of the system-wide error codes. In particular, the leave code sl@0: KErrBadDescriptor will be used if the client did not provide a valid descriptor. sl@0: sl@0: @param aDes sl@0: The data to be copied back to the client. Note that the client must have already sl@0: created a descriptor of sufficient size for the data to be copied into. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C void WriteDataToClientL(const TDesC8& aDes); sl@0: sl@0: /** sl@0: Signals to the client that its request has been completed. sl@0: sl@0: Equivalent to RMessage::Complete. sl@0: sl@0: @param aReason sl@0: The result code to be given back to the client. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C void Complete(TInt aReason); sl@0: sl@0: IMPORT_C void AdoptFileHandleFromClientL(TInt aFsHandleIndex, TInt aFileHandleIndex, RFile& aFile); sl@0: sl@0: /** sl@0: Checks whether this message has already been completed. sl@0: sl@0: @return A boolean indicating if the message has been completed. ETrue if the message has been sl@0: completed, EFalse if not. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C TBool IsCompleted(); sl@0: sl@0: /** sl@0: Constructs a TMMFMessage from an RMmfIpcMessage. sl@0: sl@0: @param aMessage sl@0: The handle to the remote message. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C TMMFMessage(const RMmfIpcMessage& aMessage); sl@0: sl@0: /** sl@0: Gets the destination info from the client. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C void FetchDestinationL(); sl@0: private: sl@0: #ifdef __MMF_USE_IPC_V2__ sl@0: /** sl@0: The encapsulated message sl@0: */ sl@0: RMessagePtr2 iMessage; sl@0: /** sl@0: The encapsulated function sl@0: */ sl@0: TInt iFunction; sl@0: /** sl@0: Private padding to preserve BC with earlier versions sl@0: */ sl@0: TInt iDummyPadding[6]; sl@0: #else sl@0: /** sl@0: The RMessage encapsulated by this object. sl@0: */ sl@0: RMessage iMessage; sl@0: #endif // __MMF_USE_IPC_V2__ sl@0: sl@0: /** sl@0: The destination of this message. sl@0: */ sl@0: TMMFMessageDestination iDestination; sl@0: sl@0: /** sl@0: Defines know about object completion state. sl@0: */ sl@0: TBool iAmCompleted; sl@0: }; sl@0: sl@0: /** sl@0: @publishedAll sl@0: sl@0: Mixin class used by CLogonMonitor to inform about its state sl@0: sl@0: @since 9.3 sl@0: */ sl@0: class MLogonMonitorObserver sl@0: { sl@0: public: sl@0: /** sl@0: The monitored thread has been terminated. sl@0: */ sl@0: virtual void ThreadTerminated() = 0; sl@0: }; sl@0: sl@0: /** sl@0: @publishedAll sl@0: sl@0: RSessionBase-based client class to handle the creation of the controller thread and sl@0: message sending over IPC. sl@0: sl@0: The controller proxy is responsible for sending and recieving messages over IPC; it does not sl@0: care exactly what those messages are. sl@0: sl@0: Note the fact that, although this is an internal component, its size cannot be changed because sl@0: it's embedded in a publishedAll class (RMMFController) and the size of the latter would also be sl@0: changed raising a binary compatibility problem. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: NONSHARABLE_CLASS(RMMFControllerProxy) : public RMmfSessionBase, public MLogonMonitorObserver sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: Constructor. sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C RMMFControllerProxy(); sl@0: sl@0: /** sl@0: Create a new thread and load a controller plugin into that thread. sl@0: sl@0: @param aControllerUid sl@0: The UID of the controller plugin to be loaded. sl@0: @param aUseSharedHeap sl@0: If this value is EFalse each controller is created with its own heap. The alternative, sl@0: if the value is ETrue, is that controllers share a special heap with other controllers sl@0: created the same way. Each heap uses a chunk, so this avoids situations where the sl@0: number of chunks per process is limited. The default behaviour is generally to be sl@0: preferred, and should give lower overall memory usage. However, if many controllers are sl@0: to be created for a particular thread, then ETrue should be provided to prevent running sl@0: out of heaps or chunks. sl@0: sl@0: @return One of the system-wide error codes. sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C TInt LoadController(TUid aControllerUid, TBool aUseSharedHeap); sl@0: sl@0: /** sl@0: Create a new thread and load a controller plugin into that thread. sl@0: sl@0: @param aControllerInfo sl@0: A reference to a CMMFControllerImplementationInformation object sl@0: used for determining the controller UID and heap size sl@0: @param aUseSharedHeap sl@0: If this value is EFalse each controller is created with its own heap. The alternative, sl@0: if the value is ETrue, is that controllers share a special heap with other controllers sl@0: created the same way. Each heap uses a chunk, so this avoids situations where the sl@0: number of chunks per process is limited. The default behaviour is generally to be sl@0: preferred, and should give lower overall memory usage. However, if many controllers are sl@0: to be created for a particular thread, then ETrue should be provided to prevent running sl@0: out of heaps or chunks. sl@0: sl@0: @return One of the system-wide error codes. sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C TInt LoadController(const CMMFControllerImplementationInformation& aControllerInfo, TBool aUseSharedHeap); sl@0: sl@0: /** sl@0: Create a new thread in another process through Secure DRM Plugin server and load a controller plugin sl@0: into that thread. The motivation of this model is to allow applications without DRM capability able sl@0: to play protected content through MMF. sl@0: sl@0: @param aControllerUid sl@0: The UID of the controller plugin to be loaded. sl@0: @param aUseSharedHeap sl@0: If this value is EFalse each controller is created with its own heap. The alternative, sl@0: if the value is ETrue, is that controllers share a special heap with other controllers sl@0: created the same way. Each heap uses a chunk, so this avoids situations where the sl@0: number of chunks per process is limited. The default behaviour is generally to be sl@0: preferred, and should give lower overall memory usage. However, if many controllers are sl@0: to be created for a particular thread, then ETrue should be provided to prevent running sl@0: out of heaps or chunks. sl@0: sl@0: @return One of the system-wide error codes. sl@0: */ sl@0: IMPORT_C TInt LoadControllerInSecureDRMProcess(TUid aControllerUid, TBool aUseSharedHeap); sl@0: sl@0: /** sl@0: Create a new thread in another process through Secure DRM Plugin server and load a controller plugin sl@0: into that thread. The motivation of this model is to allow applications without DRM capability able sl@0: to play protected content through MMF. sl@0: sl@0: @param aControllerInfo sl@0: A reference to a CMMFControllerImplementationInformation object sl@0: used for determining the controller UID and heap size sl@0: @param aUseSharedHeap sl@0: If this value is EFalse each controller is created with its own heap. The alternative, sl@0: if the value is ETrue, is that controllers share a special heap with other controllers sl@0: created the same way. Each heap uses a chunk, so this avoids situations where the sl@0: number of chunks per process is limited. The default behaviour is generally to be sl@0: preferred, and should give lower overall memory usage. However, if many controllers are sl@0: to be created for a particular thread, then ETrue should be provided to prevent running sl@0: out of heaps or chunks. sl@0: sl@0: @return One of the system-wide error codes. sl@0: */ sl@0: IMPORT_C TInt LoadControllerInSecureDRMProcess(const CMMFControllerImplementationInformation& aControllerInfo, TBool aUseSharedHeap); sl@0: sl@0: /** sl@0: Delete the controller plugin and close its thread. sl@0: sl@0: Clients must call Close() on the controller proxy, otherwise leaks will occur. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C void Close(); sl@0: sl@0: /** sl@0: Send a message synchronously to the controller thread. sl@0: sl@0: The controller framework will analyze the message to determine its correct destination. sl@0: sl@0: Note: This method will not return until the controller framework has serviced the command. sl@0: sl@0: @param aDestination sl@0: The destination of the message, consisting of the uid of sl@0: the interface of this message. sl@0: @param aFunction sl@0: The function number to indicate which function is to be called sl@0: on the interface defined in the aDestination parameter. sl@0: @param aDataTo1 sl@0: A reference to the first chunk of data to be copied to the controller sl@0: framework. The exact contents of the data are dependent on the sl@0: interface being called. Can be NULL. sl@0: @param aDataTo2 sl@0: A reference to the second chunk of data to be copied to the controller sl@0: framework. The exact contents of the data are dependent on the sl@0: interface being called. Can be NULL. sl@0: @param aDataFrom sl@0: A reference to an area of memory to which the controller framework will sl@0: write any data to be passed back to the client. Can't be NULL. sl@0: sl@0: @return The result of the request. Exact range of values is dependent on the interface. sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C TInt SendSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom) const; sl@0: sl@0: /** sl@0: Send a message synchronously to the controller thread. sl@0: sl@0: The controller framework will analyze the message to determine its correct destination. sl@0: sl@0: Note: This method will not return until the controller framework has serviced the command. sl@0: sl@0: @param aDestination sl@0: The destination of the message, consisting of the uid of sl@0: the interface of this message. sl@0: @param aFunction sl@0: The function number to indicate which function is to be called sl@0: on the interface defined in the aDestination parameter. sl@0: @param aDataTo1 sl@0: A reference to the first chunk of data to be copied to the controller sl@0: framework. The exact contents of the data are dependent on the sl@0: interface being called. Can be NULL. sl@0: @param aDataTo2 sl@0: A reference to the second chunk of data to be copied to the controller sl@0: framework. The exact contents of the data are dependent on the sl@0: interface being called. Can be NULL. sl@0: sl@0: @return The result of the request. Exact range of values is dependent on the interface. sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C TInt SendSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2) const; sl@0: sl@0: /** sl@0: Send a message asynchronously to the controller thread. sl@0: sl@0: The controller framework will analyze the message to determine its correct destination. sl@0: sl@0: Note: This method will return immediately. The RunL of the active object owning the sl@0: aStatus parameter will be called when the command is completed by the sl@0: controller framework. sl@0: sl@0: @param aDestination sl@0: The destination of the message, consisting of the uid of sl@0: the interface of this message. sl@0: @param aFunction sl@0: The function number to indicate which function is to be called sl@0: on the interface defined in the aDestination parameter. sl@0: @param aDataTo1 sl@0: A reference to the first chunk of data to be copied to the controller sl@0: framework. The exact contents of the data are dependent on the sl@0: interface being called. Can be NULL. sl@0: @param aDataTo2 sl@0: A reference to the second chunk of data to be copied to the controller sl@0: framework. The exact contents of the data are dependent on the sl@0: interface being called. Can be NULL. sl@0: @param aDataFrom sl@0: A reference to an area of memory to which the controller framework will sl@0: write any data to be passed back to the client. Can't be NULL. sl@0: @param aStatus sl@0: The TRequestStatus of an active object. This will contain the sl@0: result of the request on completion. The exact range of sl@0: result values is dependent on the interface. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C void SendAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus) const; sl@0: sl@0: /** sl@0: Send a message asynchronously to the controller thread. sl@0: sl@0: The controller framework will analyze the message to determine its correct destination. sl@0: sl@0: Note: This method will return immediately. The RunL of the active object owning the sl@0: aStatus parameter will be called when the command is completed by the sl@0: controller framework. sl@0: sl@0: @param aDestination sl@0: The destination of the message, consisting of the uid of sl@0: the interface of this message. sl@0: @param aFunction sl@0: The function number to indicate which function is to be called sl@0: on the interface defined in the aDestination parameter. sl@0: @param aDataTo1 sl@0: A reference to the first chunk of data to be copied to the controller sl@0: framework. The exact contents of the data are dependent on the sl@0: interface being called. Can be NULL. sl@0: @param aDataTo2 sl@0: A reference to the second chunk of data to be copied to the controller sl@0: framework. The exact contents of the data are dependent on the sl@0: interface being called. Can be NULL. sl@0: @param aStatus sl@0: The TRequestStatus of an active object. This will contain the sl@0: result of the request on completion. The exact range of sl@0: result values is dependent on the interface. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C void SendAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus) const; sl@0: sl@0: IMPORT_C TInt SendSync(TInt aFunction, const TIpcArgs& aIpcArgs) const; sl@0: IMPORT_C void SendAsync(TInt aFunction, const TIpcArgs& aIpcArgs, TRequestStatus& aStatus) const; sl@0: /** sl@0: Register to receive events from the controller framework. sl@0: sl@0: Events can be generated at any time, and are generally associated with things that occur sl@0: due to something happening internally within the controller. For example, an event will sl@0: be generated if the controller stops playing due to reaching the end of a file. sl@0: sl@0: @param aEvent sl@0: A reference to a TMMFEventPckg object that must be member data sl@0: of the active object calling this method. The details of the event sl@0: will be copied into this object when an event occurs. sl@0: @param aStatus sl@0: The TRequestStatus of the active object calling this method. sl@0: sl@0: @see TMMFEvent sl@0: @see CMMFControllerEventMonitor sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C void ReceiveEvents(TMMFEventPckg& aEvent, TRequestStatus& aStatus); sl@0: sl@0: /** sl@0: Cancel a previous registration to receive events from the controller framework. sl@0: sl@0: This must be called from the DoCancel() method of the active object using the sl@0: ReceiveEvents() API. sl@0: sl@0: @return One of the standard system-wide error codes. sl@0: sl@0: @see TMMFEvent sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C TInt CancelReceiveEvents(); sl@0: sl@0: /** sl@0: Set the priority of the controller's sub thread. sl@0: sl@0: This can be used to increase the responsiveness of the audio plugin to minimise sl@0: any lag in processing. This function should be used with care as it may have knock-on sl@0: effects elsewhere in the system. sl@0: sl@0: @param aPriority sl@0: The TThreadPriority that the thread should run under. The default is EPriorityNormal. sl@0: @return TInt sl@0: A standard error code: KErrNone if successful, KErrNotReady if the thread does not have a sl@0: valid handle. sl@0: */ sl@0: IMPORT_C TInt SetThreadPriority(const TThreadPriority& aPriority) const; sl@0: sl@0: /** sl@0: The controller subthread has been terminated. sl@0: sl@0: This is called by CLogonMonitor when the the thread terminates sl@0: */ sl@0: void ThreadTerminated(); sl@0: private: sl@0: /** sl@0: Creates the new thread sl@0: */ sl@0: TInt DoCreateSubThread(RServer2* aServer2, TUint aMaxHeapSize, TBool aUseSharedHeap, TUint aStackSize); sl@0: sl@0: /** sl@0: Determines the maximum heap size required by the selected controller sl@0: */ sl@0: TUint ControllersMaxHeapSizeL(TUid aControllerUid); sl@0: sl@0: /** sl@0: Load a controller by UID sl@0: sl@0: @param aControllerUid sl@0: The UID of the controller plugin to be loaded. sl@0: @param aControllerInfo sl@0: A reference to a CMMFControllerImplementationInformation object sl@0: used for determining the heap size and DRM server supporting state. sl@0: @param aUseSharedHeap sl@0: If this value is EFalse each controller is created with its own heap. The alternative, sl@0: if the value is ETrue, is that controllers share a special heap with other controllers sl@0: created the same way. Each heap uses a chunk, so this avoids situations where the sl@0: number of chunks per process is limited. The default behaviour is generally to be sl@0: preferred, and should give lower overall memory usage. However, if many controllers are sl@0: to be created for a particular thread, then ETrue should be provided to prevent running sl@0: out of heaps or chunks. sl@0: @param aNoDRMCap sl@0: The indicator supplied from user used to determine whether the user's process has DRM sl@0: capability sl@0: @return TInt sl@0: One of the system-wide error codes. sl@0: */ sl@0: TInt LoadController(TUid aControllerUid, const CMMFControllerImplementationInformation& aControllerInfo, TBool aUseSharedHeap, sl@0: TBool aNoDRMCap = EFalse); sl@0: sl@0: /** sl@0: Release heap - for use when a shared heap has been registered sl@0: */ sl@0: void ReleaseHeap(); sl@0: sl@0: /** sl@0: Create a session to handle situation of playing DRM protected content in sl@0: process with no DRM capability. sl@0: DRM server process will be created, if not yet created. This server is responsible to sl@0: manage and monitor all the MMF Controller servers created as seperate threads belong to sl@0: DRM server process. Once the new MMF Controller server is running, a MMF Controller server sl@0: session will be created and the handle is passing back. sl@0: */ sl@0: TInt DoCreateSessionForNoDRMCapClient(TUint aMaxHeapSize, TBool aUseSharedHeap, TUint aStackSize); sl@0: sl@0: private: sl@0: enum sl@0: { sl@0: /** sl@0: Shared heap has been opened for this object, and must be closed sl@0: */ sl@0: EFlagOpenedSharedHeap=0x01 sl@0: }; sl@0: sl@0: private: sl@0: /** sl@0: The thread in which the controller plugin will run. sl@0: */ sl@0: RThread iSubThread; sl@0: /** sl@0: Used to hold destination for messages from the controller proxy sl@0: (not from clients calling SendSync/SendAsync!!) sl@0: */ sl@0: TMMFMessageDestinationPckg iDestinationPckg; sl@0: /** sl@0: Used to determine the success of a logon. If the status is not pending, the logon has failed sl@0: and the thread should be closed. sl@0: */ sl@0: CLogonMonitor* iLogonAO; sl@0: /** sl@0: The priority at which the controller plugin thread runs. sl@0: */ sl@0: TThreadPriority iThreadPriority; sl@0: /** sl@0: Flags field sl@0: */ sl@0: TInt iFlags; sl@0: /** sl@0: This member is internal and not intended for use. sl@0: */ sl@0: TInt iReserved1; sl@0: }; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Mixin class to define an object capable of handling an event within the controller framework. sl@0: */ sl@0: class MAsyncEventHandler sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: Sends an event to the client. sl@0: sl@0: @param aEvent sl@0: The event. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: virtual TInt SendEventToClient(const TMMFEvent& aEvent) = 0; sl@0: }; sl@0: sl@0: #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS sl@0: #include sl@0: #endif sl@0: sl@0: #endif