在Windows 10中与32feetnet进行蓝牙配对时不显示配对弹出消息 [英] Not to display Pairing pop up mssage during Bluetooth pairing With 32feetnet in Windows 10

查看:534
本文介绍了在Windows 10中与32feetnet进行蓝牙配对时不显示配对弹出消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了两种不同的方法来连接Windows 10中的蓝牙设备. 1)使用32feetnet开发了一个应用程序,并尝试连接到蓝牙设备,并提示您是否匹配了引脚消息框. 2.创建了一个示例通用Windows程序(UWP)以连接到蓝牙设备,并提示您是否确认引脚是否匹配消息框.

I tried two different approaches to connect to Bluetooth device in windows 10. 1)Developed an application with 32feetnet and tried to connect to Bluetooth device, it is prompting with whether pin is matched or not message box. 2. Created a sample Universal Windows program(UWP) to connect to Bluetooth device, it is prompting with whether pin is matched or not message box.

有没有其他地方可以避免提示输入密码的消息框.

Is there any away to avoid the pin prompting message box.

推荐答案

EventHandler authHandler = new EventHandler(handleAuthRequests); BluetoothWin32Authentication authenticator =新的BluetoothWin32Authentication(authHandler);

EventHandler authHandler = new EventHandler(handleAuthRequests); BluetoothWin32Authentication authenticator = 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;

}

这篇关于在Windows 10中与32feetnet进行蓝牙配对时不显示配对弹出消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