javaextensions/bluetooth/bluetoothplugins/btspppushplugin/src.s60/btrfcommserverconnection.cpp
changeset 61 bf7ee68962da
parent 21 2a9601315dfc
child 72 1f0034e370aa
equal deleted inserted replaced
48:e0d6e9bd3ca7 61:bf7ee68962da
   435     LOG1(EJavaBluetooth, EInfo, "+  RFCOMMServerConnection::HandleAcceptCompleteL Err:%d", err);
   435     LOG1(EJavaBluetooth, EInfo, "+  RFCOMMServerConnection::HandleAcceptCompleteL Err:%d", err);
   436 
   436 
   437     if (KErrNone == err)
   437     if (KErrNone == err)
   438     {
   438     {
   439         mAcceptedSocket->RemoteName(btRemoteAddr);
   439         mAcceptedSocket->RemoteName(btRemoteAddr);
   440         if (mAsyncAccept && (!mAvoidFilter) && (false == isConnectionAllowed(btRemoteAddr)))
   440         TBuf<20> addr;
       
   441         TInt64 longBtAddr = 0;
       
   442         TBTDevAddr btDeviceAddress = btRemoteAddr.BTAddr();
       
   443         LOG4(EJavaBluetooth,EInfo,"TBTDevAddr Address is %x %x %x %x ",
       
   444                                    btDeviceAddress[0],btDeviceAddress[1], 
       
   445                                    btDeviceAddress[2],btDeviceAddress[3]);
       
   446         LOG2(EJavaBluetooth,EInfo,"%x %x",btDeviceAddress[4], 
       
   447                                           btDeviceAddress[5]);
       
   448         btDeviceAddress.GetReadable(addr);
       
   449         LOG1(EJavaBluetooth,EInfo,"BT: Readable address is %S",&addr);
       
   450         TLex16 toParse(addr);
       
   451         toParse.Val(longBtAddr, EHex);
       
   452         LOG1(EJavaBluetooth, EInfo,
       
   453              "L2CAPServerConnection::HandleAcceptCompleteL: Address: %llx", longBtAddr);
       
   454         if ((longBtAddr == 0) ||(mAsyncAccept && (!mAvoidFilter) && (false == isConnectionAllowed(btRemoteAddr))))
   441         {
   455         {
   442             mAcceptedSocket->CancelAll();
   456             mAcceptedSocket->CancelAll();
   443             mAcceptedSocket->Shutdown(RSocket::EImmediate);
   457             mAcceptedSocket->Shutdown(RSocket::EImmediate);
   444             delete mAcceptedSocket;
   458             delete mAcceptedSocket;
   445             mAcceptedSocket = NULL;
   459             mAcceptedSocket = NULL;
   446             ELOG(EJavaBluetooth,
   460             ELOG(EJavaBluetooth,
   447                  "RFCOMMServerConnection::HandleAcceptCompleteL Connection Rejected");
   461                  "RFCOMMServerConnection::HandleAcceptCompleteL Connection Rejected");
   448             AcceptL();
   462             AcceptL();
   449             return;
   463             return;
   450         }
   464         }
   451         TBuf<20> addr;
   465         
   452         TInt64 longBtAddr = 0;
       
   453         TBTDevAddr btDeviceAddress = btRemoteAddr.BTAddr();
       
   454         btDeviceAddress.GetReadable(addr);
       
   455         TLex16 toParse(addr);
       
   456         toParse.Val(longBtAddr, EHex);
       
   457         LOG1(EJavaBluetooth, EInfo, "RFCOMMServerConnection::HandleAcceptCompleteL: Address: %ld", longBtAddr);
       
   458         mBtClientConn = new BluetoothClientConnection(mAcceptedSocket, mServer);
   466         mBtClientConn = new BluetoothClientConnection(mAcceptedSocket, mServer);
   459         mBtClientConn->initialize(PROTOCOL_RFCOMM, longBtAddr, 0, 0);
   467         mBtClientConn->initialize(PROTOCOL_RFCOMM, longBtAddr, 0, 0);
   460         if (mAsyncAccept)
   468         if (mAsyncAccept)
   461         {
   469         {
   462             mPushEventListener->handleConnectionRequest(mBtClientConn, err);
   470             mPushEventListener->handleConnectionRequest(mBtClientConn, err);