private async void OnFindDevice(object sender, g.FIDO2.CTAP.BLE.BLEAuthenticatorScanner.FindDeviceEventArgs e) { scannerBLE.Stop(); addressBLE = e.BluetoothAddress; var ret = await this.connectBLE(); if (ret == false) { return; } // UIスレッドで実行するおまじない var ignored = this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(async() => { var app = (MainWindow)Application.Current.MainWindow; var att = await app.Register(conBLE, app.RPID, app.Challenge, this.TextPIN.Text); if (att == null) { return; } if (page == null) { page = new Page11(att); } this.NavigationService.Navigate(page); })); }
private void OnFindDevice(object sender, g.FIDO2.CTAP.BLE.BLEAuthenticatorScanner.FindDeviceEventArgs e) { //First see if we have already found this device if (this.devices == null) { this.devices = new HashSet <ulong>(); } else { if (this.devices.Contains(e.BluetoothAddress)) { return; } } try { addLog($"<OnFindDevice>"); //We want to see if there are multiple devices, so only stop the scanner when we try connect //scanner.Stop(); addLog($"- BluetoothAddress = {e.BluetoothAddress.ToString("X")}"); addLog($"- HasManufacturerData: {e.HasManufacturerData}"); if (e.HasManufacturerData) { addLog($"- CompanyId = 0x{e.CompanyId.ToString("X")}"); addLog($"- ManufacturerData = 0x{e.ManufacturerData.ToHexString()}"); } addLog($"- AdvertisementType = {e.AdvertisementType}"); addLog($"- LocalName = {e.LocalName}"); addLog($"- ServiceUuids = {String.Join(",", e.ServiceUuids)}"); lastBleAddress = e.BluetoothAddress; // そのままコネクトすることをやめる | Stop connecting as it is //ButtonConnect_Click(null, null); addLog($"Scan OK ! : Next Click [Connect]Button"); addLog(""); //Auto Connecting //DoConnect().GetAwaiter().GetResult(); //Add to found devices list this.devices.Add(e.BluetoothAddress); } catch (Exception ex) { addLog($"- OnFindDevice Error Exception{ex.Message}"); } }