Beispiel #1
0
 //--------
 public void Construct(BluetoothEndPoint localEP)
 {
     if (localEP == null)
     {
         throw new ArgumentNullException("localEP");
     }
     if (localEP.Address != BluetoothAddress.None)
     {
         throw new NotSupportedException("Don't support binding to a particular local address/port.");
     }
     m_requestedLocalEP = (BluetoothEndPoint)localEP.Clone();
 }
        public override void Connect(BluetoothEndPoint remoteEP)
        {
            // TESTING
            if (!TestUtilities.IsUnderTestHarness())
            {
                _fcty.ToJavaUuid(BluetoothService.ObexObjectPush);
                _fcty.ToJavaUuid(Guid.NewGuid());
            }
            //--
            var cloneEP = (BluetoothEndPoint)remoteEP.Clone();
            var dev     = (AndroidBthDeviceInfo)_fcty.DoGetBluetoothDeviceInfoInternalOnly(remoteEP.Address);
            var sock    = dev.CreateSocket(cloneEP, _auth, _encr);

            sock.Connect();
            SetupConnection(sock);
        }
Beispiel #3
0
        public IAsyncResult BeginConnect(BluetoothEndPoint remoteEP, AsyncCallback requestCallback, object state)
        {
            // Just in case the user modifies the original endpoint or address!!!
            BluetoothEndPoint rep2 = (BluetoothEndPoint)remoteEP.Clone();
            //
            AsyncResultNoResult arConnect     = new AsyncResultNoResult(requestCallback, state);
            AsyncResultNoResult origArConnect = System.Threading.Interlocked.CompareExchange(
                ref m_arConnect, arConnect, null);

            if (origArConnect != null)
            {
                throw new InvalidOperationException("Another Connect operation is already in progress.");
            }
            BeginFillInPort(rep2, Connect_FillInPortCallback,
                            new BeginConnectState(rep2, arConnect));
            return(arConnect);
        }