bluetooth/btstack/secman/pairingserver.cpp
branchRCL_3
changeset 10 8a27654f7b62
parent 8 2b6718f05bdb
child 22 786b94c6f0a4
equal deleted inserted replaced
8:2b6718f05bdb 10:8a27654f7b62
   773 	TBTSockAddr addr;
   773 	TBTSockAddr addr;
   774 	addr.SetBTAddr(addrBuf());
   774 	addr.SetBTAddr(addrBuf());
   775 	iProxySap = CBTProxySAP::NewL(iPhysicalLinksManager, NULL);
   775 	iProxySap = CBTProxySAP::NewL(iPhysicalLinksManager, NULL);
   776 
   776 
   777 	CleanupStack::Pop(this); // the start message cleaner
   777 	CleanupStack::Pop(this); // the start message cleaner
   778 
   778 	
       
   779 	// Now we've entered the realm of not leaving with an error, since the connection
       
   780 	// process has started.  Errors from now on must be via the Error() function call.
   779 	iState = EInitialConnectionPending;
   781 	iState = EInitialConnectionPending;
   780 	iProxySap->SetNotify(this);
   782 	iProxySap->SetNotify(this);
   781 	iProxySap->SetRemName(addr);
   783 	iProxySap->SetRemName(addr);
   782 	iProxySap->ActiveOpen();
   784 	iProxySap->ActiveOpen();
   783 	DoAccessRequestL();
   785 	TRAPD(err, DoAccessRequestL());
       
   786 	if(err != KErrNone)
       
   787 		{
       
   788 		Error(err);
       
   789 		}
   784 	}
   790 	}
   785 
   791 
   786 void CDedicatedBondingSession::CleanupStartMessage(TAny* aPtr)
   792 void CDedicatedBondingSession::CleanupStartMessage(TAny* aPtr)
   787 	{
   793 	{
   788 	LOG_STATIC_FUNC
   794 	LOG_STATIC_FUNC
   814 			{
   820 			{
   815 			iState = EFinalConnectionPending;
   821 			iState = EFinalConnectionPending;
   816 			addr.SetBTAddr(iProxySap->RemoteAddress());
   822 			addr.SetBTAddr(iProxySap->RemoteAddress());
   817 			iProxySap->SetRemName(addr); // triggers finding a link again.
   823 			iProxySap->SetRemName(addr); // triggers finding a link again.
   818 			iProxySap->ActiveOpen();
   824 			iProxySap->ActiveOpen();
   819 			DoAccessRequestL();
   825 			TRAPD(err, DoAccessRequestL());
       
   826 			if(err != KErrNone)
       
   827 				{
       
   828 				Error(err);
       
   829 				}
   820 			break;
   830 			break;
   821 			}
   831 			}
   822 		// else not deferred so complete now....
   832 		// else not deferred so complete now....
   823 		// fall-through...
   833 		// fall-through...
   824 	case EInitialConnection:
   834 	case EInitialConnection:
   862 	LOG_FUNC
   872 	LOG_FUNC
   863 	// We aren't using a raw conduit
   873 	// We aren't using a raw conduit
   864 	__ASSERT_DEBUG(EFalse, PANIC(KPairingServerFaultCat, EPairingServerUnexpectedSocketCallback));
   874 	__ASSERT_DEBUG(EFalse, PANIC(KPairingServerFaultCat, EPairingServerUnexpectedSocketCallback));
   865 	}
   875 	}
   866 
   876 
   867 void CDedicatedBondingSession::ConnectCompleteL()
   877 void CDedicatedBondingSession::ConnectComplete()
   868 	{
   878 	{
   869 	LOG_FUNC
   879 	LOG_FUNC
   870 	switch(iState)
   880 	switch(iState)
   871 		{
   881 		{
   872 	case EInitialConnectionPending:
   882 	case EInitialConnectionPending:
   877 		break;
   887 		break;
   878 	case EInitialConnection:
   888 	case EInitialConnection:
   879 	case EFinalConnection:
   889 	case EFinalConnection:
   880 		// Apparently multiple connect completes are allowed by CSocket
   890 		// Apparently multiple connect completes are allowed by CSocket
   881 		break;
   891 		break;
       
   892 	case EShutdown:
       
   893 		// If an error occurred just after the connection request then we
       
   894 		// might receive a connection complete before the async shutdown request
       
   895 		// has been executed.
       
   896 		break;
   882 	default:
   897 	default:
   883 		LOG1(_L("Unexpected Connect Complete in state %d"), iState);
   898 		LOG1(_L("Unexpected Connect Complete in state %d"), iState);
   884 		__ASSERT_DEBUG(EFalse, PANIC(KPairingServerFaultCat, EPairingServerUnexpectedSocketCallback));
   899 		__ASSERT_DEBUG(EFalse, PANIC(KPairingServerFaultCat, EPairingServerUnexpectedSocketCallback));
   885 		break;
   900 		break;
   886 		}
       
   887 	}
       
   888 
       
   889 void CDedicatedBondingSession::ConnectComplete()
       
   890 	{
       
   891 	LOG_FUNC
       
   892 	TRAPD(err, ConnectCompleteL());
       
   893 	if(err != KErrNone)
       
   894 		{
       
   895 		Error(err);
       
   896 		}
   901 		}
   897 	}
   902 	}
   898 
   903 
   899 void CDedicatedBondingSession::ConnectComplete(const TDesC8& /*aConnectData*/)
   904 void CDedicatedBondingSession::ConnectComplete(const TDesC8& /*aConnectData*/)
   900 	{
   905 	{