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:App_Process Cargu 的返回值

Guru**** 2590110 points


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

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1367206/cc2340r5-return-value-of-gattservapp_processcharcfg

器件型号:CC2340R5

工具与软件:

您好  

我尝试使用 GATT博 洛斯博格 App_Process 博格函数调用、将通知从 BLE 板发送到移动应用。

IAM 能够通过移动应用程序接收通知。

现在 ,我关闭了手机上的蓝牙接口,但仍然能够看到 App_Process 博洛斯格返回成功。

这 是因为该函数将局部变量状态初始化为成功、然后它不会因为无连接而进入"for loop"

并返回成功。

 我的理解是否正确?

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

    您好!

    感谢您与我们联系。

    您的理解完全正确!

    对于其他读者、此处引用的代码会储存在 \source\ti\ble5stack_flash\host\gattservapp_util.c:

    /*********************************************************************
     * @fn      GATTServApp_ProcessCharCfg
     *
     * @brief   Process Client Characteristic Configuration change.
     *
     * @param   charCfgTbl - characteristic configuration table.
     * @param   pValue - pointer to attribute value.
     * @param   authenticated - whether an authenticated link is required.
     * @param   attrTbl - attribute table.
     * @param   numAttrs - number of attributes in attribute table.
     * @param   taskId - task to be notified of confirmation.
     * @param   pfnReadAttrCB - read callback function pointer.
     *
     * @return  Success or Failure
     */
    bStatus_t GATTServApp_ProcessCharCfg( gattCharCfg_t *charCfgTbl, uint8 *pValue,
                                          uint8 authenticated, gattAttribute_t *attrTbl,
                                          uint16 numAttrs, uint8 taskId,
                                          pfnGATTReadAttrCB_t pfnReadAttrCB )
    {
      uint8 i;
      bStatus_t status = SUCCESS;
    
      // Verify input parameters
      if ( ( charCfgTbl == NULL ) || ( pValue == NULL ) ||
           ( attrTbl == NULL )    || ( pfnReadAttrCB == NULL ) )
      {
        return ( INVALIDPARAMETER );
      }
    
      for ( i = 0; i < linkDBNumConns; i++ )
      {
        gattCharCfg_t *pItem = &(charCfgTbl[i]);
    
        if ( ( pItem->connHandle != LINKDB_CONNHANDLE_INVALID ) &&
             ( pItem->value != GATT_CFG_NO_OPERATION ) )
        {
          gattAttribute_t *pAttr;
    
          // Find the characteristic value attribute
          pAttr = GATTServApp_FindAttr( attrTbl, numAttrs, pValue );
          if ( pAttr != NULL )
          {
            if ( pItem->value & GATT_CLIENT_CFG_NOTIFY )
            {
               status |= gattServApp_SendNotiInd( pItem->connHandle, GATT_CLIENT_CFG_NOTIFY,
                                                  authenticated, pAttr, taskId, pfnReadAttrCB );
            }
    
            if ( pItem->value & GATT_CLIENT_CFG_INDICATE )
            {
               status |= gattServApp_SendNotiInd( pItem->connHandle, GATT_CLIENT_CFG_INDICATE,
                                                  authenticated, pAttr, taskId, pfnReadAttrCB );
            }
          }
        }
      } // for
    
      return ( status );
    }

    此致、

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

    感谢确认