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: #ifndef __MMFSUBTHREADBASE_H__ sl@0: #define __MMFSUBTHREADBASE_H__ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS sl@0: #include sl@0: #endif sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Defines the maximum number of event messages that will be held server-side sl@0: while waiting for the client to request the next message in the queue. sl@0: */ sl@0: static const TInt KMMFSubThreadMaxCachedMessages = 4; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Defines the maximum heap size paramater used when creating the datapath subthread. sl@0: */ sl@0: static const TInt KMMFSubThreadMaxHeapSize = 0x100000;//1MB sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: ITC message ID's used by the client to send commands to the datapath subthread server. sl@0: */ sl@0: enum TMMFSubThreadMessageIds sl@0: { sl@0: /** sl@0: Message ID for message to request next event from the sub thread server. sl@0: */ sl@0: EMMFSubThreadReceiveEvents, sl@0: /** sl@0: Message ID for message to cancel a previous request to receive an event from the sub thread server. sl@0: */ sl@0: EMMFSubThreadCancelReceiveEvents, sl@0: /** sl@0: Message ID for message to request that the sub thread shuts itself down. sl@0: */ sl@0: EMMFSubThreadShutdown, sl@0: /** sl@0: Message ID for message to request the datapath subthread load a datapath. sl@0: */ sl@0: EMMFDataPathProxyLoadDataPathBy, sl@0: /** sl@0: Message ID for message to request the datapath subthread load a datapath with a specified sl@0: media ID. sl@0: */ sl@0: EMMFDataPathProxyLoadDataPathByMediaId, sl@0: /** sl@0: Message ID for message to request the datapath subthread load a datapath with a specified codec. sl@0: */ sl@0: EMMFDataPathProxyLoadDataPathByCodecUid, sl@0: /** sl@0: Message ID for message to request the datapath subthread load a datapath with a specified media sl@0: ID and codec. sl@0: */ sl@0: EMMFDataPathProxyLoadDataPathByMediaIdCodecUid, sl@0: /** sl@0: Message ID for message to add a data source to the datapath. sl@0: */ sl@0: EMMFDataPathProxyAddDataSource, sl@0: /** sl@0: Message ID for message to add a data sink to the datapath. sl@0: */ sl@0: EMMFDataPathProxyAddDataSink, sl@0: /** sl@0: Message ID for message to prime the datapath. sl@0: */ sl@0: EMMFDataPathProxyPrime, sl@0: /** sl@0: Message ID for message to start the datapath playing. sl@0: */ sl@0: EMMFDataPathProxyPlay, sl@0: /** sl@0: Message ID for message to pause the datapath. sl@0: */ sl@0: EMMFDataPathProxyPause, sl@0: /** sl@0: Message ID for message to stop the datapath. sl@0: */ sl@0: EMMFDataPathProxyStop, sl@0: /** sl@0: Message ID for message to get the datapath's position. sl@0: */ sl@0: EMMFDataPathProxyGetPosition, sl@0: /** sl@0: Message ID for message to set the datapath's position. sl@0: */ sl@0: EMMFDataPathProxySetPosition, sl@0: /** sl@0: Message ID for message to set the datapath's play window. sl@0: */ sl@0: EMMFDataPathProxySetPlayWindow, sl@0: /** sl@0: Message ID for message to clear the datapath's play window. sl@0: */ sl@0: EMMFDataPathProxyClearPlayWindow, sl@0: /** sl@0: Message ID for message to get the datapath's current state. sl@0: */ sl@0: EMMFDataPathProxyState, sl@0: /** sl@0: Unused. sl@0: */ sl@0: EMMFAudioPolicyProxyGetAudioPolicy sl@0: }; sl@0: sl@0: sl@0: class RMMFSubThreadBase; // declared here. sl@0: /** sl@0: @publishedAll sl@0: sl@0: Base class for clients to MMF sub threads. sl@0: Provides functionality to start the sub thread and transmit events from subthread to main thread. sl@0: */ sl@0: NONSHARABLE_CLASS( RMMFSubThreadBase ): public RMmfSessionBase sl@0: { sl@0: public: sl@0: RMMFSubThreadBase(TTimeIntervalMicroSeconds32 aShutdownTimeout) : iShutdownTimeout(aShutdownTimeout) {}; sl@0: /** sl@0: Returns the id of the subthread, allowing a client to logon to the thread to receive notification of its death. sl@0: */ sl@0: TThreadId SubThreadId() {return iSubThread.Id();}; sl@0: /** sl@0: Allows a client to receive events from the subthread. sl@0: */ sl@0: IMPORT_C void ReceiveEvents(TMMFEventPckg& aEventPckg, TRequestStatus& aStatus); sl@0: IMPORT_C TInt CancelReceiveEvents(); sl@0: /** sl@0: Signal to the subthread to exit. sl@0: Note: This function will not return until the subthread has exited, or a timeout has occurred. sl@0: */ sl@0: IMPORT_C void Shutdown(); sl@0: protected: sl@0: /** sl@0: Should be called by derived classes to start the subthread. sl@0: */ sl@0: TInt DoCreateSubThread(const TDesC& aName, TThreadFunction aFunction, TBool aUseNewHeap = EFalse); sl@0: void Panic(TMMFSubThreadPanicCode aPanicCode); sl@0: protected: sl@0: RThread iSubThread; sl@0: TTimeIntervalMicroSeconds32 iShutdownTimeout; sl@0: private: 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: TRequestStatus iLogonStatus; 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: #endif sl@0: