epoc32/include/mmf/server/mmfsubthreadbase.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef __MMFSUBTHREADBASE_H__
    17 #define __MMFSUBTHREADBASE_H__
    18 
    19 #include <e32base.h>
    20 #include <e32std.h>
    21 #include <mmf/common/mmfpaniccodes.h>
    22 #include <mmf/common/mmfcontroller.h>
    23 
    24 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
    25 #include <mmf/server/mmfsubthreadbaseimpl.h>
    26 #endif
    27 
    28 /**
    29 @publishedAll
    30 @released
    31 
    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.
    34 */
    35 static const TInt KMMFSubThreadMaxCachedMessages = 4;
    36 
    37 /**
    38 @publishedAll
    39 @released
    40 
    41 Defines the maximum heap size paramater used when creating the datapath subthread.
    42 */
    43 static const TInt KMMFSubThreadMaxHeapSize = 0x100000;//1MB
    44 
    45 
    46 /**
    47 @publishedAll
    48 @released
    49 
    50 ITC message ID's used by the client to send commands to the datapath subthread server.
    51 */
    52 enum TMMFSubThreadMessageIds
    53 	{
    54   	/**
    55 	Message ID for message to request next event from the sub thread server.
    56 	*/
    57 	EMMFSubThreadReceiveEvents,
    58 	/**
    59 	Message ID for message to cancel a previous request to receive an event from the sub thread server.
    60 	*/
    61 	EMMFSubThreadCancelReceiveEvents,
    62 	/**
    63 	Message ID for message to request that the sub thread shuts itself down.
    64 	*/
    65 	EMMFSubThreadShutdown,
    66 	/**
    67 	Message ID for message to request the datapath subthread load a datapath.
    68 	*/
    69 	EMMFDataPathProxyLoadDataPathBy,
    70 	/**
    71 	Message ID for message to request the datapath subthread load a datapath with a specified 
    72 	media ID.
    73 	*/
    74 	EMMFDataPathProxyLoadDataPathByMediaId,
    75 	/**
    76 	Message ID for message to request the datapath subthread load a datapath with a specified codec.
    77 	*/
    78 	EMMFDataPathProxyLoadDataPathByCodecUid,
    79 	/**
    80 	Message ID for message to request the datapath subthread load a datapath with a specified media 
    81 	ID and codec.
    82 	*/
    83 	EMMFDataPathProxyLoadDataPathByMediaIdCodecUid,
    84 	/**
    85     Message ID for message to add a data source to the datapath.
    86 	*/
    87 	EMMFDataPathProxyAddDataSource,
    88 	/**
    89 	Message ID for message to add a data sink to the datapath.
    90 	*/
    91 	EMMFDataPathProxyAddDataSink,
    92 	/**
    93 	Message ID for message to prime the datapath.
    94 	*/
    95 	EMMFDataPathProxyPrime,
    96 	/**
    97 	Message ID for message to start the datapath playing.
    98 	*/
    99 	EMMFDataPathProxyPlay,
   100 	/**
   101 	Message ID for message to pause the datapath.
   102 	*/
   103 	EMMFDataPathProxyPause,
   104 	/**
   105 	Message ID for message to stop the datapath.
   106 	*/
   107 	EMMFDataPathProxyStop,
   108 	/**
   109 	Message ID for message to get the datapath's position.
   110 	*/
   111 	EMMFDataPathProxyGetPosition,
   112 	/**
   113 	Message ID for message to set the datapath's position.
   114 	*/
   115 	EMMFDataPathProxySetPosition,
   116 	/**
   117 	Message ID for message to set the datapath's play window.
   118 	*/
   119 	EMMFDataPathProxySetPlayWindow,
   120 	/**
   121 	Message ID for message to clear the datapath's play window.
   122 	*/
   123 	EMMFDataPathProxyClearPlayWindow,
   124 	/**
   125 	Message ID for message to get the datapath's current state.
   126 	*/
   127 	EMMFDataPathProxyState,
   128 	/**
   129 	Unused.
   130 	*/
   131 	EMMFAudioPolicyProxyGetAudioPolicy
   132 	};
   133 
   134 
   135 class RMMFSubThreadBase; // declared here.
   136 /**
   137 @publishedAll
   138 
   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.
   141 */
   142 NONSHARABLE_CLASS( RMMFSubThreadBase ): public RMmfSessionBase
   143 	{
   144 public:
   145 	RMMFSubThreadBase(TTimeIntervalMicroSeconds32 aShutdownTimeout) : iShutdownTimeout(aShutdownTimeout) {};
   146 	/**
   147 	Returns the id of the subthread, allowing a client to logon to the thread to receive notification of its death.
   148 	*/
   149 	TThreadId SubThreadId() {return iSubThread.Id();};
   150 	/**
   151 	Allows a client to receive events from the subthread.
   152 	*/
   153 	IMPORT_C void ReceiveEvents(TMMFEventPckg& aEventPckg, TRequestStatus& aStatus);
   154 	IMPORT_C TInt CancelReceiveEvents();
   155 	/**
   156 	Signal to the subthread to exit.
   157 	Note: This function will not return until the subthread has exited, or a timeout has occurred.
   158 	*/
   159 	IMPORT_C void Shutdown();
   160 protected:
   161 	/**
   162 	Should be called by derived classes to start the subthread.
   163 	*/
   164 	TInt DoCreateSubThread(const TDesC& aName, TThreadFunction aFunction, TBool aUseNewHeap = EFalse);
   165 	void Panic(TMMFSubThreadPanicCode aPanicCode);
   166 protected:
   167 	RThread iSubThread;
   168 	TTimeIntervalMicroSeconds32 iShutdownTimeout;
   169 private:
   170 	/**
   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.
   173 	*/
   174 	TRequestStatus iLogonStatus;
   175 	/**
   176 	This member is internal and not intended for use.
   177 	*/
   178 	TInt iReserved1;
   179 	TInt iReserved2;
   180 	TInt iReserved3;
   181 	};
   182 
   183 #endif
   184