os/mm/mmlibs/mmfw/inc/mmf/server/mmfsubthreadbase.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmlibs/mmfw/inc/mmf/server/mmfsubthreadbase.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,184 @@
     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 +#ifndef __MMFSUBTHREADBASE_H__
    1.20 +#define __MMFSUBTHREADBASE_H__
    1.21 +
    1.22 +#include <e32base.h>
    1.23 +#include <e32std.h>
    1.24 +#include <mmf/common/mmfpaniccodes.h>
    1.25 +#include <mmf/common/mmfcontroller.h>
    1.26 +
    1.27 +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
    1.28 +#include <mmf/server/mmfsubthreadbaseimpl.h>
    1.29 +#endif
    1.30 +
    1.31 +/**
    1.32 +@publishedAll
    1.33 +@released
    1.34 +
    1.35 +Defines the maximum number of event messages that will be held server-side
    1.36 +while waiting for the client to request the next message in the queue.
    1.37 +*/
    1.38 +static const TInt KMMFSubThreadMaxCachedMessages = 4;
    1.39 +
    1.40 +/**
    1.41 +@publishedAll
    1.42 +@released
    1.43 +
    1.44 +Defines the maximum heap size paramater used when creating the datapath subthread.
    1.45 +*/
    1.46 +static const TInt KMMFSubThreadMaxHeapSize = 0x100000;//1MB
    1.47 +
    1.48 +
    1.49 +/**
    1.50 +@publishedAll
    1.51 +@released
    1.52 +
    1.53 +ITC message ID's used by the client to send commands to the datapath subthread server.
    1.54 +*/
    1.55 +enum TMMFSubThreadMessageIds
    1.56 +	{
    1.57 +  	/**
    1.58 +	Message ID for message to request next event from the sub thread server.
    1.59 +	*/
    1.60 +	EMMFSubThreadReceiveEvents,
    1.61 +	/**
    1.62 +	Message ID for message to cancel a previous request to receive an event from the sub thread server.
    1.63 +	*/
    1.64 +	EMMFSubThreadCancelReceiveEvents,
    1.65 +	/**
    1.66 +	Message ID for message to request that the sub thread shuts itself down.
    1.67 +	*/
    1.68 +	EMMFSubThreadShutdown,
    1.69 +	/**
    1.70 +	Message ID for message to request the datapath subthread load a datapath.
    1.71 +	*/
    1.72 +	EMMFDataPathProxyLoadDataPathBy,
    1.73 +	/**
    1.74 +	Message ID for message to request the datapath subthread load a datapath with a specified 
    1.75 +	media ID.
    1.76 +	*/
    1.77 +	EMMFDataPathProxyLoadDataPathByMediaId,
    1.78 +	/**
    1.79 +	Message ID for message to request the datapath subthread load a datapath with a specified codec.
    1.80 +	*/
    1.81 +	EMMFDataPathProxyLoadDataPathByCodecUid,
    1.82 +	/**
    1.83 +	Message ID for message to request the datapath subthread load a datapath with a specified media 
    1.84 +	ID and codec.
    1.85 +	*/
    1.86 +	EMMFDataPathProxyLoadDataPathByMediaIdCodecUid,
    1.87 +	/**
    1.88 +    Message ID for message to add a data source to the datapath.
    1.89 +	*/
    1.90 +	EMMFDataPathProxyAddDataSource,
    1.91 +	/**
    1.92 +	Message ID for message to add a data sink to the datapath.
    1.93 +	*/
    1.94 +	EMMFDataPathProxyAddDataSink,
    1.95 +	/**
    1.96 +	Message ID for message to prime the datapath.
    1.97 +	*/
    1.98 +	EMMFDataPathProxyPrime,
    1.99 +	/**
   1.100 +	Message ID for message to start the datapath playing.
   1.101 +	*/
   1.102 +	EMMFDataPathProxyPlay,
   1.103 +	/**
   1.104 +	Message ID for message to pause the datapath.
   1.105 +	*/
   1.106 +	EMMFDataPathProxyPause,
   1.107 +	/**
   1.108 +	Message ID for message to stop the datapath.
   1.109 +	*/
   1.110 +	EMMFDataPathProxyStop,
   1.111 +	/**
   1.112 +	Message ID for message to get the datapath's position.
   1.113 +	*/
   1.114 +	EMMFDataPathProxyGetPosition,
   1.115 +	/**
   1.116 +	Message ID for message to set the datapath's position.
   1.117 +	*/
   1.118 +	EMMFDataPathProxySetPosition,
   1.119 +	/**
   1.120 +	Message ID for message to set the datapath's play window.
   1.121 +	*/
   1.122 +	EMMFDataPathProxySetPlayWindow,
   1.123 +	/**
   1.124 +	Message ID for message to clear the datapath's play window.
   1.125 +	*/
   1.126 +	EMMFDataPathProxyClearPlayWindow,
   1.127 +	/**
   1.128 +	Message ID for message to get the datapath's current state.
   1.129 +	*/
   1.130 +	EMMFDataPathProxyState,
   1.131 +	/**
   1.132 +	Unused.
   1.133 +	*/
   1.134 +	EMMFAudioPolicyProxyGetAudioPolicy
   1.135 +	};
   1.136 +
   1.137 +
   1.138 +class RMMFSubThreadBase; // declared here.
   1.139 +/**
   1.140 +@publishedAll
   1.141 +
   1.142 +Base class for clients to MMF sub threads.
   1.143 +Provides functionality to start the sub thread and transmit events from subthread to main thread.
   1.144 +*/
   1.145 +NONSHARABLE_CLASS( RMMFSubThreadBase ): public RMmfSessionBase
   1.146 +	{
   1.147 +public:
   1.148 +	RMMFSubThreadBase(TTimeIntervalMicroSeconds32 aShutdownTimeout) : iShutdownTimeout(aShutdownTimeout) {};
   1.149 +	/**
   1.150 +	Returns the id of the subthread, allowing a client to logon to the thread to receive notification of its death.
   1.151 +	*/
   1.152 +	TThreadId SubThreadId() {return iSubThread.Id();};
   1.153 +	/**
   1.154 +	Allows a client to receive events from the subthread.
   1.155 +	*/
   1.156 +	IMPORT_C void ReceiveEvents(TMMFEventPckg& aEventPckg, TRequestStatus& aStatus);
   1.157 +	IMPORT_C TInt CancelReceiveEvents();
   1.158 +	/**
   1.159 +	Signal to the subthread to exit.
   1.160 +	Note: This function will not return until the subthread has exited, or a timeout has occurred.
   1.161 +	*/
   1.162 +	IMPORT_C void Shutdown();
   1.163 +protected:
   1.164 +	/**
   1.165 +	Should be called by derived classes to start the subthread.
   1.166 +	*/
   1.167 +	TInt DoCreateSubThread(const TDesC& aName, TThreadFunction aFunction, TBool aUseNewHeap = EFalse);
   1.168 +	void Panic(TMMFSubThreadPanicCode aPanicCode);
   1.169 +protected:
   1.170 +	RThread iSubThread;
   1.171 +	TTimeIntervalMicroSeconds32 iShutdownTimeout;
   1.172 +private:
   1.173 +	/**
   1.174 +	Used to determine the success of a logon.  If the status is not pending, the logon has failed
   1.175 +	and the thread should be closed.
   1.176 +	*/
   1.177 +	TRequestStatus iLogonStatus;
   1.178 +	/**
   1.179 +	This member is internal and not intended for use.
   1.180 +	*/
   1.181 +	TInt iReserved1;
   1.182 +	TInt iReserved2;
   1.183 +	TInt iReserved3;
   1.184 +	};
   1.185 +
   1.186 +#endif
   1.187 +