Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Bluetooth : get Device Specific AT commands

I am using "android.bluetooth.headset.action.VENDOR_SPECIFIC_HEADSET_EVENT" intent to get device specific AT commands. But the broadcastreciever didn't fire when I send AT command from MY Bluetooth Kit.

When I send AT+CHUP\r from my kit the android work on this command internally and disconnects the call. But when I send AT+XEVENT=foo,3\r from kit but I am not getting any thing in receiver.

Help me out

like image 836
Tushar Avatar asked Aug 08 '14 07:08

Tushar


People also ask

How do I get a list of Bluetooth devices on my Android phone?

By using BluetoothAdapter method getBondedDevices(), we can get the Bluetooth paired devices list. Following is the code snippet to get all paired devices with name and MAC address of each device.

How do I find my Bluetooth UUID Android?

getDefaultAdapter(). getBondedDevices(); BluetoothDevice glass = null; for (BluetoothDevice d : devices { ParcelUuid[] uuids = d. getUuids(); for (ParcelUuid p : uuids) { System. out.


1 Answers

I also had a hard time getting the vendor specific headset event to work, but finally figured it out. You have to add the Category of vendor specific events you want to receive to the IntentFilter specified when registering the Broadcast Receiver.

After adding

filter.addCategory(BluetoothHeadset.VENDOR_SPECIFIC_HEADSET_EVENT_COMPANY_ID_CATEGORY+"."+BluetoothAssignedNumbers.PLANTRONICS);

my receiver now gets the Vendor Specific broadcasts from the bluetooth headset. Events such as AT+XEVENT=foo,3\r

like image 74
francis Avatar answered Sep 27 '22 18:09

francis