BLE File Transfer Example

Source code path: example/ble/file_transfer

Supported Platforms

All platforms

Overview

This example demonstrates how to implement a GAP peripheral role on this platform to receive files sent from a mobile device.

Example Usage

  1. The Finsh commands for this example can be displayed by entering diss help to show command usage.

  2. When operating as a peripheral device, it will start advertising on boot with the name format: SIFLI_APP-xx-xx-xx-xx-xx-xx, where xx represents the device’s Bluetooth address. You can connect using a mobile BLE app.

  3. The sifli ble serial transport protocol can be used to send files from the mobile device to the target device, supporting one or multiple files in a single transfer.

Hardware Requirements

Before running this example, you need to prepare:

Compilation and Flashing

Navigate to the example’s project/common directory and run the scons command to compile:

> scons --board=eh-lb525 -j32

Navigate to the example’s project/common/build_xx directory and run uart_download.bat, then select the port as prompted to download:

$ ./uart_download.bat
     Uart Download
please input the serial port num:5

For detailed compilation and downloading steps, please refer to the relevant sections in Quick Start.

Expected Results

After the example starts:

  1. It can be discovered and connected by a mobile BLE app.

  2. Compress the files to be transferred into a single .zip file and transfer this file to your mobile device.

  3. Use the SIFLI BLE APP to search, connect the device, then go to the watchface interface, select the custom file, and then choose this file. This file can then be transferred to the file system of the development board.

  4. Mobile app operation steps:

  • Enable location permission for opening the feature APP1

  • Click the query button at the bottom right corner to enter the Bluetooth scanning interface. APP1

  • Click on “SCAN” to start the scan. APP2

  • After finding the device, click on “SORT”, and the broadcast named “SIFLI_APP-xx-xx-xx-xx-xx-xx” will be placed at the top. APP3

  • Click on the broadcast name “SIFLI_APP-xx-xx-xx-xx-xx-xx” to enter the device interface. APP4

  • Click on the upper right corner to enter the operation interface. APP4

  • Click “CONNECT” to ensure that the State is “CONNECT” APP4

  • Swipe up the last box, find File transfer WFPUSH2 and click to enter the file transfer interface APP4

  • Click on “SELECT FILE” to select the pre-prepared zip file from your phone, and set the “File Type” to 3. Then, check the “With Byte Align” option, and finally click “START”. APP4

  • After the transmission is completed, execute the command in the console window to enter the “file_recv” folder, and then execute the “ls” command to view the list of files. Among them, the content of the zip file will be displayed. APP4

Access to the mobile APP and DEMO project for use

Download address of Android’s free software application

https://www.pgyer.com/gurSBc

Android demo project

https://github.com/OpenSiFli/SiFli_OTA_APP
The corresponding part is “3. SiFli-SDK OTA”

iOS demo工程

https://github.com/OpenSiFli/SiFli_OTA_APP_IOS
The corresponding part is “SiFli-SDK OTA (Nor Offline)” SiFli-SDK file transfer

Troubleshooting

When the development board returns an error, check the ble_watchface_status_id_t enumeration in bf0_sibles_watchface.h

Reference Documentation

Update History

Version

Date

Release Notes

0.0.1

07/2025

Initial version

No newline at end of right file.