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.
williamr@2
     1
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@4
     4
// under the terms of "Eclipse Public License v1.0"
williamr@2
     5
// which accompanies this distribution, and is available
williamr@4
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
//
williamr@2
    15
williamr@2
    16
#ifndef __MMFSUBTHREADBASE_H__
williamr@2
    17
#define __MMFSUBTHREADBASE_H__
williamr@2
    18
williamr@2
    19
#include <e32base.h>
williamr@2
    20
#include <e32std.h>
williamr@2
    21
#include <mmf/common/mmfpaniccodes.h>
williamr@2
    22
#include <mmf/common/mmfcontroller.h>
williamr@2
    23
williamr@4
    24
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
williamr@4
    25
#include <mmf/server/mmfsubthreadbaseimpl.h>
williamr@4
    26
#endif
williamr@4
    27
williamr@2
    28
/**
williamr@2
    29
@publishedAll
williamr@2
    30
@released
williamr@2
    31
williamr@2
    32
Defines the maximum number of event messages that will be held server-side
williamr@2
    33
while waiting for the client to request the next message in the queue.
williamr@2
    34
*/
williamr@2
    35
static const TInt KMMFSubThreadMaxCachedMessages = 4;
williamr@2
    36
williamr@2
    37
/**
williamr@2
    38
@publishedAll
williamr@2
    39
@released
williamr@2
    40
williamr@2
    41
Defines the maximum heap size paramater used when creating the datapath subthread.
williamr@2
    42
*/
williamr@2
    43
static const TInt KMMFSubThreadMaxHeapSize = 0x100000;//1MB
williamr@2
    44
williamr@2
    45
williamr@2
    46
/**
williamr@2
    47
@publishedAll
williamr@2
    48
@released
williamr@2
    49
williamr@2
    50
ITC message ID's used by the client to send commands to the datapath subthread server.
williamr@2
    51
*/
williamr@2
    52
enum TMMFSubThreadMessageIds
williamr@2
    53
	{
williamr@2
    54
  	/**
williamr@2
    55
	Message ID for message to request next event from the sub thread server.
williamr@2
    56
	*/
williamr@2
    57
	EMMFSubThreadReceiveEvents,
williamr@2
    58
	/**
williamr@2
    59
	Message ID for message to cancel a previous request to receive an event from the sub thread server.
williamr@2
    60
	*/
williamr@2
    61
	EMMFSubThreadCancelReceiveEvents,
williamr@2
    62
	/**
williamr@2
    63
	Message ID for message to request that the sub thread shuts itself down.
williamr@2
    64
	*/
williamr@2
    65
	EMMFSubThreadShutdown,
williamr@2
    66
	/**
williamr@2
    67
	Message ID for message to request the datapath subthread load a datapath.
williamr@2
    68
	*/
williamr@2
    69
	EMMFDataPathProxyLoadDataPathBy,
williamr@2
    70
	/**
williamr@2
    71
	Message ID for message to request the datapath subthread load a datapath with a specified 
williamr@2
    72
	media ID.
williamr@2
    73
	*/
williamr@2
    74
	EMMFDataPathProxyLoadDataPathByMediaId,
williamr@2
    75
	/**
williamr@2
    76
	Message ID for message to request the datapath subthread load a datapath with a specified codec.
williamr@2
    77
	*/
williamr@2
    78
	EMMFDataPathProxyLoadDataPathByCodecUid,
williamr@2
    79
	/**
williamr@2
    80
	Message ID for message to request the datapath subthread load a datapath with a specified media 
williamr@2
    81
	ID and codec.
williamr@2
    82
	*/
williamr@2
    83
	EMMFDataPathProxyLoadDataPathByMediaIdCodecUid,
williamr@2
    84
	/**
williamr@2
    85
    Message ID for message to add a data source to the datapath.
williamr@2
    86
	*/
williamr@2
    87
	EMMFDataPathProxyAddDataSource,
williamr@2
    88
	/**
williamr@2
    89
	Message ID for message to add a data sink to the datapath.
williamr@2
    90
	*/
williamr@2
    91
	EMMFDataPathProxyAddDataSink,
williamr@2
    92
	/**
williamr@2
    93
	Message ID for message to prime the datapath.
williamr@2
    94
	*/
williamr@2
    95
	EMMFDataPathProxyPrime,
williamr@2
    96
	/**
williamr@2
    97
	Message ID for message to start the datapath playing.
williamr@2
    98
	*/
williamr@2
    99
	EMMFDataPathProxyPlay,
williamr@2
   100
	/**
williamr@2
   101
	Message ID for message to pause the datapath.
williamr@2
   102
	*/
williamr@2
   103
	EMMFDataPathProxyPause,
williamr@2
   104
	/**
williamr@2
   105
	Message ID for message to stop the datapath.
williamr@2
   106
	*/
williamr@2
   107
	EMMFDataPathProxyStop,
williamr@2
   108
	/**
williamr@2
   109
	Message ID for message to get the datapath's position.
williamr@2
   110
	*/
williamr@2
   111
	EMMFDataPathProxyGetPosition,
williamr@2
   112
	/**
williamr@2
   113
	Message ID for message to set the datapath's position.
williamr@2
   114
	*/
williamr@2
   115
	EMMFDataPathProxySetPosition,
williamr@2
   116
	/**
williamr@2
   117
	Message ID for message to set the datapath's play window.
williamr@2
   118
	*/
williamr@2
   119
	EMMFDataPathProxySetPlayWindow,
williamr@2
   120
	/**
williamr@2
   121
	Message ID for message to clear the datapath's play window.
williamr@2
   122
	*/
williamr@2
   123
	EMMFDataPathProxyClearPlayWindow,
williamr@2
   124
	/**
williamr@2
   125
	Message ID for message to get the datapath's current state.
williamr@2
   126
	*/
williamr@2
   127
	EMMFDataPathProxyState,
williamr@2
   128
	/**
williamr@2
   129
	Unused.
williamr@2
   130
	*/
williamr@2
   131
	EMMFAudioPolicyProxyGetAudioPolicy
williamr@2
   132
	};
