c# - 蓝牙和 C# PC -> 无需配对的手机连接

标签 c# bluetooth 32feet

我正在尝试编写简单的应用程序,它向蓝牙适配器范围内的手机发送短文本消息。

我的第一个尝试是发送文件:我可以将文件从 PC 发送到手机,但我必须在手机和 PC 上输入 PIN。

我更愿意发送文本消息(类似于推送消息)- 是否可以在不配对设备的情况下发送它?

如果无法发送推送消息,也许我可以在不请求 PIN 的情况下发送简单的文件?

我使用 32feet 库。

示例代码(用于将文件发送到选定的设备)

static int BTSendFile(string adres, string FileName)                            
        {
            Uri uri = new Uri("obex://" + adres + '/' + Path.GetFileName(FileName));
            ObexWebRequest req = new ObexWebRequest(uri);

            req.ReadFile(FileName);

            ObexWebResponse rsp = (ObexWebResponse)req.GetResponse();

            return (int)rsp.StatusCode;

        }

最佳答案

一个快速的答案是;不,您总是需要某种配对。

但是如果你看一下 different kinds of pairing在那里,您会看到 BT 2.1 支持安全简单配对 (SSP)Just Works 模式。这允许您(几乎)无需任何用户交互即可配对设备。来自维基百科:

Just works: As implied by the name, this method just works. No user interaction is required; however, a device may prompt the user to confirm the pairing process. This method is typically used by headsets with very limited IO capabilities, and is more secure than the fixed PIN mechanism which is typically used for legacy pairing by this set of limited devices. This method provides no man in the middle protection.

但是,由于“这种方法通常用于 IO 功能非常有限的耳机”,它可能不适用于您正在谈论的手机,但我认为您应该知道 :)

关于c# - 蓝牙和 C# PC -> 无需配对的手机连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13529216/

相关文章:

c# - 使用基类型调用的泛型方法

c# - 按名称使用 CngKey 存储已知的 AES key 以供以后使用

bluetooth - iBeacon "Far"、 "Near"和 "Immediate"的标称距离是多少

android - 在 Android 中打开/关闭蓝牙

ios - Pebble Watch 在应用程序处于后台模式时将数据推送到 iOS

c# - 使用 32feet.net 使用独特的服务协议(protocol)连接到 BTLE 设备

c# - 32feet.net : Invalid argument supplied - Parani module

c# - MVC 5 + $Post() 函数在服务器上托管后无法正常工作

linux - 在 Linux 下使用 Mono 从 32Feet.NET 获取 PlatformNotSupportedException

C# 将 .Count 与元组项一起使用