LoginSignup
0
0

More than 3 years have passed since last update.

LinuxとPythonでBDAを取得する

Posted at

Linux と Python で Bluetooth Device Address を取得するときのメモ。

import dbus

BLUEZ_SERVICE_NAME = 'org.bluez'
DBUS_OM_IFACE = 'org.freedesktop.DBus.ObjectManager'
DBUS_PROP_IFACE = 'org.freedesktop.DBus.Properties'


bus = dbus.SystemBus()
adapter = dbus.Interface(bus.get_object(BLUEZ_SERVICE_NAME, '/org/bluez/hci0'),
                    DBUS_PROP_IFACE)
addr = adapter.Get("org.bluez.Adapter1", "Address")
print(addr)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0