os/mm/devsound/sounddevbt/PlatSec/src/Server/AudioServer/MmfBtDevSoundSession.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2004-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 __MMFBTDEVSOUNDSESSION_H__
    17 #define __MMFBTDEVSOUNDSESSION_H__
    18 
    19 #include <e32base.h>
    20 #include <e32std.h>
    21 #include <mmfbase.h>
    22 #include <mmfutilities.h>
    23 #include <mmf/common/mmfcontroller.h>
    24 #include <mmf/common/mmfipc.h>
    25 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    26 #include <mmf/common/mmfipcserver.h>
    27 #endif
    28 #include <mmf/server/sounddevice.h>
    29 #include "MmfBtAudioClientServer.h"
    30 
    31 
    32 class CMMFAudioServer;
    33 class CMMFDevSoundServer;
    34 class CMMFDevSoundSvrImp;
    35 
    36 class CMMFDevSoundSession : public CMmfIpcSession, public MDevSoundObserver
    37 	{
    38 public:
    39 	static CMMFDevSoundSession* NewL(RServer2& aPolicyServerHandle);
    40 	~CMMFDevSoundSession();
    41 
    42 	void CreateL(const CMmfIpcServer& aServer);
    43 	void ServiceL(const RMmfIpcMessage& aMessage);
    44 	TInt DevSoundSessionId(void) {return iDevSoundSessionId;};
    45 	void SendEventToClient(/*TMMFAudioServerEvent& aEvent*/);
    46 	TBool CheckClientCapabilities();
    47 
    48 
    49 	TBool DoInitialize1L(const RMmfIpcMessage& aMessage);
    50 	TBool DoInitialize2L(const RMmfIpcMessage& aMessage);
    51 	TBool DoInitialize3L(const RMmfIpcMessage& aMessage);
    52 	TBool DoInitialize4L(const RMmfIpcMessage& aMessage);
    53 	TBool DoCapabilitiesL(const RMmfIpcMessage& aMessage);
    54 	TBool DoConfigL(const RMmfIpcMessage& aMessage);
    55 	TBool DoSetConfigL(const RMmfIpcMessage& aMessage);
    56 	TBool DoMaxVolumeL(const RMmfIpcMessage& aMessage);
    57 	TBool DoVolumeL(const RMmfIpcMessage& aMessage);
    58 	TBool DoSetVolumeL(const RMmfIpcMessage& aMessage);
    59 	TBool DoMaxGainL(const RMmfIpcMessage& aMessage);
    60 	TBool DoGainL(const RMmfIpcMessage& aMessage);
    61 	TBool DoSetGainL(const RMmfIpcMessage& aMessage);
    62 	TBool DoGetPlayBalanceL(const RMmfIpcMessage& aMessage);
    63 	TBool DoSetPlayBalanceL(const RMmfIpcMessage& aMessage);
    64 	TBool DoGetRecordBalanceL(const RMmfIpcMessage& aMessage);
    65 	TBool DoSetRecordBalanceL(const RMmfIpcMessage& aMessage);
    66 	TBool DoPlayInitL(const RMmfIpcMessage& aMessage);
    67 	TBool DoRecordInitL(const RMmfIpcMessage& aMessage);
    68 	TBool DoPlayDataL(const RMmfIpcMessage& aMessage);
    69 	TBool DoRecordDataL(const RMmfIpcMessage& aMessage);
    70 	TBool DoStopL(const RMmfIpcMessage& aMessage);
    71 	TBool DoPauseL(const RMmfIpcMessage& aMessage);
    72 	TBool DoPlayToneL(const RMmfIpcMessage& aMessage);
    73 	TBool DoPlayDualToneL(const RMmfIpcMessage& aMessage);
    74 	TBool DoPlayDTMFStringL(const RMmfIpcMessage& aMessage);
    75 	TBool DoPlayToneSequenceL(const RMmfIpcMessage& aMessage);
    76 	TBool DoPlayFixedSequenceL(const RMmfIpcMessage& aMessage);
    77 	TBool DoSetDTMFLengthsL(const RMmfIpcMessage& aMessage);
    78 	TBool DoSetVolumeRampL(const RMmfIpcMessage& aMessage);
    79 	TBool DoGetSupportedInputDataTypesL(const RMmfIpcMessage& aMessage);
    80 	TBool DoCopyFourCCArrayDataL(const RMmfIpcMessage& aMessage);
    81 	TBool DoGetRecordedBufferL(const RMmfIpcMessage& aMessage);
    82 	TBool DoSamplesRecordedL(const RMmfIpcMessage& aMessage);
    83 	TBool DoSamplesPlayedL(const RMmfIpcMessage& aMessage);
    84 	TBool DoSetToneRepeatsL(const RMmfIpcMessage& aMessage);
    85 	TBool DoSetPrioritySettingsL(const RMmfIpcMessage& aMessage);
    86 	TBool DoFixedSequenceNameL(const RMmfIpcMessage& aMessage);
    87 	TBool DoConvertInitL(const RMmfIpcMessage& aMessage);
    88 	TBool DoConvertDataL(const RMmfIpcMessage& aMessage);
    89 	TBool DoFixedSequenceCountL(const RMmfIpcMessage& aMessage);
    90 	TBool DoGetSupportedOutputDataTypesL(const RMmfIpcMessage& aMessage);
    91 
    92 	TBool DoInitializeCompleteEventL(const RMmfIpcMessage& aMessage);
    93 	TBool DoCancelInitializeCompleteEventL(const RMmfIpcMessage& aMessage);
    94 	TBool DoBufferToBeFilledEventL(const RMmfIpcMessage& aMessage);
    95 	TBool DoCancelBufferToBeFilledEventL(const RMmfIpcMessage& aMessage);
    96 	TBool DoBufferToBeEmptiedEventL(const RMmfIpcMessage& aMessage);
    97 	TBool DoCancelBufferToBeEmptiedEventL(const RMmfIpcMessage& aMessage);
    98 	TBool DoPlayErrorEventL(const RMmfIpcMessage& aMessage);
    99 	TBool DoCancelPlayErrorEventL(const RMmfIpcMessage& aMessage);
   100 	TBool DoRecordErrorEventL(const RMmfIpcMessage& aMessage);
   101 	TBool DoCancelRecordErrorEventL(const RMmfIpcMessage& aMessage);
   102 	TBool DoToneFinishedEventL(const RMmfIpcMessage& aMessage);
   103 	TBool DoCancelToneFinishedEventL(const RMmfIpcMessage& aMessage);
   104 	TBool DoSendEventToClientEventL(const RMmfIpcMessage& aMessage);
   105 	TBool DoCancelSendEventToClientEventL(const RMmfIpcMessage& aMessage);
   106 	TBool DoRegisterAsClientL(const RMmfIpcMessage& aMessage);
   107 	TBool DoCancelRegisterAsClientL(const RMmfIpcMessage& aMessage);
   108 	TBool DoGetResourceNotificationDataL(const RMmfIpcMessage& aMessage);
   109 	TBool DoWillResumePlayL(const RMmfIpcMessage& aMessage);
   110 	TBool DoSetClientThreadInfoL(const RMmfIpcMessage& aMessage);
   111 	
   112     void InitializeL(MDevSoundObserver& aDevSoundObserver, TMMFState aMode);
   113 	void InitializeL(MDevSoundObserver& aDevSoundObserver, TUid aHWDev, TMMFState aMode);
   114 	void InitializeL(MDevSoundObserver& aDevSoundObserver, CArrayPtr<TUid> aHWDevArray, TMMFState aMode);
   115 	void InitializeL(MDevSoundObserver& aDevSoundObserver, TFourCC aDesiredFourCC, TMMFState aMode);
   116 
   117 	TMMFCapabilities Capabilities();
   118 	TMMFCapabilities Config() const;
   119 	void SetConfigL(const TMMFCapabilities& aCaps);
   120 	TInt MaxVolume();
   121 	TInt Volume();
   122 	void SetVolume(TInt aVolume);
   123 	TInt MaxGain();
   124 	TInt Gain();
   125 	void SetGain(TInt aGain);
   126 	void GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage);
   127 	void SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage);
   128 	void GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage);
   129 	void SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage);
   130 	void PlayInitL();
   131 	void RecordInitL();
   132 	void PlayData();
   133 	void RecordData();
   134 	void Stop();
   135 	void Pause();
   136 	TInt SamplesRecorded();
   137 	TInt SamplesPlayed();
   138 	void PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration);
   139 	void PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration);
   140 	void PlayDTMFStringL(const TDesC& aDTMFString);
   141 	void PlayToneSequenceL(const TDesC8& aData);
   142 	void PlayFixedSequenceL(TInt aSequenceNumber);
   143 	void SetToneRepeats(TInt aRepeatCount,
   144 					const TTimeIntervalMicroSeconds& aRepeatTrailingSilence);
   145 	void SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength,
   146 									TTimeIntervalMicroSeconds32& aToneOffLength,
   147 									TTimeIntervalMicroSeconds32& aPauseLength);
   148 
   149 	void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration);
   150 	void SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings);
   151 	void ConvertInitL();
   152 	void ConvertData();
   153 	TAny* CustomInterface(TUid aInterfaceId);
   154 	TInt FixedSequenceCount();
   155 	const TDesC& FixedSequenceName(TInt aSequenceNumber);
   156 	void GetSupportedInputDataTypesL(RArray<TFourCC>& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const;
   157 	void GetSupportedOutputDataTypesL(RArray<TFourCC>& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const;
   158 
   159 	void InitializeComplete(TInt aError);
   160 	void ToneFinished(TInt aError);
   161 	void BufferToBeFilled(CMMFBuffer* aBuffer);
   162 	void PlayError(TInt aError);
   163 	void BufferToBeEmptied(CMMFBuffer* aBuffer);
   164 	void RecordError(TInt aError);
   165 	void ConvertError(TInt aError);
   166 	void DeviceMessage(TUid aMessageType, const TDesC8& aMsg);
   167 	void SendEventToClient(const TMMFEvent& aEvent);
   168 	
   169 	TInt RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData = KNullDesC8);
   170 	TInt CancelRegisterAsClient(TUid aEventType);
   171 	TInt GetResourceNotificationData(TUid aEventType, TDes8& aNotificationData);
   172 	TInt WillResumePlay();
   173 	
   174 protected:
   175 	CMMFDevSoundSession();
   176 	void ConstructL(RServer2& aPolicyServerHandle);
   177 	CMMFDevSoundSvrImp* iBody;
   178 	
   179 private:
   180 	TInt iDevSoundSessionId;
   181 	RMmfIpcMessage* iBTBFMessage;
   182 	RMmfIpcMessage* iBTBEMessage;
   183 	RMmfIpcMessage* iPEMessage;
   184 	RMmfIpcMessage* iREMessage;
   185 	RMmfIpcMessage* iTFMessage;
   186 	RMmfIpcMessage* iICMessage;
   187 	RMmfIpcMessage* iSETCMessage;
   188 	CMMFDataBuffer* iBufferPlay;
   189 	CMMFDataBuffer* iBufferRecord;
   190 	RArray<TFourCC> iArray;
   191 	HBufC* iDTMFString;
   192 	HBufC8* iToneSeqBuf;
   193 	TBool iClientHasCaps;
   194 	};
   195 	
   196 	
   197 
   198 #endif