std.hardware.bluetooth_dbus
Die Anbindung an BlueZ, den Bluetooth-Dienst von Linux, über dessen D-Bus-Schnittstelle. Alles, was den Adapter selbst betrifft — Geräte suchen, koppeln, verbinden —, läuft hierüber und nicht über Sockets.
BlueZOpenConnection öffnet die Verbindung zum System-Bus. Danach: BlueZStartDiscovery beginnt die Suche, BlueZGetManagedObjects liefert den aktuellen Gerätebestand als Rohantwort, BlueZFindDeviceAddress zieht eine Adresse daraus heraus. BlueZPairDevice und BlueZConnectDevice koppeln und verbinden; BlueZDiscoverDevices fasst Suchen und Auswerten in einem Aufruf zusammen.
Die Pfade sind D-Bus-Objektpfade in Textform (/org/bluez/hci0) und werden mit ihrer Länge übergeben.
std.hardware.bluetooth — Übersicht · Bluetooth-Guide · Standard Library
Schnittstelle
| Signatur |
|---|
BlueZOpenConnection(): int64 |
BlueZStartDiscovery(fd: int64, adapterPath: int64, pathLen: int64): int64 |
BlueZStopDiscovery(fd: int64, adapterPath: int64, pathLen: int64): int64 |
BlueZGetManagedObjects(fd: int64, outBuf: int64, maxLen: int64): int64 |
BlueZPairDevice(fd: int64, devicePath: int64, pathLen: int64): int64 |
BlueZConnectDevice(fd: int64, devicePath: int64, pathLen: int64): int64 |
BlueZDisconnectDevice(fd: int64, devicePath: int64, pathLen: int64): int64 |
BlueZFindDeviceAddress(data: int64, dataLen: int64, addrBuf: int64): int64 |
BlueZDiscoverDevices(fd: int64, adapterPath: int64, pathLen: int64, timeoutMs: int64, outBuf: int64, maxLen: int64): int64 |
BlueZClose(fd: int64) |
| Konstante | Wert | Bedeutung |
|---|---|---|
DBUS_TYPE_METHOD_CALL | 1 | – |
DBUS_TYPE_METHOD_RETURN | 2 | – |
DBUS_TYPE_ERROR | 3 | – |
DBUS_TYPE_SIGNAL | 4 | – |
DBUS_FLAG_NO_REPLY | 1 | – |
DBUS_FLAG_NO_AUTOSTART | 2 | – |
DBUS_HDR_PATH | 1 | – |
DBUS_HDR_INTERFACE | 2 | – |
DBUS_HDR_MEMBER | 3 | – |
DBUS_HDR_ERROR_NAME | 4 | – |
DBUS_HDR_REPLY_SERIAL | 5 | – |
DBUS_HDR_DESTINATION | 6 | – |
DBUS_HDR_SENDER | 7 | – |
DBUS_HDR_SIGNATURE | 8 | – |
…sowie 2 weitere Konstanten in der Quelldatei std/hardware/bluetooth_dbus.lyx.
Quelle: std/hardware/bluetooth_dbus.lyx · geprüft mit lyxc 1.0.17E · Stand 2026-08-12
