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