110,566
社区成员
发帖
与我相关
我的任务
分享
private void ReceiveData()
{
try
{
Guid mGUID = Guid.Parse("00001101-0000-1000-8000-00805F9B34FB");//这里这个mGUID也请各位帮忙解释一下,这里是从网上Copy过来的一直不太理解
bluetoothListener = new BluetoothListener(mGUID);
bluetoothListener.Start();
bluetoothClient = bluetoothListener.AcceptBluetoothClient();
isConnected = true;
if (bluetoothClient.RemoteMachineName != "PM102049")//验证设备名称
{
isConnected = false;
bluetoothListener.Stop();
bluetoothClient.Client.Close();
bluetoothClient.Close();
ReceiveData();
return;
}
bluetoothListener.Stop();
bluetoothClient.Client.Close();
bluetoothClient.Close();
}
catch (Exception)
{
isConnected = false;
}
if (isConnected)
{
GetHeartRateData();//设备通信方法
}
}