Multiple BLE(NRF52) devices in the same time CIQ

I have NRF52 SoC devices and would like to connect to two devices simultaneously with a Garmin Forerunner(as I see Garmin can connect for 3 devices at the same time from an app). Tried both solutions 

  1. Scan while not connected for both and pair after discover
  2. Scan and store to an array both, and after stop scanning and try to connect each

The behaviour is very strange, first connection successed, second started, connected, and disconnect immadietly -> getting error from CIQ, with "the device is already paierd". The two "scanResult " object is not the same, i'm filtering by name, and after strogin the scanresult . 

Used 's BLE application and my own, and getting different RAW datas from the scan result. 

If I change the second BLE device to a HR (Polar H10 sensor) it works. (However the Garmin can't see the Polar's advertising name what is very very strange. 

  • Is there anything in CIQ which can check MAC addresses, or what would be a good starting point to take this approach?

  • As I said, you can't see the MAC address with CIQ, You can however, 

    (from the API doc) it looks like you can use hasAddress to check for a specific MAC address on the other end, but I've never used it myself.

  • How did you end up pairing to two Thingy's at once then and how did you hold the device object once pairing was successful?

  • This may have just been a problem with trying to pair two separate device in too rapid succession.  Can get two device paired simultaneously now using the above code snippets.

    Currently trying to narrow exactly where the bug is.

  • I don't recall the details but it must have been trivial, or I would remember it.  It was my own app and not the sample.

  • I have to test more to understand in more detail.

    However, it seems like assigning device objects to a global variable and differentiating between devices by 'deviceName' alone is enough to pair two separate devices with identical registration profiles.

  • For two devices you need two device objects and under each is their service object, and under that the characterics for that service

    That's probably all I had to do for two thiny52. Have 2 of what I needed for one.

    Two scan results, two devices, etc.

  • Unfortunately I am coming back to this discussion as my above solution is not working correctly.  Buggy code was hiding the issue and led me to believe our app was pairing the the second device successfully.

    The issue is narrowed to the following snippet (still very similar to above):

  • Had to break this reply up due to forum length limits, sorry.

    I did find one other discussion with a similar issue, however, there the issue was limited to pairing of a single device.  The issue is happening on line 59 or 67, dependent of which device is paired first (the second device is where problems happen).  Here, the first device is pairing correctly with no issues, as shown in the below debug console .bak/.txt file.

    BLE_Delegate onScanResults() function called
    BLE_Delegate contains() function call
    BLE_Delegate broadcastScanResult() function call
    DeviceManager procScanResult() function call
    rear conditional entered
    device name found: Rear
    BLE_PairView onUpdate() function called
    rearTire device name = null
    rearTire connection status = false
    a currently paired device = Obj: 224
    BLE_Delegate onConnectedStateChanged() function call
    DeviceManager procConnection() function call
    BLE_PairView onUpdate() function called
    rearTire device name = 
    rearTire connection status = true
    a currently paired device = Obj: 224

    Here when the scan result is found and a `device` object is assigned to `$.rearTire`, initially the object is not paired.  However, the pairDevice() call of line 67 eventually calls `onConnectedStateChanged()` after which the device assigned to `$.rearTire` becomes paired.  On the Edge device view there is a debug message shown on screen to indicate when this is successful.  Everything is all good.  The problem happens when pairing the second device.

    When pairing the second device (in this case to `$.frontTire`) line 59 assigns a device object to `$.frontTire` but `BluetoothLowEnergy.pairDevice()` never calls onConnectedStateChanged()`, as shown in the below debug console .txt file printout.

    BLE_Delegate onScanResults() function called
    BLE_Delegate contains() function call
    BLE_Delegate broadcastScanResult() function call
    DeviceManager procScanResult() function call
    front conditional entered
    device name found: Front
    BLE_PairView onUpdate() function called
    frontTire device name = null
    frontTire connection status = false
    rearTire device name = 
    rearTire connection status = true
    a currently paired device = Obj: 224
    a currently paired device = Obj: 221
    BLE_PairView onUpdate() function called

    The last debug lines just repeat and `onConnectedStateChanged() is never called.

    Note, the device MAC address have been verified as different in nrfConnect.

    I do not understand why the BluetoothLowEnergy.pairDevice()` call never calls `onConnectedStateChanged()` for the second device object.

    Any direction or advice would be appreciated.