当前文档版本为 v0.4.0,您可以访问当前页面的 开发中 版本以获取最近可能的更新。

Bluetooth: Peripheral DIS

1 功能概述

此项目演示了蓝牙从机的功能,该工程专门演示DIS(Device Information)GATT服务。

2 环境要求

  • board: 支持 BLE 的蓝牙设备

  • uart(option): 用来显示串口log

  • 测试软件: nRF Connect

3 编译和烧录

项目位置:zephyr\samples_panchip\bluetooth\peripheral_dis

目前可使用ZAL工具或quick build脚本进行编译和下载。

脚本位置:quick_build_samples\bluetooth\peripheral_dis.bat

打开脚本后默认会编译项目,编译完成时,可输入字符进行后续下载等操作:

Input the keyword to continue:
  'b' build                         编译项目
  'r' make clean and rebuild        重新编译项目
  'f' flash download                下载
  'e' erase chip                    擦除芯片
  'o' open project by VS Code       打开 `VS Code`,可查看源码,执行编译下载等
  others exit                       退出
wait input:

4 演示说明

  1. 烧录完成后,设备自动启动蓝牙广播,可以在手机或抓包工具上获取如下信息:

    • Service UUID: 0x180A

    • Device Name: DIS peripheral

  2. 当手机或其它主设备与其建立连接后,串口log 会显示连接信息,如下:

    Connected
    
  3. 使用nRF Connect 连接上 DIS peripheral设备后,app显示如下:

    image

    Peripheral DIS 手机端 nRF Connect 界面