sl@0: // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef __A2DPBTHEADSETAUDIOIF_H__ sl@0: #define __A2DPBTHEADSETAUDIOIF_H__ sl@0: sl@0: #include sl@0: #include //TBTDevAddr sl@0: #include //RSocketServer, RSocket sl@0: #include //RBTPhysicalLinkAdaptor sl@0: #include "GavdpStateMachine.h" sl@0: #include "RTPStreamer.h" sl@0: sl@0: class CA2dpCodecUtilities; //fwd ref sl@0: class CMMFCodec; //fwd ref sl@0: class TRange; // fwd ref sl@0: sl@0: sl@0: /** sl@0: API to access and send audio to an A2DP compliant audio headset sl@0: This API is used internally within the Symbian reference sl@0: CMMFDevSound/CMMFHwDevices/CRoutingSoundPlayDevice. sl@0: sl@0: @internalTechnology sl@0: */ sl@0: class CA2dpBTHeadsetAudioInterface : public CBase, public MGAVDPStateChangeObserver, public MRTPStreamerObserver sl@0: { sl@0: public: sl@0: IMPORT_C static CA2dpBTHeadsetAudioInterface* NewL(); sl@0: IMPORT_C ~CA2dpBTHeadsetAudioInterface(); sl@0: IMPORT_C void Initialize(const TBTDevAddr& aRemoteAddress, TRequestStatus& aStatus); sl@0: IMPORT_C void CancelInitialize(); sl@0: IMPORT_C TInt GetSupportedDataTypes(RArray& aSupportedDataTypes) const; sl@0: IMPORT_C TInt GetSupportedSampleRates(RArray& aSupportedDiscreteRates, RArray& aSupportedRateRanges) const; sl@0: IMPORT_C TInt GetSupportedChannels(RArray& aSupportedChannels, TMMFStereoSupport& aStereoSupport) const; sl@0: IMPORT_C TInt SetDataType(const TFourCC& aDataType); sl@0: IMPORT_C TInt SetSampleRate(TUint aSampleRate); sl@0: IMPORT_C TInt SetChannels(TUint aChannels, TMMFStereoSupport aStereoSupport); sl@0: IMPORT_C void OpenDevice(TRequestStatus& aStatus); sl@0: IMPORT_C void CancelOpenDevice(); sl@0: IMPORT_C void CloseDevice(TRequestStatus& aStatus); sl@0: IMPORT_C TUint Volume() const; sl@0: IMPORT_C TInt SetVolume(TUint aVolume); sl@0: IMPORT_C void PlayData(const TDesC8& aData, TRequestStatus& aStatus); sl@0: IMPORT_C void CancelPlayData(); sl@0: IMPORT_C void FlushBuffer(); sl@0: IMPORT_C TUint BytesPlayed() const; sl@0: IMPORT_C void ResetBytesPlayed(); sl@0: IMPORT_C void PauseBuffer(); sl@0: IMPORT_C void ResumePlaying(); sl@0: IMPORT_C void NotifyError(TRequestStatus& aStatus); sl@0: IMPORT_C void CancelNotifyError(); sl@0: sl@0: //APIs only used for unit testing purposes - not needed for BT server or routing sound device sl@0: IMPORT_C MGavdpUser* TEST_MGavdpUser(); sl@0: IMPORT_C void TEST_ForceRemoteSBCCodecConfiguration(const TSBCCodecCapabilities& aRemoteCodecConfiguration); sl@0: private: sl@0: CA2dpBTHeadsetAudioInterface(); sl@0: void ConstructL(); sl@0: sl@0: void ProcessGAVDPStateChangeIdleToOpen(TInt aError); sl@0: void ProcessGAVDPStateChangeOpenToStreaming(TInt aError); sl@0: void ProcessGAVDPStateChangeStreamingToOpen(TInt aError); sl@0: sl@0: //MGAVDPStateChangeObserver sl@0: void GAVDPStateChangeComplete(const TGAVDPState& aInitialState, TInt aError); sl@0: void GAVDPStateMachineEvent(TInt aError); sl@0: void GAVDPStateMachineStreamSuspendedByRemoteHeadset(); sl@0: TInt GAVDPStateMachineReconfigureByRemoteHeadset(); sl@0: void GAVDPStateMachineStreamResumedByRemoteHeadset(); sl@0: sl@0: //MRTPStreamerObserver sl@0: void RTPStreamerEvent(TInt aError); sl@0: sl@0: TInt SetSniffMode(TBool aSniffMode); sl@0: private: sl@0: //owned classes sl@0: CGAVDPStateMachine* iGAVDPStateMachine; sl@0: CActiveRTPStreamer* iRTPStreamer; sl@0: CMMFCodec* iCodec; sl@0: CA2dpAudioCodecConfiguration* iA2dpCodecConfiguration; sl@0: sl@0: RSocketServ iSocketServer; sl@0: RBTPhysicalLinkAdapter iBTPhysicalLinkAdapter; sl@0: TRequestStatus* iInitializeRequestStatus; sl@0: TRequestStatus* iOpenDeviceRequestStatus; sl@0: TRequestStatus* iCloseDeviceRequestStatus; sl@0: TRequestStatus* iNotifyRequestStatus; sl@0: TFourCC iDataType; sl@0: TBool iAudioSettingsHaveChanged; sl@0: TBool iReconfiguring; sl@0: TBool iPaused; sl@0: TInt iOpenDeviceError; sl@0: }; sl@0: sl@0: #endif sl@0: