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.
sl@0
     1
// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#ifndef __BTSOUNDDEVICEBODY__H__
sl@0
    17
#define __BTSOUNDDEVICEBODY__H__
sl@0
    18
sl@0
    19
#include "MmfBtDevSoundCallbackHandler.h" 
sl@0
    20
#include <mmf/plugin/devsoundplugin.h>
sl@0
    21
#include <mmf/server/mmfdevsoundcustominterfacesupport.h>
sl@0
    22
sl@0
    23
sl@0
    24
/*
sl@0
    25
 *
sl@0
    26
 *	Class Name:	CMMFDevSoundClientImp
sl@0
    27
 *
sl@0
    28
 *	Reference internals for CMMFDevSound
sl@0
    29
 *  @internalComponent
sl@0
    30
 *
sl@0
    31
 */
sl@0
    32
class CMMFDevSoundClientImp : public CBase, 
sl@0
    33
							  public MMMFDevSoundPlugin,
sl@0
    34
							  public MAudioClientThreadInfo,
sl@0
    35
  							  public MAutoPauseResumeSupport
sl@0
    36
	{
sl@0
    37
public:
sl@0
    38
	static CMMFDevSoundClientImp* NewL();
sl@0
    39
	~CMMFDevSoundClientImp();
sl@0
    40
sl@0
    41
	// Initializes to raw audio data PCM16 and Sampling Rate of 8 KHz. 
sl@0
    42
	void InitializeL(MDevSoundObserver& aDevSoundObserver, TMMFState aMode);
sl@0
    43
	// Initializes with hardware device and mode (play, record, convert)
sl@0
    44
	void InitializeL(MDevSoundObserver& aDevSoundObserver, TUid aHWDev, TMMFState aMode);
sl@0
    45
	// Initializes with chain of hardware devices and mode (play, record, convert)
sl@0
    46
	void InitializeL(MDevSoundObserver& aDevSoundObserver, CArrayPtr<TUid> aHWDevArray, TMMFState aMode);
sl@0
    47
	// Initializes with hardware device associated with specific FourCC code 
sl@0
    48
	// and desired mode (play, record, convert)
sl@0
    49
	void InitializeL(MDevSoundObserver& aDevSoundObserver, TFourCC aDesiredFourCC, TMMFState aMode); 
sl@0
    50
sl@0
    51
	// Returns device capabilities
sl@0
    52
	TMMFCapabilities Capabilities();
sl@0
    53
	// Returns device configuration
sl@0
    54
	TMMFCapabilities Config() const;
sl@0
    55
	// Sets device configuration
sl@0
    56
	void SetConfigL(const TMMFCapabilities& aCaps);
sl@0
    57
sl@0
    58
	// Returns maximum play volume device supports
sl@0
    59
	TInt MaxVolume();
sl@0
    60
	// Returns play volume device is configured to
sl@0
    61
	TInt Volume();
sl@0
    62
	// Sets device play volume
sl@0
    63
	void SetVolume(TInt aVolume);
sl@0
    64
sl@0
    65
	// Returns maximum record gain device supports
sl@0
    66
	TInt MaxGain();
sl@0
    67
	// Returns record gain device is configured to
sl@0
    68
	TInt Gain();
sl@0
    69
	// Sets device record gain
sl@0
    70
	void SetGain(TInt aGain);
sl@0
    71
sl@0
    72
	// Returns play balance
sl@0
    73
	void GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage);
sl@0
    74
	// Sets play balance
sl@0
    75
	void SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage);
sl@0
    76
sl@0
    77
	// Returns record balance
sl@0
    78
	void GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage);
sl@0
    79
	// Sets record balance
sl@0
    80
	void SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage);
sl@0
    81
sl@0
    82
	// Initializes audio device and start play process
sl@0
    83
	void PlayInitL();
sl@0
    84
	// Initializes audio device and start record process
sl@0
    85
	void RecordInitL();
sl@0
    86
	// Plays the data in the buffer
sl@0
    87
	void PlayData();
sl@0
    88
	// Records data into buffer
sl@0
    89
	void RecordData();
sl@0
    90
	// Stops the ongoing operation
sl@0
    91
	void Stop();
sl@0
    92
	// Tempororily Stops the ongoing operation
sl@0
    93
	void Pause();
sl@0
    94
sl@0
    95
	// Returns the Sample recorded so far
sl@0
    96
	TInt SamplesRecorded();
sl@0
    97
	// Returns the Sample played so far
sl@0
    98
	TInt SamplesPlayed();
