c# - C# 中的蓝牙 GUID

标签 c# bluetooth guid

我使用 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/

相关文章:

c# - RyuJIT C#错误的总和结果/优化

ios - 了解 NSNetservice 的 “includesPeerToPeer” 属性

android - 如何使用广播接收器检测蓝牙状态变化?

sockets - Windows Phone 7-如何以编程方式搜索和连接到蓝牙设备

vb.net - 在文本中高效地存储 GUID?

xml - 如何将 GUID simpleType 添加到 XML 架构中?

c# - Windows 10 NotifyIcon 图标总是看起来像素化

c# - 将 UI 操作委托(delegate)给 ViewModel 执行

c# - void ** 带有 P/Invoke 的句柄

.net - DLL (.Net) 中的 GUID