maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Help converting dbus-scripts statement to python listen signal (https://talk.maemo.org/showthread.php?t=65430)

colchaodemola 2010-11-10 23:12

Help converting dbus-scripts statement to python listen signal
 
Hi, i have a dbus-scripts who says:
MYPROGRAM * * com.nokia.mce.signal sig_call_state_ind none *


Anyone know how can i listen for that event using python like the example below?
self.bus.add_signal_receiver(self.update_widget, path='/com/nokia/phone/SMS', dbus_interface='Phone.SMS', signal_name='IncomingSegment')


what would be the parameters in python ?

thanks

nicolai 2010-11-12 16:04

Re: Help converting dbus-scripts statement to python listen signal
 
Code:

import dbus
import gobject
from dbus.mainloop.glib import DBusGMainLoop

def handle_call_state_ind(call_state, em_state):
    print call_state, em_state

DBusGMainLoop(set_as_default=True)
bus = dbus.SystemBus()
bus.add_signal_receiver(handle_call_state_ind, path='/com/nokia/mce/signal', dbus_interface='com.nokia.mce.signal', signal_name='sig_call_state_ind')

gobject.MainLoop().run()

The call_state_ind return parameters are described
here:
mce-dev


regards
Nicolai

colchaodemola 2010-11-12 16:48

Re: Help converting dbus-scripts statement to python listen signal
 
Quote:

Originally Posted by nicolai (Post 871621)
Code:

import dbus
import gobject
from dbus.mainloop.glib import DBusGMainLoop

def handle_call_state_ind(call_state, em_state):
    print call_state, em_state

DBusGMainLoop(set_as_default=True)
bus = dbus.SystemBus()
bus.add_signal_receiver(handle_call_state_ind, path='/com/nokia/mce/signal', dbus_interface='com.nokia.mce.signal', signal_name='sig_call_state_ind')

gobject.MainLoop().run()

The call_state_ind return parameters are described
here:
mce-dev


regards
Nicolai

thanks nicolai , you helped me a lot !


All times are GMT. The time now is 03:56.

vBulletin® Version 3.8.8