# 执行蓝牙 PBAP 客户端功能

您可以使用 `obexctl` 主菜单中提供的命令验证蓝牙 PBAP 客户端功能。

开始之前，请按照[设置设备以使用蓝牙 PBAP 功能](https://docs.qualcomm.com/doc/80-70020-13SC/topic/bluez-pbap.html#section-h2k-3dh-rcc-navyanka-09-10-24-1056-45-735)中的说明设置设备。

## 连接远程设备

要在 PBAP 中连接远程设备，请从 `obexctl` 菜单运行以下命令：

connect <bt_address> <profile_name>
    Copy to clipboard

**参数**

- `<bt_address>` 是远程设备的蓝牙地址。
- `<profile_name>` 是 `pbap`.

**示例**

要使用 `<bt_address>` `F8:7D:76:9D:9B:6B` 连接到远程设备，请运行以下命令：

connect F8:7D:76:9D:9B:6B pbap
    Copy to clipboard

**示例输出**

[obex]# connect F8:7D:76:9D:9B:6B pbap
    Attempting to connect to F8:7D:76:9D:9B:6B
    [NEW] Session /org/bluez/obex/client/session1 [default]
    [NEW] PhonebookAccess /org/bluez/obex/client/session1
    Connection successful
    [F8:7D:76:9D:9B:6B]#
    Copy to clipboard

## 选择电话簿对象

要选择电话簿对象，请从 `obexctl` 菜单运行以下命令：

cd <phonebook_object>
    Copy to clipboard

**参数**

`<phonebook_object>` 可以是：

- `pb` 用于电话簿。
- `ich` 是来电历史记录。
- `och` 是去电历史记录。
- `mch` 是未接来电历史记录。
- `cch` 是来电、去电和未接来电历史记录。
- `spd` 用于快速拨号联系人。
- `fav` 用于收藏的联系人。

**示例**

要选择整个电话簿，请从 `obexctl` 菜单运行以下命令：

cd pb
    Copy to clipboard

**示例输出**

[F8:7D:76:9D:9B:6B]# cd pb
    Attempting to Select to pb
    Select successful
    [F8:7D:76:9D:9B:6B]#
    Copy to clipboard

## 提取电话簿

要提取电话簿，请执行以下操作：

1. [连接 DUT 和远程设备。](https://docs.qualcomm.com/doc/80-70020-13SC/topic/bluez-perform-bluetooth-pbap-client-functions.html#section-ip1-lyk-rcc-navyanka-09-10-24-2331-32-614)
2. [选择所需的电话簿。](https://docs.qualcomm.com/doc/80-70020-13SC/topic/bluez-perform-bluetooth-pbap-client-functions.html#section-xnb-dzk-rcc-navyanka-09-10-24-2336-49-621)
3. 通过运行以下命令来提取所需的电话簿：

cp <source file> <destination file>
        Copy to clipboard

    该文件存储在根目录或 `/var/bluetooth/` 目录中。

    **参数**

    - `<source file>` 是您打算拉取的电话簿。
    - `<destination file>` 是您必须将电话簿拉取到的文件。

    **示例**

    要将 `*.vcf` 拉至 `contact.vcf`，请运行以下命令：

cp *.vcf contact.vcf
        Copy to clipboard

    **示例输出**

[F8:7D:76:9D:9B:6B]# cp *. vcf contact.vcf
        Attempting to PullAll
        [NEW] Transfer /org/bluez/obex/client/session2/transfer22
        PullAll successful
        [CHG] Transfer /org/bluez/obex/client/session2/transfer22 Status: active
        [CHG] Transfer /org/bluez/obex/client/session2/transfer22 Transferred: 23976 (@23KB/s)
        [CHG] Transfer /org/bluez/obex/client/session2/transfer22 Transferred: 79920 (@55KB/s)
        [CHG] Transfer /org/bluez/obex/client/session2/transfer22 Transferred: 130536 (@50KB/s)
        [CHG] Transfer /org/bluez/obex/client/session2/transfer22 Transferred: 175824 (@45KB/s)
        [CHG] Transfer /org/bluez/obex/client/session2/transfer22 Transferred: 229184 (@53KB/s)
        [CHG] Transfer /org/bluez/obex/client/session2/transfer22 Transferred: 281052 (@51KB/s)
        [CHG] Transfer /org/bluez/obex/client/session2/transfer22 Transferred: 336330 (@55KB/s)
        [CHG] Transfer /org/bluez/obex/client/session2/transfer22 Transferred: 382284 (@45KB/s)
        [CHG] Transfer /org/bluez/obex/client/session2/transfer22 Transferred: 478188 (095KB/s)
        [CHG] Transfer /org/bluez/obex/client/session2/transfer22 Transferred: 615384 (@137KB/s)
        [CHG] Transfer /org/bluez/obex/client/session2/transfer22 Transferred: 691974 (@76KB/s)
        [CHG] Transfer /org/bluez/obex/client/session2/transfer22 Transferred: 740592 (@48KB/s)
        [CHG] Transfer /org/bluez/obex/client/session2/transfer22 Transferred: 786546 (@45KB/s)
        [CHG] Transfer /org/bluez/obex/client/session2/transfer22 Transferred: 829836 (@43KB/s)
        [CHG] Transfer /org/bluez/obex/client/session2/transfer22 Transferred: 877122 (047KB/s)
        [CHG] Transfer /org/bluez/obex/client/session2/transfer22 Transferred: 925074 (047KB/s)
        [CHG] Transfer /org/bluez/obex/client/session2/transfer22 Transferred: 972360 (@47KB/s)
        [CHG] Transfer /org/bluez/obex/client/session2/transfer22 Transferred: 1082250 (@109KB/s)
        [CHG] Transfer /org/bluez/obex/client/session2/transfer22 Transferred: 1206126 (@123KB/s)
        [CHG] Transfer /org/bluez/obex/client/session2/transfer22 Transferred: 1337328 (@131KB/s)
        [CHG] Transfer /org/bluez/obex/client/session2/transfer22 Transferred: 1347984 (@10KB/s)
        [CHG] Transfer /org/bluez/obex/client/session2/transfer22 Status: complete
        [DEL] Transfer /org/bluez/obex/client/session2/transfer22
        [F8:7D:76:9D:9B:6B]#
        Copy to clipboard
4. 打开并验证电话簿。

## 获取电话簿大小

要获取电话簿的大小，请执行以下操作：

1. [连接 DUT 和远程设备。](https://docs.qualcomm.com/doc/80-70020-13SC/topic/bluez-perform-bluetooth-pbap-client-functions.html#section-ip1-lyk-rcc-navyanka-09-10-24-2331-32-614)
2. [选择所需的电话簿。](https://docs.qualcomm.com/doc/80-70020-13SC/topic/bluez-perform-bluetooth-pbap-client-functions.html#section-xnb-dzk-rcc-navyanka-09-10-24-2336-49-621)
3. 通过运行以下命令获取所需电话簿的大小：

ls -l
        Copy to clipboard

    **示例输出**

Attempting to GetSize
                 [NEW] Transfer /org/bluez/obex/client/session1/transfer4
                 [CHG] Transfer /org/bluez/obex/client/session1/transfer4 Status: complete
                       Size: 0x0006
                 Attempting to List
                 [DEL] Transfer /org/bluez/obex/client/session1/transfer4
                 [NEW] Transfer /org/bluez/obex/client/session1/transfer5
                 [CHG] Transfer /org/bluez/obex/client/session1/transfer5 Status: complete
                 0.vcf: MyContact1
                 1.vcf: MyContact2
                 2.vcf: MyContact3
                 3.vcf: MyContact4
                 4.vcf: MyContact5
                 5.vcf: MyContact6
              [DEL] Transfer /org/bluez/obex/client/session1/transfer5
        Copy to clipboard

## 搜索联系人

要按姓名或电话号码搜索联系人，请执行以下操作：

1. [连接 DUT 和远程设备。](https://docs.qualcomm.com/doc/80-70020-13SC/topic/bluez-perform-bluetooth-pbap-client-functions.html#section-ip1-lyk-rcc-navyanka-09-10-24-2331-32-614)
2. [选择所需的电话簿。](https://docs.qualcomm.com/doc/80-70020-13SC/topic/bluez-perform-bluetooth-pbap-client-functions.html#section-xnb-dzk-rcc-navyanka-09-10-24-2336-49-621)
3. 通过运行以下命令搜索联系人：

ls <name_or_number>
        Copy to clipboard

    出现联系人文件。

    **参数**

    `<name_or_number>` 是联系人姓名或电话号码。

    **示例**

    要在电话簿中搜索名为 `BT` 的联系人，请运行以下命令：

ls BT
        Copy to clipboard

    **示例输出**

# ls BT
              Attempting to Search
           [NEW] Transfer /org/bluez/obex/client/session1/transfer7
           [CHG] Transfer /org/bluez/obex/client/session1/transfer7 Status: complete
              4.vcf: MyContact5
           [DEL] Transfer /org/bluez/obex/client/session1/transfer7
        Copy to clipboard

Last Published: Jul 22, 2025

[Previous Topic
执行蓝牙 PBAP 服务器功能](https://docs.qualcomm.com/bundle/publicresource/80-70020-13SC/topics/bluez-perform-bluetooth-pbap-server-functions.md) [Next Topic
消息访问 Profile (Message Access Profile)](https://docs.qualcomm.com/bundle/publicresource/80-70020-13SC/topics/bluez-map.md)