multiple connection issues

Dear support

I am developing my application based on central_multilink example and have a few questions:

1. in call back function connected() , I wonder why conn_connecting is set to NULL even there is no failure on connection, I am thinking of calling disconnect function to disconnect it if I need to, but if it is set to NULL, then, it is not possible, right? Also, may I create multiple connection reference variables like conn_connecting ? as I need to create multiple connections same time and freely disconnect them any time.

 2. Following code in init_central() function in while (true) {} loop is ever be called? I put a breakpoint there, and it never reach there. I wonder how does the program disconnect the connected multiple devices. Any more complete examples please? how do I refer the multiple connection if I need to disconnect them?


		iterations--;
		printk("Iterations remaining: %u\n", iterations);

		printk("Disconnecting all...\n");
		is_disconnecting = true;
		bt_conn_foreach(BT_CONN_TYPE_LE, disconnect, NULL);  //never goes here?
3. I am able to connect and disconnect a device without setting the conn_connecting to NULL, it works if I connect and disconnect one by one, but when I tried to connect a second device without disconnect the first one, it give me an error code of -12, seems meaning ENOMEM - not enough core, does this mean it has run out of memory? It only had 1 connection.

Thank you for your attention. Any example to handle multiple connection will be helpful. I would like to connect and disconnect any of them freely, is this possible?

Ping

Related