How to capture Bluetooth notifications on Mac and iOS?

I want to capture Bluetooth "Classic" device notifications on both Mac and iOS platforms primarily when:

  1. Bluetooth is turned on/off
  2. When a device gets connected/disconnected to Bluetooth

On Mac:

I used the IOBluetooth framework in Mac for this by registering for two notifications:

registerForConnectNotifications registerForDisconnectNotifications

However, the issue with this is that notifications get triggered even when a connect request happens with the device. (For ex: I pressed connect for connecting with headphones and a notification is received even though it failed to connect to the device for whatever reason).

I need the notification to be received only when the device is successfully connected with the system.

On iOS:

I am not sure which framework to go with - whether CoreBluetooth or External Accessory. I did read that CoreBluetooth supports classic devices but not every device. I would appreciate any insight or help on this topic.

It seems to be broken on Monterey 12.0.1. after registration with registerForConnectNotifications no notification is trigged. However our code worked for many years since OSX 10.7-11.4.

How to capture Bluetooth notifications on Mac and iOS?
 
 
Q