Windows 蓝牙自动配对或禁用身份验证 [英] Windows bluetooth autopairing or disable authentication

查看:15
本文介绍了Windows 蓝牙自动配对或禁用身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要 Windows 来自动与蓝牙设备配对.我不希望用户必须单击 Windows 侧的任何内容.服务器将位于用户无法到达的物理位置.必须在用户端配对很好.Windows 只需要接受没有用户输入的任何请求.

I need windows to automatically pair with bluetooth devices. I don't want the user to have to click anything on the windows side. The server will be physically located somewhere the user cannot get to. Having to pair on the user side is fine. Windows just needs to accept any requests that come in without user input.

我怎样才能做到这一点?注册表黑客?替换一个dll?硬件更改(自动配对加密狗之类的)?

How can I accomplish this? Registry hacks? Replace a dll? A Hardware change (autopairing dongle or something)?

是否有任何 SDK 可以为我提供解决此问题的工具?

Is there any SDK that will give me the tools take care of this?

目前我在 Microsoft 堆栈顶部的 Windows 机器上使用 bluecove.我也尝试了 Widcomm 堆栈,但没有成功.

Currently I am using bluecove on the windows machine on top of Microsoft stack. I tried the Widcomm stack also with no luck.

设备用于连接的主要协议是 RFCOMM.

The primary protocol that devices will use to connect is RFCOMM.

使用下面接受的答案,我想出了这段代码,即自动配对

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using InTheHand.Net.Bluetooth;
using System.Threading;

namespace BT
{
    class BluetoothAutoSSP
    {
        public static void Main()
        {
            BluetoothAutoSSP c = new BluetoothAutoSSP();

            EventHandler<BluetoothWin32AuthenticationEventArgs> handler = new         EventHandler<BluetoothWin32AuthenticationEventArgs>(c.handleRequests);
            BluetoothWin32Authentication authenticator = new BluetoothWin32Authentication(handler);

            while (true)
            {
                Thread.Sleep(10);
            }    
        }

        public void handleRequests(Object thing, BluetoothWin32AuthenticationEventArgs args)
        {
            args.Confirm = true;
        }


    }
}

推荐答案

对于 Microsoft 蓝牙堆栈:要支持传统蓝牙配对以及 v2.1 的安全简单配对,请使用 BluetoothRegisterForAuthenticationEx 函数和在您的回调函数中通过调用 BluetoothSendAuthenticationResponseEx 进行响应.

For the Microsoft Bluetooth stack: To support both traditional Bluetooth pairing as well as v2.1's Secure Simple Pairing use the BluetoothRegisterForAuthenticationEx function and in your callback function respond by calling BluetoothSendAuthenticationResponseEx.

BluetoothWin32Authentication 32feet.NET 文档中查看更多信息,其中描述了在.NET 的 32feet.NET 蓝牙库,我的文档 Bluetooth在 Windows 7 和 MSDN 中,例如BluetoothRegisterForAuthenticationEx

See more at BluetoothWin32Authentication 32feet.NET docs which describes the way to handle that in the 32feet.NET Bluetooth library for .NET, my doc Bluetooth in Windows 7, and MSDN e.g. BluetoothRegisterForAuthenticationEx etc.

顺便说一句,Widcomm 没有有一种程序化的方式来响应配对(它确实有一种启动配对的方法).BlueSoleil 显然有一个 API.

BTW Widcomm does not have a programatic way to respond to pairing (it does have a method to initiate pairing). BlueSoleil does have an API apparently.

这篇关于Windows 蓝牙自动配对或禁用身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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