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

# 验证 FTP 功能

> FTP 定义了两个蓝牙设备之间交换文件的要求。

<a id="bluez-ftp" />

要执行蓝牙 FTP 功能，您必须先完成以下过程中的步骤。

## 前提条件

* 启用 SSH 以访问您的主机设备。有关说明，请参阅 <a href="https://dragonwingdocs.qualcomm.com/Key-Documents/Flash-Guide/how-to-sign-in-with-ssh" target="_self">使用 SSH 登录</a>。

* 确保 DUT 和远程设备支持 BlueZ 协议栈。一台设备充当服务器，另一台设备充当客户端。

  <Note>
    测试或验证 FTP 服务器功能不需要测试应用程序。请通过客户端连接执行 FTP 功能。
  </Note>

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

* 将 DUT 和远程设备置于蓝牙有效范围内。

## 为蓝牙 FTP 功能设置设备

1. 在命令提示符中使用以下命令运行 SSH：

   ```text theme={null}
   ssh root@<device_IP_address>
   ```

   **示例**

   如果设备的 IP 地址为 `10.92.160.222`，请运行以下命令：

   ```text theme={null}
   ssh root@10.92.160.222
   ```

2. 输入以下密码以连接到 SSH：

   ```text theme={null}
   oelinux123
   ```

3. 运行以下命令打开蓝牙测试应用程序：

   ```text theme={null}
   obexctl
   ```

   要查看 OBEX 功能，请运行以下命令：

   ```text theme={null}
   help
   ```

   此命令提供 **obexctl** 的主菜单。

   **示例输出**

   ```text theme={null}
   sh-5.1# obexctl
   [NEW] Client /org/bluez/obex
   [obex]# help
   Menu main:
   Available commands:
   -------------------
   connect <dev> [uuid] [channel]                    Connect session
   disconnect [session]                              Disconnect session
   list                                              List available sessions
   show [session]                                    Session information
   select <session>                                  Select default session
   info <object>                                     Object information
   cancel <transfer>                                 Cancel transfer
   suspend <transfer>                                Suspend transfer
   resume <transfer>                                 Resume transfer
   send <file>                                       Send file
   pull <file>                                       Pull Vobject & stores in file
   cd <path>                                         Change current folder
   ls <options>                                      List current folder
   cp <source file> <destination file>               Copy source file to destination file
   mv <source file> <destination file>               Move source file to destination file
   rm <file>                                         Delete file
   mkdir <folder>                                    Create folder
   version                                           Display version
   quit                                              Quit program
   exit                                              Quit program
   help                                              Display help about this program
   export                                            Print environment variables
   [obex]#
   ```

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

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

   **参数**

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

   * `<profile_name>` 为 `ftp`。

   **示例**

   要连接 `<bt_address>` 为 `E8:48:B8:C8:20:00` 的远程设备，请运行以下命令：

   ```text theme={null}
   connect E8:48:B8:C8:20:00 ftp
   ```

   **示例输出**

   ```text theme={null}
   [E8:48:B8:C8:20:00]# connect E8:48:B8:C8:20:00 ftp
   Attempting to connect to E8:48:B8:C8:20:00
   [NEW] Session /org/bluez/obex/client/session7
   [NEW] FileTransfer /org/bluez/obex/client/session7
   Connection successful
   ```

   要执行 FTP 客户端功能，请参阅 <a href="perform-bluetooth-ftp-client-functions" target="_self">执行蓝牙 FTP 客户端功能</a>。

## 后续步骤

### <a href="perform-bluetooth-ftp-client-functions" target="_self">执行蓝牙 FTP 客户端功能</a>

您可以使用 **obexctl** 主菜单中提供的命令验证蓝牙 FTP 客户端功能。蓝牙 FTP 客户端功能包括创建新文件夹和更改当前文件夹以浏览文件系统。使用 FTP 客户端功能，您可以检索当前文件夹的信息、将文件复制到远程设备、从远程设备复制文件、在远程设备内复制文件、在不同位置之间移动文件，以及在不再需要时删除文件。
