private void ConnectionComplete(Task obj)
 {
     Debug.WriteLine("Connection Complete.");
     Device = new PairedDeviceBLE((ConnectingDevice as UnPairedDeviceBLE).mDevice,
                                  (dev) => {
         TriggerDeviceConnected(dev);
     });
 }
Exemplo n.º 2
0
        private void ConnectionComplete(UnPairedDeviceBLE input)
        {
            BluetoothLEDevice.FromIdAsync(input.Information.Id).AsTask().ContinueWith(
                (obj) =>
            {
                Debug.WriteLine("Connection Complete.");
                if (obj.Result == null)
                {
                    return;
                }

                var temp = new PairedDeviceBLE(obj.Result, (dev) =>
                {
                    Debug.WriteLine("Enumeration Complete.");
                    TriggerDeviceConnected(dev);
                });
            });
        }
        public void Connect(IDeviceBLE pInput)
        {
            if (pInput == null)
            {
                return;
            }

            var inputType  = pInput.GetType();
            var searchType = typeof(UnPairedDeviceBLE);

            Device = null;
            if (inputType == searchType)
            {
                //Pair if the device is able to pair
                AcceptRescan     = false;
                ConnectingDevice = pInput;
                Debug.WriteLine("Connecting to new device.");
                mAdapter.ConnectToDeviceAsync((ConnectingDevice as UnPairedDeviceBLE).mDevice).ContinueWith(StopScanning);
            }
        }
 private void ConnectionComplete(Task obj)
 {
     Debug.WriteLine("Scanning stopped, building services and charateristics.");
     Device = new PairedDeviceBLE((ConnectingDevice as UnPairedDeviceBLE).mDevice, () => { TriggerDeviceConnected(Device); });
 }