Skip to content

How to add Flags inside Advertising Data? #411

@J0EK3R

Description

@J0EK3R

Thank you @ukBaz for your great work!

In my project I'm trying to send special BT-Advertising-Telegrams to control MouldKing Hubs.

My platform is a Raspberry 4.

I managed to send the required telegrams using the deprecated HCITool:

hcitool -i hci0 cmd 08 0008 3E 02 01 02 1b ff f0 ff 6D B6 43 CF 7E 8F 47 11 88 66 59 38 D1 7A AA 26 49 5E 13 14 15 16 17 18
hcitool -i hci0 cmd 0x08 0x0006 A0 00 A0 00 03 00 00 00 00 00 00 00 00 07 00
hcitool -i hci0 cmd 0x08 0x000a 01

This calls generate the following output - catched by wireshark
Inside the "Advertising Data" are two bytes of "Flags", followed by the "Manufacturer Specific" data

Frame 2: 63 bytes on wire (504 bits), 63 bytes captured (504 bits) on interface COM3-4.2, id 0
nRF Sniffer for Bluetooth LE
Bluetooth Low Energy Link Layer
    Access Address: 0x8e89bed6
    Packet Header: 0x2502 (PDU Type: ADV_NONCONN_IND, TxAdd: Public)
    Advertising Address: RaspberryPiT_c2:62:00 (dc:a6:32:c2:62:00)
    Advertising Data
        Flags
            Length: 2
            Type: Flags (0x01)
            000. .... = Reserved: 0x0
            ...0 .... = Simultaneous LE and BR/EDR to Same Device Capable (Host): false (0x0)
            .... 0... = Simultaneous LE and BR/EDR to Same Device Capable (Controller): false (0x0)
            .... .0.. = BR/EDR Not Supported: false (0x0)
            .... ..1. = LE General Discoverable Mode: true (0x1)
            .... ...0 = LE Limited Discoverable Mode: false (0x0)
        Manufacturer Specific
            Length: 27
            Type: Manufacturer Specific (0xff)
            Company ID: Unknown (0xfff0)
            Data: 6db643cf7e8f471188665938d17aaa26495e131415161718
                [Expert Info (Note/Undecoded): Undecoded]
    CRC: 0x0a9130

I'm trying to reproduce the same BT-telegrams by modifying your example "manufacturer_data_beacon.py":

from bluezero import broadcaster

def main():
    alt = broadcaster.Beacon()
    alt.add_manufacturer_data(
        'fff0',  # Manufacturer ID
        b'\x6D\xB6\x43\xCF\x7E\x8F\x47\x11\x88\x66\x59\38\xD1\x7A\xAA\26\x5E\13\x14\x15\x16\x17\x18')

    alt.start_beacon()


if __name__ == '__main__':
    main()

Wireshark's output looks like this - very close to my requirements:

Frame 11872: 60 bytes on wire (480 bits), 60 bytes captured (480 bits) on interface COM3-4.2, id 0
nRF Sniffer for Bluetooth LE
Bluetooth Low Energy Link Layer
    Access Address: 0x8e89bed6
    Packet Header: 0x2200 (PDU Type: ADV_IND, ChSel: #1, TxAdd: Public)
    Advertising Address: RaspberryPiT_c2:62:00 (dc:a6:32:c2:62:00)
    Advertising Data
        Manufacturer Specific
            Length: 27
            Type: Manufacturer Specific (0xff)
            Company ID: Unknown (0xfff0)
            Data: 6db643cf7e8f47118866590338d17aaa165e0b1415161718
                [Expert Info (Note/Undecoded): Undecoded]
    CRC: 0xb3521a

Only the Flags are missing.

Could you please help me to add the missing Flags ? :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions