os/mm/devsound/sounddevbt/src/RoutingSoundDevice/MMFBtRoutingSoundDevice.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) 2005-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 __MMFBTROUTINGSOUNDDEVICE_H__
sl@0
    17
#define __MMFBTROUTINGSOUNDDEVICE_H__
sl@0
    18
sl@0
    19
#include <e32base.h>
sl@0
    20
#include <mmf/common/mmfutilities.h>
sl@0
    21
#include <mmf/server/sounddevice.h>
sl@0
    22
sl@0
    23
#include <mdasound.h>
sl@0
    24
sl@0
    25
#include "A2dpBTHeadsetAudioIfClient.h"
sl@0
    26
#include "MmfBtRoutingPrioritySettings.h"
sl@0
    27
sl@0
    28
/**
sl@0
    29
 * TRange - primarily used to store bounds for a range of sample rates.
sl@0
    30
 * @internalComponent
sl@0
    31
 */
sl@0
    32
class TRange
sl@0
    33
	{
sl@0
    34
public:
sl@0
    35
	TUint iLow;
sl@0
    36
	TUint iHigh;
sl@0
    37
	};
sl@0
    38
sl@0
    39
/**
sl@0
    40
 *  Routing sound play device
sl@0
    41
 *  @internalComponent
sl@0
    42
 */
sl@0
    43
class CRoutingSoundPlayDevice : public CBase
sl@0
    44
	{ 
sl@0
    45
public:	
sl@0
    46
	IMPORT_C static CRoutingSoundPlayDevice* NewL();
sl@0
    47
	~CRoutingSoundPlayDevice();
sl@0
    48
	
sl@0
    49
	IMPORT_C void Initialize(TUid aDeviceUid,
sl@0
    50
							const TDesC8& aDeviceConfig,
sl@0
    51
							TRequestStatus& aStatus);
sl@0
    52
	IMPORT_C void CancelInitialize(TUid aDeviceUid);
sl@0
    53
	IMPORT_C void OpenDevice(TUid aDeviceUid, TRequestStatus& aStatus);
sl@0
    54
	IMPORT_C void CancelOpenDevice(TUid aDeviceUid);
sl@0
    55
	IMPORT_C void CloseDevice(TUid aDeviceUid, TRequestStatus& aStatus);
sl@0
    56
	IMPORT_C TInt GetSupportedSampleRates(RArray<TUint>& aSupportedDiscreteRates, RArray<TRange>& aSupportedRateRanges);
sl@0
    57
	IMPORT_C TInt GetSupportedChannels(RArray<TUint>& aSupportedChannels, TMMFStereoSupport& aStereoSupport);
sl@0
    58
	IMPORT_C TInt GetSupportedDataTypes(RArray<TFourCC>& aSupportedDataTypes);
sl@0
    59
	IMPORT_C TInt SetDataType(const TFourCC& aDataType);
sl@0
    60
	IMPORT_C TInt SetSampleRate(TUint aSampleRate);
sl@0
    61
	IMPORT_C TInt SetChannels(TUint aChannels, TMMFStereoSupport aStereoSupport);
sl@0
    62
	IMPORT_C TInt SetBufferSize(TUint aBufferSize);
sl@0
    63
	IMPORT_C void FlushBuffer();
sl@0
    64
	IMPORT_C void NotifyError(TRequestStatus& aStatus);
sl@0
    65
	IMPORT_C void CancelNotifyError();	
sl@0
    66
	IMPORT_C TUint Volume() const;
sl@0
    67
	IMPORT_C TInt SetVolume(TUint aVolume);
sl@0
    68
	IMPORT_C void PlayData(const TDesC8& aData, TRequestStatus& aStatus);
sl@0
    69
	IMPORT_C void CancelPlayData();
sl@0
    70
	IMPORT_C TUint BytesPlayed();
sl@0
    71
	IMPORT_C TInt ResetBytesPlayed();
sl@0
    72
	IMPORT_C TInt PauseBuffer();
sl@0
    73
	IMPORT_C TInt ResumePlaying();
sl@0
    74
	IMPORT_C TInt Handle() const;
sl@0
    75
protected:	
sl@0
    76
	CRoutingSoundPlayDevice();
sl@0
    77
	void ConstructL();
sl@0
    78
private:
sl@0
    79
	RMdaDevSound iSpeakerDevice;
sl@0
    80
	RA2dpBTHeadsetAudioInterface iBTDevice;
sl@0
    81
	TUid iDeviceUid;
sl@0
    82
	TBTDevAddr iBTAddress;
sl@0
    83
	TUint iSampleRate;
sl@0
    84
	TUint iChannels;
sl@0
    85
	TMMFStereoSupport iStereoSupport;
sl@0
    86
	TUint iBufferSize;
sl@0
    87
sl@0
    88
	TRequestStatus* iInitializeStatus;
sl@0
    89
	TRequestStatus* iOpenDeviceStatus;
sl@0
    90
	TRequestStatus* iCloseDeviceStatus;
sl@0
    91
	};
