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.

[参考译文] CC2652R7:如何隐藏 BLE 特征用户描述

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

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1324824/cc2652r7-how-to-hide-ble-characteristic-user-description

器件型号:CC2652R7

您好!

我想知道是否可以通过某种方法在对器件进行身份验证之前阻止读取 BLE 特征用户说明、我能够防止他们读取和写入特征中存储的值。 我正在使用 SDK simplelink_cc13xx_cc26xx_sdk_7_10_01_24。

此致、
肯尼斯·托马斯

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

    您好!

    感谢您与我们联系。

    您是否考虑过更改 GATT 表中相应 GATT 属性的权限值?

    例如、查看简单 GATT 配置文件、可以执行以下操作:

    static gattAttribute_t simpleProfileAttrTbl[SERVAPP_NUM_ATTR_SUPPORTED] =
    {
      // Simple Profile Service
      {
        { ATT_BT_UUID_SIZE, primaryServiceUUID }, /* type */
        GATT_PERMIT_READ,                         /* permissions */
        0,                                        /* handle */
        (uint8 *)&simpleProfileService            /* pValue */
      },
    
        // Characteristic 1 Declaration
        {
          { ATT_BT_UUID_SIZE, characterUUID },
          GATT_PERMIT_READ,
          0,
          &simpleProfileChar1Props
        },
    
          // Characteristic Value 1
          {
            { ATT_BT_UUID_SIZE, simpleProfilechar1UUID },
            GATT_PERMIT_READ | GATT_PERMIT_WRITE,
            0,
            &simpleProfileChar1
          },
    
          // Characteristic 1 User Description
          {
            { ATT_BT_UUID_SIZE, charUserDescUUID },
            GATT_PERMIT_AUTHEN_READ,  //GATT_PERMIT_READ, // <=== Changed
            0,
            simpleProfileChar1UserDesp
          },

    有关更多详细信息、请参阅 https://software-dl.ti.com/simplelink/esd/simplelink_cc13xx_cc26xx_sdk/7.10.02.23/exports/docs/ble5stack/ble_user_guide/html/ble-stack-5.x/gatt.html

    我希望这将有所帮助、

    此致、

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

    嘿、Clement、

    因此、根据您的建议、我使用了 GATT_PERIPLE_Author_READ。 我定义了一个授权回调函数、与您发送的链接中显示的函数类似。 回调会评估变量是否设置为 true 并返回 Success 或 ATT_ERR_Insufficed_Author、但此回调似乎未被调用。 我试图返回成功,似乎什么都不起作用。

    此致、
    肯尼斯·托马斯

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

    您好!

    我看来工作正常。

    我已宣布授权 CB 如下:

    /*********************************************************************
    * @fn      AuthorizationCB
    *
    * @brief   Validate attribute data prior to a write operation
    *
    * @param   connHandle - connection message was received on
    * @param   pAttr - pointer to attribute
    * @param   opcode
    *
    * @return  SUCCESS, blePending or Failure
    ********************************************************************/
    bStatus_t simpleProfile_AuthorizationCB(uint16_t connHandle,
                                                     gattAttribute_t *pAttr,
                                                     uint8_t opcode)
    {
      return SUCCESS;
    }
    

    并且我已确保更新简单配置文件服务回调。

    // Simple Profile Service Callbacks
    // Note: When an operation on a characteristic requires authorization and
    // pfnAuthorizeAttrCB is not defined for that characteristic's service, the
    // Stack will report a status of ATT_ERR_UNLIKELY to the client.  When an
    // operation on a characteristic requires authorization the Stack will call
    // pfnAuthorizeAttrCB to check a client's authorization prior to calling
    // pfnReadAttrCB or pfnWriteAttrCB, so no checks for authorization need to be
    // made within these functions.
    CONST gattServiceCBs_t simpleProfileCBs =
    {
      simpleProfile_ReadAttrCB,  // Read callback function pointer
      simpleProfile_WriteAttrCB, // Write callback function pointer
      simpleProfile_AuthorizationCB // Authorization callback function pointer
    };

    您能确认您也这样做吗?

    此致、

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

    嗨、

    我正在做与您所做的相同的事情、但每当我写入特征时、我都会不断得到 ATTERR_INSUF_Authorization。

    更新:似乎需要绑定设备以获得授权才能工作、是否有办法解决这一问题?

    此致、

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

    您好!

    根据蓝牙规范、授权始终需要通过身份验证来验证远程设备是否正确。

    蓝牙核心规范版本5.3 |第3卷、C 部分、§10.5介绍了以下内容:

    此致、