How to send AT commands based on BT Hands-Free profile in android?

后端 未结 2 785
迷失自我
迷失自我 2020-12-08 12:07

I am trying to establish Bluetooth connection between an Android device with other mobile phone over Handsfree profile. I am using following code -

private          


        
相关标签:
2条回答
  • 2020-12-08 12:46

    Adding reference to AT commnads

    http://forum.xda-developers.com/showthread.php?t=1471241

    http://www.zeeman.de/wp-content/uploads/2007/09/ubinetics-at-command-set.pdf

    0 讨论(0)
  • 2020-12-08 13:04

    You need to create InputStream and OutputStream so you can talk to the phone:

    mmInStream = m_oBluetoothSocket.getInputStream();
    mmOutStream = m_oBluetoothSocket.getOutputStream();
    

    To setup the HFP connection you start to send:

    mmOutStream.write("AT+BRSF=20\r".getBytes());
    

    Where 20 is code for what you support of HFP.

    And to read from the phone:

    buffer = new byte[200];
    mmInStream.read(buffer);
    command = new String(buffer).trim();
    

    So now you can talk beetwen the devices and you can read more about the Handsfree profile on https://www.bluetooth.org/docman/handlers/downloaddoc.ashx?doc_id=238193

    0 讨论(0)
提交回复
热议问题