os/mm/devsound/sounddevbt/src/A2dpBlueTooth/headsetaudioif/GavdpStates.inl
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/GavdpStates.inl	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,182 @@
     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 __GAVDPSTATES_INL__
    1.20 +#define __GAVDPSTATES_INL__
    1.21 +
    1.22 +
    1.23 +inline TGAVDPState::TGAVDPState() : iState(EGAVDPIdle) 
    1.24 +	{
    1.25 +	}
    1.26 +	
    1.27 +		
    1.28 +inline TGAVDPState::TGAVDPState(TGAVDPStateValue aGAVDPStateValue)
    1.29 +	{
    1.30 +	iState = aGAVDPStateValue;
    1.31 +	}
    1.32 +
    1.33 +
    1.34 +inline TGAVDPState TGAVDPState::operator=(const TGAVDPState& aGAVDPState)
    1.35 +	{
    1.36 +	iState = aGAVDPState.iState;
    1.37 +	return *this;
    1.38 +	}
    1.39 +
    1.40 +	
    1.41 +inline TBool TGAVDPState::operator==(const TGAVDPState& aGAVDPState) const
    1.42 +	{
    1.43 +	return (iState == aGAVDPState.iState);
    1.44 +	}
    1.45 +
    1.46 +	
    1.47 +inline TBool TGAVDPState::operator!=(const TGAVDPState& aGAVDPState) const
    1.48 +	{
    1.49 +	return !(iState == aGAVDPState.iState);
    1.50 +	}
    1.51 +
    1.52 +
    1.53 +/**
    1.54 +This looks quite long for an inline but it's only used once
    1.55 +*/
    1.56 +inline void TGAVDPState::operator++()
    1.57 +	{
    1.58 +	switch(iState)
    1.59 +		{
    1.60 +		case EGAVDPIdle:
    1.61 +			iState =  EConnectedToGavdp;
    1.62 +			break;
    1.63 +		case EConnectedToGavdp:
    1.64 +			iState =  ESEPsDiscovered;
    1.65 +			break;
    1.66 +		case ESEPsDiscovered:
    1.67 +			iState =  ESEPSelected;
    1.68 +			break;
    1.69 +		case ESEPSelected:
    1.70 +			iState =  EConfigured;
    1.71 +			break;
    1.72 +		case EConfigured:
    1.73 +			iState =  EGAVDPOpen;
    1.74 +			break;
    1.75 +		case EGAVDPOpen:
    1.76 +			iState = EGAVDPStreaming;
    1.77 +			break;
    1.78 +		case EGAVDPStreaming:
    1.79 +			iState = EGAVDPOpen;//go back to open after streaming
    1.80 +			break;
    1.81 +		}
    1.82 +	}
    1.83 +
    1.84 +	
    1.85 +inline TGAVDPState::TGAVDPStateValue TGAVDPState::State() const
    1.86 +	{
    1.87 +	return iState;
    1.88 +	}
    1.89 +
    1.90 +
    1.91 +	
    1.92 +inline TConfigurationByRemoteHeadsetState::TConfigurationByRemoteHeadsetState() : iState(ENotBeingConfiguredByRemoteHeadset), iCodecConfigRequestedByRemoteHeadset(NULL) 
    1.93 +	{
    1.94 +	}
    1.95 +
    1.96 +	
    1.97 +inline void TConfigurationByRemoteHeadsetState::Reset()
    1.98 +	{
    1.99 +	iState = ENotBeingConfiguredByRemoteHeadset;
   1.100 +	iSEPRequestedByRemoteHeadset.Reset();
   1.101 +	delete iTransportCapsRequestedByRemoteHeadset; //ownership is with this class
   1.102 +	iTransportCapsRequestedByRemoteHeadset = NULL;
   1.103 +	delete iCodecConfigRequestedByRemoteHeadset; //ownership is with this class
   1.104 +	iCodecConfigRequestedByRemoteHeadset = NULL;
   1.105 +	}
   1.106 +
   1.107 +
   1.108 +inline TConfigurationByRemoteHeadsetState TConfigurationByRemoteHeadsetState::operator=(const TConfigurationByRemoteHeadsetStateValue& aConfigByRemoteHeadsetStateValue)
   1.109 +	{
   1.110 +	iState = aConfigByRemoteHeadsetStateValue;
   1.111 +	return *this;
   1.112 +	}
   1.113 +
   1.114 +	
   1.115 +inline TBool TConfigurationByRemoteHeadsetState::operator==(const TConfigurationByRemoteHeadsetStateValue aConfigByRemoteHeadsetStateValue) const
   1.116 +	{
   1.117 +	return (iState == aConfigByRemoteHeadsetStateValue);
   1.118 +	}
   1.119 +
   1.120 +	
   1.121 +inline TBool TConfigurationByRemoteHeadsetState::operator!=(const TConfigurationByRemoteHeadsetStateValue aConfigByRemoteHeadsetStateValue) const
   1.122 +	{
   1.123 +	return (iState != aConfigByRemoteHeadsetStateValue);
   1.124 +	}
   1.125 +
   1.126 +		
   1.127 +inline  TConfigurationByRemoteHeadsetState::TConfigurationByRemoteHeadsetStateValue TConfigurationByRemoteHeadsetState::State() const
   1.128 +	{
   1.129 +	return iState;
   1.130 +	}
   1.131 +
   1.132 +	
   1.133 +inline TSEID TConfigurationByRemoteHeadsetState::SEPRequestedByRemoteHeadset() const
   1.134 +	{
   1.135 +	return iSEPRequestedByRemoteHeadset;
   1.136 +	}
   1.137 +
   1.138 +	
   1.139 +inline void TConfigurationByRemoteHeadsetState::SetSEPRequestedByRemoteHeadset(const TSEID& aSEID)
   1.140 +	{
   1.141 +	iSEPRequestedByRemoteHeadset = aSEID;
   1.142 +	}
   1.143 +
   1.144 +	
   1.145 +inline TAvdtpMediaTransportCapabilities* TConfigurationByRemoteHeadsetState::TransportCapsRequestedByRemoteHeadset() const
   1.146 +	{//note ownership stays with TConfigurationByRemoteHeadsetState
   1.147 +	return iTransportCapsRequestedByRemoteHeadset;
   1.148 +	}
   1.149 +
   1.150 +	
   1.151 +inline void TConfigurationByRemoteHeadsetState::SetTransportCapsRequestedByRemoteHeadset(TAvdtpMediaTransportCapabilities* aTransportCapsRequestedByRemoteHeadset)
   1.152 +	{//note ownership is transferred to TConfigurationByRemoteHeadsetState
   1.153 +	if (iTransportCapsRequestedByRemoteHeadset)
   1.154 +		{//then the headset is requesting a new configuration, but the old
   1.155 +		//one has not been reset - this shouldn't happen, but could happen
   1.156 +		//if the headset called GAVDP_ConfigurationIndication more than once with 
   1.157 +		//the same config with no intermediate StartStreams or Abort.
   1.158 +		delete iTransportCapsRequestedByRemoteHeadset;
   1.159 +		iTransportCapsRequestedByRemoteHeadset = NULL;
   1.160 +		}
   1.161 +	iTransportCapsRequestedByRemoteHeadset = aTransportCapsRequestedByRemoteHeadset;
   1.162 +	}
   1.163 +
   1.164 +
   1.165 +inline TAvdtpMediaCodecCapabilities* TConfigurationByRemoteHeadsetState::CodecConfigRequestedByRemoteHeadset() const
   1.166 +	{//note ownership stays with TConfigurationByRemoteHeadsetState
   1.167 +	return iCodecConfigRequestedByRemoteHeadset;
   1.168 +	}
   1.169 +
   1.170 +	
   1.171 +inline void TConfigurationByRemoteHeadsetState::SetCodecConfigRequestedByRemoteHeadset(TAvdtpMediaCodecCapabilities* aCodecConfigRequestedByRemoteHeadset)
   1.172 +	{//note ownership is transferred to TConfigurationByRemoteHeadsetState
   1.173 +	if (iCodecConfigRequestedByRemoteHeadset)
   1.174 +		{//then the headset is requesting a new configuration, but the old
   1.175 +		//one has not been reset - this shouldn't happen, but could happen
   1.176 +		//if the headset called GAVDP_ConfigurationIndication more than once with 
   1.177 +		//the same config with no intermediate StartStreams or Abort.
   1.178 +		delete iCodecConfigRequestedByRemoteHeadset;
   1.179 +		iCodecConfigRequestedByRemoteHeadset = NULL;
   1.180 +		}
   1.181 +	iCodecConfigRequestedByRemoteHeadset = aCodecConfigRequestedByRemoteHeadset;
   1.182 +	}
   1.183 +
   1.184 +#endif
   1.185 +