关于写Notify使能问题

你好. 我这边在看bass_task.c源码时, 发现他gattc_write_cmd_ind_handler函数里要去操作notify的东西. (BAS_IDX_BATT_LVL_NTF_CFG)
这个使能Notify是由手机端传来的, 但是 我这边测试时, 发现在上层已经使能Nofity的时候, 他不会回调gattc_write_cmd_ind_handler函数.
我一开始以为是GATTC_WRITE_CMD_IND这个命令的过, 我换成了其他的WRITE CMD 也是不行. 这个是怎么回事呢?
GATTC_WRITE_CMD 和 GATTC_WRITE_CMD_IND 有啥差别的呢?

另外, sdk好像也无法获取read 回调函数. 这个是因为sdk不支持read的吗?

Parents
  • 以lightblue为例,界面上有Listen for notification。来回点击,就可以看到配置了相应Notification使能的属性。我在函数gattc_write_cmd_ind_handler里面添加的打印如下
    static int gattc_write_cmd_ind_handler(ke_msg_id_t const msgid,
    struct gattc_write_cmd_ind const *param,
    ke_task_id_t const dest_id,
    ke_task_id_t const src_id)
    {
    .......
    // Only update configuration if value for stop or notification enable
    if ((ntf_cfg == PRF_CLI_STOP_NTFIND) || (ntf_cfg == PRF_CLI_START_NTF))
    {

    arch_printf("ntf_cfg is 0x%x\n",ntf_cfg); //添加的打印
    // Set NTF Cfg value in the DB
    attmdb_att_set_value(bass_env.shdl[i] + BAS_IDX_BATT_LVL_NTF_CFG, sizeof(uint16_t),
    (uint8_t *)&ntf_cfg);
    ....

Reply
  • 以lightblue为例,界面上有Listen for notification。来回点击,就可以看到配置了相应Notification使能的属性。我在函数gattc_write_cmd_ind_handler里面添加的打印如下
    static int gattc_write_cmd_ind_handler(ke_msg_id_t const msgid,
    struct gattc_write_cmd_ind const *param,
    ke_task_id_t const dest_id,
    ke_task_id_t const src_id)
    {
    .......
    // Only update configuration if value for stop or notification enable
    if ((ntf_cfg == PRF_CLI_STOP_NTFIND) || (ntf_cfg == PRF_CLI_START_NTF))
    {

    arch_printf("ntf_cfg is 0x%x\n",ntf_cfg); //添加的打印
    // Set NTF Cfg value in the DB
    attmdb_att_set_value(bass_env.shdl[i] + BAS_IDX_BATT_LVL_NTF_CFG, sizeof(uint16_t),
    (uint8_t *)&ntf_cfg);
    ....

Children
No Data