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: How to hide BLE Characteristic User Description

Part Number: CC2652R7

Hello,

I was wondering if there was a way to prevent the BLE Characteristic User Description from being read until the device has been Authenticated, I was able to prevent them from reading and writing the value stored in the characteristic. I am using SDK simplelink_cc13xx_cc26xx_sdk_7_10_01_24.

Regards,
Kenneth Thomas

  • Hi,

    Thank you for reaching out.

    Have you considered changing the permissions value of the corresponding GATT attribute in the GATT table?

    For example, looking at the Simple GATT profile, you could do the following:

    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
          },

    For more details, please refer to 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

    I hope this will help,

    Best regards,

  • Hey Clement,

    So using your suggestion I used GATT_PERMIT_AUTHOR_READ. I defined an authorization callback function like the one shown in the link you sent. The callback evaluates if a variable is set to true and returns SUCCESS or ATT_ERR_INSUFFICIENT_AUTHOR however this callback doesn't seem being invoked. I tried just returning SUCCESS and nothing seems to work.

    Regards,
    Kenneth Thomas

  • Hi,

    It seems to be working properly on my side.

    I have declared the AuthorizationCB as following:

    /*********************************************************************
    * @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;
    }
    

    And I have ensured to update the Simple Profile Service Callbacks.

    // 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
    };

    Can you confirm you do the same?

    Best regards,

  • Hey,

    I am doing the same thing you're doing but I keep getting an ATTERR_INSUF_AUTHORIZATION whenever I write to a Characteristic.

    Update: It seems that the device needs to be bonded for Authorization to work, is there a way around that?

    Regards,

  • Hi,

    Per Bluetooth specifications, authorization always requires authentication to verify that the remote device is the right one.

    BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 3, Part C, §10.5 states the following:

    Best regards,