> ## 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.

# 执行蓝牙 MAP 客户端功能

> 您可以使用 ``obexctl`` 主菜单中提供的命令验证蓝牙 MAP 客户端功能。蓝牙 MAP 客户端功能允许您连接远程设备、发送消息以及列出设备上的所有消息。

## 前提条件

开始之前，请按照 <a href="verify-map-functions#set-up-the-device-for-bluetooth-map-functions" target="_self">为蓝牙 MAP 功能设置设备</a> 中的说明设置设备。

## 连接远程设备

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

```text theme={null}
connect <bt_address> <profile_name>
```

**参数**

* `<bt_address>` 是远程设备的蓝牙地址。

* `<profile_name>` 为 `map`。

**示例**

要连接 `<bt_address>` 为 `22:22:23:DB:F2:4A` 的远程设备，请运行以下命令：

```text theme={null}
connect 22:22:23:DB:F2:4A map
```

**示例输出**

```text theme={null}
#connect 22:22:23:DB:F2:4A map
Attempting to connect to 22:22:23:DB:F2:4A
[NEW] Session /org/bluez/obex/client/session23 [default]
[NEW] MessageAccess /org/bluez/obex/client/session23
[NEW] Transfer /org/bluez/obex/client/session23/transfer149
Connection successful
```

## 列出文件夹中的消息

要列出文件夹中的消息，请执行以下操作：

1. <a href="perform-bluetooth-pbap-client-functions#connect-the-remote-device" target="_self">连接 DUT 和远程设备。</a>

2. 将当前目录切换到目标目录。

   **示例**

   如果消息文件夹位于 `telecom/msg`，请在 `obexctl` 菜单中运行以下命令：

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

3. 运行以下命令列出目标文件夹中的消息：

   ```text theme={null}
   ls <folder_name>
   ```

   **示例**

   要列出 `inbox` 中的消息，请运行以下命令：

   ```text theme={null}
   ls inbox
   ```

   **示例输出**

   ```text theme={null}
   [22:22:23:DB:F2:4A]# ls inbox
   Attempting to ListMessages
   [NEW] Transfer /org/bluez/obex/client/session22/transfer141
   [CHG] Transfer /org/bluez/obex/client/session22/transfer141 Status: complete
   [NEW] Message /org/bluez/obex/client/session22/message288230376151711846
   [NEW] Message /org/bluez/obex/client/session22/message288230376151711844
   [NEW] Message /org/bluez/obex/client/session22/message288230376151711842
   ```

## 发送消息

要发送消息，请执行以下操作：

1. <a href="perform-bluetooth-pbap-client-functions#connect-the-remote-device" target="_self">连接 DUT 和远程设备。</a>

2. 将当前目录切换到 outbox 目录。

   **示例**

   要将目录切换到 `outbox`，请在 `obexctl` 菜单中运行以下命令：

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

3. 确保消息存在于 `outbox` 文件夹中。如果消息不存在，请创建一个。

   **示例**

   您可以创建一个名为 `map_file.msg` 的 BMSG 文件，内容如下：

   ```text theme={null}
   BEGIN:BMSG
   VERSION:1.0
   STATUS:UNREAD
   TYPE:SMS_GSM
   FOLDER:outbox
   NOTIFICATION:1
   BEGIN:VCARD
   VERSION:2.1
   N:QCOM-BTD
   END:VCARD
   BEGIN:BENV
   BEGIN:VCARD
   VERSION:2.1
   N:null;;;;
   TEL:123-456-7890
   END:VCARD
   BEGIN:BBODY
   CHARSET:UTF-8
   LENGTH:50
   BEGIN:MSG
   Hello from client side
   END:MSG
   END:BBODY
   END:BENV
   END:BMSG
   ```

4. 在 `obexctl` 菜单中运行以下命令发送消息：

   ```text theme={null}
   send <message_filename>
   ```

   **参数**

   `<message_filename>` 是您要发送的消息的文件名。

   **示例**

   要发送 `map_file.msg`，请运行以下命令：

   ```text theme={null}
   send map_file.msg
   ```

   **示例输出**

   ```text theme={null}
   [22:22:23:DB:F2:4A]# send map_file.msg
   Attempting to send map_file.msg to /org/bluez/obex/client/session22
   [NEW] Transfer /org/bluez/obex/client/session22/transfer147
   Transfer /org/bluez/obex/client/session22/transfer147
      Status: queued
      Name :
      Size: 322
      Filename: map_file.msg
      Session: /org/bluez/obex/client/session22
   [CHG] Transfer /org/bluez/obex/client/session22/transfer147 Status: complete
   [DEL] Transfer /org/bluez/obex/client/session22/transfer147
   ```
