os/mm/devsound/sounddevbt/src/A2dpBlueTooth/headsetaudioif/GavdpStates.inl
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef __GAVDPSTATES_INL__
    17 #define __GAVDPSTATES_INL__
    18 
    19 
    20 inline TGAVDPState::TGAVDPState() : iState(EGAVDPIdle) 
    21 	{
    22 	}
    23 	
    24 		
    25 inline TGAVDPState::TGAVDPState(TGAVDPStateValue aGAVDPStateValue)
    26 	{
    27 	iState = aGAVDPStateValue;
    28 	}
    29 
    30 
    31 inline TGAVDPState TGAVDPState::operator=(const TGAVDPState& aGAVDPState)
    32 	{
    33 	iState = aGAVDPState.iState;
    34 	return *this;
    35 	}
    36 
    37 	
    38 inline TBool TGAVDPState::operator==(const TGAVDPState& aGAVDPState) const
    39 	{
    40 	return (iState == aGAVDPState.iState);
    41 	}
    42 
    43 	
    44 inline TBool TGAVDPState::operator!=(const TGAVDPState& aGAVDPState) const
    45 	{
    46 	return !(iState == aGAVDPState.iState);
    47 	}
    48 
    49 
    50 /**
    51 This looks quite long for an inline but it's only used once
    52 */
    53 inline void TGAVDPState::operator++()
    54 	{
    55 	switch(iState)
    56 		{
    57 		case EGAVDPIdle:
    58 			iState =  EConnectedToGavdp;
    59 			break;
    60 		case EConnectedToGavdp:
    61 			iState =  ESEPsDiscovered;
    62 			break;
    63 		case ESEPsDiscovered:
    64 			iState =  ESEPSelected;
    65 			break;
    66 		case ESEPSelected:
    67 			iState =  EConfigured;
    68 			break;
    69 		case EConfigured:
    70 			iState =  EGAVDPOpen;
    71 			break;
    72 		case EGAVDPOpen:
    73 			iState = EGAVDPStreaming;
    74 			break;
    75 		case EGAVDPStreaming:
    76 			iState = EGAVDPOpen;//go back to open after streaming
    77 			break;
    78 		}
    79 	}
    80 
    81 	
    82 inline TGAVDPState::TGAVDPStateValue TGAVDPState::State() const
    83 	{
    84 	return iState;
    85 	}
    86 
    87 
    88 	
    89 inline TConfigurationByRemoteHeadsetState::TConfigurationByRemoteHeadsetState() : iState(ENotBeingConfiguredByRemoteHeadset), iCodecConfigRequestedByRemoteHeadset(NULL) 
    90 	{
    91 	}
    92 
    93 	
    94 inline void TConfigurationByRemoteHeadsetState::Reset()
    95 	{
    96 	iState = ENotBeingConfiguredByRemoteHeadset;
    97 	iSEPRequestedByRemoteHeadset.Reset();
    98 	delete iTransportCapsRequestedByRemoteHeadset; //ownership is with this class
    99 	iTransportCapsRequestedByRemoteHeadset = NULL;
   100 	delete iCodecConfigRequestedByRemoteHeadset; //ownership is with this class
   101 	iCodecConfigRequestedByRemoteHeadset = NULL;
   102 	}
   103 
   104 
   105 inline TConfigurationByRemoteHeadsetState TConfigurationByRemoteHeadsetState::operator=(const TConfigurationByRemoteHeadsetStateValue& aConfigByRemoteHeadsetStateValue)
   106 	{
   107 	iState = aConfigByRemoteHeadsetStateValue;
   108 	return *this;
   109 	}
   110 
   111 	
   112 inline TBool TConfigurationByRemoteHeadsetState::operator==(const TConfigurationByRemoteHeadsetStateValue aConfigByRemoteHeadsetStateValue) const
   113 	{
   114 	return (iState == aConfigByRemoteHeadsetStateValue);
   115 	}
   116 
   117 	
   118 inline TBool TConfigurationByRemoteHeadsetState::operator!=(const TConfigurationByRemoteHeadsetStateValue aConfigByRemoteHeadsetStateValue) const
   119 	{
   120 	return (iState != aConfigByRemoteHeadsetStateValue);
   121 	}
   122 
   123 		
   124 inline  TConfigurationByRemoteHeadsetState::TConfigurationByRemoteHeadsetStateValue TConfigurationByRemoteHeadsetState::State() const
   125 	{
   126 	return iState;
   127 	}
   128 
   129 	
   130 inline TSEID TConfigurationByRemoteHeadsetState::SEPRequestedByRemoteHeadset() const
   131 	{
   132 	return iSEPRequestedByRemoteHeadset;
   133 	}
   134 
   135 	
   136 inline void TConfigurationByRemoteHeadsetState::SetSEPRequestedByRemoteHeadset(const TSEID& aSEID)
   137 	{
   138 	iSEPRequestedByRemoteHeadset = aSEID;
   139 	}
   140 
   141 	
   142 inline TAvdtpMediaTransportCapabilities* TConfigurationByRemoteHeadsetState::TransportCapsRequestedByRemoteHeadset() const
   143 	{//note ownership stays with TConfigurationByRemoteHeadsetState
   144 	return iTransportCapsRequestedByRemoteHeadset;
   145 	}
   146 
   147 	
   148 inline void TConfigurationByRemoteHeadsetState::SetTransportCapsRequestedByRemoteHeadset(TAvdtpMediaTransportCapabilities* aTransportCapsRequestedByRemoteHeadset)
   149 	{//note ownership is transferred to TConfigurationByRemoteHeadsetState
   150 	if (iTransportCapsRequestedByRemoteHeadset)
   151 		{//then the headset is requesting a new configuration, but the old
   152 		//one has not been reset - this shouldn't happen, but could happen
   153 		//if the headset called GAVDP_ConfigurationIndication more than once with 
   154 		//the same config with no intermediate StartStreams or Abort.
   155 		delete iTransportCapsRequestedByRemoteHeadset;
   156 		iTransportCapsRequestedByRemoteHeadset = NULL;
   157 		}
   158 	iTransportCapsRequestedByRemoteHeadset = aTransportCapsRequestedByRemoteHeadset;
   159 	}
   160 
   161 
   162 inline TAvdtpMediaCodecCapabilities* TConfigurationByRemoteHeadsetState::CodecConfigRequestedByRemoteHeadset() const
   163 	{//note ownership stays with TConfigurationByRemoteHeadsetState
   164 	return iCodecConfigRequestedByRemoteHeadset;
   165 	}
   166 
   167 	
   168 inline void TConfigurationByRemoteHeadsetState::SetCodecConfigRequestedByRemoteHeadset(TAvdtpMediaCodecCapabilities* aCodecConfigRequestedByRemoteHeadset)
   169 	{//note ownership is transferred to TConfigurationByRemoteHeadsetState
   170 	if (iCodecConfigRequestedByRemoteHeadset)
   171 		{//then the headset is requesting a new configuration, but the old
   172 		//one has not been reset - this shouldn't happen, but could happen
   173 		//if the headset called GAVDP_ConfigurationIndication more than once with 
   174 		//the same config with no intermediate StartStreams or Abort.
   175 		delete iCodecConfigRequestedByRemoteHeadset;
   176 		iCodecConfigRequestedByRemoteHeadset = NULL;
   177 		}
   178 	iCodecConfigRequestedByRemoteHeadset = aCodecConfigRequestedByRemoteHeadset;
   179 	}
   180 
   181 #endif
   182