Hello, do yourself a favour and please read How to get the best out of this forum and modify your post accordingly (including code tags and necessary documentation of your ask).
is there a constant heartbeat coming from the BT connexion? you won't be able to easily detect the BT disconnect with an HC-06
why do you perform the test against btif you have not read anything new?