如何使用 bluez 在 linux 上实现 HFP?

问题描述

我想在 Linux 上实现 HFP。 据我了解,我需要先在手机和计算机之间创建 SPP 连接才能交换一些设置。在 BT 规范中,有一个 spp 服务。这是我需要的还是我必须使用dbus?我可以使用串行通信发送 AT 命令吗? 我在互联网上阅读了很多东西,并从 git 中阅读了源代码,但不确定如何解决 spp 的问题。

解决方法

Linux 中的 HFP 是作为 oFono 的一部分实现的。你可以参考ofono代码。 SPP 和 HFP 用例不同。

安装ofono后,您可以将移动设备连接到Linux机器,然后您可以使用以下命令从手机拨打电话。

dbus-send --system --print-reply --dest=org.ofono /hfp/org/bluez/hci0/dev_05_BA_8D_DF_B7_9C org.ofono.VoiceCallManager.Dial string:"1234567890" string:"default">