File: test-client.py

package info (click to toggle)
gnome-bluetooth3 47.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,724 kB
  • sloc: ansic: 6,846; python: 561; xml: 113; sh: 46; makefile: 21
file content (21 lines) | stat: -rw-r--r-- 507 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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()