os/mm/devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundSession.h
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundSession.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,203 @@
1.4 +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved.
1.5 +// This component and the accompanying materials are made available
1.6 +// under the terms of "Eclipse Public License v1.0"
1.7 +// which accompanies this distribution, and is available
1.8 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.9 +//
1.10 +// Initial Contributors:
1.11 +// Nokia Corporation - initial contribution.
1.12 +//
1.13 +// Contributors:
1.14 +//
1.15 +// Description:
1.16 +//
1.17 +
1.18 +#ifndef __MMFDEVSOUNDSESSION_H__
1.19 +#define __MMFDEVSOUNDSESSION_H__
1.20 +
1.21 +#include <e32base.h>
1.22 +#include <e32std.h>
1.23 +#include <mmf/common/mmfbase.h>
1.24 +#include <mmf/common/mmfutilities.h>
1.25 +#include <mmf/common/mmfcontroller.h>
1.26 +#include <mmf/common/mmfipc.h>
1.27 +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
1.28 +#include <mmf/common/mmfipcserver.h>
1.29 +#endif
1.30 +#include <mmf/server/sounddevice.h>
1.31 +#include "MmfAudioClientServer.h"
1.32 +#include <mmf/server/mmfdevsoundcustominterface.h>
1.33 +#include "MmfDevSoundCIDeMuxUtility.h"
1.34 +
1.35 +#include <e32msgqueue.h>
1.36 +
1.37 +class CMMFAudioServer;
1.38 +class CMMFDevSoundServer;
1.39 +class CMMFDevSoundSvrImp;
1.40 +
1.41 +class CMMFDevSoundSession : public CMmfIpcSession, public MDevSoundObserver,
1.42 + public MMMFDevSoundCustomInterfaceDeMuxInterface
1.43 + {
1.44 +public:
1.45 + static CMMFDevSoundSession* NewL(RServer2& aPolicyServerHandle);
1.46 + ~CMMFDevSoundSession();
1.47 +
1.48 + void CreateL(const CMmfIpcServer& aServer);
1.49 + void ServiceL(const RMmfIpcMessage& aMessage);
1.50 + TInt DevSoundSessionId(void) {return iDevSoundSessionId;};
1.51 + void SendEventToClient(/*TMMFAudioServerEvent& aEvent*/);
1.52 + TBool CheckClientCapabilities();
1.53 +
1.54 +
1.55 + TBool DoInitialize1L(const RMmfIpcMessage& aMessage);
1.56 + TBool DoInitialize2L(const RMmfIpcMessage& aMessage);
1.57 + TBool DoInitialize3L(const RMmfIpcMessage& aMessage);
1.58 + TBool DoInitialize4L(const RMmfIpcMessage& aMessage);
1.59 + TBool DoCapabilitiesL(const RMmfIpcMessage& aMessage);
1.60 + TBool DoConfigL(const RMmfIpcMessage& aMessage);
1.61 + TBool DoSetConfigL(const RMmfIpcMessage& aMessage);
1.62 + TBool DoMaxVolumeL(const RMmfIpcMessage& aMessage);
1.63 + TBool DoVolumeL(const RMmfIpcMessage& aMessage);
1.64 + TBool DoSetVolumeL(const RMmfIpcMessage& aMessage);
1.65 + TBool DoMaxGainL(const RMmfIpcMessage& aMessage);
1.66 + TBool DoGainL(const RMmfIpcMessage& aMessage);
1.67 + TBool DoSetGainL(const RMmfIpcMessage& aMessage);
1.68 + TBool DoGetPlayBalanceL(const RMmfIpcMessage& aMessage);
1.69 + TBool DoSetPlayBalanceL(const RMmfIpcMessage& aMessage);
1.70 + TBool DoGetRecordBalanceL(const RMmfIpcMessage& aMessage);
1.71 + TBool DoSetRecordBalanceL(const RMmfIpcMessage& aMessage);
1.72 + TBool DoPlayInitL(const RMmfIpcMessage& aMessage);
1.73 + TBool DoRecordInitL(const RMmfIpcMessage& aMessage);
1.74 + TBool DoPlayDataL(const RMmfIpcMessage& aMessage);
1.75 + TBool DoRecordDataL(const RMmfIpcMessage& aMessage);
1.76 + TBool DoStopL(const RMmfIpcMessage& aMessage);
1.77 + TBool DoPauseL(const RMmfIpcMessage& aMessage);
1.78 + TBool DoPlayToneL(const RMmfIpcMessage& aMessage);
1.79 + TBool DoPlayDualToneL(const RMmfIpcMessage& aMessage);
1.80 + TBool DoPlayDTMFStringL(const RMmfIpcMessage& aMessage);
1.81 + TBool DoPlayToneSequenceL(const RMmfIpcMessage& aMessage);
1.82 + TBool DoPlayFixedSequenceL(const RMmfIpcMessage& aMessage);
1.83 + TBool DoSetDTMFLengthsL(const RMmfIpcMessage& aMessage);
1.84 + TBool DoSetVolumeRampL(const RMmfIpcMessage& aMessage);
1.85 + TBool DoGetSupportedInputDataTypesL(const RMmfIpcMessage& aMessage);
1.86 + TBool DoCopyFourCCArrayDataL(const RMmfIpcMessage& aMessage);
1.87 + TBool DoGetRecordedBufferL(const RMmfIpcMessage& aMessage);
1.88 + TBool DoSamplesRecordedL(const RMmfIpcMessage& aMessage);
1.89 + TBool DoSamplesPlayedL(const RMmfIpcMessage& aMessage);
1.90 + TBool DoSetToneRepeatsL(const RMmfIpcMessage& aMessage);
1.91 + TBool DoSetPrioritySettingsL(const RMmfIpcMessage& aMessage);
1.92 + TBool DoFixedSequenceNameL(const RMmfIpcMessage& aMessage);
1.93 + TBool DoFixedSequenceCountL(const RMmfIpcMessage& aMessage);
1.94 + TBool DoGetSupportedOutputDataTypesL(const RMmfIpcMessage& aMessage);
1.95 +
1.96 + TBool DoBufferToBeFilledDataL(const RMmfIpcMessage& aMessage);
1.97 + TBool DoBufferToBeEmptiedDataL(const RMmfIpcMessage& aMessage);
1.98 + TBool DoRegisterAsClientL(const RMmfIpcMessage& aMessage);
1.99 + TBool DoCancelRegisterAsClientL(const RMmfIpcMessage& aMessage);
1.100 + TBool DoGetResourceNotificationDataL(const RMmfIpcMessage& aMessage);
1.101 + TBool DoWillResumePlayL(const RMmfIpcMessage& aMessage);
1.102 + TBool DoEmptyBuffersL(const RMmfIpcMessage& aMessage);
1.103 + TBool DoSetClientThreadInfoL(const RMmfIpcMessage& aMessage);
1.104 + TBool DoGetTimePlayedL(const RMmfIpcMessage& aMessage);
1.105 +
1.106 + TBool DoSyncCustomCommandL(const RMmfIpcMessage& aMessage);
1.107 + TBool DoSyncCustomCommandResultL(const RMmfIpcMessage& aMessage);
1.108 + TBool DoAsyncCustomCommandL(const RMmfIpcMessage& aMessage);
1.109 + TBool DoAsyncCustomCommandResultL(const RMmfIpcMessage& aMessage);
1.110 +
1.111 + // from MMMFDevSoundCustomInterfaceDeMuxInterface
1.112 + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf);
1.113 + virtual void DoCloseSlaveL(TInt aHandle);
1.114 + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage);
1.115 + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage);
1.116 + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage);
1.117 + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage);
1.118 +
1.119 +
1.120 + void InitializeL(MDevSoundObserver& aDevSoundObserver, TMMFState aMode);
1.121 + void InitializeL(MDevSoundObserver& aDevSoundObserver, TUid aHWDev, TMMFState aMode);
1.122 + void InitializeL(MDevSoundObserver& aDevSoundObserver, TFourCC aDesiredFourCC, TMMFState aMode);
1.123 +
1.124 + TMMFCapabilities Capabilities();
1.125 + TMMFCapabilities Config() const;
1.126 + void SetConfigL(const TMMFCapabilities& aCaps);
1.127 + TInt MaxVolume();
1.128 + TInt Volume();
1.129 + void SetVolume(TInt aVolume);
1.130 + TInt MaxGain();
1.131 + TInt Gain();
1.132 + void SetGain(TInt aGain);
1.133 + void GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage);
1.134 + void SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage);
1.135 + void GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage);
1.136 + void SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage);
1.137 + void PlayInitL();
1.138 + void RecordInitL();
1.139 + void PlayData();
1.140 + void RecordData();
1.141 + void Stop();
1.142 + void Pause();
1.143 + TInt SamplesRecorded();
1.144 + TInt SamplesPlayed();
1.145 + void PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration);
1.146 + void PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration);
1.147 + void PlayDTMFStringL(const TDesC& aDTMFString);
1.148 + void PlayToneSequenceL(const TDesC8& aData);
1.149 + void PlayFixedSequenceL(TInt aSequenceNumber);
1.150 + void SetToneRepeats(TInt aRepeatCount,
1.151 + const TTimeIntervalMicroSeconds& aRepeatTrailingSilence);
1.152 + void SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength,
1.153 + TTimeIntervalMicroSeconds32& aToneOffLength,
1.154 + TTimeIntervalMicroSeconds32& aPauseLength);
1.155 +
1.156 + void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration);
1.157 + void SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings);
1.158 +
1.159 + TAny* CustomInterface(TUid aInterfaceId);
1.160 + TInt FixedSequenceCount();
1.161 + const TDesC& FixedSequenceName(TInt aSequenceNumber);
1.162 + void GetSupportedInputDataTypesL(RArray<TFourCC>& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const;
1.163 + void GetSupportedOutputDataTypesL(RArray<TFourCC>& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const;
1.164 +
1.165 + void InitializeComplete(TInt aError);
1.166 + void ToneFinished(TInt aError);
1.167 + void BufferToBeFilled(CMMFBuffer* aBuffer);
1.168 + void PlayError(TInt aError);
1.169 + void BufferToBeEmptied(CMMFBuffer* aBuffer);
1.170 + void RecordError(TInt aError);
1.171 + void ConvertError(TInt aError);
1.172 + void DeviceMessage(TUid aMessageType, const TDesC8& aMsg);
1.173 + void SendEventToClient(const TMMFEvent& aEvent);
1.174 +
1.175 + TInt RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData = KNullDesC8);
1.176 + TInt CancelRegisterAsClient(TUid aEventType);
1.177 + TInt GetResourceNotificationData(TUid aEventType, TDes8& aNotificationData);
1.178 + TInt WillResumePlay();
1.179 +
1.180 +
1.181 +protected:
1.182 + CMMFDevSoundSession();
1.183 + void ConstructL(RServer2& aPolicyServerHandle);
1.184 + CMMFDevSoundSvrImp* iBody;
1.185 +
1.186 +private:
1.187 + TInt iDevSoundSessionId;
1.188 + CMMFDataBuffer* iBufferPlay;
1.189 + CMMFDataBuffer* iBufferRecord;
1.190 + RArray<TFourCC> iArray;
1.191 + HBufC* iDTMFString;
1.192 + HBufC8* iToneSeqBuf;
1.193 + TBool iClientHasCaps;
1.194 +
1.195 + RMsgQueue<TMMFDevSoundQueueItem> iMsgQueue; // replaces the messages / AO handlers
1.196 + TMMFDevSoundProxyHwBufPckg iHwBufPckgFill; // data store for 2-stage asynch message passing
1.197 + TMMFDevSoundProxyHwBufPckg iHwBufPckgEmpty; // data store for 2-stage asynch message passing
1.198 +
1.199 + // array of custom interface pairs
1.200 + RArray<TMMFDevSoundCustomInterfaceDeMuxData> iCustomInterfaceArray;
1.201 + CMMFDevSoundCIDeMuxUtility* iDeMuxUtility;
1.202 + };
1.203 +
1.204 +
1.205 +
1.206 +#endif