【问题标题】:C# connection via Bluetooth with 32feet library通过蓝牙与 32feet 库的 C# 连接
【发布时间】:2015-10-06 14:05:38
【问题描述】:

我正在使用 C# 和 32feet 库编写控制台应用程序。我想通过蓝牙连接到手机设备。我正在关注此代码:link 我在配对两个设备时遇到了一个问题。我正在使用这一行来请求连接:

bool isPaired = BluetoothSecurity.PairRequest(device.DeviceAddress, DEVICE_PIN);

现在我的手机上显示了身份验证请求,但有一个问题,因为手机上的身份验证码与 DEVICE_PIN 略有不同。计算机尝试连接手机,但几分钟后我收到“连接失败”信息。 这是我的配对方法

public void  pair(int index)
        {
      BluetoothClient client = new BluetoothClient();
            devices = client.DiscoverDevices();

            BluetoothDeviceInfo device = devices[index];
            bool isPaired = BluetoothSecurity.PairRequest(device.DeviceAddress, "8080");
            if (isPaired)
            {
                Console.WriteLine("Paired: ");
            }
            else
            {
                Console.WriteLine("Not paired: ");
            }
        }

【问题讨论】:

  • 试试:client.setPin(...)

标签: c# bluetooth 32feet


【解决方案1】:

尝试一一停止计算机上的蓝牙 Windows 服务并进行测试。 停止 Windows 服务后,请确保在您的计算机上禁用/启用蓝牙无线电才能生效。

【讨论】:

    猜你喜欢
    • 2013-05-24
    • 1970-01-01
    • 2022-08-17
    • 2020-01-27
    • 1970-01-01
    • 2017-04-27
    • 1970-01-01
    • 1970-01-01
    • 2015-05-04
    相关资源
    最近更新 更多