我使用 C#.Net (feet32 lib) 构建蓝牙服务器/客户端工具。我按照 https://www.youtube.com/watch?v=Xxnpq6ePQMk 的说明进行操作,但我遇到了Guid的问题。在我输入从我的笔记本电脑访问的蓝牙 Guid 后(设备管理器 -> 双击你的蓝牙设备打开它的属性 -> 详细信息 -> Class Guid),它仍然无法连接。我不确定我获取 GUID 的方法是否正确,或者其他问题?谢谢!
Guid mUUID = new Guid("e0cbf06c-cd8b-4647-bb8a-263b43f0f974");
// Guid mUUID = new Guid("be5ef05c-288d-45d7-b786-eb8e0b0d67cc");
bool serverStarted = false;
public void ServerConnectThread()
{
serverStarted = true;
updateUI("server started, wait for client");
BluetoothListener blueListener = new BluetoothListener(mUUID);
blueListener.Start();
BluetoothClient conn = blueListener.AcceptBluetoothClient();
updateUI("Client has connected");
Stream mStream = conn.GetStream();
while (true)
{
//handle server connection
byte[] received = new byte[1024];
mStream.Read(received, 0, received.Length);
updateUI("Received:" + Encoding.ASCII.GetString(received));
}
}
最佳答案
正确的 GUID 不是类 guid,而是它的蓝牙服务 GUID,您会从与类 GUID 相同的列表中看到它。类 GUID 和蓝牙服务 GUID 不同。
关于c# - C# 中的蓝牙 GUID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37381652/