Concurrent usage of mmcli
João M. S. Silva
joao.m.santos.silva at gmail.com
Tue Oct 6 08:09:51 PDT 2015
Thank you for your explanations in both posts.
On 10/06/2015 10:40 AM, Aleksander Morgado wrote:
> There really is no need to do this, I believe. If you're sending
> multiple SMS messages, you should first create the corresponding SMS
> object in ModemManager, and then send each of the SMS messages one by
> one. I see your modem is a Huawei one, AT-based, so the action of
> sending an SMS is done via AT commands. Well, apart from the enabling
> operation, there *shouldn't* be any issue when trying to send multiple
> SMS messages from different mmcli operations. Are you having any
> issues with the SMS sending operations?
I don't have issues running my script which creates and sends the SMS. I
attach the script.
Recently, I've been considering running the script from 2 different
sources. So, 2 different processes may be calling this script
at the same time, at unpredictable times. That's where the modem usage
conflict appears.
But I believe that checking for the output of the enable command +
sleeping, as you suggest, will suffice.
João M. S. Silva
P.S.: Yesterday I came to know of another program, smstools, that uses
the file methodology: http://smstools3.kekekasvi.com/index.php?p=s3
-------------- next part --------------
#!/bin/bash
# arguments
text=$1
number=$2
test=$3
# modem re-scan
mmcli -S
# search for modem number
modem=-1
for i in `seq 0 9`; do
mmcli -m $i
if [ $? -eq 0 ]; then
modem=$i
break;
fi
done
if [ $modem -eq -1 ]; then
exit 1
fi
# enable
mmcli -m ${modem} -e
# connect
mmcli -m ${modem} --simple-connect="apn=internet"
# create SMS
sms=$(mmcli -m ${modem} \
--messaging-create-sms="text='${text}',number=${number}" \
| awk '$1 ~/freedesktop/ {print $1}')
# show SMS
mmcli -m ${modem} -s ${sms}
# send SMS
if [ "${test}" == "0" ]; then
mmcli -m ${modem} -s ${sms} --send
fi
# delete SMS
mmcli -m ${modem} --messaging-delete-sms=${sms}
# disconnect
mmcli -m ${modem} --simple-disconnect
# disable
mmcli -m ${modem} -d
More information about the ModemManager-devel
mailing list