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

Two connections between nRf52832 device and a single smartphone

Hi,

I have a question about the connection handling when we have two connections to a single smartphone.

The smartphone runs two Applications:

  App 1: Acts as central/master, my device is peripheral

  App 2: Acts as peripheral/slave, my device is central

I read this discussion which says that this should be possible for the nRF.

However here it is stated that the smartphone will "only support one physical connection" 

-------- Q1:Does this mean that it is impossible to have two connections as central and peripheral to the smartphone?

--------- Q2: If it should be possible is there any example that shows how to handle this?

Currently I have issues that when for example disconnecting one connection, both Apps will be disconnected and not able to connect again before not deleting the bonding information on both sides. This happens even though I get two connection handles and two peer ids, one for every App.

----------Q3: Should it be the case that I get two connection handles?

Thank you for any help on the questions

Parents
  • Hello Erikk,

    Both Android and iOS support both multiple connections and can handle a bi-directional connection to a single device. You may, actually, try it quickly using nRF Connect for Android. First, set up the GATT Server Configuration on the phone to match the configuration required by your device. Then connect to your device (I assume it's advertising?). nRF Connect will connect to it and will receive connection request to the server. You will see all event in the log. From CLIENT tab you may send messages to the device, and from SERVER tab you may use the phone as peripheral (setting readable values, sending notifications, etc.). You may actually have it in 2 different applications. Or more. E.g. nRF Connect can be connected bi-directionally while you're connected in both your apps. The "single physical connection" means, that the mobile phone is managing the connection and is sending any data that any app requests. Each app may have a single or even multiple BluetoothGatt object, which are seen as virtual connections.

    Such bi-directional communication is also supported in our Android BLE Library since version 2.2.

    I don't know how does it work from the peripheral side. Is the mobile visible with one MAC address, or two. There are samples of it both in NCS and nRF5 SDK, however on mobile side we currently don't have any sample demonstrating bi-directional communication other than some documentation on above-mentioned library.

Reply
  • Hello Erikk,

    Both Android and iOS support both multiple connections and can handle a bi-directional connection to a single device. You may, actually, try it quickly using nRF Connect for Android. First, set up the GATT Server Configuration on the phone to match the configuration required by your device. Then connect to your device (I assume it's advertising?). nRF Connect will connect to it and will receive connection request to the server. You will see all event in the log. From CLIENT tab you may send messages to the device, and from SERVER tab you may use the phone as peripheral (setting readable values, sending notifications, etc.). You may actually have it in 2 different applications. Or more. E.g. nRF Connect can be connected bi-directionally while you're connected in both your apps. The "single physical connection" means, that the mobile phone is managing the connection and is sending any data that any app requests. Each app may have a single or even multiple BluetoothGatt object, which are seen as virtual connections.

    Such bi-directional communication is also supported in our Android BLE Library since version 2.2.

    I don't know how does it work from the peripheral side. Is the mobile visible with one MAC address, or two. There are samples of it both in NCS and nRF5 SDK, however on mobile side we currently don't have any sample demonstrating bi-directional communication other than some documentation on above-mentioned library.

Children
No Data
Related