sl@0: // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef __BTSOUNDDEVICEBODY__H__ sl@0: #define __BTSOUNDDEVICEBODY__H__ sl@0: sl@0: #include "MmfBtDevSoundCallbackHandler.h" sl@0: #include sl@0: #include sl@0: sl@0: sl@0: /* sl@0: * sl@0: * Class Name: CMMFDevSoundClientImp sl@0: * sl@0: * Reference internals for CMMFDevSound sl@0: * @internalComponent sl@0: * sl@0: */ sl@0: class CMMFDevSoundClientImp : public CBase, sl@0: public MMMFDevSoundPlugin, sl@0: public MAudioClientThreadInfo, sl@0: public MAutoPauseResumeSupport sl@0: { sl@0: public: sl@0: static CMMFDevSoundClientImp* NewL(); sl@0: ~CMMFDevSoundClientImp(); sl@0: sl@0: // Initializes to raw audio data PCM16 and Sampling Rate of 8 KHz. sl@0: void InitializeL(MDevSoundObserver& aDevSoundObserver, TMMFState aMode); sl@0: // Initializes with hardware device and mode (play, record, convert) sl@0: void InitializeL(MDevSoundObserver& aDevSoundObserver, TUid aHWDev, TMMFState aMode); sl@0: // Initializes with chain of hardware devices and mode (play, record, convert) sl@0: void InitializeL(MDevSoundObserver& aDevSoundObserver, CArrayPtr aHWDevArray, TMMFState aMode); sl@0: // Initializes with hardware device associated with specific FourCC code sl@0: // and desired mode (play, record, convert) sl@0: void InitializeL(MDevSoundObserver& aDevSoundObserver, TFourCC aDesiredFourCC, TMMFState aMode); sl@0: sl@0: // Returns device capabilities sl@0: TMMFCapabilities Capabilities(); sl@0: // Returns device configuration sl@0: TMMFCapabilities Config() const; sl@0: // Sets device configuration sl@0: void SetConfigL(const TMMFCapabilities& aCaps); sl@0: sl@0: // Returns maximum play volume device supports sl@0: TInt MaxVolume(); sl@0: // Returns play volume device is configured to sl@0: TInt Volume(); sl@0: // Sets device play volume sl@0: void SetVolume(TInt aVolume); sl@0: sl@0: // Returns maximum record gain device supports sl@0: TInt MaxGain(); sl@0: // Returns record gain device is configured to sl@0: TInt Gain(); sl@0: // Sets device record gain sl@0: void SetGain(TInt aGain); sl@0: sl@0: // Returns play balance sl@0: void GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage); sl@0: // Sets play balance sl@0: void SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage); sl@0: sl@0: // Returns record balance sl@0: void GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage); sl@0: // Sets record balance sl@0: void SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage); sl@0: sl@0: // Initializes audio device and start play process sl@0: void PlayInitL(); sl@0: // Initializes audio device and start record process sl@0: void RecordInitL(); sl@0: // Plays the data in the buffer sl@0: void PlayData(); sl@0: // Records data into buffer sl@0: void RecordData(); sl@0: // Stops the ongoing operation sl@0: void Stop(); sl@0: // Tempororily Stops the ongoing operation sl@0: void Pause(); sl@0: sl@0: // Returns the Sample recorded so far sl@0: TInt SamplesRecorded(); sl@0: // Returns the Sample played so far sl@0: TInt SamplesPlayed(); sl@0: sl@0: // Initializes device and start playing tone sl@0: void PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration); sl@0: // Initializes device and start playing dual tone sl@0: void PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration); sl@0: // Initializes device and start playing DTMF String sl@0: void PlayDTMFStringL(const TDesC& aDTMFString); sl@0: // Initializes device and start playing tone sequence sl@0: void PlayToneSequenceL(const TDesC8& aData); sl@0: // Initializes device and start playing fixed sequence sl@0: void PlayFixedSequenceL(TInt aSequenceNumber); sl@0: sl@0: // Sets tone repeat attributes sl@0: void SetToneRepeats(TInt aRepeatCount, sl@0: const TTimeIntervalMicroSeconds& aRepeatTrailingSilence); sl@0: // Sets DTMF tone attributes sl@0: void SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength, sl@0: TTimeIntervalMicroSeconds32& aToneOffLength, sl@0: TTimeIntervalMicroSeconds32& aPauseLength); sl@0: // Sets volume ramp for playing sl@0: void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration); sl@0: // Sets priority settings sl@0: void SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings); sl@0: sl@0: // Provides interface for converting data in buffer sl@0: void ConvertInitL(); sl@0: // Converts data in the buffer sl@0: void ConvertData(); sl@0: sl@0: // Provides interface for sending custom commands for the audio device sl@0: TAny* CustomInterface(TUid aInterfaceId); sl@0: sl@0: // Provides interface for querying fixed sequence count sl@0: TInt FixedSequenceCount(); sl@0: // Provides interface for querying fixed sequence name sl@0: const TDesC& FixedSequenceName(TInt aSequenceNumber); sl@0: // Gets the supported input datatypes sl@0: void GetSupportedInputDataTypesL(RArray& aSupportedDataTypesconst, const TMMFPrioritySettings& aPrioritySettings) const; sl@0: // Gets the supported output datatypes sl@0: void GetSupportedOutputDataTypesL(RArray& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const; sl@0: // Set the real client thread with thread Id sl@0: TInt SetClientThreadInfo(TThreadId aTid); sl@0: sl@0: // Registers the client for notification sl@0: TInt RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData = KNullDesC8); sl@0: //cancels the registered notification sl@0: TInt CancelRegisterAsClient(TUid aEventType); sl@0: //get the notification data to resume sl@0: TInt GetResourceNotificationData(TUid aEventType,TDes8& aNotificationData); sl@0: //if client need more than the default timeout period sl@0: TInt WillResumePlay(); sl@0: sl@0: private: sl@0: // So that nobody can extend sl@0: CMMFDevSoundClientImp(); sl@0: // Second phase constructor sl@0: void ConstructL(); sl@0: void CancelCalbackHandlers(); sl@0: sl@0: private: sl@0: sl@0: RMMFDevSoundProxy* iDevSoundProxy; sl@0: MDevSoundObserver* iDevSoundObserver; sl@0: sl@0: // Handles receiving events sl@0: CMMFBufferToBeFilledHandler* iBTBFHandler; sl@0: CMMFBufferToBeEmptiedHandler* iBTBEHandler; sl@0: CMMFPlayErrorHandler* iPEHandler; sl@0: CMMFRecordErrorHandler* iREHandler; sl@0: CMMFToneFinishedHandler* iTFHandler; sl@0: CMMFInitializeCompleteHandler* iICHandler; sl@0: CMMFSendEventToClientHandler* iSETCHandler; sl@0: }; sl@0: sl@0: #include "BtSoundDeviceBody.inl" sl@0: sl@0: #endif // __BTSOUNDDEVICEBODY__H__