os/mm/devsound/sounddevbt/src/A2dpBlueTooth/headsetaudioif/A2dpBTheadsetAudioIf.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/devsound/sounddevbt/src/A2dpBlueTooth/headsetaudioif/A2dpBTheadsetAudioIf.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,109 @@
     1.4 +// Copyright (c) 2005-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 __A2DPBTHEADSETAUDIOIF_H__
    1.20 +#define __A2DPBTHEADSETAUDIOIF_H__
    1.21 +
    1.22 +#include <e32base.h>
    1.23 +#include <bttypes.h> //TBTDevAddr
    1.24 +#include <es_sock.h> //RSocketServer, RSocket
    1.25 +#include <bt_sock.h> //RBTPhysicalLinkAdaptor
    1.26 +#include "GavdpStateMachine.h"
    1.27 +#include "RTPStreamer.h"
    1.28 +
    1.29 +class CA2dpCodecUtilities; //fwd ref
    1.30 +class CMMFCodec; //fwd ref
    1.31 +class TRange;	// fwd ref
    1.32 +
    1.33 +
    1.34 +/**
    1.35 +API to access and send audio to an A2DP compliant audio headset
    1.36 +This API is used internally within the Symbian reference 
    1.37 +CMMFDevSound/CMMFHwDevices/CRoutingSoundPlayDevice.
    1.38 +
    1.39 +@internalTechnology
    1.40 +*/
    1.41 +class CA2dpBTHeadsetAudioInterface : public CBase, public MGAVDPStateChangeObserver, public MRTPStreamerObserver
    1.42 +	{
    1.43 +public:
    1.44 +	IMPORT_C static CA2dpBTHeadsetAudioInterface* NewL();
    1.45 +	IMPORT_C ~CA2dpBTHeadsetAudioInterface();	
    1.46 +	IMPORT_C void Initialize(const TBTDevAddr& aRemoteAddress, TRequestStatus& aStatus);
    1.47 +	IMPORT_C void CancelInitialize();
    1.48 +	IMPORT_C TInt GetSupportedDataTypes(RArray<TFourCC>& aSupportedDataTypes) const;
    1.49 +	IMPORT_C TInt GetSupportedSampleRates(RArray<TUint>& aSupportedDiscreteRates, RArray<TRange>& aSupportedRateRanges) const;
    1.50 +	IMPORT_C TInt GetSupportedChannels(RArray<TUint>& aSupportedChannels, TMMFStereoSupport& aStereoSupport) const;
    1.51 +	IMPORT_C TInt SetDataType(const TFourCC& aDataType);
    1.52 +	IMPORT_C TInt SetSampleRate(TUint aSampleRate);
    1.53 +	IMPORT_C TInt SetChannels(TUint aChannels, TMMFStereoSupport aStereoSupport);
    1.54 +	IMPORT_C void OpenDevice(TRequestStatus& aStatus);
    1.55 +	IMPORT_C void CancelOpenDevice();
    1.56 +	IMPORT_C void CloseDevice(TRequestStatus& aStatus);
    1.57 +	IMPORT_C TUint Volume() const;
    1.58 +	IMPORT_C TInt SetVolume(TUint aVolume);
    1.59 +	IMPORT_C void PlayData(const TDesC8& aData, TRequestStatus& aStatus);
    1.60 +	IMPORT_C void CancelPlayData();
    1.61 +	IMPORT_C void FlushBuffer();
    1.62 +	IMPORT_C TUint BytesPlayed() const;
    1.63 +	IMPORT_C void ResetBytesPlayed();
    1.64 +	IMPORT_C void PauseBuffer();
    1.65 +	IMPORT_C void ResumePlaying();
    1.66 +	IMPORT_C void NotifyError(TRequestStatus& aStatus);
    1.67 +	IMPORT_C void CancelNotifyError();
    1.68 +	
    1.69 +	//APIs only used for unit testing purposes - not needed for BT server or routing sound device
    1.70 +	IMPORT_C MGavdpUser* TEST_MGavdpUser();
    1.71 +	IMPORT_C void TEST_ForceRemoteSBCCodecConfiguration(const TSBCCodecCapabilities& aRemoteCodecConfiguration);
    1.72 +private:
    1.73 +	CA2dpBTHeadsetAudioInterface();
    1.74 +	void ConstructL();
    1.75 +	
    1.76 +	void ProcessGAVDPStateChangeIdleToOpen(TInt aError);
    1.77 +	void ProcessGAVDPStateChangeOpenToStreaming(TInt aError);
    1.78 +	void ProcessGAVDPStateChangeStreamingToOpen(TInt aError);
    1.79 +
    1.80 +	//MGAVDPStateChangeObserver
    1.81 +	void GAVDPStateChangeComplete(const TGAVDPState& aInitialState, TInt aError);
    1.82 +	void GAVDPStateMachineEvent(TInt aError);
    1.83 +	void GAVDPStateMachineStreamSuspendedByRemoteHeadset();
    1.84 +	TInt GAVDPStateMachineReconfigureByRemoteHeadset();
    1.85 +	void GAVDPStateMachineStreamResumedByRemoteHeadset();
    1.86 +	
    1.87 +	//MRTPStreamerObserver
    1.88 +	void RTPStreamerEvent(TInt aError);
    1.89 +
    1.90 +	TInt SetSniffMode(TBool aSniffMode);
    1.91 +private:
    1.92 +	//owned classes
    1.93 +	CGAVDPStateMachine* iGAVDPStateMachine;
    1.94 +	CActiveRTPStreamer* iRTPStreamer;
    1.95 +	CMMFCodec* iCodec;
    1.96 +	CA2dpAudioCodecConfiguration* iA2dpCodecConfiguration;
    1.97 +	
    1.98 +	RSocketServ iSocketServer;
    1.99 +	RBTPhysicalLinkAdapter iBTPhysicalLinkAdapter;
   1.100 +	TRequestStatus* iInitializeRequestStatus;
   1.101 +	TRequestStatus* iOpenDeviceRequestStatus;
   1.102 +	TRequestStatus* iCloseDeviceRequestStatus;
   1.103 +	TRequestStatus* iNotifyRequestStatus;
   1.104 +	TFourCC	iDataType;
   1.105 +	TBool	iAudioSettingsHaveChanged;
   1.106 +	TBool	iReconfiguring;
   1.107 +	TBool	iPaused;
   1.108 +	TInt iOpenDeviceError;
   1.109 +	};
   1.110 +
   1.111 +#endif
   1.112 +