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.

广播关闭之后无法重新开启

Other Parts Discussed in Thread: BLE-STACK

最近我们在程序中增加开关广播的命令接口,遇到了如题的问题:可以关闭广播,但是关闭之后就无法开启了。想不出来问题在哪里,请教一下TI的专家有没有什么思路。开关操作的代码如下:

  if(en == 0)
  { // Disable Advertising
    if(advEnabled == TRUE)
    {
      GapAdv_disable(advHandleLongRange);
      GapAdv_disable(advHandleLegacy);

      advEnabled = FALSE;
    }
  }
  else
  { // Enable Advertising
    if ((linkDB_NumActive() < maxNumBleConns) && (advEnabled == FALSE))
    {
      GapAdv_enable(advHandleLegacy, GAP_ADV_ENABLE_OPTIONS_USE_MAX, 0);
      GapAdv_enable(advHandleLongRange, GAP_ADV_ENABLE_OPTIONS_USE_MAX, 0);

      advEnabled = TRUE;
    }
  }

可以确认的是代码行都可以执行到,但只有disable部分像期望的一样工作,enable部分执行之后,旁边扫描的手机上可以看到广播包一闪而过,然后就不再广播了。

一些额外的信息:我们的程序是在multi_role项目的基础上改来的。目前使用的SDK版本:1.50.00.71。