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 __GAVDPSTATES_INL__ sl@0: #define __GAVDPSTATES_INL__ sl@0: sl@0: sl@0: inline TGAVDPState::TGAVDPState() : iState(EGAVDPIdle) sl@0: { sl@0: } sl@0: sl@0: sl@0: inline TGAVDPState::TGAVDPState(TGAVDPStateValue aGAVDPStateValue) sl@0: { sl@0: iState = aGAVDPStateValue; sl@0: } sl@0: sl@0: sl@0: inline TGAVDPState TGAVDPState::operator=(const TGAVDPState& aGAVDPState) sl@0: { sl@0: iState = aGAVDPState.iState; sl@0: return *this; sl@0: } sl@0: sl@0: sl@0: inline TBool TGAVDPState::operator==(const TGAVDPState& aGAVDPState) const sl@0: { sl@0: return (iState == aGAVDPState.iState); sl@0: } sl@0: sl@0: sl@0: inline TBool TGAVDPState::operator!=(const TGAVDPState& aGAVDPState) const sl@0: { sl@0: return !(iState == aGAVDPState.iState); sl@0: } sl@0: sl@0: sl@0: /** sl@0: This looks quite long for an inline but it's only used once sl@0: */ sl@0: inline void TGAVDPState::operator++() sl@0: { sl@0: switch(iState) sl@0: { sl@0: case EGAVDPIdle: sl@0: iState = EConnectedToGavdp; sl@0: break; sl@0: case EConnectedToGavdp: sl@0: iState = ESEPsDiscovered; sl@0: break; sl@0: case ESEPsDiscovered: sl@0: iState = ESEPSelected; sl@0: break; sl@0: case ESEPSelected: sl@0: iState = EConfigured; sl@0: break; sl@0: case EConfigured: sl@0: iState = EGAVDPOpen; sl@0: break; sl@0: case EGAVDPOpen: sl@0: iState = EGAVDPStreaming; sl@0: break; sl@0: case EGAVDPStreaming: sl@0: iState = EGAVDPOpen;//go back to open after streaming sl@0: break; sl@0: } sl@0: } sl@0: sl@0: sl@0: inline TGAVDPState::TGAVDPStateValue TGAVDPState::State() const sl@0: { sl@0: return iState; sl@0: } sl@0: sl@0: sl@0: sl@0: inline TConfigurationByRemoteHeadsetState::TConfigurationByRemoteHeadsetState() : iState(ENotBeingConfiguredByRemoteHeadset), iCodecConfigRequestedByRemoteHeadset(NULL) sl@0: { sl@0: } sl@0: sl@0: sl@0: inline void TConfigurationByRemoteHeadsetState::Reset() sl@0: { sl@0: iState = ENotBeingConfiguredByRemoteHeadset; sl@0: iSEPRequestedByRemoteHeadset.Reset(); sl@0: delete iTransportCapsRequestedByRemoteHeadset; //ownership is with this class sl@0: iTransportCapsRequestedByRemoteHeadset = NULL; sl@0: delete iCodecConfigRequestedByRemoteHeadset; //ownership is with this class sl@0: iCodecConfigRequestedByRemoteHeadset = NULL; sl@0: } sl@0: sl@0: sl@0: inline TConfigurationByRemoteHeadsetState TConfigurationByRemoteHeadsetState::operator=(const TConfigurationByRemoteHeadsetStateValue& aConfigByRemoteHeadsetStateValue) sl@0: { sl@0: iState = aConfigByRemoteHeadsetStateValue; sl@0: return *this; sl@0: } sl@0: sl@0: sl@0: inline TBool TConfigurationByRemoteHeadsetState::operator==(const TConfigurationByRemoteHeadsetStateValue aConfigByRemoteHeadsetStateValue) const sl@0: { sl@0: return (iState == aConfigByRemoteHeadsetStateValue); sl@0: } sl@0: sl@0: sl@0: inline TBool TConfigurationByRemoteHeadsetState::operator!=(const TConfigurationByRemoteHeadsetStateValue aConfigByRemoteHeadsetStateValue) const sl@0: { sl@0: return (iState != aConfigByRemoteHeadsetStateValue); sl@0: } sl@0: sl@0: sl@0: inline TConfigurationByRemoteHeadsetState::TConfigurationByRemoteHeadsetStateValue TConfigurationByRemoteHeadsetState::State() const sl@0: { sl@0: return iState; sl@0: } sl@0: sl@0: sl@0: inline TSEID TConfigurationByRemoteHeadsetState::SEPRequestedByRemoteHeadset() const sl@0: { sl@0: return iSEPRequestedByRemoteHeadset; sl@0: } sl@0: sl@0: sl@0: inline void TConfigurationByRemoteHeadsetState::SetSEPRequestedByRemoteHeadset(const TSEID& aSEID) sl@0: { sl@0: iSEPRequestedByRemoteHeadset = aSEID; sl@0: } sl@0: sl@0: sl@0: inline TAvdtpMediaTransportCapabilities* TConfigurationByRemoteHeadsetState::TransportCapsRequestedByRemoteHeadset() const sl@0: {//note ownership stays with TConfigurationByRemoteHeadsetState sl@0: return iTransportCapsRequestedByRemoteHeadset; sl@0: } sl@0: sl@0: sl@0: inline void TConfigurationByRemoteHeadsetState::SetTransportCapsRequestedByRemoteHeadset(TAvdtpMediaTransportCapabilities* aTransportCapsRequestedByRemoteHeadset) sl@0: {//note ownership is transferred to TConfigurationByRemoteHeadsetState sl@0: if (iTransportCapsRequestedByRemoteHeadset) sl@0: {//then the headset is requesting a new configuration, but the old sl@0: //one has not been reset - this shouldn't happen, but could happen sl@0: //if the headset called GAVDP_ConfigurationIndication more than once with sl@0: //the same config with no intermediate StartStreams or Abort. sl@0: delete iTransportCapsRequestedByRemoteHeadset; sl@0: iTransportCapsRequestedByRemoteHeadset = NULL; sl@0: } sl@0: iTransportCapsRequestedByRemoteHeadset = aTransportCapsRequestedByRemoteHeadset; sl@0: } sl@0: sl@0: sl@0: inline TAvdtpMediaCodecCapabilities* TConfigurationByRemoteHeadsetState::CodecConfigRequestedByRemoteHeadset() const sl@0: {//note ownership stays with TConfigurationByRemoteHeadsetState sl@0: return iCodecConfigRequestedByRemoteHeadset; sl@0: } sl@0: sl@0: sl@0: inline void TConfigurationByRemoteHeadsetState::SetCodecConfigRequestedByRemoteHeadset(TAvdtpMediaCodecCapabilities* aCodecConfigRequestedByRemoteHeadset) sl@0: {//note ownership is transferred to TConfigurationByRemoteHeadsetState sl@0: if (iCodecConfigRequestedByRemoteHeadset) sl@0: {//then the headset is requesting a new configuration, but the old sl@0: //one has not been reset - this shouldn't happen, but could happen sl@0: //if the headset called GAVDP_ConfigurationIndication more than once with sl@0: //the same config with no intermediate StartStreams or Abort. sl@0: delete iCodecConfigRequestedByRemoteHeadset; sl@0: iCodecConfigRequestedByRemoteHeadset = NULL; sl@0: } sl@0: iCodecConfigRequestedByRemoteHeadset = aCodecConfigRequestedByRemoteHeadset; sl@0: } sl@0: sl@0: #endif sl@0: