Using cron and dbus default tip
authorMichael Smith <smithm@netapps.com.au>
Sun Aug 30 15:02:46 2009 +1000 (2009-08-30)
changeset 132a2779e53a76
parent 12 899fa9589f85
Using cron and dbus
crontab
mokod
parse_gps
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/crontab	Sun Aug 30 15:02:46 2009 +1000
     1.3 @@ -0,0 +1,1 @@
     1.4 +* * * * * /home/root/moko-utils/mokod
     2.1 --- a/mokod	Sun Aug 30 13:28:34 2009 +1000
     2.2 +++ b/mokod	Sun Aug 30 15:02:46 2009 +1000
     2.3 @@ -1,5 +1,8 @@
     2.4  #! /bin/sh
     2.5  UTIL=/home/root/moko-utils
     2.6  # Enable the GPS
     2.7 +DBUSCALL_='dbus-send --print-reply=undocumented --system --type=method_call --dest=' 
     2.8 +${DBUSCALL_}org.freesmartphone.ousaged /org/freesmartphone/Usage org.freesmartphone.Usage.SetResourcePolicy string:GPS string:enabled
     2.9  echo 1 > /sys/bus/platform/devices/neo1973-pm-gps.0/power_on
    2.10 -tail -f /dev/ttySAC1 | $UTIL/parse_gps >> /home/root/location
    2.11 +res=`${DBUSCALL_}org.freedesktop.Gypsy /org/freedesktop/Gypsy org.freedesktop.Gypsy.Position.GetPosition | cut -d" " -f 5`
    2.12 +echo "`date -u "+%Y-%m-%d %H:%M:%S"` $res" >> /media/mmcblk0p2/home/root/location
     3.1 --- a/parse_gps	Sun Aug 30 13:28:34 2009 +1000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,27 +0,0 @@
     3.4 -#! /bin/sh
     3.5 -UTIL=/home/root/moko-utils
     3.6 -last_lat=0
     3.7 -last_lon=0
     3.8 -while [ 1 ]
     3.9 -do
    3.10 -    read line
    3.11 -    if [ $? -ne 0 ]
    3.12 -    then
    3.13 -        exit
    3.14 -    fi
    3.15 -    process=`echo $line | cut -d"," -f 1`
    3.16 -    case $process in
    3.17 -        \$GPGGA)
    3.18 -            LON=`echo $line | cut -d"," -f 5`
    3.19 -            LAT=`echo $line | cut -d"," -f 3`
    3.20 -            if [ "$last_lat$last_lon" != "$LAT$LON" ]
    3.21 -            then
    3.22 -                last_lat=$LAT
    3.23 -                last_lon=$LON
    3.24 -                echo "`date -u "+%Y-%m-%d %H:%M:%S"` $LAT $LON"
    3.25 -#    echo "line [$line]"
    3.26 -            fi
    3.27 -        ;;
    3.28 -    esac
    3.29 -done
    3.30 -#$GPGGA,065852.00,5613.022527,N,00306.725890,W,1,05,0.5,158.0,M,0.277000,M,-0.010 0515,*7A