williamr@2
   133
williamr@2
   134
williamr@2
   135
class RMMFSubThreadBase; // declared here.
williamr@2
   136
/**
williamr@4
   137
@publishedAll
williamr@2
   138
williamr@2
   139
Base class for clients to MMF sub threads.
williamr@2
   140
Provides functionality to start the sub thread and transmit events from subthread to main thread.
williamr@2
   141
*/
williamr@2
   142
NONSHARABLE_CLASS( RMMFSubThreadBase ): public RMmfSessionBase
williamr@2
   143
	{
williamr@2
   144
public:
williamr@2
   145
	RMMFSubThreadBase(TTimeIntervalMicroSeconds32 aShutdownTimeout) : iShutdownTimeout(aShutdownTimeout) {};
williamr@2
   146
	/**
williamr@2
   147
	Returns the id of the subthread, allowing a client to logon to the thread to receive notification of its death.
williamr@2
   148
	*/
williamr@2
   149
	TThreadId SubThreadId() {return iSubThread.Id();};
williamr@2
   150
	/**
williamr@2
   151
	Allows a client to receive events from the subthread.
williamr@2
   152
	*/
williamr@2
   153
	IMPORT_C void ReceiveEvents(TMMFEventPckg& aEventPckg, TRequestStatus& aStatus);
williamr@2
   154
	IMPORT_C TInt CancelReceiveEvents();
williamr@2
   155
	/**
williamr@2
   156
	Signal to the subthread to exit.
williamr@2
   157
	Note: This function will not return until the subthread has exited, or a timeout has occurred.
williamr@2
   158
	*/
williamr@2
   159
	IMPORT_C void Shutdown();
williamr@2
   160
protected:
williamr@2
   161
	/**
williamr@2
   162
	Should be called by derived classes to start the subthread.
williamr@2
   163
	*/
williamr@2
   164
	TInt DoCreateSubThread(const TDesC& aName, TThreadFunction aFunction, TBool aUseNewHeap = EFalse);
williamr@2
   165
	void Panic(TMMFSubThreadPanicCode aPanicCode);
williamr@2
   166
protected:
williamr@2
   167
	RThread iSubThread;
williamr@2
   168
	TTimeIntervalMicroSeconds32 iShutdownTimeout;
williamr@2
   169
private:
williamr@2
   170
	/**
williamr@2
   171
	Used to determine the success of a logon.  If the status is not pending, the logon has failed
williamr@2
   172
	and the thread should be closed.
williamr@2
   173
	*/
williamr@2
   174
	TRequestStatus iLogonStatus;
williamr@2
   175
	/**
williamr@2
   176
	This member is internal and not intended for use.
williamr@2
   177
	*/
williamr@2
   178
	TInt iReserved1;
williamr@2
   179
	TInt iReserved2;
williamr@2
   180
	TInt iReserved3;
williamr@2
   181
	};
williamr@2
   182
williamr@4
   183
#endif
williamr@2
   184