1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/devsound/sounddevbt/src/RoutingSoundDevice/MMFBtRoutingSoundDevice.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,145 @@
1.4 +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef __MMFBTROUTINGSOUNDDEVICE_H__
1.20 +#define __MMFBTROUTINGSOUNDDEVICE_H__
1.21 +
1.22 +#include <e32base.h>
1.23 +#include <mmf/common/mmfutilities.h>
1.24 +#include <mmf/server/sounddevice.h>
1.25 +
1.26 +#include <mdasound.h>
1.27 +
1.28 +#include "A2dpBTHeadsetAudioIfClient.h"
1.29 +#include "MmfBtRoutingPrioritySettings.h"
1.30 +
1.31 +/**
1.32 + * TRange - primarily used to store bounds for a range of sample rates.
1.33 + * @internalComponent
1.34 + */
1.35 +class TRange
1.36 + {
1.37 +public:
1.38 + TUint iLow;
1.39 + TUint iHigh;
1.40 + };
1.41 +
1.42 +/**
1.43 + * Routing sound play device
1.44 + * @internalComponent
1.45 + */
1.46 +class CRoutingSoundPlayDevice : public CBase
1.47 + {
1.48 +public:
1.49 + IMPORT_C static CRoutingSoundPlayDevice* NewL();
1.50 + ~CRoutingSoundPlayDevice();
1.51 +
1.52 + IMPORT_C void Initialize(TUid aDeviceUid,
1.53 + const TDesC8& aDeviceConfig,
1.54 + TRequestStatus& aStatus);
1.55 + IMPORT_C void CancelInitialize(TUid aDeviceUid);
1.56 + IMPORT_C void OpenDevice(TUid aDeviceUid, TRequestStatus& aStatus);
1.57 + IMPORT_C void CancelOpenDevice(TUid aDeviceUid);
1.58 + IMPORT_C void CloseDevice(TUid aDeviceUid, TRequestStatus& aStatus);
1.59 + IMPORT_C TInt GetSupportedSampleRates(RArray<TUint>& aSupportedDiscreteRates, RArray<TRange>& aSupportedRateRanges);
1.60 + IMPORT_C TInt GetSupportedChannels(RArray<TUint>& aSupportedChannels, TMMFStereoSupport& aStereoSupport);
1.61 + IMPORT_C TInt GetSupportedDataTypes(RArray<TFourCC>& aSupportedDataTypes);
1.62 + IMPORT_C TInt SetDataType(const TFourCC& aDataType);
1.63 + IMPORT_C TInt SetSampleRate(TUint aSampleRate);
1.64 + IMPORT_C TInt SetChannels(TUint aChannels, TMMFStereoSupport aStereoSupport);
1.65 + IMPORT_C TInt SetBufferSize(TUint aBufferSize);
1.66 + IMPORT_C void FlushBuffer();
1.67 + IMPORT_C void NotifyError(TRequestStatus& aStatus);
1.68 + IMPORT_C void CancelNotifyError();
1.69 + IMPORT_C TUint Volume() const;
1.70 + IMPORT_C TInt SetVolume(TUint aVolume);
1.71 + IMPORT_C void PlayData(const TDesC8& aData, TRequestStatus& aStatus);
1.72 + IMPORT_C void CancelPlayData();
1.73 + IMPORT_C TUint BytesPlayed();
1.74 + IMPORT_C TInt ResetBytesPlayed();
1.75 + IMPORT_C TInt PauseBuffer();
1.76 + IMPORT_C TInt ResumePlaying();
1.77 + IMPORT_C TInt Handle() const;
1.78 +protected:
1.79 + CRoutingSoundPlayDevice();
1.80 + void ConstructL();
1.81 +private:
1.82 + RMdaDevSound iSpeakerDevice;
1.83 + RA2dpBTHeadsetAudioInterface iBTDevice;
1.84 + TUid iDeviceUid;
1.85 + TBTDevAddr iBTAddress;
1.86 + TUint iSampleRate;
1.87 + TUint iChannels;
1.88 + TMMFStereoSupport iStereoSupport;
1.89 + TUint iBufferSize;
1.90 +
1.91 + TRequestStatus* iInitializeStatus;
1.92 + TRequestStatus* iOpenDeviceStatus;
1.93 + TRequestStatus* iCloseDeviceStatus;
1.94 + };
1.95 +
1.96 +
1.97 +
1.98 +/**
1.99 + * Routing sound record device
1.100 + * @internalComponent
1.101 + */
1.102 +class CRoutingSoundRecordDevice : public CBase
1.103 + {
1.104 +public:
1.105 + IMPORT_C static CRoutingSoundRecordDevice* NewL();
1.106 + IMPORT_C ~CRoutingSoundRecordDevice();
1.107 +
1.108 + IMPORT_C void Initialize(TUid aDeviceUid,
1.109 + const TDesC8& aDeviceConfig,
1.110 + TRequestStatus& aStatus);
1.111 + IMPORT_C void CancelInitialize(TUid aDeviceUid);
1.112 + IMPORT_C void OpenDevice(TUid aDeviceUid, TRequestStatus& aStatus);
1.113 + IMPORT_C void CancelOpenDevice(TUid aDeviceUid);
1.114 + IMPORT_C void CloseDevice(TUid aDeviceUid, TRequestStatus& aStatus);
1.115 + IMPORT_C TInt GetSupportedSampleRates(RArray<TUint>& aSupportedDiscreteRates, RArray<TRange>& aSupportedRateRanges);
1.116 + IMPORT_C TInt GetSupportedChannels(RArray<TUint>& aSupportedChannels, TMMFStereoSupport& aStereoSupport);
1.117 + IMPORT_C TInt SetSampleRate(TUint aSampleRate);
1.118 + IMPORT_C TInt SetChannels(TUint aChannels, TMMFStereoSupport aStereoSupport);
1.119 + IMPORT_C TInt SetBufferSize(TUint aBufferSize);
1.120 + IMPORT_C void FlushBuffer();
1.121 + IMPORT_C void NotifyError(TRequestStatus& aStatus);
1.122 + IMPORT_C void CancelNotifyError();
1.123 + IMPORT_C TUint Gain() const;
1.124 + IMPORT_C TInt SetGain(TUint aGain);
1.125 + IMPORT_C void RecordData(TDes8& aData, TRequestStatus& aStatus);
1.126 + IMPORT_C void CancelRecordData();
1.127 + IMPORT_C TUint BytesRecorded();
1.128 + IMPORT_C TInt Handle() const;
1.129 +
1.130 +protected:
1.131 + void ConstructL();
1.132 + CRoutingSoundRecordDevice();
1.133 +private:
1.134 + // although the microphone is the only device for now, there may be
1.135 + // a BT microphone in the future, so keep the device uid
1.136 + RMdaDevSound iInputDevice;
1.137 + TUid iDeviceUid;
1.138 + TUint iSampleRate;
1.139 + TUint iChannels;
1.140 + TMMFStereoSupport iStereoSupport;
1.141 + TUint iBufferSize;
1.142 +
1.143 + TRequestStatus* iOpenDeviceStatus;
1.144 + };
1.145 +
1.146 +
1.147 +#endif // __MMFBTROUTINGSOUNDDEVICE_H__
1.148 +