sl@0
    99
sl@0
   100
	// Initializes device and start playing tone
sl@0
   101
	void PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration);
sl@0
   102
	// Initializes device and start playing dual tone
sl@0
   103
	void PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration);
sl@0
   104
	// Initializes device and start playing DTMF String
sl@0
   105
	void PlayDTMFStringL(const TDesC& aDTMFString);
sl@0
   106
	// Initializes device and start playing tone sequence
sl@0
   107
	void PlayToneSequenceL(const TDesC8& aData);
sl@0
   108
	// Initializes device and start playing fixed sequence
sl@0
   109
	void PlayFixedSequenceL(TInt aSequenceNumber);
sl@0
   110
sl@0
   111
	// Sets tone repeat attributes
sl@0
   112
	void SetToneRepeats(TInt aRepeatCount,
sl@0
   113
					const TTimeIntervalMicroSeconds& aRepeatTrailingSilence);
sl@0
   114
	// Sets DTMF tone attributes
sl@0
   115
	void SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength,
sl@0
   116
									TTimeIntervalMicroSeconds32& aToneOffLength,
sl@0
   117
									TTimeIntervalMicroSeconds32& aPauseLength);
sl@0
   118
	// Sets volume ramp for playing
sl@0
   119
	void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration);
sl@0
   120
	// Sets priority settings
sl@0
   121
	void SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings);
sl@0
   122
sl@0
   123
	// Provides interface for converting data in buffer
sl@0
   124
	void ConvertInitL();
sl@0
   125
	// Converts data in the buffer
sl@0
   126
	void ConvertData();
sl@0
   127
sl@0
   128
	// Provides interface for sending custom commands for the audio device
sl@0
   129
	TAny* CustomInterface(TUid aInterfaceId);
sl@0
   130
sl@0
   131
	// Provides interface for querying fixed sequence count
sl@0
   132
	TInt FixedSequenceCount();
sl@0
   133
	// Provides interface for querying fixed sequence name
sl@0
   134
	const TDesC& FixedSequenceName(TInt aSequenceNumber);
sl@0
   135
	// Gets the supported input datatypes
sl@0
   136
	void GetSupportedInputDataTypesL(RArray<TFourCC>& aSupportedDataTypesconst, const TMMFPrioritySettings& aPrioritySettings) const;
sl@0
   137
	// Gets the supported output datatypes
sl@0
   138
	void GetSupportedOutputDataTypesL(RArray<TFourCC>& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const;
sl@0
   139
	// Set the real client thread with thread Id
sl@0
   140
	TInt SetClientThreadInfo(TThreadId aTid);
sl@0
   141
sl@0
   142
	// Registers the client for notification
sl@0
   143
	TInt RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData = KNullDesC8);
sl@0
   144
	//cancels the registered notification
sl@0
   145
	TInt CancelRegisterAsClient(TUid aEventType);
sl@0
   146
	//get the notification data to resume 
sl@0
   147
	TInt GetResourceNotificationData(TUid aEventType,TDes8& aNotificationData);
sl@0
   148
	//if client need more than the default timeout period
sl@0
   149
	TInt WillResumePlay();
sl@0
   150
sl@0
   151
private:
sl@0
   152
	// So that nobody can extend 
sl@0
   153
	CMMFDevSoundClientImp();
sl@0
   154
	// Second phase constructor
sl@0
   155
	void ConstructL();
sl@0
   156
	void CancelCalbackHandlers();
sl@0
   157
sl@0
   158
private:
sl@0
   159
sl@0
   160
	RMMFDevSoundProxy* iDevSoundProxy;
sl@0
   161
	MDevSoundObserver* iDevSoundObserver;
sl@0
   162
sl@0
   163
	// Handles receiving events
sl@0
   164
	CMMFBufferToBeFilledHandler* iBTBFHandler;
sl@0
   165
	CMMFBufferToBeEmptiedHandler* iBTBEHandler;
sl@0
   166
	CMMFPlayErrorHandler* iPEHandler;
sl@0
   167
	CMMFRecordErrorHandler* iREHandler;
sl@0
   168
	CMMFToneFinishedHandler* iTFHandler;
sl@0
   169
	CMMFInitializeCompleteHandler* iICHandler;
sl@0
   170
	CMMFSendEventToClientHandler* iSETCHandler;
sl@0
   171
	};
sl@0
   172
sl@0
   173
#include "BtSoundDeviceBody.inl"
sl@0
   174
sl@0
   175
#endif // __BTSOUNDDEVICEBODY__H__