Ble scan multiple advertisement packets

Hello,


Doing a scanForPeripherals with a given custom UUID service give a different behavior between iOS and Mac OS program execution.


It seemes that CBCentralManagerScanOptionAllowDuplicatesKey is not taken into account on Mac OS (Catalina) using Catalyst and we have multiple advertisement packet as per the log below.


<CBPeripheral: 0x6000033061c0, identifier = 3702E8B8-FCD6-42E1-B79C-1B0202A15B42, name = (null), state = disconnected>

<CBPeripheral: 0x6000033061c0, identifier = 3702E8B8-FCD6-42E1-B79C-1B0202A15B42, name = TIBTOP 2D08, state = disconnected>

<CBPeripheral: 0x600003305d60, identifier = 420ED12B-2767-4DDE-AB4A-B1BA6159C4D3, name = (null), state = disconnected>

<CBPeripheral: 0x600003305d60, identifier = 420ED12B-2767-4DDE-AB4A-B1BA6159C4D3, name = TIBTOP 6890, state = disconnected>


In iOS it works as expected


<CBPeripheral: 0x2807312c0, identifier = 05D6357E-9374-1C5A-F03C-AA798C1A595A, name = TIBTOP, state = disconnected>

<CBPeripheral: 0x280736800, identifier = AF7828EC-E80A-06BA-6134-4F5C064C1BFB, name = TIBTOP, state = disconnected>


Is it a known issue on Mac OS or a missundertanding of the Core Bluetooth behavior on Mac OS ?


Best regards,

Replies

Hello,


We investigate further the behavior difference between iOS and Mac OS with Catalyst.


The advertisement packet we receive for the same CBPeripheral looks odd. As you can see the first advertisement packet is almost complete as expected unless the LocalName is missing.


The next advertisement packet we receive contains the LocalName key but all the ManufaturerData are missing.


All next advertisement packet we receive are the same.


(lldb) po advertisementData
▿ 4 elements
  ▿ 0 : 2 elements
    - key : "kCBAdvDataIsConnectable"
    - value : 1
  ▿ 1 : 2 elements
    - key : "kCBAdvDataManufacturerData"
    - value : <30c9d31b 787478>
  ▿ 2 : 2 elements
    - key : "kCBAdvDataServiceUUIDs"
    ▿ value : 1 element
      - 0 : 0BD51666-E7CB-469B-8E4D-2742AAAA0100
  ▿ 3 : 2 elements
    - key : "kCBAdvDataChannel"
    - value : 37

(lldb) po advertisementData
▿ 3 elements
  ▿ 0 : 2 elements
    - key : "kCBAdvDataIsConnectable"
    - value : 0
  ▿ 1 : 2 elements
    - key : "kCBAdvDataLocalName"
    - value : TIBTOP 7478
  ▿ 2 : 2 elements
    - key : "kCBAdvDataChannel"
    - value : 37


On iOS the same code has the correct behavior


(lldb) po advertisementData
▿ 4 elements
  ▿ 0 : 2 elements
    - key : "kCBAdvDataIsConnectable"
    - value : 1
  ▿ 1 : 2 elements
    - key : "kCBAdvDataManufacturerData"
    - value : <b4fd1825 b22d08>
  ▿ 2 : 2 elements
    - key : "kCBAdvDataServiceUUIDs"
    ▿ value : 1 element
      - 0 : 0BD51666-E7CB-469B-8E4D-2742AAAA0100
  ▿ 3 : 2 elements
    - key : "kCBAdvDataTimestamp"
    - value : 593621625.261801

(lldb) po advertisementData
▿ 5 elements
  ▿ 0 : 2 elements
    - key : "kCBAdvDataManufacturerData"
    - value : <b4fd1825 b22d08>
  ▿ 1 : 2 elements
    - key : "kCBAdvDataTimestamp"
    - value : 593621625.262453
  ▿ 2 : 2 elements
    - key : "kCBAdvDataLocalName"
    - value : TIBTOP 2D08
  ▿ 3 : 2 elements
    - key : "kCBAdvDataIsConnectable"
    - value : 1
  ▿ 4 : 2 elements
    - key : "kCBAdvDataServiceUUIDs"
    ▿ value : 1 element
      - 0 : 0BD51666-E7CB-469B-8E4D-2742AAAA0100


Thanks for your support