一、简介

本文介绍如何启动蓝牙适配器(Adapter),这是执行其他蓝牙相关命令的前置条件。

二、示例

以下示例介绍如何启动蓝牙适配器。

前提条件

在 NSH 中打开 bttool。有关 bttool 的详细命令说明,请参见 bttool 命令说明

ap> bttool

 

命令输入

bttool> enable

输出信息

执行成功后,预期输出如下:

Adapter state changed: 4

 

此输出表示蓝牙适配器的 BR/EDR(基本速率/增强数据速率)和 LE(低功耗)功能已成功启用。

适配器状态

状态 释义
1 正在启用 BLE 功能。
2 BLE 功能已启用。
3 正在启用 BR/EDR 功能。
4 BR/EDR 功能已启用。

示例输出

以下是蓝牙适配器状态变化的示例输出:

[bttool] Context:0xf1893610, Adapter state changed: 1
[bttool] Context2:0xf1893590, Adapter state changed: 1
[bttool] Context:0xf1893610, Adapter state changed: 2
[bttool] Context2:0xf1893590, Adapter state changed: 2
[bttool] Context:0xf1893610, Adapter state changed: 3
[bttool] Context2:0xf1893590, Adapter state changed: 3
[bttool] Context:0xf1893610, Adapter state changed: 4
[bttool] Adapter Name: XIAOMI VELA-052, Cap: 3, Class: 0x00280704, Mode:2
[bttool] Context2:0xf1893590, Adapter state changed: 4
Logo

openvela 操作系统专为 AIoT 领域量身定制,以轻量化、标准兼容、安全性和高度可扩展性为核心特点。openvela 以其卓越的技术优势,已成为众多物联网设备和 AI 硬件的技术首选,涵盖了智能手表、运动手环、智能音箱、耳机、智能家居设备以及机器人等多个领域。

更多推荐