在 Windows 10 中与 32feetnet 蓝牙配对期间不显示配对弹出消息

Not to display Pairing pop up mssage during Bluetooth pairing With 32feetnet in Windows 10

我在 windows10 中尝试了两种不同的连接蓝牙设备的方法。 1)用32feetnet开发了一个应用程序,尝试连接蓝牙设备,提示pin是否匹配的消息框。 2. 创建了一个示例通用 Windows 程序(UWP)来连接蓝牙设备,它会提示是否匹配 pin 消息框。

有什么办法可以避免pin提示消息框吗

EventHandler authHandler = new EventHandler(handleAuthRequests); BluetoothWin32Authentication 验证器 = new BluetoothWin32Authentication(authHandler);

private void btnPairSSP_Click(object sender, EventArgs e)
{
    BluetoothDeviceInfo selectedDevice = devices[lstBTDevices.SelectedIndex];
    if (MessageBox.Show(String.Format("Would you like to attempt to pair with {0}?", selectedDevice.DeviceName), "Pair Device", MessageBoxButtons.YesNo) == DialogResult.Yes)
    {
        Task t = new Task(PairBluetoothTask);
        t.Start();
    }
}

private void PairBluetoothTask()
{
    BluetoothDeviceInfo selectedDevice = devices[lstBTDevices.SelectedIndex];
    if (BluetoothSecurity.PairRequest(selectedDevice.DeviceAddress, null))
    {
        MessageBox.Show("We paired!");
    }
    else
    {
        MessageBox.Show("Failed to pair!");
    }

}

private void handleAuthRequests(object sender, BluetoothWin32AuthenticationEventArgs e)
{
    e.Confirm = true;

}