1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __MMFSUBTHREADBASE_H__
17 #define __MMFSUBTHREADBASE_H__
21 #include <mmf/common/mmfpaniccodes.h>
22 #include <mmf/common/mmfcontroller.h>
24 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
25 #include <mmf/server/mmfsubthreadbaseimpl.h>
32 Defines the maximum number of event messages that will be held server-side
33 while waiting for the client to request the next message in the queue.
35 static const TInt KMMFSubThreadMaxCachedMessages = 4;
41 Defines the maximum heap size paramater used when creating the datapath subthread.
43 static const TInt KMMFSubThreadMaxHeapSize = 0x100000;//1MB
50 ITC message ID's used by the client to send commands to the datapath subthread server.
52 enum TMMFSubThreadMessageIds
55 Message ID for message to request next event from the sub thread server.
57 EMMFSubThreadReceiveEvents,
59 Message ID for message to cancel a previous request to receive an event from the sub thread server.
61 EMMFSubThreadCancelReceiveEvents,
63 Message ID for message to request that the sub thread shuts itself down.
65 EMMFSubThreadShutdown,
67 Message ID for message to request the datapath subthread load a datapath.
69 EMMFDataPathProxyLoadDataPathBy,
71 Message ID for message to request the datapath subthread load a datapath with a specified
74 EMMFDataPathProxyLoadDataPathByMediaId,
76 Message ID for message to request the datapath subthread load a datapath with a specified codec.
78 EMMFDataPathProxyLoadDataPathByCodecUid,
80 Message ID for message to request the datapath subthread load a datapath with a specified media
83 EMMFDataPathProxyLoadDataPathByMediaIdCodecUid,
85 Message ID for message to add a data source to the datapath.
87 EMMFDataPathProxyAddDataSource,
89 Message ID for message to add a data sink to the datapath.
91 EMMFDataPathProxyAddDataSink,
93 Message ID for message to prime the datapath.
95 EMMFDataPathProxyPrime,
97 Message ID for message to start the datapath playing.
99 EMMFDataPathProxyPlay,
101 Message ID for message to pause the datapath.
103 EMMFDataPathProxyPause,
105 Message ID for message to stop the datapath.
107 EMMFDataPathProxyStop,
109 Message ID for message to get the datapath's position.
111 EMMFDataPathProxyGetPosition,
113 Message ID for message to set the datapath's position.
115 EMMFDataPathProxySetPosition,
117 Message ID for message to set the datapath's play window.
119 EMMFDataPathProxySetPlayWindow,
121 Message ID for message to clear the datapath's play window.
123 EMMFDataPathProxyClearPlayWindow,
125 Message ID for message to get the datapath's current state.
127 EMMFDataPathProxyState,
131 EMMFAudioPolicyProxyGetAudioPolicy
135 class RMMFSubThreadBase; // declared here.
139 Base class for clients to MMF sub threads.
140 Provides functionality to start the sub thread and transmit events from subthread to main thread.
142 NONSHARABLE_CLASS( RMMFSubThreadBase ): public RMmfSessionBase
145 RMMFSubThreadBase(TTimeIntervalMicroSeconds32 aShutdownTimeout) : iShutdownTimeout(aShutdownTimeout) {};
147 Returns the id of the subthread, allowing a client to logon to the thread to receive notification of its death.
149 TThreadId SubThreadId() {return iSubThread.Id();};
151 Allows a client to receive events from the subthread.
153 IMPORT_C void ReceiveEvents(TMMFEventPckg& aEventPckg, TRequestStatus& aStatus);
154 IMPORT_C TInt CancelReceiveEvents();
156 Signal to the subthread to exit.
157 Note: This function will not return until the subthread has exited, or a timeout has occurred.
159 IMPORT_C void Shutdown();
162 Should be called by derived classes to start the subthread.
164 TInt DoCreateSubThread(const TDesC& aName, TThreadFunction aFunction, TBool aUseNewHeap = EFalse);
165 void Panic(TMMFSubThreadPanicCode aPanicCode);
168 TTimeIntervalMicroSeconds32 iShutdownTimeout;
171 Used to determine the success of a logon. If the status is not pending, the logon has failed
172 and the thread should be closed.
174 TRequestStatus iLogonStatus;
176 This member is internal and not intended for use.