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

# 执行蓝牙 OPP 客户端功能

> 您可以使用 ``obexctl`` 主菜单中提供的命令验证蓝牙 OPP 客户端功能。蓝牙 OPP 客户端功能允许您以客户端角色发送文件。

<a id="bluez-perform-bluetooth-opp-client-functions" />

## 以客户端角色发送文件

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

要以客户端角色发送文件，请执行以下操作：

1. 在 `obexctl` 菜单中运行以下命令连接远程设备：

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

   **参数**

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

   * `<profile_name>` 为 `opp`。

   **示例**

   要连接 `<bt_address>` 为 `22:22:5A:A5:56:6B` 的远程设备，请运行以下命令：

   ```text theme={null}
   connect 22:22:5A:A5:56:6B opp
   ```

   **示例输出**

   ```text theme={null}
   [obex]# connect 22:22:5A:A5:56:6B opp
   Attempting to connect to 22:22:5A:A5:56:6B
   [NEW] Session /org/bluez/obex/client/session1 [default]
   [NEW] ObjectPush /org/bluez/obex/client/session1
   Connection successful
   [22:22:5A:A5:56:6B]#
   ```

2. 在 DUT 的本地目录中创建一个文本文件。

3. 在 `obexctl` 菜单中运行以下命令将此文本文件发送到远程设备：

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

   **参数**

   `<filepath>` 是文本文件的文件路径。

   **示例**

   要发送位于 `/local/mnt/workspace/` 的文本文件 `temp.txt`，请运行以下命令：

   ```text theme={null}
   send /local/mnt/workspace/temp.txt
   ```

   **示例输出**

   ```text theme={null}
   [22:22:5A:A5:56:6B]# send /local/mnt/workspace/temp.txt
   Attempting to send /local/mnt/workspace/temp.txt to /org/bluez/obex/client/session1
   [NEW] Transfer /org/bluez/obex/client/session1/transfer1
   Transfer /org/bluez/obex/client/session1/transfer1
      Status: queued
      Name: temp.txt
      Size: 36
      Filename: /local/mnt/workspace/temp.txt
      Session: /org/bluez/obex/client/session1
   [CHG] Transfer /org/bluez/obex/client/session1/transfer1 Status: complete
   [DEL] Transfer /org/bluez/obex/client/session1/transfer1
   [22:22:5A:A5:56:6B]#
   ```

4. 在远程设备上，接受接收文件的提示。

   文件即成功发送到远程设备。
