bluez/test/test-manager
Tedd Ho-Jeong An 7fe27bbf7d test: Add SPDX License Identifier
This patch adds SPDX License Identifier and removes the license text.

-------------------------------------
       License            COUNT
-------------------------------------
 LGPL-2.1-or-later    :     35

License: LGPL-2.1-or-later
   test/agent.py
   test/bluezutils.py
   test/dbusdef.py
   test/example-advertisement
   test/example-endpoint
   test/example-gatt-client
   test/example-gatt-server
   test/example-player
   test/exchange-business-cards
   test/ftp-client
   test/get-managed-objects
   test/get-obex-capabilities
   test/list-devices
   test/list-folders
   test/map-client
   test/monitor-bluetooth
   test/opp-client
   test/pbap-client
   test/sap_client.py
   test/simple-endpoint
   test/simple-obex-agent
   test/simple-player
   test/test-adapter
   test/test-device
   test/test-discovery
   test/test-gatt-profile
   test/test-health
   test/test-health-sink
   test/test-hfp
   test/test-manager
   test/test-mesh
   test/test-nap
   test/test-network
   test/test-profile
   test/test-sap-server
2020-09-21 16:20:26 -07:00

43 lines
1.1 KiB
Python
Executable File

#!/usr/bin/python
# SPDX-License-Identifier: LGPL-2.1-or-later
from __future__ import absolute_import, print_function, unicode_literals
import dbus
import dbus.mainloop.glib
try:
from gi.repository import GObject
except ImportError:
import gobject as GObject
import bluezutils
def interfaces_added(path, interfaces):
if interfaces.get("org.bluez.Adapter1") != None:
print("Adapter with path %s added" % (path))
def interfaces_removed(path, interfaces):
if "org.bluez.Adapter1" in interfaces:
print("Adapter with path %s removed" % (path))
if __name__ == "__main__":
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
bus = dbus.SystemBus()
bus.add_signal_receiver(interfaces_added, bus_name="org.bluez",
dbus_interface="org.freedesktop.DBus.ObjectManager",
signal_name="InterfacesAdded")
bus.add_signal_receiver(interfaces_removed, bus_name="org.bluez",
dbus_interface="org.freedesktop.DBus.ObjectManager",
signal_name="InterfacesRemoved")
try:
path = bluezutils.find_adapter().object_path
print("Adapter found at path %s" % (path))
except:
print("No adapter found")
mainloop = GObject.MainLoop()
mainloop.run()