aboutsummaryrefslogblamecommitdiffstats
path: root/examples/dbus/test_bt_list_handles.py
blob: 52510ac9ceb24066d37c516331d0f9694a23efa9 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11










                                                                          
                              




                                         
                                             


                                           
                                      





                                                           
#!/usr/bin/env python

import sys
import dbus
from efl import dbus_mainloop
from efl import ecore


def print_remote_handles(adapter, bdaddr):
    handles = [hex(int(h)) \
               for h in list(adapter.GetRemoteServiceHandles(bdaddr, ""))]
    print("Handles:", handles)
    ecore.idler_add(ecore.main_loop_quit)
    return False


if len(sys.argv) != 2:
    print("USAGE: %s <bdaddr>" % sys.argv[0])
    sys.exit(1)

dbus_ml = dbus_mainloop.DBusEcoreMainLoop()
bus = dbus.SystemBus(mainloop=dbus_ml)

obj = bus.get_object("org.bluez", "/org/bluez/hci0")
adapter = dbus.Interface(obj, "org.bluez.Adapter")

ecore.idler_add(print_remote_handles, adapter, sys.argv[1])
ecore.main_loop_begin()