diff --git a/test/example-gatt-client b/test/example-gatt-client
index 724a45d..5a02505 100755
--- a/test/example-gatt-client
+++ b/test/example-gatt-client
-#!/usr/bin/python
+#!/usr/bin/env python3
import argparse
import dbus
-import gobject
+try:
+ from gi.repository import GObject
+except ImportError:
+ import gobject as GObject
import sys
from dbus.mainloop.glib import DBusGMainLoop
global bus
bus = dbus.SystemBus()
global mainloop
- mainloop = gobject.MainLoop()
+ mainloop = GObject.MainLoop()
om = dbus.Interface(bus.get_object(BLUEZ_SERVICE_NAME, '/'), DBUS_OM_IFACE)
om.connect_to_signal('InterfacesRemoved', interfaces_removed_cb)
if not process_hr_service(service_path):
sys.exit(1)
except dbus.DBusException as e:
- print e.message
+ print(e)
sys.exit(1)
- print 'Heart Rate Service ready'
+ print('Heart Rate Service ready')
start_client()
diff --git a/test/example-gatt-server b/test/example-gatt-server
index 67dee1a..f2ddb2b 100755
--- a/test/example-gatt-server
+++ b/test/example-gatt-server
-#!/usr/bin/python
+#!/usr/bin/env python3
import dbus
import dbus.exceptions
import dbus.service
import array
-import gobject
+try:
+ from gi.repository import GObject
+except ImportError:
+ import gobject as GObject
+import sys
from random import randint
from collections import OrderedDict
if not self.notifying:
return
- gobject.timeout_add(1000, self.hr_msrmt_cb)
+ GObject.timeout_add(1000, self.hr_msrmt_cb)
def StartNotify(self):
if self.notifying:
service)
self.notifying = False
self.battery_lvl = 100
- gobject.timeout_add(5000, self.drain_battery)
+ GObject.timeout_add(5000, self.drain_battery)
def notify_battery_level(self):
if not self.notifying:
def __init__(self, bus, index, characteristic):
self.writable = 'writable-auxiliaries' in characteristic.flags
- self.value = array.array('B', 'This is a characteristic for testing')
+ self.value = array.array('B', b'This is a characteristic for testing')
self.value = self.value.tolist()
Descriptor.__init__(
self, bus, index,
DBUS_OM_IFACE)
objects = remote_om.GetManagedObjects()
- for o, props in objects.iteritems():
- if props.has_key(GATT_MANAGER_IFACE):
+ for o, props in objects.items():
+ if GATT_MANAGER_IFACE in props.keys():
return o
return None
app = Application(bus)
- mainloop = gobject.MainLoop()
+ mainloop = GObject.MainLoop()
service_manager.RegisterApplication(app.get_path(), {},
reply_handler=register_app_cb,