View Single Post
Posts: 1,038 | Thanked: 3,981 times | Joined on Nov 2010 @ USA
#17
Originally Posted by marmistrz View Post
As far as I see, either wlancond or wps_ui is responsible for showing up the connection prompt.

Can we modify the dbus configuration, so that when a dbus signal is sent to com.nokia.wlancond a script is run?
You can add a dbus listener (in Python with add_signal_receiver) with a script like this:
Code:
#!/usr/bin/env python

import gobject, dbus
from dbus.mainloop.glib import DBusGMainLoop
 
#def handle_sms(sendernumber):
#    print 'Got New Message.'
#    print 'New message from %s' % sendernumber

def handle_sms2(event):
    print 'Got new event.'
#    print 'New event message %s' % event
    print 'First event element %s' % event[0][0]
    print 'First event element date  %d %d %d' % event[0][2][0]
    print 'First event phone number %s' % event[0][12]
    print 'First event message %s' % event[0][15]
 
print 'Setting up listener . . .'
DBusGMainLoop(set_as_default=True)
print 'Getting System Bus . . .'
#Aha, needs to be SessionBus on N9 see https://talk.maemo.org/showthread.php?t=95876
bus = dbus.SessionBus()
#print 'Adding signal receiver . . .'
#bus.add_signal_receiver(handle_sms, path='/org/freedesktop/Telepathy/Connection/ring/tel/ring/text30', dbus_interface='org.freedesktop.Telepathy.Channel.Interface.Messages', signal_name='MessageReceived')
print 'Adding event receiver . . .'
bus.add_signal_receiver(handle_sms2, path='/CommHistoryModel', dbus_interface='com.nokia.commhistory', signal_name='eventsAdded')
print 'Running main loop'
gobject.MainLoop().run()
print 'done'
Excuse the dust, this is a WIP that's never been cleaned up. Really just proves the concept that I can receive and do something with a received SMS.

It does not prevent other processes from getting that message. In this case, SMSs are still processed normally.
 

The Following 2 Users Say Thank You to robthebold For This Useful Post: