This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] CC2340R5:从服务发现响应中获取句柄值

Guru**** 2341440 points
Other Parts Discussed in Thread: CC2340R5
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1444841/cc2340r5-get-handle-values-from-service-discovery-response

器件型号:CC2340R5

工具与软件:

您好!

使用的芯片组: CC2340R5

SDK:  simplelink_lowpower_f3_sdk_8_10_01_02

我目前正在 CC2340R5上开发 BLE 客户端应用。 我在扫描、连接和服务发现方面取得了成功。 在执行服务发现后、我成功地收到了响应以及一些数据。 我目前在理解从服务发现响应中收到的数据时遇到问题。

有关我的项目的其他信息、请参阅此 票证

我将在 CC2340R5上运行 SDK 提供的数据流示例、因为它配置为外设。 我有另一个 CC2340R5 EVK、我以客户端角色运行基本 BLE 示例代码。

下面是从 nrf connect 中获取的数据流示例暴露的服务的屏幕截图。

连接完成后、我将调用" GATT_DiscAllPrimaryServices ' API。 我是如何调用 API 的详细信息在我在开始时分享的票证链接中进行了说明。

收到"ATT_READ_BY_GRP_TYPE_RSP"事件后、我将打印 len 和 numGroups 字段、如下所示。

消息内容如下。

0x01、0x00、0x0b、0x00、0x00、0x18、0x23、0x00、0xff、0xff、 0x00、0x00、0x00、0x00、0x00、0x00、0x50、0x00、0x40、0x51、0x04、0xc、0xc、0xc、0、0x00、0xf0

帮助我理解上述数据包。  

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    很抱歉,我们的服务出现了延误。

    您将需要构建句柄、请参阅以下代码:

            for (int i = 0; i < response->numGrps; i++)
            {
                uint16_t attributeHandle = BUILD_UINT16(response->pDataList[i * response->len + 0],
                                                        response->pDataList[i * response->len + 1]);
    
                uint16_t endHandle = BUILD_UINT16(response->pDataList[i * response->len + 2],
                                                  response->pDataList[i * response->len + 3]);

    您可能还需要参阅低功耗蓝牙核心规范5.3第3卷。 F 部分第3.4.4.10节、了解有关数据包格式的更多信息。

    此致!

    Nima Behmanesh