蓝牙设备是一个电子血氧仪,已经和电脑成功配对了,用代码连接的时候出现报错。代码如下:
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);