script to send and read incoming SMS
Matthias Huber
matthias.huber at wollishausen.de
Tue Oct 27 19:25:54 CET 2009
RANJAN schrieb:
>
>
> On Tue, Oct 27, 2009 at 11:02 PM, Matthias Huber
> <matthias.huber at wollishausen.de
> <mailto:matthias.huber at wollishausen.de>> wrote:
>
> RANJAN schrieb:
>
> Hi,
>
> Any idea about a simple script to send and read the received
> SMS on the FR in python?
>
> i tried it at the moment: for example:
>
> mdbus -s org.freesmartphone.ogsmd /org/freesmartphone/GSM/Device
> org.freesmartphone.GSM.SMS.SendMessage 0049987654321 "test
> message" []
>
> is this ok, or do you want a python script ?
>
>
> A script would help but I guess it is about creating an object and
> calling the function using it.
>
> Sriranjan
>
of course, what else, but because i tried it already, you must not
reinvent the wheel again:
root at om-gta02 ~/contactx # cat sms_read.py
#!/usr/bin/python
import sys
import dbus
from dbus.mainloop.glib import DBusGMainLoop
DBusGMainLoop(set_as_default=True)
bus = dbus.SystemBus()
device = bus.get_object( 'org.freesmartphone.ogsmd',
'/org/freesmartphone/GSM/Device' )
iface = dbus.Interface(device, 'org.freesmartphone.GSM.SIM')
for i in iface.RetrieveMessagebook("all"):
print repr(i)
root at om-gta02 ~/contactx # cat sms_send.py
#!/usr/bin/python
import sys
import dbus
from dbus.mainloop.glib import DBusGMainLoop
DBusGMainLoop(set_as_default=True)
bus = dbus.SystemBus()
gsm_device_obj = bus.get_object( 'org.freesmartphone.ogsmd',
'/org/freesmartphone/GSM/Device' )
gsm_sms_iface = dbus.Interface(gsm_device_obj, 'org.freesmartphone.GSM.SMS')
gsm_sms_iface.SendMessage( sys.argv[1], sys.argv[2], [] )
--
Mit freundlichen Grüssen
Matthias Huber
Kohlstattstr. 14
86459 Wollishausen
Tel: 08238-7998
LPI000181125
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openmoko.org/pipermail/devel/attachments/20091027/09532259/attachment.htm
More information about the devel
mailing list