os/mm/devsound/sounddevbt/src/A2dpBlueTooth/headsetaudioif/A2dpBTheadsetAudioIf.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 __A2DPBTHEADSETAUDIOIF_H__
sl@0
    17
#define __A2DPBTHEADSETAUDIOIF_H__
sl@0
    18
sl@0
    19
#include <e32base.h>
sl@0
    20
#include <bttypes.h> //TBTDevAddr
sl@0
    21
#include <es_sock.h> //RSocketServer, RSocket
sl@0
    22
#include <bt_sock.h> //RBTPhysicalLinkAdaptor
sl@0
    23
#include "GavdpStateMachine.h"
sl@0
    24
#include "RTPStreamer.h"
sl@0
    25
sl@0
    26
class CA2dpCodecUtilities; //fwd ref
sl@0
    27
class CMMFCodec; //fwd ref
sl@0
    28
class TRange;	// fwd ref
sl@0
    29
sl@0
    30
sl@0
    31
/**
sl@0
    32
API to access and send audio to an A2DP compliant audio headset
sl@0
    33
This API is used internally within the Symbian reference 
sl@0
    34
CMMFDevSound/CMMFHwDevices/CRoutingSoundPlayDevice.
sl@0
    35
sl@0
    36
@internalTechnology
sl@0
    37
*/
sl@0
    38
class CA2dpBTHeadsetAudioInterface : public CBase, public MGAVDPStateChangeObserver, public MRTPStreamerObserver
sl@0
    39
	{
sl@0
    40
public:
sl@0
    41
	IMPORT_C static CA2dpBTHeadsetAudioInterface* NewL();
sl@0
    42
	IMPORT_C ~CA2dpBTHeadsetAudioInterface();	
sl@0
    43
	IMPORT_C void Initialize(const TBTDevAddr& aRemoteAddress, TRequestStatus& aStatus);
sl@0
    44
	IMPORT_C void CancelInitialize();
sl@0
    45
	IMPORT_C TInt GetSupportedDataTypes(RArray<TFourCC>& aSupportedDataTypes) const;
sl@0
    46
	IMPORT_C TInt GetSupportedSampleRates(RArray<TUint>& aSupportedDiscreteRates, RArray<TRange>& aSupportedRateRanges) const;
sl@0
    47
	IMPORT_C TInt GetSupportedChannels(RArray<TUint>& aSupportedChannels, TMMFStereoSupport& aStereoSupport) const;
sl@0
    48
	IMPORT_C TInt SetDataType(const TFourCC& aDataType);
sl@0
    49
	IMPORT_C TInt SetSampleRate(TUint aSampleRate);
sl@0
    50
	IMPORT_C TInt SetChannels(TUint aChannels, TMMFStereoSupport aStereoSupport);
sl@0
    51
	IMPORT_C void OpenDevice(TRequestStatus& aStatus);
sl@0
    52
	IMPORT_C void CancelOpenDevice();
sl@0
    53
	IMPORT_C void CloseDevice(TRequestStatus& aStatus);
sl@0
    54
	IMPORT_C TUint Volume() const;
sl@0
    55
	IMPORT_C TInt SetVolume(TUint aVolume);
sl@0
    56
	IMPORT_C void PlayData(const TDesC8& aData, TRequestStatus& aStatus);
sl@0
    57
	IMPORT_C void CancelPlayData();
sl@0
    58
	IMPORT_C void FlushBuffer();
sl@0
    59
	IMPORT_C TUint BytesPlayed() const;
sl@0
    60
	IMPORT_C void ResetBytesPlayed();
sl@0
    61
	IMPORT_C void PauseBuffer();
sl@0
    62
	IMPORT_C void ResumePlaying();
sl@0
    63
	IMPORT_C void NotifyError(TRequestStatus& aStatus);
sl@0
    64
	IMPORT_C void CancelNotifyError();
sl@0
    65
	
sl@0
    66
	//APIs only used for unit testing purposes - not needed for BT server or routing sound device
sl@0
    67
	IMPORT_C MGavdpUser* TEST_MGavdpUser();
sl@0
    68
	IMPORT_C void TEST_ForceRemoteSBCCodecConfiguration(const TSBCCodecCapabilities& aRemoteCodecConfiguration);
sl@0
    69
private:
sl@0
    70
	CA2dpBTHeadsetAudioInterface();
sl@0
    71
	void ConstructL();
sl@0
    72
	
sl@0
    73
	void ProcessGAVDPStateChangeIdleToOpen(TInt aError);
sl@0
    74
	void ProcessGAVDPStateChangeOpenToStreaming(TInt aError);
sl@0
    75
	void ProcessGAVDPStateChangeStreamingToOpen(TInt aError);
sl@0
    76
sl@0
    77
	//MGAVDPStateChangeObserver
sl@0
    78
	void GAVDPStateChangeComplete(const TGAVDPState& aInitialState, TInt aError);
sl@0
    79
	void GAVDPStateMachineEvent(TInt aError);
sl@0
    80
	void GAVDPStateMachineStreamSuspendedByRemoteHeadset();
sl@0
    81
	TInt GAVDPStateMachineReconfigureByRemoteHeadset();
sl@0
    82
	void GAVDPStateMachineStreamResumedByRemoteHeadset();
sl@0
    83
	
sl@0
    84
	//MRTPStreamerObserver
sl@0
    85
	void RTPStreamerEvent(TInt aError);
sl@0
    86
sl@0
    87
	TInt SetSniffMode(TBool aSniffMode);
sl@0
    88
private:
sl@0
    89
	//owned classes
sl@0
    90
	CGAVDPStateMachine* iGAVDPStateMachine;
sl@0
    91
	CActiveRTPStreamer* iRTPStreamer;
sl@0
    92
	CMMFCodec* iCodec;
sl@0
    93
	CA2dpAudioCodecConfiguration* iA2dpCodecConfiguration;
sl@0
    94
	
sl@0
    95
	RSocketServ iSocketServer;
sl@0
    96
	RBTPhysicalLinkAdapter iBTPhysicalLinkAdapter;
sl@0
    97
	TRequestStatus* iInitializeRequestStatus;
sl@0
    98
	TRequestStatus* iOpenDeviceRequestStatus;
sl@0
    99
	TRequestStatus* iCloseDeviceRequestStatus;
sl@0
   100
	TRequestStatus* iNotifyRequestStatus;
sl@0
   101
	TFourCC	iDataType;
sl@0
   102
	TBool	iAudioSettingsHaveChanged;
sl@0
   103
	TBool	iReconfiguring;
sl@0
   104
	TBool	iPaused;
sl@0
   105
	TInt iOpenDeviceError;
sl@0
   106
	};
sl@0
   107
sl@0
   108
#endif
sl@0
   109