[gnome-bluetooth/wip/hadess/power-state-bluez: 2/2] lib: Add test application for BluetoothClient properties




commit 3feea0103abefa2c9bba667846d03d6d868e42b3
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Aug 25 16:11:37 2022 +0200

    lib: Add test application for BluetoothClient properties

 lib/test-client.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
---
diff --git a/lib/test-client.py b/lib/test-client.py
new file mode 100644
index 00000000..ab3866b8
--- /dev/null
+++ b/lib/test-client.py
@@ -0,0 +1,21 @@
+#!/usr/bin/python3
+#
+# Copyright (C) 2022 Bastien Nocera <hadess hadess net>
+#
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+import gi
+from gi.repository import GLib
+from gi.repository import Gio
+gi.require_version('GnomeBluetooth', '3.0')
+from gi.repository import GnomeBluetooth
+
+def notify_cb(client, pspec):
+    value = client.get_property(pspec.name)
+    print(f'{pspec.name} changed to {value}')
+
+client = GnomeBluetooth.Client.new()
+client.connect('notify', notify_cb)
+
+ml = GLib.MainLoop()
+ml.run()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]