0

I am using BlueZ stack for Bluetooth connection between Smart-phone(AG-Audio Gateway) and Embedded board(HF-Handsfree).

On which layer of Bluez ( HCI, L2CAP, RFCOMM) we will get reason of Bluetooth disconnection. So we can differentiate following type of disconnection:

  1. Smart-Phone SIMPLE DISCONNECT, but phone is still have HF Embedded device in its paired list.
  2. Smart-Phone FORGET HF device during bluetooth connection.
  3. Disconnection because HF device went out of Smart-Phone bluetooth Range
Hari
  • 111
  • 1
  • 1
  • 8

1 Answers1

0

HCI: Disconnection Complete Event, check the Reason byte.

Eirik M
  • 726
  • 1
  • 6
  • 12
  • Whenever disconnection initiated by smartphone (AG), I am getting reason : HCI_OE_USER_ENDED_CONNECTION 0x13 – Hari Jul 27 '16 at 11:17
  • Whenever disconnection initiated by smartphone (AG), I am getting reason : HCI_OE_USER_ENDED_CONNECTION 0x13 But this is not enough to distinguish between following type of disconnection: 1. Smart-Phone SIMPLE DISCONNECT, but phone is still have HF Embedded device in its paired list. 2. Smart-Phone FORGET HF device during bluetooth connection. 3. Smart-Phone SWITCH OFF bluetooth during bluetooth connection. I am getting specific event when disconnection initiated from Phone end (AG) but in this can we further distinguish type of disconnection ? – Hari Jul 27 '16 at 11:26
  • The error codes should be different depending on the scenario. For example for out of range I would expected "Connection Timeout" (0x08). Also, if AG initiates the disconnect you would probably get "Connection Terminated By Local Host" (0x16) on the smart phone. Since AG initiated the disconnect it should know the reason, and the return code means the procedure was successful. – Eirik M Jul 27 '16 at 14:20