std.hardware.bluetooth_types

Die gemeinsame Grundlage aller Bluetooth-Units: Geräteadressen und Socket-Adressstrukturen.

Eine Bluetooth-Adresse (BD_ADDR) ist 6 Byte lang und wird auf dem Bus in umgekehrter Reihenfolge übertragen — die Schreibweise AA:BB:CC:DD:EE:FF steht im Speicher als FF EE DD CC BB AA. Genau daran scheitern selbstgebaute Umwandlungen; BTStrToAddr und BTAddrToStr nehmen einem das ab.

BTSockAddrRcCreate (RFCOMM) und BTSockAddrL2Create (L2CAP) füllen die passende sockaddr-Struktur im Rohspeicher — Lyx kennt keine C-Structs, die Felder liegen an festen Offsets.

std.hardware.bluetooth — Übersicht · Bluetooth-Guide · Standard Library


Schnittstelle

Signatur
BTAddrFromBytes(b0: int64, b1: int64, b2: int64, b3: int64, b4: int64, b5: int64): int64
BTAddrGetByte(addr: int64, byteIdx: int64): int64
BTAddrToUInt64(addr: int64): int64
BTAddrToStr(addr: int64, outBuf: int64)
BTStrToAddr(s: int64): int64
BTSockAddrRcCreate(buf: int64, bdaddr: int64, channel: int64)
BTSockAddrL2Create(buf: int64, psm: int64, bdaddr: int64, addrType: int64)
BTSockAddrRcReadAddr(buf: int64): int64
BTSockAddrRcReadChannel(buf: int64): int64
BTTypesSmokeTest(): int64
Konstante Wert Bedeutung
BT_BDADDR_SIZE 6 MAC-Adresse in Bytes
BT_SOCKADDR_RC_SIZE 10 sizeof(struct sockaddr_rc)
BT_SOCKADDR_L2_SIZE 14 sizeof(struct sockaddr_l2)
BDADDR_BREDR 0 Klassisches Bluetooth
BDADDR_LE_PUBLIC 1 BLE — öffentliche Adresse
BDADDR_LE_RANDOM 2 BLE — zufällige Adresse

Quelle: std/hardware/bluetooth_types.lyx · geprüft mit lyxc 1.0.17E · Stand 2026-08-12