sl@0: // Copyright (c) 2005-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 __MMFBTROUTINGSOUNDDEVICE_H__ sl@0: #define __MMFBTROUTINGSOUNDDEVICE_H__ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #include sl@0: sl@0: #include "A2dpBTHeadsetAudioIfClient.h" sl@0: #include "MmfBtRoutingPrioritySettings.h" sl@0: sl@0: /** sl@0: * TRange - primarily used to store bounds for a range of sample rates. sl@0: * @internalComponent sl@0: */ sl@0: class TRange sl@0: { sl@0: public: sl@0: TUint iLow; sl@0: TUint iHigh; sl@0: }; sl@0: sl@0: /** sl@0: * Routing sound play device sl@0: * @internalComponent sl@0: */ sl@0: class CRoutingSoundPlayDevice : public CBase sl@0: { sl@0: public: sl@0: IMPORT_C static CRoutingSoundPlayDevice* NewL(); sl@0: ~CRoutingSoundPlayDevice(); sl@0: sl@0: IMPORT_C void Initialize(TUid aDeviceUid, sl@0: const TDesC8& aDeviceConfig, sl@0: TRequestStatus& aStatus); sl@0: IMPORT_C void CancelInitialize(TUid aDeviceUid); sl@0: IMPORT_C void OpenDevice(TUid aDeviceUid, TRequestStatus& aStatus); sl@0: IMPORT_C void CancelOpenDevice(TUid aDeviceUid); sl@0: IMPORT_C void CloseDevice(TUid aDeviceUid, TRequestStatus& aStatus); sl@0: IMPORT_C TInt GetSupportedSampleRates(RArray& aSupportedDiscreteRates, RArray& aSupportedRateRanges); sl@0: IMPORT_C TInt GetSupportedChannels(RArray& aSupportedChannels, TMMFStereoSupport& aStereoSupport); sl@0: IMPORT_C TInt GetSupportedDataTypes(RArray& aSupportedDataTypes); sl@0: IMPORT_C TInt SetDataType(const TFourCC& aDataType); sl@0: IMPORT_C TInt SetSampleRate(TUint aSampleRate); sl@0: IMPORT_C TInt SetChannels(TUint aChannels, TMMFStereoSupport aStereoSupport); sl@0: IMPORT_C TInt SetBufferSize(TUint aBufferSize); sl@0: IMPORT_C void FlushBuffer(); sl@0: IMPORT_C void NotifyError(TRequestStatus& aStatus); sl@0: IMPORT_C void CancelNotifyError(); sl@0: IMPORT_C TUint Volume() const; sl@0: IMPORT_C TInt SetVolume(TUint aVolume); sl@0: IMPORT_C void PlayData(const TDesC8& aData, TRequestStatus& aStatus); sl@0: IMPORT_C void CancelPlayData(); sl@0: IMPORT_C TUint BytesPlayed(); sl@0: IMPORT_C TInt ResetBytesPlayed(); sl@0: IMPORT_C TInt PauseBuffer(); sl@0: IMPORT_C TInt ResumePlaying(); sl@0: IMPORT_C TInt Handle() const; sl@0: protected: sl@0: CRoutingSoundPlayDevice(); sl@0: void ConstructL(); sl@0: private: sl@0: RMdaDevSound iSpeakerDevice; sl@0: RA2dpBTHeadsetAudioInterface iBTDevice; sl@0: TUid iDeviceUid; sl@0: TBTDevAddr iBTAddress; sl@0: TUint iSampleRate; sl@0: TUint iChannels; sl@0: TMMFStereoSupport iStereoSupport; sl@0: TUint iBufferSize; sl@0: sl@0: TRequestStatus* iInitializeStatus; sl@0: TRequestStatus* iOpenDeviceStatus; sl@0: TRequestStatus* iCloseDeviceStatus; sl@0: }; sl@0: sl@0: sl@0: sl@0: /** sl@0: * Routing sound record device sl@0: * @internalComponent sl@0: */ sl@0: class CRoutingSoundRecordDevice : public CBase sl@0: { sl@0: public: sl@0: IMPORT_C static CRoutingSoundRecordDevice* NewL(); sl@0: IMPORT_C ~CRoutingSoundRecordDevice(); sl@0: sl@0: IMPORT_C void Initialize(TUid aDeviceUid, sl@0: const TDesC8& aDeviceConfig, sl@0: TRequestStatus& aStatus); sl@0: IMPORT_C void CancelInitialize(TUid aDeviceUid); sl@0: IMPORT_C void OpenDevice(TUid aDeviceUid, TRequestStatus& aStatus); sl@0: IMPORT_C void CancelOpenDevice(TUid aDeviceUid); sl@0: IMPORT_C void CloseDevice(TUid aDeviceUid, TRequestStatus& aStatus); sl@0: IMPORT_C TInt GetSupportedSampleRates(RArray& aSupportedDiscreteRates, RArray& aSupportedRateRanges); sl@0: IMPORT_C TInt GetSupportedChannels(RArray& aSupportedChannels, TMMFStereoSupport& aStereoSupport); sl@0: IMPORT_C TInt SetSampleRate(TUint aSampleRate); sl@0: IMPORT_C TInt SetChannels(TUint aChannels, TMMFStereoSupport aStereoSupport); sl@0: IMPORT_C TInt SetBufferSize(TUint aBufferSize); sl@0: IMPORT_C void FlushBuffer(); sl@0: IMPORT_C void NotifyError(TRequestStatus& aStatus); sl@0: IMPORT_C void CancelNotifyError(); sl@0: IMPORT_C TUint Gain() const; sl@0: IMPORT_C TInt SetGain(TUint aGain); sl@0: IMPORT_C void RecordData(TDes8& aData, TRequestStatus& aStatus); sl@0: IMPORT_C void CancelRecordData(); sl@0: IMPORT_C TUint BytesRecorded(); sl@0: IMPORT_C TInt Handle() const; sl@0: sl@0: protected: sl@0: void ConstructL(); sl@0: CRoutingSoundRecordDevice(); sl@0: private: sl@0: // although the microphone is the only device for now, there may be sl@0: // a BT microphone in the future, so keep the device uid sl@0: RMdaDevSound iInputDevice; sl@0: TUid iDeviceUid; sl@0: TUint iSampleRate; sl@0: TUint iChannels; sl@0: TMMFStereoSupport iStereoSupport; sl@0: TUint iBufferSize; sl@0: sl@0: TRequestStatus* iOpenDeviceStatus; sl@0: }; sl@0: sl@0: sl@0: #endif // __MMFBTROUTINGSOUNDDEVICE_H__ sl@0: