CAF BLE state module build assert when CONFIG_BT_PERIPHERAL and CONFIG_BT_CENTRAL is set

ref. an earlier ticket,  CAF BLE state BT connection limit 

I am using ncs 2.0.0 on a custom nRF52840 board

When enabling the CAF BLE state module, I get a build assert error due to 

BUILD_ASSERT(!IS_ENABLED(CONFIG_BT_PERIPHERAL) ||
(ARRAY_SIZE(active_conn) == 1));

If I enable only CONFIG_BT_PERIPHERAL, all is OK, but if I in addition enable CONFIG_BT_CENTRAL, the build asserts as shown above.

My project (a BLE peripheral) does not need to be BLE central that connects to a peripheral. But it needs to have observer role.

I could, instead set CONFIG_BT_OBSERVER=y instead of CONFIG_BT_CENTRAL, but I also need the scan library for setting up scan filters, which depends on CONFIG_BT_SCAN, which again depends on CONFIG_BT_CENTRAL, and then we are back again to the build assert in the CAF module ble_state.c.

Would it be possible to change that build assert test? Or alternatively enable the scan library without having to enable CONFIG_BT_CENTRAL?

 

Parents
  • It seems like the nrf scan library is dependent on CONFIG_BT_CENTRAL unfortunately. Could you try to remove this dependeny, by commenting out this line? Also when running bt_scan_init(), set param.connect_if_match to false. I'm not sure if this would work, or if there is anything else that needs to be modified.

    Please let me know if you get it to work, and maybe I could try to create a PR to the library. If you don't get it to work, let me know as well, and I will try to make it work.

    Best regards,

    Simon

Reply
  • It seems like the nrf scan library is dependent on CONFIG_BT_CENTRAL unfortunately. Could you try to remove this dependeny, by commenting out this line? Also when running bt_scan_init(), set param.connect_if_match to false. I'm not sure if this would work, or if there is anything else that needs to be modified.

    Please let me know if you get it to work, and maybe I could try to create a PR to the library. If you don't get it to work, let me know as well, and I will try to make it work.

    Best regards,

    Simon

Children
Related