bluetooth/btstack/linkmgr/physicallinksmanager.cpp
changeset 50 0bcc0c74cec9
parent 21 5e5528a288fe
child 56 015fa7494bd2
equal deleted inserted replaced
47:a1b8f5cc021e 50:0bcc0c74cec9
    21 #include "hcifacade.h"
    21 #include "hcifacade.h"
    22 #include "Basebandmodel.h"
    22 #include "Basebandmodel.h"
    23 #include "ProxySAP.h"
    23 #include "ProxySAP.h"
    24 
    24 
    25 #include <bt_sock.h>
    25 #include <bt_sock.h>
    26 #include "PhysicalLinkHelper.h"
    26 #include "roleswitchhelper.h"
    27 #include "hostresolver.h"
    27 #include "hostresolver.h"
    28 
    28 
    29 #include <bluetooth/hci/writepagetimeoutcommand.h>
    29 #include <bluetooth/hci/writepagetimeoutcommand.h>
    30 
    30 
    31 #ifdef __FLOG_ACTIVE
    31 #ifdef __FLOG_ACTIVE
   581 	CPhysicalLink* found = FindPhysicalLink(aConnH);
   581 	CPhysicalLink* found = FindPhysicalLink(aConnH);
   582 	RETURN_IF_NULL_CONNECTION(found);
   582 	RETURN_IF_NULL_CONNECTION(found);
   583 	found->MaxSlotsChange(aConnH, aSlots);
   583 	found->MaxSlotsChange(aConnH, aSlots);
   584 	}
   584 	}
   585 
   585 
       
   586 void CPhysicalLinksManager::EncryptionKeyRefreshComplete(THCIErrorCode aErr, THCIConnHandle aConnH)
       
   587 	{
       
   588 	CPhysicalLink* found = FindPhysicalLink(aConnH);
       
   589 	RETURN_IF_NULL_CONNECTION(found);
       
   590 	found->EncryptionKeyRefreshComplete(aErr, aConnH);
       
   591 	}
       
   592 
   586 void CPhysicalLinksManager::ModeChange(THCIErrorCode aErr, THCIConnHandle aConnH, TBTLinkMode aMode, TBasebandTime aInterval)
   593 void CPhysicalLinksManager::ModeChange(THCIErrorCode aErr, THCIConnHandle aConnH, TBTLinkMode aMode, TBasebandTime aInterval)
   587 	{
   594 	{
   588 	CPhysicalLink* found = FindPhysicalLink(aConnH);
   595 	CPhysicalLink* found = FindPhysicalLink(aConnH);
   589 	RETURN_IF_NULL_CONNECTION(found);
   596 	RETURN_IF_NULL_CONNECTION(found);
   590 	found->ModeChange(aErr, aConnH, aMode, aInterval);
   597 	found->ModeChange(aErr, aConnH, aMode, aInterval);
   994  	if (iRoleSwitchersQ.IsFirst(&aRoleSwitcher))
  1001  	if (iRoleSwitchersQ.IsFirst(&aRoleSwitcher))
   995  		{
  1002  		{
   996  		// this the only role request, it's safe to kick off the state machine
  1003  		// this the only role request, it's safe to kick off the state machine
   997  		// first suspend host resolver
  1004  		// first suspend host resolver
   998  		LinkManagerProtocol().InquiryMgr().Suspend();
  1005  		LinkManagerProtocol().InquiryMgr().Suspend();
   999  		aRoleSwitcher.Start();
  1006  		aRoleSwitcher.StartHelper();
  1000  		}
  1007  		}
  1001  	}
  1008  	}
  1002  
  1009  
  1003  void CPhysicalLinksManager::RemoveRoleSwitcher(CRoleSwitcher& aRoleSwitcher)
  1010  void CPhysicalLinksManager::RemoveRoleSwitcher(CRoleSwitcher& aRoleSwitcher)
  1004  	{
  1011  	{
  1014 		iRoleSwitchersQ.Remove(aRoleSwitcher);
  1021 		iRoleSwitchersQ.Remove(aRoleSwitcher);
  1015 		}
  1022 		}
  1016  	
  1023  	
  1017  	if (startNextRoleSwitcher && !iRoleSwitchersQ.IsEmpty())
  1024  	if (startNextRoleSwitcher && !iRoleSwitchersQ.IsEmpty())
  1018  		{
  1025  		{
  1019  		iRoleSwitchersQ.First()->Start();
  1026  		iRoleSwitchersQ.First()->StartHelper();
  1020  		}
  1027  		}
  1021  	else 
  1028  	else 
  1022  		{
  1029  		{
  1023  		// resume host resolver
  1030  		// resume host resolver
  1024  		LinkManagerProtocol().InquiryMgr().Resume();
  1031  		LinkManagerProtocol().InquiryMgr().Resume();