View Single Post
peterleinchen's Avatar
Posts: 4,117 | Thanked: 8,901 times | Joined on Aug 2010 @ Ruhrgebiet, Germany
#127
Hey nicolai,

here is some shell code, which I use to detect online state when switching from one SIM to another (dual adapter).

Code:
#give some/infinite time to enter PIN (if SIM requests PIN and only needed for IAP and call forwarding)
#this will wait until cell modem gets online after switching
if [ "$3" != "" -o "$7" != "" ]; then
    /usr/bin/dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteDialog string:"We need to wait for cell modem to get online ..." uint32:4 string:"ack"
    sleep 3
    scount=0
    while [ "`cat /var/run/ssc`" != "online" ] 
    do
        /usr/bin/dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:"still waiting for cell modem to get online ..."
        if [ $scount < 30 ]; then
            sleep 3
            let scount+=3
        elif [ $scount < 60 ]; then
            sleep 5
            let scount+=5
        else  
            sleep 10
        fi
    done
    /usr/bin/dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteDialog string:"Done, we are online!" uint32: string:
fi
Where I think, you are interested only in that line
Code:
    while [ "`cat /var/run/ssc`" != "online" ]
I wait infinite until I detect this and then continue to connect specific IAP.

Hope this helps.
 

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