sl@0
    92
sl@0
    93
sl@0
    94
sl@0
    95
/**
sl@0
    96
 *  Routing sound record device
sl@0
    97
 *  @internalComponent
sl@0
    98
 */
sl@0
    99
class CRoutingSoundRecordDevice : public CBase
sl@0
   100
	{
sl@0
   101
public:
sl@0
   102
	IMPORT_C static CRoutingSoundRecordDevice* NewL();
sl@0
   103
	IMPORT_C ~CRoutingSoundRecordDevice();
sl@0
   104
	
sl@0
   105
	IMPORT_C void Initialize(TUid aDeviceUid,
sl@0
   106
							const TDesC8& aDeviceConfig,
sl@0
   107
							TRequestStatus& aStatus);
sl@0
   108
	IMPORT_C void CancelInitialize(TUid aDeviceUid);
sl@0
   109
	IMPORT_C void OpenDevice(TUid aDeviceUid, TRequestStatus& aStatus);
sl@0
   110
	IMPORT_C void CancelOpenDevice(TUid aDeviceUid);
sl@0
   111
	IMPORT_C void CloseDevice(TUid aDeviceUid, TRequestStatus& aStatus);
sl@0
   112
	IMPORT_C TInt GetSupportedSampleRates(RArray<TUint>& aSupportedDiscreteRates, RArray<TRange>& aSupportedRateRanges);
sl@0
   113
	IMPORT_C TInt GetSupportedChannels(RArray<TUint>& aSupportedChannels, TMMFStereoSupport& aStereoSupport);
sl@0
   114
	IMPORT_C TInt SetSampleRate(TUint aSampleRate);
sl@0
   115
	IMPORT_C TInt SetChannels(TUint aChannels, TMMFStereoSupport aStereoSupport);
sl@0
   116
	IMPORT_C TInt SetBufferSize(TUint aBufferSize);
sl@0
   117
	IMPORT_C void FlushBuffer();
sl@0
   118
	IMPORT_C void NotifyError(TRequestStatus& aStatus);
sl@0
   119
	IMPORT_C void CancelNotifyError();
sl@0
   120
	IMPORT_C TUint Gain() const;
sl@0
   121
	IMPORT_C TInt SetGain(TUint aGain);
sl@0
   122
	IMPORT_C void RecordData(TDes8& aData, TRequestStatus& aStatus);
sl@0
   123
	IMPORT_C void CancelRecordData();
sl@0
   124
	IMPORT_C TUint BytesRecorded();
sl@0
   125
	IMPORT_C TInt Handle() const;
sl@0
   126
	
sl@0
   127
protected:
sl@0
   128
	void ConstructL();
sl@0
   129
	CRoutingSoundRecordDevice();
sl@0
   130
private:
sl@0
   131
	// although the microphone is the only device for now, there may be
sl@0
   132
	// a BT microphone in the future, so keep the device uid
sl@0
   133
	RMdaDevSound iInputDevice;
sl@0
   134
	TUid iDeviceUid;
sl@0
   135
	TUint iSampleRate;
sl@0
   136
	TUint iChannels;
sl@0
   137
	TMMFStereoSupport iStereoSupport;
sl@0
   138
	TUint iBufferSize;
sl@0
   139
sl@0
   140
	TRequestStatus* iOpenDeviceStatus;	
sl@0
   141
	};
sl@0
   142
sl@0
   143
sl@0
   144
#endif // __MMFBTROUTINGSOUNDDEVICE_H__
sl@0
   145