How to get BLE event(adv event, connect event) callback? OR How to get notification of BLE event end?

To synchronize user programs and advertisement, I need to know when the BLE event will end, I hope when the event end, it will notify application(user logic), Is there a relevant method to achieve it?

Related