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.

Read Using Characteristic UUID

TI的大神们啊!

    你们过完5.1了吗?节后快乐!~小弟有个问题请教啊:

    小弟使用BTool与simpleBLEperipheral连接,在Read/Write -> Characteristic Read -> Sub-Procedure 栏目选择Read Using Characteric UUID.

希望通过UUID来获取特征值对应的handle。

    当我读取UUID为0XFFF1及0XFFF2时都能正常获取到对应的handle值:0X0025、0X0028。

但是对UUID位0XFFF3及0XFFF4却不能正常读取handle,分别回应ATTR_NOT_FOUND及READ_BOT_PERMITTED,见下图

我想请问为何这两个特征值无法通过UUID获取对应的handle呢?是否有哪些属性需要设置?

    

  • Hi,shaokai Lin

    你把uuid为0xFFF3与0xFFF4的特征值的所有属性发出来看看。

  • 就simpleBLEPeripheral工程的配置啊,只不过我将char3更改为与char1一样的属性:

    // 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_READ,
    0,
    simpleProfileChar1UserDesp
    },

    // Characteristic 2 Declaration
    {
    { ATT_BT_UUID_SIZE, characterUUID },
    GATT_PERMIT_READ,
    0,
    &simpleProfileChar2Props
    },

    // Characteristic Value 2
    {
    { ATT_BT_UUID_SIZE, simpleProfilechar2UUID },
    GATT_PERMIT_READ,
    0,
    &simpleProfileChar2
    },

    // Characteristic 2 User Description
    {
    { ATT_BT_UUID_SIZE, charUserDescUUID },
    GATT_PERMIT_READ,
    0,
    simpleProfileChar2UserDesp
    },

    // Characteristic 3 Declaration
    {
    { ATT_BT_UUID_SIZE, characterUUID },
    GATT_PERMIT_READ,
    0,
    &simpleProfileChar3Props
    },

    // Characteristic Value 3
    {
    { ATT_BT_UUID_SIZE, simpleProfilechar3UUID },
    GATT_PERMIT_WRITE | GATT_PERMIT_READ,
    0,
    &simpleProfileChar3
    },

    // Characteristic 3 User Description
    {
    { ATT_BT_UUID_SIZE, charUserDescUUID },
    GATT_PERMIT_READ ,
    0,
    simpleProfileChar3UserDesp
    },

    // Characteristic 4 Declaration
    {
    { ATT_BT_UUID_SIZE, characterUUID },
    GATT_PERMIT_READ,
    0,
    &simpleProfileChar4Props
    },

    // Characteristic Value 4
    {
    { ATT_BT_UUID_SIZE, simpleProfilechar4UUID },
    0,
    0,
    &simpleProfileChar4
    },

    // Characteristic 4 configuration
    {
    { ATT_BT_UUID_SIZE, clientCharCfgUUID },
    GATT_PERMIT_READ | GATT_PERMIT_WRITE,
    0,
    (uint8 *)simpleProfileChar4Config
    },

    // Characteristic 4 User Description
    {
    { ATT_BT_UUID_SIZE, charUserDescUUID },
    GATT_PERMIT_READ,
    0,
    simpleProfileChar4UserDesp
    },

    // Characteristic 5 Declaration
    {
    { ATT_BT_UUID_SIZE, characterUUID },
    GATT_PERMIT_READ,
    0,
    &simpleProfileChar5Props
    },

    // Characteristic Value 5
    {
    { ATT_BT_UUID_SIZE, simpleProfilechar5UUID },
    GATT_PERMIT_AUTHEN_READ,
    0,
    simpleProfileChar5
    },

    // Characteristic 5 User Description
    {
    { ATT_BT_UUID_SIZE, charUserDescUUID },
    GATT_PERMIT_READ,
    0,
    simpleProfileChar5UserDesp
    },

    你试试会不会出这种情况

  • 呼呼,各位:

            不好意思,是我个人的疏忽,由于我更改了char3的属性,但是忘了也要同时更改以下这个两个函数:
    simpleProfile_ReadAttrCB ()
    simpleProfile_WriteAttrCB ()
    现在这个问题已经解决。
  • shaokai,

    你需要对照 simpleProfileChar3Props 和 simpleProfileChar4Props, 可以看到这两个定义了char3 只有 write属性,char4 只有 notify 属性,因此都是不可读。

  • Thanks Yan:

            事实上,这两个属性我也更改了,跟char1的属性一样。

    最后发现问题原来是我疏忽了:更改char3的属性的同时,也要更改读写函数

    simpleProfile_ReadAttrCB()

    simpleProfile_WriteAttrCB()

    这个问题刚刚解决了。。。

  • 3  跟4 的属性值  操作权限不一样的哦  不能写的

  • 嗨 Yan,提主已经把char3 char4的客户端读写属性改变了。所以按理说 shaokai特征值配置正确,就应该可以读写的。我的问题是 simpleProfile_WriteAttrCB()与simpleProfile_ReadAttrCB()这两个函数赋给了simpleProfileCBs这样的回调函数结构体,然后注册GATT属性表时候使用,如下

    GATTServApp_RegisterService( simpleProfileAttrTbl,
    GATT_NUM_ATTRS( simpleProfileAttrTbl ),
    &simpleProfileCBs );

    然后什么时候在调用上面两个函数我们就不再知道了,这就造就了我的不解!这两个函数要在什么情况下被回调。谢谢关注。我是CQ_JIMI