您好!
我想知道是否可以通过某种方法在对器件进行身份验证之前阻止读取 BLE 特征用户说明、我能够防止他们读取和写入特征中存储的值。 我正在使用 SDK simplelink_cc13xx_cc26xx_sdk_7_10_01_24。
此致、
肯尼斯·托马斯
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.
您好!
我想知道是否可以通过某种方法在对器件进行身份验证之前阻止读取 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
},
我希望这将有所帮助、
此致、
您好!
我看来工作正常。
我已宣布授权 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
};
您能确认您也这样做吗?
此致、