标志在蓝牙中意味着什么?

What do Flags mean in bluetooth?

我一直在试用 bluez btmon 工具来监控 raspberry pi 4 上的蓝牙发现结果。

btmon 工具 returns 标准输出如下:

@ MGMT Event: Device Found (0x0012) plen 42                                    {0x0001} [hci0] 0.207973
        LE Address: 61:E1:E1:49:C8:DC (Resolvable)
        RSSI: -51 dBm (0xcd)
        Flags: 0x00000004
          Not Connectable
        Data length: 28
        16-bit Service UUIDs (complete): 1 entry
          Google (0xfe9f)
        Service Data (UUID 0xfe9f): 0000000000000000000000000000000000000000

@ MGMT Event: Device Found (0x0012) plen 33                                    {0x0001} [hci0] 0.224956
        LE Address: 48:82:8F:DB:5C:65 (Resolvable)
        RSSI: -76 dBm (0xb4)
        Flags: 0x00000000
        Data length: 19
        Flags: 0x1a
          LE General Discoverable Mode
          Simultaneous LE and BR/EDR (Controller)
          Simultaneous LE and BR/EDR (Host)
        TX power: 5 dBm
        Company: Apple, Inc. (76)
          Type: Unknown (16)
          Data: 491faeca8c8638

@ MGMT Event: Device Found (0x0012) plen 43                                    {0x0001} [hci0] 0.298194
        LE Address: 0E:AF:D9:F0:D8:F1 (Non-Resolvable)
        RSSI: -68 dBm (0xbc)
        Flags: 0x00000004
          Not Connectable
        Data length: 29
        Company: Microsoft (6)
          Data: 0109210a065124d7b5c04445534b544f502d44484845413434

@ MGMT Event: Device Found (0x0012) plen 43                                    {0x0001} [hci0] 0.940219
        LE Address: 86:2A:FD:9E:57:0D (OUI 86-2A-FD)
        RSSI: -77 dBm (0xb3)
        Flags: 0x00000000
        Data length: 29
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported
        Service Data (UUID 0xfdf7): 01384a3dd6381b593c74d9369eefaa9b720000000003

一直在寻找一些官方文档来解释每个发现的设备信息中的“标志”字段(这些标志代码:0x00000004、0x00000000、0x1a、0x06),但我似乎找不到一个有意义的文档。

如果有人能解释这些标志的含义,以及如何理解这些代码,我们将不胜感激?

提前致谢。

我不知道你所谓的“官方文档”,但是Bluetooth Core Specification and the Supplement to the Bluetooth Core Specification certainly explains it. Have a look at chapter 1.3 FLAGS of CSS

在您显示的日志中,您可以看到几个低功耗蓝牙设备的广告数据。每个广告数据都包含一个或多个字段,称为广告类型。其中一种 AD 类型是“标志”字段。它可能是零个或多个八位字节长,第一个八位字节包含以下信息:

Octet Bit Description
0 0 LE Limited Discoverable Mode
0 1 LE General Discoverable Mode
0 2 BR/EDR Not Supported. Bit 37 of LMP Feature Mask Definitions (Page 0)
0 3 Simultaneous LE and BR/EDR to Same Device Capable (Controller). Bit 49 of LMP Feature Mask Definitions (Page 0)
0 4 Previously Used
0 5..7 Reserved for future use

给定的信息告诉您有关使用过的蓝牙无线电和广告本身的一些信息。如果你有兴趣更深入地了解这个话题,我推荐阅读这篇蓝牙博客文章:Advertising Works, Part 1