Re: Modemmanager - how to send sms? - receiving is ok



On Tue, 2012-01-31 at 13:08 +0100, PongráczI wrote:
> Dear All,
> 
> I  spent several days to make sms sending work, but in one hand, I
> failed, in the other hand, I did not find clear answer/solution on the
> internet.

I did recently add a test tool to ModemManager git to show how this is
done, after I fixed MM to use PDU mode on devices that don't support
text mode.  freedesktop cgit is down to the relevant parts are (in
python+dbus):

msg_dict = dbus.Dictionary(
    {
        dbus.String('number') : dbus.String(number),
        dbus.String('text') : dbus.String(message),
        dbus.String('smsc') : dbus.String(smsc),
        dbus.String('validity') : dbus.UInt32(validity)
    },
    signature=dbus.Signature("sv")
)

sms_iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.ModemManager.Modem.Gsm.SMS')
try:
    indexes = sms_iface.Send(msg_dict)
    print "Message index: %d" % indexes[0]
except Exception, e:
    print "Sending message failed: %s" % e

> So, I decided to ask you, experts about this question.
> 
> I explain the needed conditions and actual results.
> 
> Conditions (recent situation):
> 
>       * usb based mobile broadband gsm stick (all used stick is
>         working well, usb_modeswitch handles them correctly),
>       * modemmanager is running and lock the GSM modem, because the
>         internet connection is live (working well),
>       * should use with dbus-send executable from command line,

You can use dicts with dbus-send if dbus-send is new enough; it won't
look very pretty but it's possible.  Python is a lot nicer.

>       * it would be nice to not interrupt the internet connection,

This depends on your 3G stick.  If the stick exposes either a
pseudo-ethernet network port (like Ericsson devices and some newer
Huawei, ZTE, Sierra, Option ones) then you're fine; otherwise it must
expose two AT-capable ttys so that when connected the other can be used
to send the SMS.

>       * kernel: 2.6.34,
>       * operating system: i486 optimized debian testing
>       * usb_modeswitch: compiled from source, due to a necessary
>         bugfix: 1.2.2-1
> 
> My positive test results using dbus from bash:
> 
>       * I succeed to read sms from the gsm modem stick, signal
>         quality, information by using dbus-send executable from
>         command line, while the internet connection was live. In other
>         words, I am able to read sms and other information from the
>         modem, using modemmanager's dbus interface.
>       * I can enable/disable the internet connection using nmcli too.
>         Networkmanager makes a good job, thank you guys.
>       * Using the mentioned tools, I am able to recover internet
>         connection automatically, even the stick removed/inserted
>         again.
> 
> My negative (unsuccesful) tests:
>  
> 
>       * latest mm-send-sms.py failed, I got this error message (Error
>         org.freedesktop.ModemManager.Modem.Gsm.Unknown: Unknown error)
>         and it seems this python script make something with the dbus,
>         because after that I am not able use the dbus-send to receive
>         sms list from the stick, so, from my point of view, this
>         python script kills the modem in this way. 

I'd try current git master, or the latest MM_05 branch of what will
become MM 0.5.2.  That has the SMS fixes that I talk about above, plus
the reworked "sms-send.py" tool which I've tested quite a bit.

Dan

>         The internet connection was live during, before and after this
>         step, so, it seems it did not harm the data connection, but
>         only the sms related part of modem.
>       * I am not able to use the command line dbus-send to build up
>         the necessary data structure for sending SMS. Probably
>         I simply stupid, it is possible, but I did not succeed to
>         create the a{sv} structure. The internet connection was live
>         before/during/after this test.
> 
> My question is, how to send sms using modemmanager's dbus interface
> from command line, using dbus-send or python, without kill internet
> connection or sms functionality?
> 
> Sorry about my long article, I hope I wrote down everything. If not,
> please let me know. Any help are appreciated.
> 
> Thank you!
> 
> István
> 
> _______________________________________________
> networkmanager-list mailing list
> networkmanager-list gnome org
> http://mail.gnome.org/mailman/listinfo/networkmanager-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]