Python DBusで非同期メソッドを実装するにはどうすればよいですか?以下の例:
class LastfmApi(dbus.service.Object):
def __init__(self):
bus_name = dbus.service.BusName('fm.lastfm.api', bus=dbus.SessionBus())
dbus.service.Object.__init__(self, bus_name, '/')
@dbus.service.method('fm.last.api.account', out_signature="s")
def getUsername(self):
## How do I get this method done asynchronously ??
## For example, this method should go off and retrieve the "username"
## asynchronously. When this method returns, the "username" isn't available
## immediately but will be made available at a later time.
Twistedのglib2リアクターを使用しています。
更新:この動作を実装できることはわかっています-DBusにはメソッド呼び出しへの「シリアル」(一意の識別子)が含まれており、呼び出されたメソッドは「呼び出し」と「応答」を照合するためにこの識別子にアクセスできます。