> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 执行蓝牙 PBAP 服务器功能

> 您可以使用 ``obexctl`` 主菜单中提供的命令验证蓝牙 PBAP 服务器功能。蓝牙 PBAP 服务器功能允许您从服务器获取联系人。

<a id="bluez-perform-bluetooth-pbap-server-functions" />

## 从服务器拉取联系人

开始之前，请执行以下操作：

* 配对 DUT 和远程设备。有关说明，请参阅 <a href="perform-bluetooth-gap-functions#pair-with-a-remote-bluetooth-device" target="_self">与远程蓝牙设备配对</a>。

* 在服务器上创建 PBAP 目录。

  <Note>
    在 BlueZ 协议栈中，由于无法在服务器上创建联系人，因此无法直接测试或验证 PBAP 服务器功能。因此，您必须在 DUT 上创建 PBAP 目录。有关创建 PBAP 目录的更多信息，请参阅 <a href="#sample-pbap-directory" target="_self">示例 PBAP 目录</a>。
  </Note>

要从服务器拉取联系人，请执行以下操作：

1. 从远程设备发起到 DUT 的连接。

2. 按如下方式在 DUT 上接受连接请求：

   a. 在 DUT 上运行 SSH。

   b. 运行以下命令打开 `bluetoothctl` 应用程序：

   ```text theme={null}
   bluetoothctl
   ```

   c. 对连接请求进行认证。

3. 将目标联系人从服务器拉取到客户端。

4. 在客户端上打开并验证检索到的联系人。

## 示例 PBAP 目录

您可以按如下方式创建示例 PBAP 目录来验证 PBAP 服务器功能：

1. 在 DUT 上运行 SSH。

2. 运行以下命令在 `root` 目录为每个电话簿存储库创建一个 `telecom` 文件夹：

   ```text theme={null}
   mkdir telecom
   ```

3. 运行以下命令将当前目录切换到 `telecom`：

   ```text theme={null}
   cd telecom
   ```

4. 在 `telecom` 目录中，为不同的电话簿对象创建子文件夹。

   要在 `telecom` 中创建子文件夹，请运行以下命令：

   ```text theme={null}
   mkdir <subfolder>
   ```

   **参数**

   `<subfolder>` 是子文件夹的名称。例如 `pb`。

   电话簿对象请使用以下文件夹名称：

| 电话簿对象   | 文件夹名称 |
| ------- | ----- |
| 主电话簿    | `pb`  |
| 来电历史    | `ich` |
| 去电历史    | `och` |
| 未接来电历史  | `mch` |
| 合并通话历史  | `cch` |
| 快速拨号联系人 | `spd` |
| 收藏联系人   | `fav` |

5. 在每个子文件夹中，创建示例 VCF 文件。

下图展示了一个示例 PBAP 目录。它包含两个电话簿存储库的 `telecom` 目录。在 `telecom` 目录中，有针对不同电话簿对象的子文件夹。这些子文件夹中包含 VCF 文件。

<img src="https://mintcdn.com/qualcomm-prod/PyJ823JBh-_RDtS4/Technologies/Bluetooth/media/qli-bt/pbap-folder-structure.png?fit=max&auto=format&n=PyJ823JBh-_RDtS4&q=85&s=9a87e9b6c392fd3b14e3a20685bb6f04" alt="" width="1437" height="1471" data-path="Technologies/Bluetooth/media/qli-bt/pbap-folder-structure.png" />
