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

# 执行蓝牙 MAP 服务器功能

> 您可以使用 ``obexctl`` 主菜单中提供的命令验证蓝牙 MAP 服务器功能。蓝牙 MAP 服务器功能允许您在服务器上获取和读取消息。

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

## 拉取并读取消息

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

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

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

  <Note>
    在 BlueZ 协议栈中，由于无法在设备上发送或接收蜂窝消息，因此无法直接测试或验证 MAP 服务器功能。因此，您必须在 DUT 上创建 MAP 目录。有关创建 MAP 目录的更多信息，请参见<a href="#sample-map-directory" target="_self">示例 MAP 目录</a>。
  </Note>

要从服务器拉取并读取消息，请执行以下操作：

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

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

   a. 在 DUT 上运行 SSH。

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

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

   c. 对连接请求进行身份验证。当 `bluetoothctl` 提示授权传入会话时，输入 `yes`。

   **示例输出**

   ```text theme={null}
   [agent] Authorize service (yes/no): yes
   ```

3. 将目标消息从服务器拉取到客户端。

4. 在客户端打开并验证检索到的消息。

## 示例 MAP 目录

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

1. 在 DUT 上运行 SSH。

2. 按顺序运行以下命令创建消息目录 `map-messages/telecom/msg`：

   a. 创建 `map-messages` 目录：

   ```text theme={null}
   mkdir map-messages
   ```

   b. 进入 `map-messages` 目录：

   ```text theme={null}
   cd map-messages
   ```

   c. 创建 `telecom` 目录：

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

   d. 进入 `telecom` 目录：

   ```text theme={null}
   cd map-messages/telecom
   ```

   e. 创建 `msg` 目录：

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

   f. 进入 `telecom/msg` 目录：

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

3. 在 `msg` 目录中创建以下子文件夹：

   * `inbox`

   * `outbox`

   * `sent`

   * `deleted`

   * `draft`

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

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

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

4. 在每个子文件夹中创建消息文件。

下图显示了一个示例 MAP 目录。在 `/map-messages/telecom/msg/` 目录中，有针对不同类型消息的子文件夹。这些子文件夹包含消息。

<img src="https://mintcdn.com/qualcomm-staging/uWQLnBcS9sxlZhgB/Technologies/Bluetooth/media/qli-bt/map-folder-structure.png?fit=max&auto=format&n=uWQLnBcS9sxlZhgB&q=85&s=acaa580f527e21daef0ab5e3476aaecb" alt="" width="1321" height="700" data-path="Technologies/Bluetooth/media/qli-bt/map-folder-structure.png" />
