-
Notifications
You must be signed in to change notification settings - Fork 11
/
emitter.py
executable file
·33 lines (27 loc) · 931 Bytes
/
emitter.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
33
#!/usr/bin/python
"""Emmitter functionality."""
import dbus
import dbus.service
import dbus.glib
class Emitter(dbus.service.Object):
"""Emitter DBUS service object."""
def __init__(self, bus_name, object_path):
"""Initialize the emitter DBUS service object."""
dbus.service.Object.__init__(self, bus_name, object_path)
@dbus.service.signal('tld.domain.sub.event')
def test(self):
"""Emmit a test signal."""
print('Emitted a test signal')
@dbus.service.signal('tld.domain.sub.event')
def quit_signal(self):
"""Emmit a quit signal."""
print('Emitted a quit signal')
"""
Emit a test signal on the dbus.
Emit a receiver_quit signal which should stop the receiver.
"""
session_bus = dbus.SessionBus()
bus_name = dbus.service.BusName('sub.domain.tld', bus=session_bus)
emitter = Emitter(bus_name, '/tld/domain/sub/event')
emitter.test()
emitter.quit_signal()