LEW21 / pydbus

Pythonic DBus library
GNU Lesser General Public License v2.1
331 stars 75 forks source link

I can't seem to retrieve any signals #74

Closed Lokimor closed 6 years ago

Lokimor commented 6 years ago

I don't know if I got the syntax wrong, the methods are working perfectly fine and are also returning the right values, but I can't retrieve any signal even if I can see them with dbus-monitor --system --profile.

Did I miss something?

Part of the xml that is relevant:

            <method name="StartSession">
                <arg name="screen_type" type="y" direction="in"/>
                <arg name="credit" type="u" direction="in"/>
                <arg name="IDtext" type="s" direction="in"/>
                <arg name="result" type="b" direction="out"/>
            </method>
            <method name="AddCredit">
                <arg name="credit" type="u" direction="in"/>
                <arg name="result" type="b" direction="out"/>
            </method>>
            <signal name="SelectionEcho">
                <arg name="item" type="s" direction="out"/>
                <arg name="price" type="s" direction="out"/>
            </signal>

Part of my code:

 def myFunc(item, price):
    print(item)
    print(price)
    loop.quit()

from pydbus import SystemBus
from gi.repository import GLib

bus = SystemBus()

# Create an object that will proxy for a particular remote object.
dev = bus.get(
    "org.testing.Sbc", # Bus name
   "/Sbc" # Object path
)

devapi = dev['org.Testing.Dbus.SBCInterface']

result = devapi.StartSession(0, 0,"Session started by Python script") #Works well
print(result)
devapi.Addcredit(5000) #Works well

devapi.SelectionEcho.connect(myFunc) #Doesn't do anything, also tried all below without result
# devapi.SelectionEcho.connect(print)
# devapi.onSelectionEcho= myFunc
# devapi.onSelectionEcho= print

loop = GLib.MainLoop()
loop.run()
Lokimor commented 6 years ago

I'm closing this because I'm doing it in C++with QT instead.