如何在C++/Linux中检查是否正确注册了SDP服务记录

How to check that SDP service record was registered correctly in C++/Linux

我正在尝试用 C++ linux 注册我的蓝牙 SDP 服务,如下所示:Example 4-9. Describing a service

我在哪里或如何检查服务是否已注册?我尝试在 运行ning bluetoothctlsdptool browse 命令时查看所有服务,但那里没有显示带有我的 UUID 的服务。

我还尝试在 sdp_uuid16_create(&rootUuid, PUBLIC_BROWSE_GROUP) 调用中更改服务组(不确定它是如何调用的),例如 sdp_uuid16_create(&rootUuid, SERIAL_PORT_SVCLASS_ID) 并按原样使用 sdptool search SP 进行搜索此处显示 Bluetooth Profiles 但没有任何效果。

当我 运行 在我的另一台 PC 上发现服务程序(站点上的第一段)时,它发现该服务非常好。

您链接到的文档引用的是大多数系统不再 运行 的 BlueZ 版本。

它引用的许多工具(例如hciattachhciconfighcitoolhcidumprfcommsdptoolciptoolgatttool) 在 2017 年被 BlueZ 项目弃用。

还有以下SO问题谈到BlueZ发生的变化:

https://github.com/nettlep/gobbledegook 等库是在 C 中使用新 D-Bus API 的示例。

API 的 BlueZ 文档可在以下位置找到: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc

我已经通过键入 sdptool browse local 检查了所有本地 SDP 记录。在这种情况下,我可以看到我的记录在列表中最低:

Service Name: Service Name
Service Description: Service Description
Service Provider: Service Provider
Service RecHandle: 0x10010
Service Class ID List:
  UUID 128: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
  "Serial Port" (0x1101)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 1
Profile Descriptor List:
  "Serial Port" (0x1101)
    Version: 0x0100