高通 Linux 蓝牙指南(十)

蓝牙Hands-Free Profile功能(HFP)

HFP定义了音频网关设备如何连接到免提设备以实现远程控制和音频连接等功能。
要执行HFP客户端或音频网关功能,您必须首先完成以下过程中的步骤。

设置设备以实现 HFP 功能

先决条件

启用SSH访问您的主机设备。
将DUT和远程设备放在蓝牙附近。

步骤

1、在命令提示符中使用以下命令运行 SSH:
ssh root@<device_IP_address>

示例
如果设备的IP地址10.92.160.222,运行以下命令:

ssh root@10.92.160.222
2、通过输入以下密码连接到 SSH
oelinux123
3、根据需要为HFP客户端或音频网关功能配置DUT

为HFP客户端功能配置DUT

为HFP功能设置初始设备后,对HFP客户端执行以下操作:

  1. 通过在 SSH 中运行以下命令来验证 ofono 服务的状态:
systemctl status ofono
  1. 在文本编辑器的 /etc/pulse/目录中打开脉冲配置文件system.pa。
  2. 将headset=ofono添加到文件中的以下行:
Load module bluetooth discover
load-module module-bluetooth-discover headset=ofono

该文件必须如下所示:

### Load module bluetooth discover
load-module module-bluetooth-discover headset=ofono

### Load module bluetooth policy
load-module module-bluetooth-policy
sh-5.1#
  1. 保存文件。
  2. 通过运行以下命令重新加载守护进程:
systemctl daemon-reload
  1. 通过运行以下命令重启 PulseAudio:
systemctl restart pulseaudio

重新加载守护程序并重新启动PulseAudio后,system.pa配置文件中的更改会反映在系统中。使用DBUS在PulseAudio和ofono之间建立连接。

  1. 通过在SSH中运行以下命令来运行bluetoothctl:
bluetoothctl
  1. 通过从bluetoothctl菜单运行以下命令来验证是否列出了免提客户端设备的UUID:
bluetoothctl

示例输出:

[bluetooth]# show
Controller 22:22:9B:2C:79:1E (public)
    Name: qcm6490
    Alias: qcm6490
    Class: 0x002c0000
    Powered: yes
    Discoverable: no
    DiscoverableTimeout: 0x000000b4
    Pairable: yes
    UUID: A/V Remote Control        (e000110e-0000-1000-8000-00805f9b34fb)
    UUID: PnP Information           (e0001200-0000-1000-8000-00805f9b34fb)
    UUID: Audio Source              (e000110a-0000-1000-8000-00805f9b34fb)
    UUID: Audio Sink                (e000110b-0000-1000-8000-00805f9b34fb)
    UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
    UUID: Generic Access Profile    (e0001800-0000-1000-8000-00805f9b34fb)
    UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
    UUID: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)
    UUID: Handsfree                 (e000111e-0000-1000-8000-00805f9b34fb)
    Modalias: usb:v1D6Bp0246d0541
    Discovering: no
    Roles: central
    Roles: peripheral
Advertising Features:
    ActiveInstances: 0x00 (0)
    SupportedInstances: 0x10 (16)
    SupportedIncludes: tx-power
    SupportedIncludes: appearance
    SupportedIncludes: local-name
    SupportedSecondaryChannels: 1M
    SupportedSecondaryChannels: 2M
    SupportedSecondaryChannels: Coded
[bluetooth]#

注意:免提音频网关和耳机的 UUID 未列出。仅列出了从 PulseAudio 配置的免提客户端 UUID。

  1. 通过在SSH中运行以下命令打开ofono/test菜单:
ls -rt /usr/lib/ofono/test

注意:ofono/test应用程序仅在qcom-multimedia-test-image中可用。要在用户构建中运行ofono/test应用程序,您必须编译它。

示例输出:

sh-5.1# ls -rt /usr/lib/ofono/test
unlock-pin                 set-ddr                     hangup-call
test-stk-menu              set-context-property        hangup-all
test-ss-control-cs         set-cbs-topics              hangup-active
test-ss-control-cf         set-call-forwarding         get-tech-preference
test-ss-control-cb         send-vcard                  get-serving-cell-info
test-ss                    send-vcal                   get-operators
test-sms                   send-ussd                   get-icon
test-smart-messaging       send-sms                    enter-pin
test-serving-cell-info     scan-for-operators          enable-throttling
test-push-notification     reset-pin                   enable-modem
     remove-contexts             enable-gprs
test-network-registration  release-and-swap            enable-cbs
test-modem                 release-and-answer          display-icon
test-message-waiting       reject-calls                disable-throttling
test-gnss                  register-operator           disable-modem
test-cbs                   register-auto               disable-gprs
test-call-settings         receive-sms                 disable-call-forwarding
test-call-forwarding       process-context-settings    dial-number
test-call-barring          private-chat                deactivate-context
test-advice-of-charge      online-modem                deactivate-all
swap-calls                 offline-modem               create-multiparty
set-use-sms-reports        monitor-ofono               create-mms-context
set-umts-band              lockdown-modem              create-internet-context
set-tty                    lock-pin                    change-pin
set-tech-preference        list-operators              cdma-set-credentials
set-speaker-volume         list-modems                 cdma-list-call
set-sms-smsc               list-messages               cdma-hangup
set-sms-bearer             list-contexts               cdma-dial-number
set-sms-alphabet           list-calls                  cdma-connman-enable
set-roaming-allowed        list-applications           cdma-connman-disable
set-msisdn                 list-allowed-access-points  cancel-ussd
set-mms-details            initiate-ussd               cancel-sms
set-mic-volume             ims-unregister              backtrace
set-lte-property           ims-register                answer-calls
set-gsm-band               hold-and-answer             activate-context
set-fast-dormancy          hangup-multiparty
sh-5.1#

为HFP音频网关功能配置DUT

为HFP功能设置初始设备后,对HFP音频网关执行以下操作:

  1. 通过在SSH中运行以下命令来运行Bluetoothctl:
bluetoothctl
  1. 通过从Bluetoothctl菜单运行以下命令,验证是否列出了免提音频网关和耳机的UUID:
show

示例输出:

[bluetooth]# show
Controller 22:22:9B:2C:79:1E (public)
    Name: qcm6490
    Alias: qcm6490
    Class: 0x006c0000
    Powered: yes
    Discoverable: no
    DiscoverableTimeout: 0x000000b4
    Pairable: yes
    UUID: A/V Remote Control        (0000110a-0000-1000-8000-00805f9b34fb)
    UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
    UUID: Handsfree Audio Gateway   (0000111f-0000-1000-8000-00805f9b34fb)
    UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
    UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
    UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
    UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
    UUID: Audio Source              (0000110a-0000-1000-8000-00805f9b34fb)
    UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
    UUID: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)
    UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
    Modalias: usb:v1D6Bp0246d0541
    Discovering: no
    Roles: central
    Roles: peripheral
Advertising Features:
    ActiveInstances: 0x00 (0)
    SupportedInstances: 0x10 (16)
    SupportedIncludes: tx-power
    SupportedIncludes: appearance
    SupportedIncludes: local-name
    SupportedSecondaryChannels: 1M
    SupportedSecondaryChannels: 2M
    SupportedSecondaryChannels: Coded
[bluetooth]# |

执行蓝牙HFP客户端功能
您可以使用bluetoothctl菜单和ofono/test工具执行HFP客户端功能。
执行蓝牙HFP音频网关功能
您可以使用bluetoothctl菜单和paplay命令执行HFP音频网关功能。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值