求问,C#连接蓝牙设备,报“在其上下文中,该请求的地址无效”是什么情况?

shdshch2011 2018-04-23 04:31:32
蓝牙设备是一个电子血氧仪,已经和电脑成功配对了,用代码连接的时候出现报错。代码如下:
BluetoothClient client = new BluetoothClient();
BluetoothRadio radio = BluetoothRadio.PrimaryRadio;//获取蓝牙适配器
BluetoothDeviceInfo[] devices = client.DiscoverDevices();//搜索蓝牙
BluetoothDeviceInfo targetDevice = devices[0];
BluetoothAddress DeviceAddress = targetDevice.DeviceAddress;
Guid mGUID = BluetoothService.Handsfree;//mGUID={0000111e-0000-1000-8000-00805f9b34fb}
client.Connect(DeviceAddress, mGUID);
...全文
820 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

110,565

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