Update contrib.
1 // Copyright (c) 2005-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __MMFBTROUTINGSOUNDDEVICE_H__
17 #define __MMFBTROUTINGSOUNDDEVICE_H__
20 #include <mmf/common/mmfutilities.h>
21 #include <mmf/server/sounddevice.h>
25 #include "A2dpBTHeadsetAudioIfClient.h"
26 #include "MmfBtRoutingPrioritySettings.h"
29 * TRange - primarily used to store bounds for a range of sample rates.
40 * Routing sound play device
43 class CRoutingSoundPlayDevice : public CBase
46 IMPORT_C static CRoutingSoundPlayDevice* NewL();
47 ~CRoutingSoundPlayDevice();
49 IMPORT_C void Initialize(TUid aDeviceUid,
50 const TDesC8& aDeviceConfig,
51 TRequestStatus& aStatus);
52 IMPORT_C void CancelInitialize(TUid aDeviceUid);
53 IMPORT_C void OpenDevice(TUid aDeviceUid, TRequestStatus& aStatus);
54 IMPORT_C void CancelOpenDevice(TUid aDeviceUid);
55 IMPORT_C void CloseDevice(TUid aDeviceUid, TRequestStatus& aStatus);
56 IMPORT_C TInt GetSupportedSampleRates(RArray<TUint>& aSupportedDiscreteRates, RArray<TRange>& aSupportedRateRanges);
57 IMPORT_C TInt GetSupportedChannels(RArray<TUint>& aSupportedChannels, TMMFStereoSupport& aStereoSupport);
58 IMPORT_C TInt GetSupportedDataTypes(RArray<TFourCC>& aSupportedDataTypes);
59 IMPORT_C TInt SetDataType(const TFourCC& aDataType);
60 IMPORT_C TInt SetSampleRate(TUint aSampleRate);
61 IMPORT_C TInt SetChannels(TUint aChannels, TMMFStereoSupport aStereoSupport);
62 IMPORT_C TInt SetBufferSize(TUint aBufferSize);
63 IMPORT_C void FlushBuffer();
64 IMPORT_C void NotifyError(TRequestStatus& aStatus);
65 IMPORT_C void CancelNotifyError();
66 IMPORT_C TUint Volume() const;
67 IMPORT_C TInt SetVolume(TUint aVolume);
68 IMPORT_C void PlayData(const TDesC8& aData, TRequestStatus& aStatus);
69 IMPORT_C void CancelPlayData();
70 IMPORT_C TUint BytesPlayed();
71 IMPORT_C TInt ResetBytesPlayed();
72 IMPORT_C TInt PauseBuffer();
73 IMPORT_C TInt ResumePlaying();
74 IMPORT_C TInt Handle() const;
76 CRoutingSoundPlayDevice();
79 RMdaDevSound iSpeakerDevice;
80 RA2dpBTHeadsetAudioInterface iBTDevice;
82 TBTDevAddr iBTAddress;
85 TMMFStereoSupport iStereoSupport;
88 TRequestStatus* iInitializeStatus;
89 TRequestStatus* iOpenDeviceStatus;
90 TRequestStatus* iCloseDeviceStatus;
96 * Routing sound record device
99 class CRoutingSoundRecordDevice : public CBase
102 IMPORT_C static CRoutingSoundRecordDevice* NewL();
103 IMPORT_C ~CRoutingSoundRecordDevice();
105 IMPORT_C void Initialize(TUid aDeviceUid,
106 const TDesC8& aDeviceConfig,
107 TRequestStatus& aStatus);
108 IMPORT_C void CancelInitialize(TUid aDeviceUid);
109 IMPORT_C void OpenDevice(TUid aDeviceUid, TRequestStatus& aStatus);
110 IMPORT_C void CancelOpenDevice(TUid aDeviceUid);
111 IMPORT_C void CloseDevice(TUid aDeviceUid, TRequestStatus& aStatus);
112 IMPORT_C TInt GetSupportedSampleRates(RArray<TUint>& aSupportedDiscreteRates, RArray<TRange>& aSupportedRateRanges);
113 IMPORT_C TInt GetSupportedChannels(RArray<TUint>& aSupportedChannels, TMMFStereoSupport& aStereoSupport);
114 IMPORT_C TInt SetSampleRate(TUint aSampleRate);
115 IMPORT_C TInt SetChannels(TUint aChannels, TMMFStereoSupport aStereoSupport);
116 IMPORT_C TInt SetBufferSize(TUint aBufferSize);
117 IMPORT_C void FlushBuffer();
118 IMPORT_C void NotifyError(TRequestStatus& aStatus);
119 IMPORT_C void CancelNotifyError();
120 IMPORT_C TUint Gain() const;
121 IMPORT_C TInt SetGain(TUint aGain);
122 IMPORT_C void RecordData(TDes8& aData, TRequestStatus& aStatus);
123 IMPORT_C void CancelRecordData();
124 IMPORT_C TUint BytesRecorded();
125 IMPORT_C TInt Handle() const;
129 CRoutingSoundRecordDevice();
131 // although the microphone is the only device for now, there may be
132 // a BT microphone in the future, so keep the device uid
133 RMdaDevSound iInputDevice;
137 TMMFStereoSupport iStereoSupport;
140 TRequestStatus* iOpenDeviceStatus;
144 #endif // __MMFBTROUTINGSOUNDDEVICE_H__