bluetooth/btstack/linkmgr/physicallinksmanager.cpp
branchRCL_3
changeset 14 f8503e232b0c
parent 0 29b1cd4cb562
child 25 99439b07e980
equal deleted inserted replaced
13:16aa830c86c8 14:f8503e232b0c
   314 		iTerminatingProxy->TerminatePhysicalLinksComplete();
   314 		iTerminatingProxy->TerminatePhysicalLinksComplete();
   315 		}
   315 		}
   316 	iTerminatingProxy=aProxySAP;
   316 	iTerminatingProxy=aProxySAP;
   317 	}
   317 	}
   318 	
   318 	
   319 TInt CPhysicalLinksManager::TerminateAllPhysicalLinks(CBTProxySAP* aProxySAP)
   319 TInt CPhysicalLinksManager::TerminateAllPhysicalLinks(CBTProxySAP* aProxySAP, THCIErrorCode aErrorCode)
   320 	{
   320 	{
   321 	TInt count=iPhysicalLinks.Count();
   321 	TInt count=iPhysicalLinks.Count();
   322 	TInt retVal = (count==0) ? KErrNotFound : KErrNone;
   322 	TInt retVal = (count==0) ? KErrNotFound : KErrNone;
   323 		
   323 		
   324 	for (TInt i=0; i<count; i++)
   324 	for (TInt i=0; i<count; i++)
   325 		{
   325 		{
   326 		// If any one of the physical links return an error then this 
   326 		// If any one of the physical links return an error then this 
   327 		// function needs to return an error.
   327 		// function needs to return an error.
   328 		TInt err = iPhysicalLinks[i]->Terminate(ERemoteUserEndedConnection);
   328 		TInt err = iPhysicalLinks[i]->Terminate(aErrorCode);
   329 		if (err != KErrNone)
   329 		if (err != KErrNone)
   330 			{
   330 			{
   331 			retVal=err;
   331 			retVal=err;
   332 			}
   332 			}
   333 		}
   333 		}
  1307 		}
  1307 		}
  1308 	iPinRequesters[ix].AddNotifier(aNotifier);
  1308 	iPinRequesters[ix].AddNotifier(aNotifier);
  1309 	return KErrNone;
  1309 	return KErrNone;
  1310 	}
  1310 	}
  1311 
  1311 
  1312 TBool CBluetoothPrefetchManager::IsPrefetchAvailable(const TBTDevAddr& aAddr, TBTPinCode& aPinCode)
  1312 
  1313 	{
  1313 TInt CBluetoothPrefetchManager::IsPrefetchAvailable(const TBTDevAddr& aAddr) const
  1314 	TInt ix = iPrefetchedPins.Find(aAddr, CompareAddressInStore);
  1314     {
  1315 	if (ix < 0)
  1315     return iPrefetchedPins.Find(aAddr, CompareAddressInStore);
  1316 		{
  1316     }
  1317 		return EFalse;
  1317 
  1318 		}
  1318 TBool CBluetoothPrefetchManager::GetPrefetch(const TBTDevAddr& aAddr, TBTPinCode& aPinCode) const
  1319 	aPinCode.Copy(iPrefetchedPins[ix].iPin);
  1319     {
  1320 	iPrefetchedPins.Remove(ix);
  1320     TInt ix = IsPrefetchAvailable(aAddr);
  1321 	return ETrue;
  1321     if (ix >= 0)
       
  1322         {
       
  1323         aPinCode.Copy(iPrefetchedPins[ix].iPin);
       
  1324         return ETrue;
       
  1325         }
       
  1326     return EFalse;
       
  1327     }
       
  1328 
       
  1329 void CBluetoothPrefetchManager::RemovePrefetch(const TBTDevAddr& aAddr)
       
  1330 	{
       
  1331 	TInt ix = IsPrefetchAvailable(aAddr);
       
  1332 	if (ix >= 0)
       
  1333 		{
       
  1334         iPrefetchedPins.Remove(ix);
       
  1335 		}
  1322 	}
  1336 	}
  1323 
  1337 
  1324 TInt CBluetoothPrefetchManager::PINCodeRequestReply(const TBTDevAddr& aDevAddr, const TDesC8& aPin) const
  1338 TInt CBluetoothPrefetchManager::PINCodeRequestReply(const TBTDevAddr& aDevAddr, const TDesC8& aPin) const
  1325 	{
  1339 	{
  1326 	TInt ix = iPinRequesters.Find(aDevAddr, CompareAddressInRequest);
  1340 	TInt ix = iPinRequesters.Find(aDevAddr, CompareAddressInRequest);