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.

CC2540扫描设备选择

Other Parts Discussed in Thread: CC2540

CC2540作为主机时,会接收到很多设备的广播包,这些设备中有很多都是可以扫描的,它如何决定哪些设备扫描哪些不扫描?

  • 一般从机发送广播,然后主机进行扫描,发现周围的从机设备,后续再进行连接绑定之类的操作
  • 您可以看一下
    /**
    * @brief Start a device discovery scan.
    *
    * @param mode - discovery mode: @ref GAP_DEVDISC_MODE_DEFINES
    * @param activeScan - TRUE to perform active scan
    * @param whiteList - TRUE to only scan for devices in the white list
    *
    * @return SUCCESS: Discovery scan started.<BR>
    * bleIncorrectMode: Invalid profile role.<BR>
    * bleAlreadyInRequestedMode: Not available.<BR>
    */
    extern bStatus_t GAPCentralRole_StartDiscovery(uint8_t mode, uint8_t activeScan, uint8_t whiteList);
  • 您好,感谢您的回答,我的从机有一些固定格式的数据,广播数据只有31字节放不下,因此想把一部分数据放在扫描响应中。主机在接收到的广播数据中发现匹配的设备后再对该设备进行扫描,该如何操作?另外SimpleBLECentral只有在扫描时间超时后触发GAP_DEVICE_DISCOVERY_EVENT事件,能否当我发现想要连接的设备以后主动触发该事件?