Update contrib.
1 // Copyright (c) 2001-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 __BTSOUNDDEVICEBODY__H__
17 #define __BTSOUNDDEVICEBODY__H__
19 #include "MmfBtDevSoundCallbackHandler.h"
20 #include <mmf/plugin/devsoundplugin.h>
21 #include <mmf/server/mmfdevsoundcustominterfacesupport.h>
26 * Class Name: CMMFDevSoundClientImp
28 * Reference internals for CMMFDevSound
32 class CMMFDevSoundClientImp : public CBase,
33 public MMMFDevSoundPlugin,
34 public MAudioClientThreadInfo,
35 public MAutoPauseResumeSupport
38 static CMMFDevSoundClientImp* NewL();
39 ~CMMFDevSoundClientImp();
41 // Initializes to raw audio data PCM16 and Sampling Rate of 8 KHz.
42 void InitializeL(MDevSoundObserver& aDevSoundObserver, TMMFState aMode);
43 // Initializes with hardware device and mode (play, record, convert)
44 void InitializeL(MDevSoundObserver& aDevSoundObserver, TUid aHWDev, TMMFState aMode);
45 // Initializes with chain of hardware devices and mode (play, record, convert)
46 void InitializeL(MDevSoundObserver& aDevSoundObserver, CArrayPtr<TUid> aHWDevArray, TMMFState aMode);
47 // Initializes with hardware device associated with specific FourCC code
48 // and desired mode (play, record, convert)
49 void InitializeL(MDevSoundObserver& aDevSoundObserver, TFourCC aDesiredFourCC, TMMFState aMode);
51 // Returns device capabilities
52 TMMFCapabilities Capabilities();
53 // Returns device configuration
54 TMMFCapabilities Config() const;
55 // Sets device configuration
56 void SetConfigL(const TMMFCapabilities& aCaps);
58 // Returns maximum play volume device supports
60 // Returns play volume device is configured to
62 // Sets device play volume
63 void SetVolume(TInt aVolume);
65 // Returns maximum record gain device supports
67 // Returns record gain device is configured to
69 // Sets device record gain
70 void SetGain(TInt aGain);
72 // Returns play balance
73 void GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage);
75 void SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage);
77 // Returns record balance
78 void GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage);
79 // Sets record balance
80 void SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage);
82 // Initializes audio device and start play process
84 // Initializes audio device and start record process
86 // Plays the data in the buffer
88 // Records data into buffer
90 // Stops the ongoing operation
92 // Tempororily Stops the ongoing operation
95 // Returns the Sample recorded so far
96 TInt SamplesRecorded();
97 // Returns the Sample played so far
100 // Initializes device and start playing tone
101 void PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration);
102 // Initializes device and start playing dual tone
103 void PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration);
104 // Initializes device and start playing DTMF String
105 void PlayDTMFStringL(const TDesC& aDTMFString);
106 // Initializes device and start playing tone sequence
107 void PlayToneSequenceL(const TDesC8& aData);
108 // Initializes device and start playing fixed sequence
109 void PlayFixedSequenceL(TInt aSequenceNumber);
111 // Sets tone repeat attributes
112 void SetToneRepeats(TInt aRepeatCount,
113 const TTimeIntervalMicroSeconds& aRepeatTrailingSilence);
114 // Sets DTMF tone attributes
115 void SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength,
116 TTimeIntervalMicroSeconds32& aToneOffLength,
117 TTimeIntervalMicroSeconds32& aPauseLength);
118 // Sets volume ramp for playing
119 void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration);
120 // Sets priority settings
121 void SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings);
123 // Provides interface for converting data in buffer
125 // Converts data in the buffer
128 // Provides interface for sending custom commands for the audio device
129 TAny* CustomInterface(TUid aInterfaceId);
131 // Provides interface for querying fixed sequence count
132 TInt FixedSequenceCount();
133 // Provides interface for querying fixed sequence name
134 const TDesC& FixedSequenceName(TInt aSequenceNumber);
135 // Gets the supported input datatypes
136 void GetSupportedInputDataTypesL(RArray<TFourCC>& aSupportedDataTypesconst, const TMMFPrioritySettings& aPrioritySettings) const;
137 // Gets the supported output datatypes
138 void GetSupportedOutputDataTypesL(RArray<TFourCC>& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const;
139 // Set the real client thread with thread Id
140 TInt SetClientThreadInfo(TThreadId aTid);
142 // Registers the client for notification
143 TInt RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData = KNullDesC8);
144 //cancels the registered notification
145 TInt CancelRegisterAsClient(TUid aEventType);
146 //get the notification data to resume
147 TInt GetResourceNotificationData(TUid aEventType,TDes8& aNotificationData);
148 //if client need more than the default timeout period
149 TInt WillResumePlay();
152 // So that nobody can extend
153 CMMFDevSoundClientImp();
154 // Second phase constructor
156 void CancelCalbackHandlers();
160 RMMFDevSoundProxy* iDevSoundProxy;
161 MDevSoundObserver* iDevSoundObserver;
163 // Handles receiving events
164 CMMFBufferToBeFilledHandler* iBTBFHandler;
165 CMMFBufferToBeEmptiedHandler* iBTBEHandler;
166 CMMFPlayErrorHandler* iPEHandler;
167 CMMFRecordErrorHandler* iREHandler;
168 CMMFToneFinishedHandler* iTFHandler;
169 CMMFInitializeCompleteHandler* iICHandler;
170 CMMFSendEventToClientHandler* iSETCHandler;
173 #include "BtSoundDeviceBody.inl"
175 #endif // __BTSOUNDDEVICEBODY__H__