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.

[参考译文] CC2745R10-Q1:连接监视器无法获取连接数据

Guru**** 2419530 points


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

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1540422/cc2745r10-q1-connection-monitor-failed-to-obtain-connection-data

器件型号:CC2745R10-Q1


工具/软件:

您好、TI

*SDK 版本:9.11.00.18、示例: car_node

我目前正在调试连接监视器。 Connection_Conn EventHandler 收到 BLEAPPUTIL_LINK_RESIDEND_EVENT 后、尝试通过 CMS_GetConnData 检索连接数据失败、返回错误代码 0x05 (CM_INVALID_PARAMS)。

static void Connection_ConnEventHandler(uint32 event, BLEAppUtil_msgHdr_t *pMsgData)
{
#ifdef FII_CM
  cmsConnDataParams_t cm_data;
  uint16_t cm_data_size;
  cmErrorCodes_e status;
#endif

  if (pMsgData != NULL)
  {
    switch (event)
    {
      case BLEAPPUTIL_LINK_ESTABLISHED_EVENT:
      {
        gapEstLinkReqEvent_t *pGapEstMsg = (gapEstLinkReqEvent_t *)pMsgData;

        // Add the connection to the connected device list
        Connection_addConnInfo(pGapEstMsg->connectionHandle, pGapEstMsg->devAddr);

        PHSCA_ESELOG_PRINTF("%s", "Conn status: Established\r\n");

#if defined(RANGING_CLIENT) && !defined(RANGING_CLIENT_EXTCTRL_APP)
        // Call MTU exchange
        AppGATT_exchangeMTU(pGapEstMsg->connectionHandle, MAX_PDU_SIZE);
#endif
        BLEAppUtil_registerConnNotifHandler(pGapEstMsg->connectionHandle,GAP_CB_CONN_EVENT_ALL);

#ifdef FII_CM
        status = CMS_InitConnDataParams(&cm_data);
        if(status == CM_SUCCESS)
        {
            cm_data_size = CMS_GetConnDataSize();
            status = CMS_GetConnData(pGapEstMsg->connectionHandle, &cm_data);
            if(status == CM_SUCCESS)
            {
                PHSCA_ESELOG_PRINTF("CMS_GetConnData success! Data size[0x%4x]\r\n", cm_data_size);
            }
            else
            {
                PHSCA_ESELOG_PRINTF("CMS_GetConnData fail![0x%2x]\r\n", status);
            }
        }
        else
        {
            PHSCA_ESELOG_PRINTF("%s\r\n", "CMS_InitConnDataParams fail!");
        }
#endif

        break;
      }
}

Log:

我的工作流程是否正确? 为什么失败了?

此致!

普雷斯顿

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

    您好:

    似乎需要在 cm_params 结构内分配一个缓冲区:

    /**
     * @brief Host Connection Monitor Serving get connection data parameters
     */
    typedef struct
    {
      uint16_t dataSize;             //!< The allocated CM data size
      uint8_t  *pCmData;             //!< Pointer to the buffer the application allocated
    } cmsConnDataParams_t;

    在您的代码中:

            status = CMS_InitConnDataParams(&cm_data);
            if(status == CM_SUCCESS)
            {
                cm_data_size = CMS_GetConnDataSize();
                cm_data.dataSize = cm_data_size; // Add this
                cm_data.pCmData = ICall_malloc(cm_data_size); // Add this as well.
                status = CMS_GetConnData(pGapEstMsg->connectionHandle, &cm_data);
                if(status == CM_SUCCESS)

    请让我知道这是否适合您!

    此致、

    Nima Behmanesh

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

    嗨、 Nima

    问题已解决。 感谢您的支持!

    此致!

    普雷斯顿