首页 > 解决方案 > BLE 服务 UUID--System.FormatException:'Guid 应包含 32 位数字和 4 个破折号(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)。

问题描述

我正在编写一个 UWP 代码来连接附近的 BLE 设备。在这行代码...

GattDeviceServicesResult result = await GetGattServicesForUuidAsync(
    new System.Guid("00001809-0000-1000-8000-00805F9B34FB"),
    BluetoothCacheMode.Uncached
);

...它给了我错误...

System.FormatException: 'Guid 应包含 32 位数字和 4 个破折号 (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)。'

我已经仔细检查了字符 UUID 是 1809,并且我已将其转换为 128 位 UUID,但它仍然给出错误。

标签: c#uwpuuidformatexception

解决方案


推荐阅读