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