private void SearchTx() { if (BluetoothAdapter.DefaultAdapter != null && BluetoothAdapter.DefaultAdapter.IsEnabled) { SerialAdapter.SearchAvailableDevices(() => { }, adress => { string deviceName = BluetoothAdapter.DefaultAdapter.GetRemoteDevice(adress).Name; if (deviceName != null) { // Connecting to a bluetooth device while discovery is not possible (or very slow). Therefore we only check for a match in the device name. Regex regex = new Regex(ValidateTxNameExpression); if (regex.IsMatch(deviceName)) { InterfaceFound?.Invoke(this, new InterfaceFoundEventArgs(adress, deviceName, ControllerType.Tx)); } } }, () => { SearchFinished?.Invoke(this, EventArgs.Empty); _searching = false; _waitForFinishedResetEvent.Set(); }); } else { _searching = false; _waitForFinishedResetEvent.Set(); } }
private void OnQueryInterfaceResponse(IdpResponse response) { if (response.ResponseCode == IdpResponseCode.OK) { var vid = response.Transaction.Read <UInt16>(); var pid = response.Transaction.Read <UInt16>(); InterfaceFound?.Invoke(this, new InterfaceFoundEventArgs(vid, pid, response.Transaction.Source)); } }
private void SearchTxt() { Thread.Sleep(100); IFtInterface txtInterface = new TxtInterface(); foreach (string ipaddress in PossibleIpaddresses) { if (txtInterface.IsValidInterface(ipaddress)) { InterfaceFound?.Invoke(this, new InterfaceFoundEventArgs(ipaddress, "TXT Controller", ControllerType.Txt)); } } }