os/mm/devsound/sounddevbt/PlatSec/src/SoundDevice/BtSoundDeviceBody.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef __BTSOUNDDEVICEBODY__H__
    17 #define __BTSOUNDDEVICEBODY__H__
    18 
    19 #include "MmfBtDevSoundCallbackHandler.h" 
    20 #include <mmf/plugin/devsoundplugin.h>
    21 #include <mmf/server/mmfdevsoundcustominterfacesupport.h>
    22 
    23 
    24 /*
    25  *
    26  *	Class Name:	CMMFDevSoundClientImp
    27  *
    28  *	Reference internals for CMMFDevSound
    29  *  @internalComponent
    30  *
    31  */
    32 class CMMFDevSoundClientImp : public CBase, 
    33 							  public MMMFDevSoundPlugin,
    34 							  public MAudioClientThreadInfo,
    35   							  public MAutoPauseResumeSupport
    36 	{
    37 public:
    38 	static CMMFDevSoundClientImp* NewL();
    39 	~CMMFDevSoundClientImp();
    40 
    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); 
    50 
    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);
    57 
    58 	// Returns maximum play volume device supports
    59 	TInt MaxVolume();
    60 	// Returns play volume device is configured to
    61 	TInt Volume();
    62 	// Sets device play volume
    63 	void SetVolume(TInt aVolume);
    64 
    65 	// Returns maximum record gain device supports
    66 	TInt MaxGain();
    67 	// Returns record gain device is configured to
    68 	TInt Gain();
    69 	// Sets device record gain
    70 	void SetGain(TInt aGain);
    71 
    72 	// Returns play balance
    73 	void GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage);
    74 	// Sets play balance
    75 	void SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage);
    76 
    77 	// Returns record balance
    78 	void GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage);
    79 	// Sets record balance
    80 	void SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage);
    81 
    82 	// Initializes audio device and start play process
    83 	void PlayInitL();
    84 	// Initializes audio device and start record process
    85 	void RecordInitL();
    86 	// Plays the data in the buffer
    87 	void PlayData();
    88 	// Records data into buffer
    89 	void RecordData();
    90 	// Stops the ongoing operation
    91 	void Stop();
    92 	// Tempororily Stops the ongoing operation
    93 	void Pause();
    94 
    95 	// Returns the Sample recorded so far
    96 	TInt SamplesRecorded();
    97 	// Returns the Sample played so far
    98 	TInt SamplesPlayed();
    99 
   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);
   110 
   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);
   122 
   123 	// Provides interface for converting data in buffer
   124 	void ConvertInitL();
   125 	// Converts data in the buffer
   126 	void ConvertData();
   127 
   128 	// Provides interface for sending custom commands for the audio device
   129 	TAny* CustomInterface(TUid aInterfaceId);
   130 
   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);
   141 
   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();
   150 
   151 private:
   152 	// So that nobody can extend 
   153 	CMMFDevSoundClientImp();
   154 	// Second phase constructor
   155 	void ConstructL();
   156 	void CancelCalbackHandlers();
   157 
   158 private:
   159 
   160 	RMMFDevSoundProxy* iDevSoundProxy;
   161 	MDevSoundObserver* iDevSoundObserver;
   162 
   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;
   171 	};
   172 
   173 #include "BtSoundDeviceBody.inl"
   174 
   175 #endif // __BTSOUNDDEVICEBODY__H__