コード例 #1
0
 private void ConnectionComplete(Task obj)
 {
     Debug.WriteLine("Connection Complete.");
     Device = new PairedDeviceBLE((ConnectingDevice as UnPairedDeviceBLE).mDevice,
                                  (dev) => {
         TriggerDeviceConnected(dev);
     });
 }
コード例 #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);
                });
            });
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
 private void ConnectionComplete(Task obj)
 {
     Debug.WriteLine("Scanning stopped, building services and charateristics.");
     Device = new PairedDeviceBLE((ConnectingDevice as UnPairedDeviceBLE).mDevice, () => { TriggerDeviceConnected(Device); });
 }