BLE iBeacon Advertisement Example

Source code path: example/ble/iBeacon

Supported Platforms

  • eh-lb52x

  • eh-lb56x

  • eh-lb58x

Overview

This example demonstrates the usage of iBeacon advertisement.

Usage Instructions

  1. After booting, the iBeacon broadcast will be enabled. You can refer to the implementation of ble_app_ibeacon_advertising_start(). The default iBeacon broadcast content is UUID: 95d0b422-a4bd-45d4-9920-576bc6632372, Major: 256, Minor: 258, RSSI at 1m: -50 dBm.

  2. Use the finsh command “cmd_diss adv_update [UUID] [Major] [Minor] [RSSI_at_1m]” to modify the broadcast content. The UUID format should be like “12345678-1234-1234-1234-123456789abc”; Major value range is 0–65535; Minor value range is 0–65535; RSSI_at_1m value range is -128 to 127.

  3. Use the finsh commands “cmd_diss adv_start” and “cmd_diss adv_stop” to enable and stop the iBeacon broadcast, respectively.

Hardware Requirements

Before running this example, prepare:

Compilation and Flashing

Switch to the example project directory and run the scons command to compile:

> scons --board=eh-lb525 -j32

Switch to the example project/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 download steps, please refer to the Quick Start Guide.

Expected Results

After the example starts:

  1. It can perform iBeacon advertisement, and cannot be connected by a mobile phone.

  2. Modify advertisement content: enter cmd_diss adv_update <UUID> <Major> <Minor> <RSSI_at_1m> in the serial terminal. All four parameters are mandatory. For example:

    msh />cmd_diss adv_update 12345678-1234-1234-1234-123456789abc 1 2 -60
    

    The terminal prints the 16 bytes of the UUID and the parsed values. update adv 0 indicates the advertising data was updated successfully: alt text

  3. Stop advertising: enter cmd_diss adv_stop in the serial terminal. The terminal prints the stop reason and the advertising mode (mode 2 is broadcast mode), and the phone app can no longer discover the device:

    msh />cmd_diss adv_stop
    ADV stopped reason 0, mode 2
    
  4. Start advertising: enter cmd_diss adv_start in the serial terminal. The terminal prints the start result, where result 0 means success, and the phone app can discover the device again. alt text

Troubleshooting

Reference Documentation

Update History

Version

Date

Release Notes

0.0.1

09/2025

Initial version