android自动免提,如何在Android中发送基于BT免提配置文件的A...

我正在尝试通过免提配置文件在Android设备与其他手机之间建立蓝牙连接.我正在使用以下代码 –

private static final UUID MY_UUID = UUID.fromString("0000111F-0000-1000-8000-00805F9B34FB"); // UUID for Hands free profile

// Some code...

// Get Bluetooth Adapter.

m_oBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

// Some code...

// For paired BT device, getting a connection established.

if(null != m_oBluetoothDevice)

{

if(BluetoothDevice.BOND_BONDED == m_oBluetoothDevice.getBondState())

{

try

{

m_oBluetoothSocket = m_oBluetoothDevice.createRfcommSocketToServiceRecord(MY_UUID);

m_oBluetoothSocket.connect();

Log.i(TAG, "Socket Connected");

}

catch(Exception e)

{

if(null != m_oBluetoothSocket)

{

Log.i(TAG, "Closing socket");

try

{

m_oBluetoothSocket.close();

}

catch (Exception e1)

{

Log.i(TAG, "Error while closing socket : " + e1.getMessage());

}

}

}

}

}

我可以使用此代码创建RFCOMMSocket.

现在我想发送基于蓝牙免提配置文件的AT命令.例如如果其他手机接到电话,我的Android设备可以通过发送AT命令 – “CHUP”拒绝此呼叫.我不确定这是否可能.

此时,我被卡住了.我已经阅读了蓝牙API,我发现 –

BluetoothHeadset.ACTION_VENDOR_SPECIFIC_HEADSET_EVENT

我们可以使用此Intent发送AT命令吗?这是基于蓝牙免提配置文件发送AT命令的正确方法吗?请有人帮助我,给我正确的指导.

你们的任何意见对我都有很大的帮助.

提前致谢.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值