This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Device Connection count changes

Hai, I want to connect central to a single  peripheral   and after certain operations, I want to connect central to more peripherals

  1. I tried with,

                          #define NRF_SDH_BLE_CENTRAL_LINK_COUNT 1

                           and after some operations, I had changed  to

                           #define NRF_SDH_BLE_CENTRAL_LINK_COUNT 8

                          but  my device (central) connecting to a single peripheral only not with many periphral

         2. even i tried with

                          #define NRF_SDH_BLE_CENTRAL_LINK_COUNT 8

                           BLE_LBS_C_ARRAY_DEF(m_lbs_c, NRF_SDH_BLE_CENTRAL_LINK_COUNT); 
                           BLE_DB_DISCOVERY_ARRAY_DEF(m_db_disc, NRF_SDH_BLE_CENTRAL_LINK_COUNT); 
                           NRF_BLE_SCAN_DEF(m_scan); 
                           NRF_BLE_GQ_DEF(m_ble_gatt_queue, NRF_SDH_BLE_CENTRAL_LINK_COUNT,NRF_BLE_GQ_QUEUE_SIZE);

and after some operations, I had changed  to

                          #define NRF_SDH_BLE_CENTRAL_LINK_COUNT 8

                          BLE_LBS_C_ARRAY_DEF(m_lbs_c, NRF_SDH_BLE_CENTRAL_LINK_COUNT); 
                          BLE_DB_DISCOVERY_ARRAY_DEF(m_db_disc, NRF_SDH_BLE_CENTRAL_LINK_COUNT); 
                          NRF_BLE_SCAN_DEF(m_scan); 
                          NRF_BLE_GQ_DEF(m_ble_gatt_queue, NRF_SDH_BLE_CENTRAL_LINK_COUNT,NRF_BLE_GQ_QUEUE_SIZE);

But  i getting error  like, " Initializer element is not a constant"

 Kindly help me, thank you

Parents
  • Hi,

    What SDK version are you using ? What example are you testing? Is it ble_app_multilink_central?

    You should set NRF_SDH_BLE_CENTRAL_LINK_COUNT to the max number of devices you want to connect to at the same time. 

    If you don't want to connect to a new device right after connecting to the first device, you need make sure that you don't resume scanning in the handling of the BLE_GAP_EVT_CONNECTED event in ble_evt_handler().

     

    and after certain operations, I want to connect central to more peripherals

     Then after certain operations, you call scan_start(). You can check how many devices you are connect to with ble_conn_state_central_conn_count().

  • Hai Sigurd,
     Yes, I am using ble_app_multilink_central fro testing with 16.X.X  SDK along with PCA10056


    my  need was my central connect with a single peripheral, and after some operation, my sensor  need to connect with multiple peripheral (which is 8 links),

    The function ble_conn_state_central_conn_count() returns the count of link with peripherals, kindly help me

    Thanks in advance

  • Hai Sigurd, the operations are just saving application data to my FDS via a custom mobile app(Using Bluetooth  in mobile) and after storing the application data  I want to connect with multiple links

    Here, my Conditional case only after storing the application data I should connect with multiple device and While writing the application data in fds, I want to connect with a single device, till now I can't do It kindly help me

  • Venkat RAM said:
    and after storing the application data  I want to connect with multiple links

     Then maybe you can use the event FDS_EVT_WRITE  in the the registered FDS event handler function to start the scanning again.

  • Yes, I am using that same event FDS_EVT_WRITE  and start scan again but now how can I change the  no of count link, 

    I had already  given as

    // <o> NRF_SDH_BLE_CENTRAL_LINK_COUNT - Maximum number of central links.
    #ifndef NRF_SDH_BLE_CENTRAL_LINK_COUNT
    #define NRF_SDH_BLE_CENTRAL_LINK_COUNT 1
    #endif  

    in my sdk_config and

    BLE_LBS_C_ARRAY_DEF(m_lbs_c, NRF_SDH_BLE_CENTRAL_LINK_COUNT); /**< LED button client instances. */

    BLE_DB_DISCOVERY_ARRAY_DEF(m_db_disc, NRF_SDH_BLE_CENTRAL_LINK_COUNT); /**< Database discovery module instances. */
    NRF_BLE_SCAN_DEF(m_scan); /**< Scanning Module instance. */
    NRF_BLE_GQ_DEF(m_ble_gatt_queue, /**< BLE GATT Queue instance. */
    NRF_SDH_BLE_CENTRAL_LINK_COUNT,
    NRF_BLE_GQ_QUEUE_SIZE);  

    in my main file

    now after using the event FDS_EVT_WRITE and scan again ,i dont now how to change the Maximum number of central links. again

  • Hi,

    Just keep the NRF_SDH_BLE_CENTRAL_LINK_COUNT at 8. If you plan to connect to 8 devices, then you should set this define to 8 from the start.

  • Hai Sigurd, I will explain my bug in detail

    My Nrf52840 should connect with a maximum of only one device and  through the one device I will; write some data in FDS and only after the success message from the FDS write operation my nrf52840device able to connect with 8 peripheral  devices 

    Kindly note Before the FDS success message my device wants to connect with a single device and ONLY after the fds Success message my device wants to connect with multiple(8) device 

Reply
  • Hai Sigurd, I will explain my bug in detail

    My Nrf52840 should connect with a maximum of only one device and  through the one device I will; write some data in FDS and only after the success message from the FDS write operation my nrf52840device able to connect with 8 peripheral  devices 

    Kindly note Before the FDS success message my device wants to connect with a single device and ONLY after the fds Success message my device wants to connect with multiple(8) device 

Children
  • Hi,

    Venkat RAM said:
    Kindly note Before the FDS success message my device wants to connect with a single device and ONLY after the fds Success message my device wants to connect with multiple(8) device 

    Yes, I understand, just make sure that you don't start the BLE scanning again when you connect the first device. Only start the scanning again when you get the FDS success message.

Related