This may not be a great list for this question (which would be?); it’s a big 
group, and I’m hoping there’s some people here that cross into these same areas.

I’m new to dbus, it seems it’s a sort of CORBA for the Linux world. :) Python 
seems to be a popular way to interact with it. I’m trying to interact with the 
BlueZ services for Bluetooth LE stuff, and the scant hints I can find seem to 
indicate dbus is the preferred way going forward. The BlueZ distribution even 
provides example code. That said, my question should be independent of whether 
this was BLE or a dbus interface for a Calculator program.

There is a class defined as such:

    class Characteristic(dbus.service.Object):
        def __init__(self, bus, index, uuid, flags, service):
            # … set a bunch of attributes
            dbus.service.Object.__init__(self, bus, self.path)

        @dbus.service.method(GATT_CHRC_IFACE, in_signature='ay')
        def WriteValue(self, value):
            print('Default WriteValue called, returning error’)
            raise NotSupportedException()

Then I have a subclass of my own:

    class MyCharacteristic(Characteristic):
        def __init__(self, bus, index, uuid, flags, service):
            Characteristic.__init__(self, bus, index, uuid, flags, service)
            # … set some of my own attributes

        def WriteValue(self, value):
            print(‘Got write value:’, value)
            self.anotherMethod(value)
            print(‘back from anotherMethod’)

        def anotherMethod(self, value):
            print(‘pondering this value:’, value)

My program does not call WriteValue directly. It seems to be called by the 
bluetooth machinery. The mainloop, or something like that. I don’t honestly 
know. I just know I use some other boilerplate code involving registration and 
the mainloop, to get it all running. And so the MyCharacteristic.WriteValue() 
method DOES get fired. I see the output. But when it gets to the anotherMethod 
call, it just seems to... not. More callbacks may fire later. But that’s the 
end of that one. I’ve tried this under python2 AND python3.

So my basic python-dbus question is: Is this some nuance where a callback 
method, inheriting from what looks like a proxy of some sort 
(dbus.service.Object) should/can not send messages to itself?

Help me python-obis, help me. You’re my only hope.


-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to