forked from timvideos/gst-switch
-
Notifications
You must be signed in to change notification settings - Fork 1
/
dbusConnect2.py
executable file
·32 lines (29 loc) · 1.02 KB
/
dbusConnect2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from gi.repository import Gio, GLib
from time import sleep
address = "unix:abstract=gstswitch"
name = None
object_path = "/info/duzy/gst/switch/SwitchController"
# a = connection.call_sync(
# name, object_path, 'org.freedesktop.DBus.Introspectable', 'Introspect',
# None, GLib.VariantType.new("(s)"), Gio.DBusCallFlags.NONE, -1,
# None)
#mode = 1
#print type(mode), mode
mode=0
while mode<=3:
print "mode:", mode
connection = Gio.DBusConnection.new_for_address_sync(
address,
Gio.DBusConnectionFlags.AUTHENTICATION_CLIENT,
None, None)
args = GLib.Variant('(i)',(mode,))
print "args:", args
b = connection.call_sync(
name, object_path, 'info.duzy.gst.switch.SwitchControllerInterface', 'set_composite_mode',
args, GLib.VariantType.new("(b)"), Gio.DBusCallFlags.NONE, -1,
None)
print b.unpack()[0],type(b.unpack()[0])
mode += 1
if mode==4:
mode=0
sleep(0.5)