bluetoothengine/btsac/src/btsacState.cpp
changeset 0 f63038272f30
child 1 6a1fe72036e3
equal deleted inserted replaced
-1:000000000000 0:f63038272f30
       
     1 /*
       
     2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Default implementation of BTSAC state machine handles
       
    15 *				 methods which the active state is not supposed to handle
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "btsacactive.h"
       
    22 #include "btsacState.h"
       
    23 #include "btsacStateIdle.h"
       
    24 #include "btsacStateListening.h"
       
    25 #include "debug.h"
       
    26 
       
    27 // ================= MEMBER FUNCTIONS =======================
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // CBtsacState::CBtsacState
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 CBtsacState::CBtsacState(CBTSAController& aParent, TStateIndex aStateIndex)
       
    34 : iParent(aParent), iStateIndex(aStateIndex)
       
    35     {
       
    36     }
       
    37 
       
    38 // -----------------------------------------------------------------------------
       
    39 // CBtsacState::~CBtsacState
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 CBtsacState::~CBtsacState()
       
    43     {
       
    44     }    
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // CBtsacState::ErrorOnEntryL
       
    48 // -----------------------------------------------------------------------------
       
    49 //    
       
    50 CBtsacState* CBtsacState::ErrorOnEntryL(TInt /*aReason*/)
       
    51     {
       
    52     TRACE_FUNC
       
    53     return CBtsacListening::NewL(iParent, EGavdpResetReasonNone, KErrNone);
       
    54     }
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // CBtsacState::Parent
       
    58 // -----------------------------------------------------------------------------
       
    59 //    
       
    60  CBTSAController& CBtsacState::Parent()
       
    61     {
       
    62     return iParent;
       
    63     }
       
    64     
       
    65  // -----------------------------------------------------------------------------
       
    66 // CBtsacState::GavdpErrorActive
       
    67 // -----------------------------------------------------------------------------
       
    68 //    
       
    69  CBtsacActive* CBtsacState::GavdpErrorActive()
       
    70     {
       
    71     return iParent.GetGavdpErrorActive();
       
    72     }
       
    73 
       
    74 // -----------------------------------------------------------------------------
       
    75 // CBtsacState::ConnectL
       
    76 // -----------------------------------------------------------------------------
       
    77 //
       
    78 void CBtsacState::ConnectL(const TBTDevAddr& /*aAddr*/)
       
    79     {
       
    80     TRACE_FUNC
       
    81     Parent().CompletePendingRequests(KConnectReq, KErrInUse);
       
    82     }
       
    83 
       
    84 // -----------------------------------------------------------------------------
       
    85 // CBtsacState::CancelConnectL
       
    86 // -----------------------------------------------------------------------------
       
    87 //
       
    88 void CBtsacState::CancelConnectL()
       
    89     {
       
    90     TRACE_FUNC
       
    91     Parent().CompletePendingRequests(KConnectReq, KErrNotSupported);
       
    92     }
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // CBtsacState::DisconnectL
       
    96 // -----------------------------------------------------------------------------
       
    97 //
       
    98 void CBtsacState::DisconnectL()
       
    99     {
       
   100     TRACE_FUNC
       
   101     Parent().CompletePendingRequests(KDisconnectReq, KErrCouldNotDisconnect);
       
   102     }
       
   103 
       
   104 // -----------------------------------------------------------------------------
       
   105 // CBtsacState::DisconnectedFromRemoteOrError
       
   106 // -----------------------------------------------------------------------------
       
   107 //
       
   108 void CBtsacState::DisconnectedFromRemoteOrError(TInt /*aErr*/)
       
   109     {
       
   110     TRACE_FUNC
       
   111     }
       
   112 
       
   113 // -----------------------------------------------------------------------------
       
   114 // CBtsacState::Configure()
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117 void CBtsacState::Configure()
       
   118 	{
       
   119 	TRACE_FUNC
       
   120 	}
       
   121 
       
   122 // -----------------------------------------------------------------------------
       
   123 // CBtsacState::OpenAudioLinkL()
       
   124 // -----------------------------------------------------------------------------
       
   125 //
       
   126 void CBtsacState::OpenAudioLinkL(const TBTDevAddr& /*aAddr*/)
       
   127 	{
       
   128 	TRACE_FUNC
       
   129 	Parent().CompletePendingRequests(KOpenAudioReq, KErrNotSupported);
       
   130 	}
       
   131 
       
   132 // -----------------------------------------------------------------------------
       
   133 // CBtsacState::CancelOpenAudioLinkL()
       
   134 // -----------------------------------------------------------------------------
       
   135 //
       
   136 void CBtsacState::CancelOpenAudioLinkL()
       
   137     {
       
   138 	TRACE_FUNC
       
   139 	Parent().CompletePendingRequests(KOpenAudioReq, KErrNotSupported);
       
   140     }
       
   141 
       
   142 // -----------------------------------------------------------------------------
       
   143 // CBtsacState::CloseAudioLinkL
       
   144 // -----------------------------------------------------------------------------
       
   145 //
       
   146 void CBtsacState::CloseAudioLinkL(const TBTDevAddr& /*aAddr*/)
       
   147 	{
       
   148 	TRACE_FUNC
       
   149 	Parent().CompletePendingRequests(KCloseAudioReq, KErrNotSupported);
       
   150 	}
       
   151 
       
   152 // -----------------------------------------------------------------------------
       
   153 // CBtsacState::CancelCloseAudioLink
       
   154 // -----------------------------------------------------------------------------
       
   155 //
       
   156 void CBtsacState::CancelCloseAudioLink(const TBTDevAddr& /*aAddr*/)
       
   157 	{
       
   158 	TRACE_FUNC
       
   159 	Parent().CompletePendingRequests(KCloseAudioReq, KErrNotSupported);
       
   160 	}
       
   161 
       
   162 // -----------------------------------------------------------------------------
       
   163 // CBtsacState::StartRecording
       
   164 // -----------------------------------------------------------------------------
       
   165 //
       
   166 void CBtsacState::StartRecording()
       
   167 	{
       
   168 	TRACE_FUNC
       
   169 	}
       
   170 
       
   171 // -----------------------------------------------------------------------------
       
   172 // CBtsacState::GAVDP_ConnectConfirm
       
   173 // -----------------------------------------------------------------------------
       
   174 //
       
   175 void CBtsacState::GAVDP_ConnectConfirm(const TBTDevAddr& /*aDeviceAddr*/)
       
   176 	{
       
   177 	TRACE_FUNC
       
   178 	}
       
   179 	
       
   180 // -----------------------------------------------------------------------------
       
   181 // CBtsacState::GAVDP_SEPDiscovered
       
   182 // -----------------------------------------------------------------------------
       
   183 //		
       
   184 void CBtsacState::GAVDP_SEPDiscovered(const TAvdtpSEPInfo& /*aSEP*/)
       
   185 	{
       
   186 	TRACE_FUNC
       
   187 	}
       
   188 	
       
   189 // -----------------------------------------------------------------------------
       
   190 // CBtsacState::GAVDP_SEPDiscoveryComplete
       
   191 // -----------------------------------------------------------------------------
       
   192 //
       
   193 void CBtsacState::GAVDP_SEPDiscoveryComplete() 	
       
   194 	{
       
   195 	TRACE_FUNC
       
   196 	}
       
   197 	
       
   198 // -----------------------------------------------------------------------------
       
   199 // CBtsacState::GAVDP_SEPCapability
       
   200 // -----------------------------------------------------------------------------
       
   201 //
       
   202 void CBtsacState::GAVDP_SEPCapability(TAvdtpServiceCapability* /*aCapability*/)
       
   203 	{
       
   204 	TRACE_FUNC
       
   205 	}
       
   206 	
       
   207 // -----------------------------------------------------------------------------
       
   208 // CBtsacState::GAVDP_SEPCapabilityComplete
       
   209 // -----------------------------------------------------------------------------
       
   210 //
       
   211 void CBtsacState::GAVDP_SEPCapabilityComplete() 	
       
   212 	{
       
   213 	TRACE_FUNC
       
   214 	}
       
   215 	
       
   216 // -----------------------------------------------------------------------------
       
   217 // CBtsacState::GAVDP_AbortStreamConfirm
       
   218 // -----------------------------------------------------------------------------
       
   219 //		
       
   220 void CBtsacState::GAVDP_AbortStreamConfirm()
       
   221 	{
       
   222 	TRACE_INFO((_L("CBtsacState::GAVDP_AbortStreamConfirm(), state %d"), GetStateIndex()))
       
   223 	Parent().CompletePendingRequests(KCompleteAllReqs, KErrAbort);
       
   224 	TRAPD(err, Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonNone, KErrDisconnected)));
       
   225 	if (err)
       
   226 		{
       
   227 		TRACE_INFO((_L("CBtsacState::GAVDP_AbortStreamConfirm() Couldn't change state.")))
       
   228 		}
       
   229 	}
       
   230 	
       
   231 // -----------------------------------------------------------------------------
       
   232 // CBtsacState::GAVDP_StartStreamsConfirm
       
   233 // -----------------------------------------------------------------------------
       
   234 //
       
   235 void CBtsacState::GAVDP_StartStreamsConfirm()
       
   236 	{
       
   237 	TRACE_FUNC
       
   238 	}
       
   239 	
       
   240 // -----------------------------------------------------------------------------
       
   241 // CBtsacState::GAVDP_SuspendStreamsConfirm
       
   242 // -----------------------------------------------------------------------------
       
   243 //		
       
   244 void CBtsacState::GAVDP_SuspendStreamsConfirm()
       
   245 	{
       
   246 	TRACE_FUNC
       
   247 	}
       
   248 	
       
   249 // -----------------------------------------------------------------------------
       
   250 // CBtsacState::GAVDP_SecurityControlConfirm
       
   251 // -----------------------------------------------------------------------------
       
   252 //		
       
   253 void CBtsacState::GAVDP_SecurityControlConfirm(const TDesC8& /*aResponseData*/)
       
   254 	{
       
   255 	TRACE_FUNC
       
   256 	}
       
   257 
       
   258 // -----------------------------------------------------------------------------
       
   259 // CBtsacState::GAVDP_ConfigurationConfirm
       
   260 // -----------------------------------------------------------------------------
       
   261 //
       
   262 void CBtsacState::GAVDP_ConfigurationConfirm()
       
   263 	{
       
   264 	TRACE_FUNC
       
   265 	// configuration complete and SEP selected *AND* reconfigure confirm
       
   266 	}
       
   267 
       
   268 // -----------------------------------------------------------------------------
       
   269 // CBtsacState::GAVDP_ConfigurationStartIndication
       
   270 // -----------------------------------------------------------------------------
       
   271 //
       
   272 void CBtsacState::GAVDP_ConfigurationStartIndication(TSEID /*aLocalSEID*/, TSEID /*aRemoteSEID*/) 
       
   273 	{
       
   274 	TRACE_FUNC
       
   275 	}
       
   276 	
       
   277 // -----------------------------------------------------------------------------
       
   278 // CBtsacState::GAVDP_ConfigurationIndication
       
   279 // -----------------------------------------------------------------------------
       
   280 //		
       
   281 TInt CBtsacState::GAVDP_ConfigurationIndication(TAvdtpServiceCapability* /*aCapability*/) 
       
   282 	{
       
   283 	TRACE_FUNC
       
   284 	return KErrGeneral; 	
       
   285 	}
       
   286 	
       
   287 // -----------------------------------------------------------------------------
       
   288 // CBtsacState::GAVDP_ConfigurationEndIndication
       
   289 // -----------------------------------------------------------------------------
       
   290 //
       
   291 TInt CBtsacState::GAVDP_ConfigurationEndIndication() 
       
   292 	{
       
   293 	TRACE_FUNC
       
   294 	return KErrGeneral;	
       
   295 	}
       
   296 	
       
   297 // -----------------------------------------------------------------------------
       
   298 // CBtsacState::GAVDP_StartIndication
       
   299 // -----------------------------------------------------------------------------
       
   300 //
       
   301 TInt CBtsacState::GAVDP_StartIndication(TSEID /*aSEID*/) 
       
   302 	{
       
   303 	TRACE_FUNC
       
   304 	return KErrGeneral;	
       
   305 	}
       
   306 	
       
   307 // -----------------------------------------------------------------------------
       
   308 // CBtsacState::GAVDP_SuspendIndication
       
   309 // -----------------------------------------------------------------------------
       
   310 //
       
   311 TInt CBtsacState::GAVDP_SuspendIndication(TSEID /*aSEID*/) 
       
   312 	{
       
   313 	TRACE_FUNC
       
   314 	return KErrGeneral;
       
   315 	}
       
   316 	
       
   317 // -----------------------------------------------------------------------------
       
   318 // CBtsacState::GAVDP_SecurityControlIndication
       
   319 // -----------------------------------------------------------------------------
       
   320 //
       
   321 TInt CBtsacState::GAVDP_SecurityControlIndication(TSEID /*aSEID*/, TDes8& /*aSecurityDataInOut*/) 
       
   322 	{
       
   323 	TRACE_FUNC
       
   324 	return KErrGeneral;
       
   325 	}
       
   326 	
       
   327 // -----------------------------------------------------------------------------
       
   328 // CBtsacState::GAVDP_AbortIndication
       
   329 // -----------------------------------------------------------------------------
       
   330 //
       
   331 void CBtsacState::GAVDP_AbortIndication(TSEID aSEID) 
       
   332 	{
       
   333 	TRACE_INFO((_L("CBtsacState::GAVDP_AbortIndication(), state %d, SEID:%d"), GetStateIndex(), aSEID.SEID()))
       
   334 	(void)aSEID;
       
   335 	Parent().CompletePendingRequests(KCompleteAllReqs, KErrDisconnected);
       
   336 	TRAPD(err, Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonNone, KErrDisconnected)))
       
   337 	if(err)
       
   338 		{
       
   339 		TRACE_INFO((_L("CBtsacState::GAVDP_AbortIndication(), error! Couldn't change state")))
       
   340 		}
       
   341 	}
       
   342 	
       
   343 // -----------------------------------------------------------------------------
       
   344 // CBtsacState::GAVDP_ReleaseIndication
       
   345 // -----------------------------------------------------------------------------
       
   346 //		
       
   347 void CBtsacState::GAVDP_ReleaseIndication(TSEID /*aSEID*/) 
       
   348 	{
       
   349 	TRACE_FUNC
       
   350 	}
       
   351 	
       
   352 // -----------------------------------------------------------------------------
       
   353 // CBtsacState::GAVDP_BearerReady
       
   354 // -----------------------------------------------------------------------------
       
   355 //			
       
   356 void CBtsacState::GAVDP_BearerReady(RSocket /*aSocket*/, const TAvdtpSockAddr& /*aAddress*/)
       
   357 	{
       
   358 	TRACE_FUNC
       
   359 	}
       
   360 	
       
   361 // -----------------------------------------------------------------------------
       
   362 // CBtsacState::RequestCompletedL
       
   363 // -----------------------------------------------------------------------------
       
   364 //	
       
   365 void CBtsacState::RequestCompletedL(CBtsacActive& /*aActive*/)
       
   366 	{
       
   367 	TRACE_FUNC
       
   368 	}
       
   369 
       
   370 // -----------------------------------------------------------------------------
       
   371 // CBtsacState::CancelRequest
       
   372 // -----------------------------------------------------------------------------
       
   373 //	
       
   374 void CBtsacState::CancelRequest(CBtsacActive& /*aActive*/)
       
   375 	{
       
   376 	TRACE_FUNC
       
   377 	}
       
   378 
       
   379 // -----------------------------------------------------------------------------
       
   380 // CBtsacState::HandleGavdpErrorL
       
   381 // -----------------------------------------------------------------------------
       
   382 //
       
   383 void CBtsacState::HandleGavdpErrorL(TInt /*aError*/)
       
   384 	{
       
   385 	TRACE_FUNC
       
   386 	}
       
   387 
       
   388 // -----------------------------------------------------------------------------
       
   389 // CBtsacState::GetState
       
   390 // -----------------------------------------------------------------------------
       
   391 //
       
   392 TStateIndex CBtsacState::GetStateIndex() const
       
   393 	{
       
   394 	return iStateIndex;
       
   395 	}
       
   396 
       
   397 // -----------------------------------------------------------------------------
       
   398 // CBtsacState::GAVDP_Error
       
   399 // -----------------------------------------------------------------------------
       
   400 //
       
   401 void CBtsacState::GAVDP_Error(TInt aError, const TDesC8& /*aErrorData*/) 
       
   402 	{
       
   403 	TRACE_INFO((_L("CBtsacState::GAVDP_Error(%d)"), aError))
       
   404 	Parent().GAVDP_Error(aError);
       
   405 	}
       
   406 	
       
   407 //  End of File