bluetooth/gavdp/source/gavdpImp.cpp
changeset 0 29b1cd4cb562
child 22 786b94c6f0a4
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 // Copyright (c) 2004-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 // Implementation of Generic Audio-Video Distribution Profile - GAVDP
       
    15 // The CGavdp class acts as a "Body" implementation to the RGavdp "Handle"
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @publishedPartner
       
    21 */
       
    22 
       
    23 
       
    24 #include "gavdpInternal.h"
       
    25 
       
    26 CGavdp* CGavdp::NewL(MGavdpUser& aServiceUser, RSocketServ& aSocketServer, RGavdp& aHandle)
       
    27 	{
       
    28 #ifndef BLUETOOTH_NO_AV
       
    29 	CGavdp* gavdp = new(ELeave) CGavdp(aServiceUser, aSocketServer, aHandle);
       
    30 	CleanupStack::PushL(gavdp);
       
    31 	gavdp->ConstructL();
       
    32 	CleanupStack::Pop(gavdp);
       
    33 	return gavdp;
       
    34 #else
       
    35 	User::Leave(KErrNotSupported);
       
    36 	return NULL; // not reached
       
    37 #endif
       
    38 	}
       
    39 	
       
    40 CGavdp::~CGavdp()
       
    41 	{
       
    42 	DeAllocSocketsAndHelpers();
       
    43 	iSocketServer.Close();
       
    44 	}
       
    45 	
       
    46 void CGavdp::DeAllocSocketsAndHelpers()
       
    47 	{
       
    48 	delete iRequesterHelper;
       
    49 	iRequesterHelper = NULL;
       
    50 	delete iIndicatorHelper;
       
    51 	iIndicatorHelper = NULL;
       
    52 	AvdtpRequester().Close();
       
    53 	AvdtpIndicator().Close();
       
    54 	}
       
    55 	
       
    56 void CGavdp::ConstructL()
       
    57 	{
       
    58 	User::LeaveIfError(iSocketServer.Connect());
       
    59 	ConstructSocketsAndHelpersL();
       
    60 	}
       
    61 	
       
    62 void CGavdp::Cancel()
       
    63 	{
       
    64 	if (iRequesterHelper)
       
    65 		{
       
    66 		delete iRequesterHelper;
       
    67 		iRequesterHelper = NULL;
       
    68 		iState = EIdle;
       
    69 		// it is the client's job to recover state, so they should send an Abort.
       
    70 		}
       
    71 	// leave indications running.
       
    72 	}
       
    73 
       
    74 void CGavdp::ConstructSocketsAndHelpersL()
       
    75 	{
       
    76 	User::LeaveIfError(AvdtpRequester().Open(iSocketServer, KAVDTPProtocolName));
       
    77 
       
    78 	// mark as for signalling purposes
       
    79 	TAvdtpSockAddr addr;
       
    80 	addr.SetSession(ESignalling);
       
    81 	User::LeaveIfError(AvdtpRequester().Bind(addr));
       
    82 
       
    83 	// start reading for AVDTP indications
       
    84 	User::LeaveIfError(AvdtpIndicator().Open(iSocketServer, KAVDTPProtocolName));
       
    85 
       
    86 	User::LeaveIfError(AvdtpIndicator().SetOpt(ESetAsSecondarySAP,
       
    87 								  KSolBtAVDTPInternal,
       
    88 								  KNullDesC8));
       
    89 								  
       
    90 	User::LeaveIfError(AvdtpRequester().SetOpt(EBindToSecondarySAP,
       
    91 									  KSolBtAVDTPInternal,
       
    92 									  KNullDesC8));
       
    93 	iIndicatorHelper = CGavdpIndicator::NewL(*this, iServiceUser);
       
    94 	iIndicatorHelper->Begin();
       
    95 	}
       
    96 	
       
    97 CGavdp::CGavdp(MGavdpUser& aServiceUser, RSocketServ& aClientSocketServer, RGavdp& aHandle)
       
    98 : iClientSocketServer(aClientSocketServer), iServiceUser(aServiceUser), iHandle(aHandle)
       
    99 	{
       
   100 	}
       
   101 	
       
   102 void CGavdp::Connect(const TBTDevAddr& aRemoteAddr)
       
   103 	{
       
   104 	__ASSERT_ALWAYS((iState == EIdle || iState == EListening), Panic(EGavdpBadState));
       
   105 	__ASSERT_ALWAYS(iNumSEPsRegistered, Panic(EGavdpSEPMustBeRegisteredBeforeConnect));
       
   106 	__ASSERT_ALWAYS(aRemoteAddr!=TBTDevAddr(0), Panic(EGavdpBadRemoteAddress));
       
   107 	__ASSERT_ALWAYS(!iRequesterHelper, Panic(EGavdpBadState));
       
   108 	
       
   109 	AvdtpRequester().SetOpt(EStopAwaitPassiveSignallingChannel, KSolBtAVDTPSignalling, NULL);
       
   110 		
       
   111 	TRAPD(err, iRequesterHelper = CGavdpConnector::NewL(*this, iServiceUser, aRemoteAddr));
       
   112 	
       
   113 	if (err)
       
   114 		{
       
   115 		iServiceUser.GAVDP_Error(err, KNullDesC8);
       
   116 		}
       
   117 	else
       
   118 		{
       
   119 		iState = EConnecting;
       
   120 		iRequesterHelper->Begin();	
       
   121 		}	
       
   122 	}
       
   123 
       
   124 void CGavdp::DiscoverRemoteSEPs()
       
   125 	{
       
   126 	__ASSERT_ALWAYS(!iRequesterHelper, Panic(EGavdpBadState));
       
   127 	
       
   128 	TRAPD(err, iRequesterHelper = CGavdpDiscover::NewL(*this, iServiceUser));
       
   129 	
       
   130 	if (err)
       
   131 		{
       
   132 		iServiceUser.GAVDP_Error(err, KNullDesC8);
       
   133 		}
       
   134 	else
       
   135 		{
       
   136 		iRequesterHelper->Begin();	
       
   137 		}
       
   138 	}
       
   139 
       
   140 void CGavdp::GetRemoteSEPCapabilities(TSEID aSEID, const TAvdtpServiceCategories& aInterestingCategories)
       
   141 	{
       
   142 	__ASSERT_ALWAYS(!iRequesterHelper /*&& iServiceUser*/, Panic(EGavdpBadState));
       
   143 	CheckSEID(aSEID);
       
   144 	
       
   145 	TRAPD(err, iRequesterHelper = CGavdpGetCaps::NewL(*this,
       
   146 											 iServiceUser,
       
   147 											 aSEID,
       
   148 											 aInterestingCategories));
       
   149 	
       
   150 	if (err)
       
   151 		{
       
   152 		iServiceUser.GAVDP_Error(err, KNullDesC8);
       
   153 		}
       
   154 	else
       
   155 		{
       
   156 		iRequesterHelper->Begin();	
       
   157 		}
       
   158 	}
       
   159 	
       
   160 TInt CGavdp::BeginConfiguringRemoteSEP(TSEID aRemoteSEID, TSEID aLocalSEID)
       
   161 	{
       
   162 	__ASSERT_ALWAYS(iState!=EConfiguringRemoteSEP, Panic(EGavdpBadState));
       
   163 	CheckSEID(aRemoteSEID);
       
   164 	CheckSEID(aLocalSEID);
       
   165 
       
   166 	TInternalSelectRemoteSEP select;
       
   167 	select.iLocalSEID = aLocalSEID;
       
   168 	select.iRemoteSEID = aRemoteSEID;
       
   169 	
       
   170 	TPckg<TInternalSelectRemoteSEP> seidpckg(select);
       
   171 	TInt err = AvdtpRequester().SetOpt(EStartConfiguringRemote, KSolBtAVDTPSignalling, seidpckg);
       
   172 	if (err==KErrNone)
       
   173 		{
       
   174 		iState = EConfiguringRemoteSEP;
       
   175 		}
       
   176 	return err;
       
   177 	}
       
   178 	
       
   179 TInt CGavdp::BeginConfiguringLocalSEP(TSEID aSEID)
       
   180 	{
       
   181 	__ASSERT_ALWAYS(iState!=EConfiguringLocalSEP, Panic(EGavdpBadState));
       
   182 	TPckg<TSEID> seidpckg(aSEID);
       
   183 	TInt err = AvdtpRequester().SetOpt(EStartConfiguringLocal, KSolBtAVDTPSignalling, seidpckg);
       
   184 	if (err==KErrNone)
       
   185 		{
       
   186 		iState = EConfiguringLocalSEP;
       
   187 		}
       
   188 	return err;
       
   189 	}
       
   190 	
       
   191 	
       
   192 TInt CGavdp::AddSEPCapability(const TAvdtpServiceCapability& aCapability)
       
   193 	{
       
   194 	__ASSERT_ALWAYS(iState==EConfiguringLocalSEP || iState==EConfiguringRemoteSEP,
       
   195 																Panic(EGavdpBadState));
       
   196 
       
   197 	// convert into protocol form - this is a handy way to get a descriptor for IPC purposes
       
   198 	// if AVDTP requires the reverse operation it is of course allowed to get back to the T class form
       
   199 	RBuf8 buf;
       
   200 	TInt err = aCapability.AsProtocol(buf);
       
   201 	if (err==KErrNone)
       
   202 		{
       
   203 		err = AvdtpRequester().SetOpt(EAddCapabilitySelection,KSolBtAVDTPSignalling, buf);
       
   204 		}
       
   205 		
       
   206 	buf.Close();
       
   207 	return err; 
       
   208 	}
       
   209 
       
   210 void CGavdp::CommitSEPConfiguration()
       
   211 	{
       
   212 	__ASSERT_ALWAYS(iState == EConfiguringLocalSEP || iState == EConfiguringRemoteSEP, Panic(EGavdpBadState));
       
   213 	__ASSERT_ALWAYS(!iRequesterHelper, Panic(EGavdpBadState));
       
   214 	
       
   215 	TRAPD(err, iRequesterHelper = CGavdpSelectSEP::NewL(*this, iServiceUser));
       
   216 	
       
   217 	if (err)
       
   218 		{
       
   219 		iServiceUser.GAVDP_Error(err, KNullDesC8);
       
   220 		}
       
   221 	else
       
   222 		{
       
   223 		iRequesterHelper->Begin();
       
   224 		}
       
   225 	}
       
   226 
       
   227 void CGavdp::StartStream(TSEID aSEID)
       
   228 	{
       
   229 	__ASSERT_ALWAYS(!iRequesterHelper, Panic(EGavdpBadState));
       
   230 	
       
   231 	TRAPD(err, iRequesterHelper = CGavdpStart::NewL(*this, iServiceUser, aSEID));
       
   232 	
       
   233 	if (err)
       
   234 		{
       
   235 		iServiceUser.GAVDP_Error(err, KNullDesC8);
       
   236 		}
       
   237 	else
       
   238 		{
       
   239 		iRequesterHelper->Begin();	
       
   240 		}	
       
   241 	}
       
   242 
       
   243 void CGavdp::SuspendStream(TSEID aSEID)
       
   244 	{
       
   245 	__ASSERT_ALWAYS(!iRequesterHelper, Panic(EGavdpBadState));
       
   246 	
       
   247 	TRAPD(err, iRequesterHelper = CGavdpSuspend::NewL(*this, iServiceUser, aSEID));
       
   248 	
       
   249 	if (err)
       
   250 		{
       
   251 		iServiceUser.GAVDP_Error(err, KNullDesC8);
       
   252 		}
       
   253 	else
       
   254 		{
       
   255 		iRequesterHelper->Begin();	
       
   256 		}	
       
   257 	}
       
   258 
       
   259 void CGavdp::AbortStream(TSEID aSEID)	
       
   260 	{
       
   261 	__ASSERT_ALWAYS(!iRequesterHelper, Panic(EGavdpBadState));
       
   262 	CheckSEID(aSEID);
       
   263 	
       
   264 	TRAPD(err, iRequesterHelper = CGavdpAbort::NewL(*this, iServiceUser, aSEID));
       
   265 	
       
   266 	if (err)
       
   267 		{
       
   268 		iServiceUser.GAVDP_Error(err, KNullDesC8);
       
   269 		}
       
   270 	else
       
   271 		{
       
   272 		iRequesterHelper->Begin();	
       
   273 		}
       
   274 	}
       
   275 
       
   276 void CGavdp::SendSecurityControl(TSEID aSEID, const TDesC8& aSecurityData)	
       
   277 	{
       
   278 	__ASSERT_ALWAYS(!iRequesterHelper, Panic(EGavdpBadState));
       
   279 	CheckSEID(aSEID);
       
   280 	
       
   281 	TRAPD(err, iRequesterHelper = CGavdpSecurityControl::NewL(*this, iServiceUser, aSEID, aSecurityData));
       
   282 	
       
   283 	if (err)
       
   284 		{
       
   285 		iServiceUser.GAVDP_Error(err, KNullDesC8);
       
   286 		}
       
   287 	else
       
   288 		{
       
   289 		iRequesterHelper->Begin();	
       
   290 		}
       
   291 	}
       
   292 	
       
   293 
       
   294 TInt CGavdp::RegisterSEP(TAvdtpSEPInfo& aInfo)
       
   295 	{
       
   296 	// note this is a GetOpt - but it also sets:
       
   297 	// in goes the info, without SEID
       
   298 	// out comes the same structure with SEID filled in
       
   299 	TPckg<TAvdtpSEPInfo> sepInfo(aInfo);
       
   300 	TInt err = AvdtpRequester().GetOpt(ERegisterSEP, KSolBtAVDTPSignalling, sepInfo);
       
   301 	if (err==KErrNone)
       
   302 		{
       
   303 		iNumSEPsRegistered++;
       
   304 		}
       
   305 	return err;
       
   306 	}
       
   307 
       
   308 
       
   309 /**
       
   310 Called when gavdp client has registed all seps and is ready
       
   311 May be short lived as they may try to connect out quickly
       
   312 */
       
   313 TInt CGavdp::Listen()
       
   314 	{
       
   315 	__ASSERT_ALWAYS(iNumSEPsRegistered, Panic(EGavdpSEPMustBeRegisteredBeforeListen));
       
   316 	TInt ret = KErrNone;
       
   317 	
       
   318 	if (iState!=EConnected)
       
   319 		{
       
   320 		// start awaiting for signalling channel as as SEP has been successfully registered
       
   321 		ret = AvdtpRequester().SetOpt(EAwaitPassiveSignallingChannel, KSolBtAVDTPSignalling, NULL);
       
   322 		if (KErrNone==ret)
       
   323 			{
       
   324 			iState = EListening;
       
   325 			}
       
   326 		}
       
   327 	else
       
   328 		{
       
   329 		ret = KErrInUse;
       
   330 		}
       
   331 	return ret;
       
   332 	}
       
   333 	
       
   334 
       
   335 // private
       
   336 
       
   337 void CGavdp::SendResponse( TInternalAvdtpAirIndication aIndication,
       
   338 						  TInt aResult,
       
   339 						  const TAny* aResponseData/*=NULL*/,
       
   340 						  TInt aResponseDataLen/*=0*/)
       
   341 	{
       
   342 	TInt err = KErrNone;
       
   343 	
       
   344 	switch (aIndication.iIndication)
       
   345 		{
       
   346 		case EAvdtpSetConfiguration:
       
   347 		case EAvdtpReconfigure:
       
   348 			{
       
   349 			TAvdtpInternalConfigurationResponse rsp;
       
   350 			rsp.iSEID = aIndication.iSEID;
       
   351 			rsp.iTransactionLabel = aIndication.iTransactionLabel;
       
   352 			rsp.iResult = aResult;
       
   353 			rsp.iIsReconfigure = aIndication.iIndication==EAvdtpReconfigure;
       
   354 			
       
   355 			if (aResult!=KErrNone)
       
   356 				{
       
   357 				__ASSERT_DEBUG(aResponseData, Panic(EGavdpResponseDataExpected));
       
   358 				rsp.iCategory = *static_cast<const TAvdtpServiceCategory*>(aResponseData);
       
   359 				}
       
   360 	
       
   361 			TPckg<TAvdtpInternalConfigurationResponse> pckg(rsp);
       
   362 			
       
   363 			err = AvdtpRequester().SetOpt(ESendConfigurationResponse, KSolBtAVDTPSignalling, pckg);
       
   364 			
       
   365 			break;
       
   366 			}
       
   367 		case EAvdtpSecurityControl:
       
   368 			{
       
   369 			// optional to send data in response
       
   370 			TAvdtpInternalSecurityControlResponse rsp;
       
   371 			rsp.iSEID = aIndication.iSEID;
       
   372 			rsp.iTransactionLabel = aIndication.iTransactionLabel;
       
   373 			rsp.iResult = aResult;
       
   374 
       
   375 			if (aResult==KErrNone)
       
   376 				{
       
   377 				rsp.iSecurityControlInfo.Copy(static_cast<const TUint8*>(aResponseData), aResponseDataLen);
       
   378 				}
       
   379 	
       
   380 			TPckg<TAvdtpInternalSecurityControlResponse> pckg(rsp);			
       
   381 			err = AvdtpRequester().SetOpt(ESendSecurityControlResponse, KSolBtAVDTPSignalling, pckg);
       
   382 			
       
   383 			break;
       
   384 			}
       
   385 		case EAvdtpStart:
       
   386 			{
       
   387 			TAvdtpInternalStartResponse rsp;
       
   388 			rsp.iSEID = aIndication.iSEID;
       
   389 			rsp.iTransactionLabel = aIndication.iTransactionLabel;
       
   390 			rsp.iResult = aResult;
       
   391 
       
   392 			TPckg<TAvdtpInternalStartResponse> pckg(rsp);
       
   393 			err = AvdtpRequester().SetOpt(ESendStartResponse, KSolBtAVDTPSignalling, pckg);		
       
   394 			
       
   395 			break;
       
   396 			}
       
   397 		case EAvdtpSuspend:
       
   398 			{
       
   399 			TAvdtpInternalSuspendResponse rsp;
       
   400 			rsp.iSEID = aIndication.iSEID;
       
   401 			rsp.iTransactionLabel = aIndication.iTransactionLabel;
       
   402 			rsp.iResult = aResult;
       
   403 
       
   404 			TPckg<TAvdtpInternalSuspendResponse> pckg(rsp);
       
   405 			err = AvdtpRequester().SetOpt(ESendSuspendResponse, KSolBtAVDTPSignalling, pckg);
       
   406 			
       
   407 			break;
       
   408 			}
       
   409 		}	
       
   410 
       
   411 	if (err!=KErrNone)
       
   412 		{
       
   413 		iServiceUser.GAVDP_Error(err, KNullDesC8);
       
   414 		}
       
   415 	}
       
   416 		
       
   417 	
       
   418 void CGavdp::ServiceComplete(TInt aResult)
       
   419 	{
       
   420 	__ASSERT_DEBUG(iRequesterHelper, Fault(EGavdpHelperCompletingBadly));
       
   421 	iRequesterHelper = NULL;
       
   422 	
       
   423 	if (aResult==KErrNone)
       
   424 		{
       
   425 		switch (iState)
       
   426 			{
       
   427 			case EConfiguringRemoteSEP:
       
   428 			case EListening:
       
   429 			case EConnecting:
       
   430 				iState = EConnected;
       
   431 				break;
       
   432 			case EConfiguringLocalSEP:
       
   433 				{
       
   434 				iState = EIdle;
       
   435 				break;
       
   436 				}
       
   437 				
       
   438 			}
       
   439 		}
       
   440 	else
       
   441 		{
       
   442 		iState = EIdle; // or perhaps errored? 
       
   443 		}
       
   444 	}
       
   445 	
       
   446 void CGavdp::Error(TInt aError)
       
   447 	{
       
   448 	// helper tells user - here we do whatever we need to tidy ourselves
       
   449 	delete iRequesterHelper;
       
   450 	iRequesterHelper = NULL;
       
   451 	iState = EIdle;
       
   452 	// and tell the user
       
   453 	iServiceUser.GAVDP_Error(aError, KNullDesC8);
       
   454 	}
       
   455 
       
   456 void CGavdp::FatalError()
       
   457 	{
       
   458 	//Unbind from the body before informing the user
       
   459 	iHandle.UnbindBody();
       
   460 	//Now tell the user we are DEAD
       
   461 	iServiceUser.GAVDP_Error(KErrDied, KNullDesC8);
       
   462 	//Cleanup: we've unbound from the body, We are no longer owned. Delete ourselves
       
   463 	delete this;
       
   464 	}
       
   465 
       
   466 /*
       
   467 Forms the binding between passively created signalling and sockets
       
   468 */
       
   469 void CGavdp::BindSignallingL(const TBTDevAddr& aRemoteAddress)
       
   470 	{
       
   471 	// use the same helper as if we originated the signalling channel
       
   472 	if (iRequesterHelper)
       
   473 		{
       
   474 		// the client has just issued another command
       
   475 		// this is likely to be something that renders the connections invalid anyway
       
   476 		// eg Abort, Config
       
   477 		User::Leave(KErrInUse);
       
   478 		}
       
   479 	iRequesterHelper = CGavdpConnector::NewL(*this, iServiceUser, aRemoteAddress);
       
   480 	iRequesterHelper->Begin();
       
   481 	}
       
   482 	
       
   483 /*
       
   484 Forms the binding between passively created transport sessions and sockets
       
   485 */
       
   486 void CGavdp::BindBearersL(TSEID aSEID, TBool aRequireReporting, TBool aRequireRecovery)
       
   487 	{
       
   488 	// which bearers? spy on set config to see if rec&rep in use
       
   489 	// or from the indication?
       
   490 	//certainly media
       
   491 	CheckSEID(aSEID);
       
   492 	
       
   493 	TAvdtpSockAddr addr;
       
   494 	AvdtpRequester().RemoteName(addr);	
       
   495 	addr.SetSEID(aSEID);
       
   496 	
       
   497 	if (iRequesterHelper)
       
   498 		{
       
   499 		// the client has just issued another command
       
   500 		// this is likely to be something that renders the connections invalid anyway
       
   501 		// eg Abort, Config
       
   502 		User::Leave(KErrInUse);
       
   503 		}
       
   504 	
       
   505 	iRequesterHelper = CGavdpUPlaneConnector::NewL(*this,
       
   506 										  iServiceUser,
       
   507 										  addr,
       
   508 										  aRequireReporting,
       
   509 										  aRequireRecovery,
       
   510 										  iClientSocketServer
       
   511 										  );
       
   512 	iRequesterHelper->Begin();
       
   513 	}
       
   514 
       
   515 TInt CGavdp::CreateBearerSockets(TSEID aSEID)
       
   516 	{	
       
   517 	// form socket address and connect
       
   518 	// should be in state listening. if we are told to create bearers then of course stop listening
       
   519 	CheckSEID(aSEID);
       
   520 	
       
   521 	TAvdtpSockAddr addr;
       
   522 	
       
   523 	// get remote BDAddr for this session
       
   524 	AvdtpRequester().RemoteName(addr);
       
   525 	
       
   526 	// now set SEID and Session type
       
   527 	addr.SetSEID(aSEID);
       
   528 	
       
   529 	// ask avdtp if reporting and recovery are configured
       
   530 	TReportingAndRecovery rar;
       
   531 	rar.iSEID = aSEID;
       
   532 	TPckg<TReportingAndRecovery> rarBuf(rar);
       
   533 	TInt err = AvdtpRequester().GetOpt(EGetReportingAndRecoveryConfig, KSolBtAVDTPSignalling, rarBuf);
       
   534 	if(err == KErrNone)
       
   535 		{
       
   536 		// helper sets session types	
       
   537 		TRAP(err, iRequesterHelper = CGavdpUPlaneConnector::NewL(*this,
       
   538 																iServiceUser,
       
   539 																addr,
       
   540 																rar.iReporting,
       
   541 																rar.iRecovery,
       
   542 																iClientSocketServer));
       
   543 		if (err)
       
   544 			{
       
   545 			iServiceUser.GAVDP_Error(err, KNullDesC8);
       
   546 			}
       
   547 		else
       
   548 			{
       
   549 			iRequesterHelper->Begin();	
       
   550 			}
       
   551 		}
       
   552 	else
       
   553 		{
       
   554 		iServiceUser.GAVDP_Error(err, KNullDesC8);
       
   555 		}
       
   556 	return err;	
       
   557 	}
       
   558 
       
   559 
       
   560 inline TBool CGavdp::CheckSEID(TSEID aSEID)
       
   561 	{
       
   562 	TBool ok = aSEID.IsValid();
       
   563 	__ASSERT_ALWAYS(ok, Panic(EGavdpUserSuppliedBadSEID));
       
   564 	return ok;
       
   565 	}
       
   566 	
       
   567 
       
   568 TInt CGavdp::Shutdown()
       
   569 	{
       
   570 	Cancel();
       
   571 	iState=EIdle;
       
   572 	return AvdtpRequester().SetOpt(EShutdown, KSolBtAVDTPSignalling, NULL);
       
   573 	}