std.hardware.bluetooth_ext

BLE-Scannen mit Auswertung: Umgebungsgeräte finden und ihre Werbedaten zerlegen.

Ein BLE-Gerät sendet in kurzen Abständen Advertising-Pakete mit Adresse, Sendestärke (RSSI) und einer Nutzlast aus typisierten Feldern — Name, angebotene Dienste, Herstellerdaten. Die BleScanResult*-Funktionen lesen die Felder eines Treffers aus dem Ergebnispuffer; BleScannerStart/BleScannerStop steuern den Scan.

Die Sendestärke ist der einzige Anhaltspunkt für Entfernung, den BLE bietet — und ein grober: Sie schwankt mit Ausrichtung und Hindernissen um mehrere Dezibel. Für „welches Gerät ist näher„ taugt sie, für Meterangaben nicht.

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


Schnittstelle

Signatur
BleScanResultAddr(buf: int64, idx: int64): int64
BleScanResultRSSI(buf: int64, idx: int64): int64
BleScanResultIsConnectable(buf: int64, idx: int64): int64
BleScanResultNameLen(buf: int64, idx: int64): int64
BleScanResultName(buf: int64, idx: int64): int64
BleScanResultAdvLen(buf: int64, idx: int64): int64
BleScanResultAdvData(buf: int64, idx: int64): int64
BleScannerStart(fd: int64, adapterPath: int64, pathLen: int64): int64
BleScannerStop(fd: int64, adapterPath: int64, pathLen: int64): int64
BleScannerReadNext(fd: int64, result: int64): int64
BleScan(fd: int64, adapterPath: int64, pathLen: int64, timeoutMs: int64, resultsBuf: int64, maxResults: int64): int64
BleAdvertisementRegister(fd: int64, adapterPath: int64, pathLen: int64, advConfig: int64): int64
BleAdvertisementHandleGetAll(fd: int64, advConfig: int64, serial: int64): int64
BleAdvertisementUnregister(fd: int64, adapterPath: int64, pathLen: int64): int64
MeshNetworkJoin(fd: int64, uuid: int64): int64
MeshSend(fd: int64, dst: int64, data: int64, dataLen: int64): int64
MeshRecv(fd: int64, srcOut: int64, dataBuf: int64, bufLen: int64): int64
Konstante Wert Bedeutung
BLE_SCAN_RESULT_SIZE 128
BLE_ADV_TYPE_PERIPHERAL 0
BLE_ADV_TYPE_BROADCAST 1
BLE_ADV_CONFIG_SIZE 64
MESH_STATUS_NOT_IMPLEMENTED -2

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