蓝牙转串行适配器 - 连接异常
-
05-07-2019 - |
题
目前正在编写一个应用程序来连接到设备“BTLink 蓝牙到串行适配器”
有关设备的更多信息: 设备规格创建了这样的代码:
BluetoothAddress btAddress = null;
if (!BluetoothAddress.TryParse(comboBoxDevices.SelectedValue.ToString().Trim(), out btAddress))
throw new Exception(String.Format("Adress: {0} wrong !", comboBoxDevices.SelectedValue.ToString().Trim()));
BluetoothEndPoint endPoint = new BluetoothEndPoint(btAddress, BluetoothService.DialupNetworking);
_bluetoothClient.Connect(endPoint);
我测试了两种类型的 GUID:BluetoothService.DialupNetworking、BluetoothService.SerialPort。我收到这条消息:“由于目标机积极拒绝它,因此无法建立任何连接”是什么问题?
最好的问候,mykhaylo
解决方案
我首先尝试使用设备的内置蓝牙功能连接到目标计算机。只有在成功之后我才会尝试以编程方式连接到它。
为了能够连接到蓝牙设备,您需要了解以下信息:
- 要使用的蓝牙配置文件。您已经尝试过串行和拨号,但实际上哪一个才是您想要的呢?许多设备仅支持单个配置文件,并且将拒绝连接到请求不受支持的服务的另一台设备。
- 认证信息。某些设备需要预定义密码。
- 许多设备只能与单个 BT 设备形成连接。目标设备是否已连接到其他地方?
您遇到的错误很可能与上述错误之一有关,与蓝牙库的使用无关。
其他提示
不隶属于 StackOverflow