1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/devsound/sounddevbt/PlatSec/src/SoundDevice/BtSoundDeviceBody.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,175 @@
1.4 +// Copyright (c) 2001-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 __BTSOUNDDEVICEBODY__H__
1.20 +#define __BTSOUNDDEVICEBODY__H__
1.21 +
1.22 +#include "MmfBtDevSoundCallbackHandler.h"
1.23 +#include <mmf/plugin/devsoundplugin.h>
1.24 +#include <mmf/server/mmfdevsoundcustominterfacesupport.h>
1.25 +
1.26 +
1.27 +/*
1.28 + *
1.29 + * Class Name: CMMFDevSoundClientImp
1.30 + *
1.31 + * Reference internals for CMMFDevSound
1.32 + * @internalComponent
1.33 + *
1.34 + */
1.35 +class CMMFDevSoundClientImp : public CBase,
1.36 + public MMMFDevSoundPlugin,
1.37 + public MAudioClientThreadInfo,
1.38 + public MAutoPauseResumeSupport
1.39 + {
1.40 +public:
1.41 + static CMMFDevSoundClientImp* NewL();
1.42 + ~CMMFDevSoundClientImp();
1.43 +
1.44 + // Initializes to raw audio data PCM16 and Sampling Rate of 8 KHz.
1.45 + void InitializeL(MDevSoundObserver& aDevSoundObserver, TMMFState aMode);
1.46 + // Initializes with hardware device and mode (play, record, convert)
1.47 + void InitializeL(MDevSoundObserver& aDevSoundObserver, TUid aHWDev, TMMFState aMode);
1.48 + // Initializes with chain of hardware devices and mode (play, record, convert)
1.49 + void InitializeL(MDevSoundObserver& aDevSoundObserver, CArrayPtr<TUid> aHWDevArray, TMMFState aMode);
1.50 + // Initializes with hardware device associated with specific FourCC code
1.51 + // and desired mode (play, record, convert)
1.52 + void InitializeL(MDevSoundObserver& aDevSoundObserver, TFourCC aDesiredFourCC, TMMFState aMode);
1.53 +
1.54 + // Returns device capabilities
1.55 + TMMFCapabilities Capabilities();
1.56 + // Returns device configuration
1.57 + TMMFCapabilities Config() const;
1.58 + // Sets device configuration
1.59 + void SetConfigL(const TMMFCapabilities& aCaps);
1.60 +
1.61 + // Returns maximum play volume device supports
1.62 + TInt MaxVolume();
1.63 + // Returns play volume device is configured to
1.64 + TInt Volume();
1.65 + // Sets device play volume
1.66 + void SetVolume(TInt aVolume);
1.67 +
1.68 + // Returns maximum record gain device supports
1.69 + TInt MaxGain();
1.70 + // Returns record gain device is configured to
1.71 + TInt Gain();
1.72 + // Sets device record gain
1.73 + void SetGain(TInt aGain);
1.74 +
1.75 + // Returns play balance
1.76 + void GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage);
1.77 + // Sets play balance
1.78 + void SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage);
1.79 +
1.80 + // Returns record balance
1.81 + void GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage);
1.82 + // Sets record balance
1.83 + void SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage);
1.84 +
1.85 + // Initializes audio device and start play process
1.86 + void PlayInitL();
1.87 + // Initializes audio device and start record process
1.88 + void RecordInitL();
1.89 + // Plays the data in the buffer
1.90 + void PlayData();
1.91 + // Records data into buffer
1.92 + void RecordData();
1.93 + // Stops the ongoing operation
1.94 + void Stop();
1.95 + // Tempororily Stops the ongoing operation
1.96 + void Pause();
1.97 +
1.98 + // Returns the Sample recorded so far
1.99 + TInt SamplesRecorded();
1.100 + // Returns the Sample played so far
1.101 + TInt SamplesPlayed();
1.102 +
1.103 + // Initializes device and start playing tone
1.104 + void PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration);
1.105 + // Initializes device and start playing dual tone
1.106 + void PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration);
1.107 + // Initializes device and start playing DTMF String
1.108 + void PlayDTMFStringL(const TDesC& aDTMFString);
1.109 + // Initializes device and start playing tone sequence
1.110 + void PlayToneSequenceL(const TDesC8& aData);
1.111 + // Initializes device and start playing fixed sequence
1.112 + void PlayFixedSequenceL(TInt aSequenceNumber);
1.113 +
1.114 + // Sets tone repeat attributes
1.115 + void SetToneRepeats(TInt aRepeatCount,
1.116 + const TTimeIntervalMicroSeconds& aRepeatTrailingSilence);
1.117 + // Sets DTMF tone attributes
1.118 + void SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength,
1.119 + TTimeIntervalMicroSeconds32& aToneOffLength,
1.120 + TTimeIntervalMicroSeconds32& aPauseLength);
1.121 + // Sets volume ramp for playing
1.122 + void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration);
1.123 + // Sets priority settings
1.124 + void SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings);
1.125 +
1.126 + // Provides interface for converting data in buffer
1.127 + void ConvertInitL();
1.128 + // Converts data in the buffer
1.129 + void ConvertData();
1.130 +
1.131 + // Provides interface for sending custom commands for the audio device
1.132 + TAny* CustomInterface(TUid aInterfaceId);
1.133 +
1.134 + // Provides interface for querying fixed sequence count
1.135 + TInt FixedSequenceCount();
1.136 + // Provides interface for querying fixed sequence name
1.137 + const TDesC& FixedSequenceName(TInt aSequenceNumber);
1.138 + // Gets the supported input datatypes
1.139 + void GetSupportedInputDataTypesL(RArray<TFourCC>& aSupportedDataTypesconst, const TMMFPrioritySettings& aPrioritySettings) const;
1.140 + // Gets the supported output datatypes
1.141 + void GetSupportedOutputDataTypesL(RArray<TFourCC>& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const;
1.142 + // Set the real client thread with thread Id
1.143 + TInt SetClientThreadInfo(TThreadId aTid);
1.144 +
1.145 + // Registers the client for notification
1.146 + TInt RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData = KNullDesC8);
1.147 + //cancels the registered notification
1.148 + TInt CancelRegisterAsClient(TUid aEventType);
1.149 + //get the notification data to resume
1.150 + TInt GetResourceNotificationData(TUid aEventType,TDes8& aNotificationData);
1.151 + //if client need more than the default timeout period
1.152 + TInt WillResumePlay();
1.153 +
1.154 +private:
1.155 + // So that nobody can extend
1.156 + CMMFDevSoundClientImp();
1.157 + // Second phase constructor
1.158 + void ConstructL();
1.159 + void CancelCalbackHandlers();
1.160 +
1.161 +private:
1.162 +
1.163 + RMMFDevSoundProxy* iDevSoundProxy;
1.164 + MDevSoundObserver* iDevSoundObserver;
1.165 +
1.166 + // Handles receiving events
1.167 + CMMFBufferToBeFilledHandler* iBTBFHandler;
1.168 + CMMFBufferToBeEmptiedHandler* iBTBEHandler;
1.169 + CMMFPlayErrorHandler* iPEHandler;
1.170 + CMMFRecordErrorHandler* iREHandler;
1.171 + CMMFToneFinishedHandler* iTFHandler;
1.172 + CMMFInitializeCompleteHandler* iICHandler;
1.173 + CMMFSendEventToClientHandler* iSETCHandler;
1.174 + };
1.175 +
1.176 +#include "BtSoundDeviceBody.inl"
1.177 +
1.178 +#endif // __BTSOUNDDEVICEBODY__H__