diff --git a/.getardoplist-cron b/.getardoplist-cron index 67692fb..4659dd3 100755 --- a/.getardoplist-cron +++ b/.getardoplist-cron @@ -66,7 +66,18 @@ if [[ $? -eq 0 ]]; then echo "Depending on your internet speed" else - exit + #check for internet before attempting to download the list + + internet=1 #set the test to false + + while [ "$internet" = 1 ]; do + echo "check for internet connection" + ping -c 5 8.8.8.8 + internet=$? + sleep 60 #wait one minute before trying again + done + +echo "Internet connection detected" fi #remove old files before downloading new ones if [ -f $THIRTY ]; then diff --git a/cat-functions b/cat-functions index ffbeda5..0e9d006 100644 --- a/cat-functions +++ b/cat-functions @@ -246,7 +246,7 @@ POSITION(){ POST=$(yad --form --width=420 --text-align=center --center --title="Position" --text-align=center \ --image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \ --text="Position Reports by KM4ACK" \ ---field="Choose":CB "Post Position|Single Station Request|All Nearby Stations" \ +--field="Choose":CB "Post Position|Single Station Request|All Nearby Stations|100 Mobile Stations" \ --field="Enter Call Below ONLY for Single Station Requests":LBL \ --field="Call Sign-SSID" \ --field="Comment for Post Position" \ @@ -283,6 +283,11 @@ elif [ "$REPORT" = "All Nearby Stations" ]; then SUBJECT="REQUEST" BODY="WL2K_NEARBY" COMPOSE +elif [ "$REPORT" = "100 Mobile Stations" ]; then + TO="INQUIRY" + SUBJECT="REQUEST" + BODY="WL2K_MOBILES" + COMPOSE fi diff --git a/catalog b/catalog index efa8757..18329d6 100755 --- a/catalog +++ b/catalog @@ -18,6 +18,8 @@ yad --form --width=420 --text-align=center --center --title="Pat Catalog" --text --field="Position Reports":fbtn 'bash -c "kill -USR1 $YAD_PID; source $MYPATH/cat-functions; POSITION"' \ --field="Propagation Reports":fbtn 'bash -c "kill -USR1 $YAD_PID; source $MYPATH/cat-functions; PROPAGATION"' \ --field="News Reports":fbtn 'bash -c "kill -USR1 $YAD_PID; source $MYPATH/cat-functions; NEWS"' \ +--field="Send SMS":fbtn 'bash -c "kill -USR1 $YAD_PID; $HOME/patmenu2/sms/manage-sms"' \ +--field="Convert WL2K_NEARBY to APRS":fbtn 'bash -c "kill -USR1 $YAD_PID; $HOME/patmenu2/convert_to_aprs"' \ --button="Main Menu":1 QUIT=$? diff --git a/changelog b/changelog index a7a74b6..dc17605 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,15 @@ -release=2.8.0 +release=2.9.0 Changelog +2.9.0 add 100 Mobiles to Position Request screen in catalog - https://github.com/km4ack/patmenu2/issues/51 + fix stop modems - https://github.com/km4ack/patmenu2/issues/51 + add wait for internet to getardoplist-cron - https://github.com/km4ack/patmenu2/issues/50 + add convert WL2K_NEARBY to APRS in Pat Catalog - Thanks to Kenny, KC4OJS for the idea! + add convert_to_aprs file + fix issue #54 when starting VARA modems - https://github.com/km4ack/patmenu2/issues/54 + add sms text feature + add sound card to quick stats + fix typo - https://github.com/km4ack/patmenu2/issues/57 2.8.0 redesign layout of main screen add new modem menu add vara modem start (beta) diff --git a/convert_to_aprs b/convert_to_aprs new file mode 100755 index 0000000..cdfca09 --- /dev/null +++ b/convert_to_aprs @@ -0,0 +1,91 @@ +#!/bin/bash + +#scirpt to convert WL2K_NEARBY to POS file +#that can be imported into YAAC +#KM4ACK 01AUGUST2022 + +MYPATH=$HOME/patmenu2 +LOGO=$MYPATH/pmlogo.png +MAIN=$MYPATH/./catalog +CONFIG=$HOME/.config/pat/config.json +PATCALL=$(grep mycall $HOME/.config/pat/config.json | head -1 | sed 's/"mycall": "//;s/",//;s/ //g') +LIST=$HOME/.local/share/pat/mailbox/$PATCALL/in +MAILBOX=$HOME/.local/share/pat/mailbox/$PATCALL/in + + + +#remove exiting file if it exist +if [ -f $HOME/Desktop/gateways.pos ]; then +rm $HOME/Desktop/gateways.pos +fi + +#give user feedback +yad --center --timeout=2 --timeout-indicator=top --no-buttons \ +--text="Processing File" & + +#Look for the WL2K_NEARBY email +COUNT=0 +#var=$((var+1)) +for file in $MAILBOX/* +do + NEARBY_LIST=$(grep WL2K_NEARBY $file) + if [ -n "$NEARBY_LIST" ]; then + COUNT=$((COUNT+1)) + if [ $COUNT -gt 1 ]; then + #Warn user about multiple WL2K_NEARBY Reports in inbox + yad --form --width=500 --text-align=center --center --title="WL2K to ARPS Object" --text-align=center \ + --image ${LOGO} --window-icon=${LOGO} --image-on-top --separator="|" --item-separator="|" \ + --text="Multiples Found\rBe sure only one WL2K_NEARBY report\ris in your inbox. Multiples will cause erroneous data." \ + --button=gtk-ok + $MAIN & + exit + fi + FILE=$file + fi +done + +#create a copy to work with +cp $FILE /run/user/$UID/tempgatelist + +#check that we have a file. warn user if not +if [ $? = 1 ]; then +yad --form --width=500 --text-align=center --center --title="WL2K to ARPS Object" --text-align=center \ +--image ${LOGO} --window-icon=${LOGO} --image-on-top --separator="|" --item-separator="|" \ +--text="FAILED\rNo Nearby (WL2K_NEARBY) File Found in Inbox" +$MAIN & +exit +fi + +#remove everything but the data we need at the top of the file +sed -i '1,17d' /run/user/$UID/tempgatelist + +###########NOTE############# +#APRS symbol lookup table can be found at +#https://4.bp.blogspot.com/-ewK-9I_62wk/WIMI_LFpEII/AAAAAAAAWYA/xMso0AANY649LEWvOAjMIsmyPLWBwOszQCLcB/s1600/KWFAPRS_LUTv2.png +#In the echo command below I have used "\a" which produces a red diamond on the map. The "\" goes between the $LAT $LONG and the +#second character goes between the $LONG and $Comment +#########End Note########### + +#process the file +while read -r line; do + CALL=$(echo $line | awk '{print $1}') + CALL=`printf "%-9s" $CALL` + LAT=$(echo $line | awk '{print $5}' | sed 's/-//') + LONG=$(echo $line | awk '{print $6}' | sed 's/-//') + COMMENT=$(echo $line | awk '{$1=$2=$3=$4=$5=$6=$7=$8=""; print $0}' | sed -e 's/^[ \t]*//') + TIME=$(date -u +%H%M%S) + +# echo ";$CALL*$TIME""h""$LAT/$LONG-$COMMENT" >> ~/Desktop/gateways.pos (Produces a house on the map) + echo ";$CALL*$TIME""h""$LAT\\$LONG""a""$COMMENT" >> ~/Desktop/gateways.pos #(Produces a red diamond on the map) +done < /run/user/$UID/tempgatelist + +#let user know processing is finished +yad --form --width=500 --text-align=center --center --title="WL2K to ARPS Object" --text-align=center \ +--image ${LOGO} --window-icon=${LOGO} --image-on-top --separator="|" --item-separator="|" \ +--text="Processing done.\rA gateways.pos file has been created and\r is on your desktop ready to import into YAAC." \ +--button=gtk-ok + +#remove the temp file +rm /run/user/$UID/tempgatelist +$MAIN & +exit \ No newline at end of file diff --git a/pat-functions b/pat-functions index 493cd2e..136da71 100644 --- a/pat-functions +++ b/pat-functions @@ -147,6 +147,14 @@ TELNET=$(grep telnet, $SMD) ARDOP=$(grep ardop, $SMD) AX25=$(grep ax25, $SMD) PAT=$(pidof pat) +CARD=$(arecord -l | grep USB | awk '{print $2;}' | sed 's/://') + +#Check if sound card found +if [ -z $CARD ]; then +CARD="Not found" +else +CARD="$CARD,0" +fi #Set telnet variable if [ -n "$TELNET" ]; then TELNET="telnet," @@ -183,6 +191,7 @@ yad --form --width=320 --text-align=center --center --title="Quick Stats" --text --field="Rig Control":RO "$RIG" \ --field="Pat Port":RO "$PORT" \ --field="Pat Server":RO "$PAT" \ +--field="Sound Card":RO "$CARD" \ --button=gtk-ok $MAIN & exit diff --git a/sms/add-carrier b/sms/add-carrier new file mode 100755 index 0000000..4ad7434 --- /dev/null +++ b/sms/add-carrier @@ -0,0 +1,39 @@ +#!/bin/bash + +#script to add phone carries to master list +#KM4ACK 02AUGUST2022 + +FILE=$HOME/patmenu2/sms/cellproviders.txt +MYTEMP=/run/user/$UID/templist.txt +MAIN=$HOME/patmenu2/sms/manage-sms +export MYPATH=$HOME/patmenu2 +LOGO=$MYPATH/pmlogo.png + +INFO=$(PARSER='OFS="\n" {print $1}' + +tail -300 $FILE | awk "$PARSER" | \ +yad --title="Search Results" --width=1100 --height=500 \ + --image $LOGO --window-icon=$LOGO --image-on-top --multiple \ + --center --list --text="Carrier List" \ + --column Carrier \ + --button="Cancel":1 \ + --button="Add Carrier":2 > $MYTEMP) +BUT=$? + +if [ $BUT = 1 ]; then +$MAIN & +exit +elif [ $BUT = 252 ]; then +exit +fi + +sed -i 's/|//g' $MYTEMP + +cat $MYTEMP >> $HOME/patmenu2/sms/myphonelist.txt +sort $HOME/patmenu2/sms/myphonelist.txt > /run/user/$UID/sortedlist +mv /run/user/$UID/sortedlist $HOME/patmenu2/sms/myphonelist.txt + +yad --center --timeout=3 --timeout-indicator=top --no-buttons --text="The carrier list has been updated" + +$MAIN & +exit \ No newline at end of file diff --git a/sms/cellproviders.txt b/sms/cellproviders.txt new file mode 100644 index 0000000..00edbd6 --- /dev/null +++ b/sms/cellproviders.txt @@ -0,0 +1,72 @@ +3-River-Wireless=@sms.3rivers.net +ACS-Wireless=@paging.acswireless.com +Alltel=@message.alltel.com +ATT=@txt.att.net +Bell-Canada=@txt.bellmobility.ca +Bell-Canada=@bellmobility.ca +Bell-Mobility=@txt.bell.ca +Bell-Mobility=@txt.bellmobility.ca +Blue-Sky-Frog=@blueskyfrog.com +Bluegrass-Cellular=@sms.bluecell.com +Boost-Mobile=@myboostmobile.com +BPL-Mobile=@bplmobile.com +Carolina-West=@cwwsms.com +Cellular-One=@mobile.celloneusa.com +Cellular-South=@csouth1.com +Centennial-Wireless=@cwemail.com +CenturyTel=@messaging.centurytel.net +Cingular=@txt.att.net +Clearnet=@msg.clearnet.com +Comcast=@comcastpcs.textmsg.com +Corr-Wireless=@corrwireless.net +Dobson=@mobile.dobson.net +Edge-Wireless=@sms.edgewireless.com +Fido=@fido.ca +Golden-Telecom=@sms.goldentele.com +Helio=@messaging.sprintpcs.com +Houston-Cellular=@text.houstoncellular.net +Idea-Cellular=@ideacellular.net +Illinois-Valley-Cellular=@ivctext.com +Inland-Cellular=@inlandlink.com +MCI=@pagemci.com +Metroncall=@page.metrocall.com +Metrocall-2-Way=@my2way.com +Metro-PCS=@mymetropcs.com +Microcell=@fido.ca +Midwest-Wireless=@clearlydigital.com +Mobilcomm=@mobilecomm.net +MTS=@text.mtsmobility.com +Nextel=@messaging.nextel.com +OnlineBeep=@onlinebeep.net +PCS-One=@pcsone.net +Presidents-Choice=@txt.bell.ca +Public-Service-Cellular=@sms.pscel.com +Quest=@qwestmp.com +10digitphonenumber=@pcs.rogers.com +Rogers-Canada=@pcs.rogers.com +Satellink=.pageme@satellink.net +Southwestern-Bell=@email.swbw.com +Sprint=@messaging.sprintpcs.com +Sumcom=@tms.suncom.com +Surewest-Comms=@mobile.surewest.com +T-Mobile=@tmomail.net +Telus=@msg.telus.com +Tracfone=@txt.att.net +Triton=@tms.suncom.com +Unicel=@utext.com +US-Cellular=@email.uscc.net +Solo-Mobile=@txt.bell.ca +Sprint=@messaging.sprintpcs.com +Sumcom=@tms.suncom.com +Surewest=@mobile.surewest.com +T-Mobile=@tmomail.net +Telus=@msg.telus.com +Triton=@tms.suncom.com +Unicel=@utext.com +US-Cellular=@email.uscc.net +US-West=@uswestdatamail.com +Verizon=@vtext.com +Virgin-Mobile=@vmobl.com +Virgin-Mobile-Canada=@vmobile.ca +West-Central=@sms.wcc.net +Western-Wireless=@cellularonewest.com diff --git a/sms/current-carriers b/sms/current-carriers new file mode 100755 index 0000000..28d3d53 --- /dev/null +++ b/sms/current-carriers @@ -0,0 +1,25 @@ +#!/bin/bash + +#script to add phone carries to master list +#KM4ACK 02AUGUST2022 + +FILE=$HOME/patmenu2/sms/myphonelist.txt +MYTEMP=/run/user/$UID/templist.txt +MAIN=$HOME/patmenu2/sms/manage-sms +export MYPATH=$HOME/patmenu2 +LOGO=$MYPATH/pmlogo.png + +INFO=$(PARSER='OFS="\n" {print $1}' + +tail -300 $FILE | awk "$PARSER" | \ +yad --title="Search Results" --width=600 --height=500 \ + --image $LOGO --window-icon=$LOGO --image-on-top --multiple \ + --center --list --text="Carrier List" \ + --column Carrier \ + --button=gtk-ok) +BUT=$? +if [ $BUT = 252 ]; then +exit +fi + +$MAIN \ No newline at end of file diff --git a/sms/manage-sms b/sms/manage-sms new file mode 100755 index 0000000..7a3957c --- /dev/null +++ b/sms/manage-sms @@ -0,0 +1,28 @@ +#!/bin/bash + +#Pat SMS Manager +#20220720 KM4ACK + + +export MYPATH=$HOME/patmenu2 +LOGO=$MYPATH/pmlogo.png +MAIN=$MYPATH/./patmenu + + +yad --form --width=420 --text-align=center --center --title="Pat SMS Manager" --text-align=center \ +--image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \ +--text="Pat SMS Manager by KM4ACK" \ +--field="Show Current Carrier List":fbtn 'bash -c "kill -USR1 $YAD_PID; $MYPATH/sms/current-carriers"' \ +--field="Add Carriers":fbtn 'bash -c "kill -USR1 $YAD_PID; $MYPATH/sms/add-carrier"' \ +--field="Remove Carriers":fbtn 'bash -c "kill -USR1 $YAD_PID; $MYPATH/sms/remove-carrier"' \ +--field="Send Text Message":fbtn 'bash -c "kill -USR1 $YAD_PID; $MYPATH/sms/winlink2sms"' \ +--button="Main Menu":1 + +BUT=$? + +if [ $BUT = 1 ]; then +$MAIN & +exit +elif [ $BUT = 252 ]; then +exit +fi \ No newline at end of file diff --git a/sms/myphonelist.txt b/sms/myphonelist.txt new file mode 100644 index 0000000..72d241e --- /dev/null +++ b/sms/myphonelist.txt @@ -0,0 +1,5 @@ +ATT=@txt.att.net +Sprint=@messaging.sprintpcs.com +T-Mobile=@tmomail.net +Verizon=@vtext.com +Unknown= diff --git a/sms/remove-carrier b/sms/remove-carrier new file mode 100755 index 0000000..f227414 --- /dev/null +++ b/sms/remove-carrier @@ -0,0 +1,39 @@ +#!/bin/bash + +#script to remove phone carries to master list +#KM4ACK 02AUGUST2022 + +FILE=$HOME/patmenu2/sms/myphonelist.txt +MYTEMP=/run/user/$UID/templist.txt +MAIN=$HOME/patmenu2/sms/manage-sms +export MYPATH=$HOME/patmenu2 +LOGO=$MYPATH/pmlogo.png + +INFO=$(PARSER='OFS="\n" {print $1}' + +tail -300 $FILE | awk "$PARSER" | \ +yad --title="Search Results" --width=600 --height=500 \ + --image $LOGO --window-icon=$LOGO --image-on-top --multiple \ + --center --list --text="Current Carrier List" \ + --column Carrier \ + --button="Cancel":1 \ + --button="Remove Carrier":2 > $MYTEMP) +BUT=$? + +if [ $BUT = 1 ]; then +$MAIN & +exit +elif [ $BUT = 252 ]; then +exit +fi + +sed -i 's/|//g' $MYTEMP + +while read -r line; do + sed -i "/$line/d" $FILE +done < $MYTEMP + +yad --center --timeout=3 --timeout-indicator=top --no-buttons --text="The carrier list has been updated" + +$MAIN & +exit \ No newline at end of file diff --git a/sms/winlink2sms b/sms/winlink2sms new file mode 100755 index 0000000..6fb94bf --- /dev/null +++ b/sms/winlink2sms @@ -0,0 +1,93 @@ +#!/bin/bash + +#Script to send text message to regular cellphones via Winlink +#20JULY2022 KM4ACK + +#subject CANNOT be blank +SUBJECT="Winlink text msg" +#PHONE_LIST=/run/user/$UID/my_phonelist.txt +PHONE_LIST=$HOME/patmenu2/sms/myphonelist.txt +MAIN=$HOME/patmenu2/sms/manage-sms + +UNKNOWN(){ +#send message to every carrier in the list +while read line in ; do +CARRIER=$(echo $line | awk -F "=" '{print $2}') +if [ -n "$CARRIER" ]; then +TO="-c $PHONE$CARRIER" +echo $TO >> /run/user/$UID/$PHONE.txt +fi +done <$PHONE_LIST + +#remove the "-c" from the first address on the list +sed -i '0,/-c /{s/-c //}' /run/user/$UID/$PHONE.txt +TO=$(cat /run/user/$UID/$PHONE.txt) +rm /run/user/$UID/$PHONE.txt + +#compose message and send to pat outbox +echo "$MESSAGE" | pat compose $TO -s "$SUBJECT" +yad --center --timeout=3 --timeout-indicator=top --no-buttons --text="Message posted to Pat outbox." & +exit +} + +#get list of carriers to populate dialog carrier box on main screen +CARRIER=$(cat $PHONE_LIST | awk -F"=" '{print $1"|"}') + +#main menu +SETTING=$(yad --center --width=500 --wrap --window-icon=$HOME/Pi-APRS/ISS.png \ +--title="Send Text Messages via Winlink" --text="Please complete the following:" \ +--form --separator="|" --item-separator="|" \ +--field="Phone Number" "$PHONE" \ +--field="Carrier":CB "${CARRIER[@]}" \ +--field="Message" "$MSG" \ +--button="Post Message" \ +--button="Cancel" +) +BUT=$? + +#check to see if user wants to exit +if [ $BUT = 252 ]; then +echo "goodbye" +exit +elif [ $BUT = 1 ]; then +$MAIN & +exit +fi + +#check to see if carrier is unknown. If so, send to UNKNOWN function. +CARRIER=$(echo $SETTING | awk -F"|" '{print $2}' | sed 's/ //') +if [ "$CARRIER" = 'Unknown' ]; then +PHONE=$(echo $SETTING | awk -F"|" '{print $1}') +MESSAGE=$(echo $SETTING | awk -F"|" '{print $3}') +UNKNOWN +fi + + +PHONE=$(echo $SETTING | awk -F"|" '{print $1}' | sed 's/ //g') +CARRIER=$(echo $SETTING | awk -F"|" '{print $2}' | sed 's/ //g') +CARRIER=$(cat $PHONE_LIST | grep "$CARRIER" | sed 's/.*=//') +TO=$PHONE$CARRIER +MESSAGE=$(echo $SETTING | awk -F"|" '{print $3}') + +if [ -z "$PHONE" ]; then +yad --center --width=300 --wrap --window-icon=$HOME/Pi-APRS/ISS.png \ +--title="ERROR" --text="Phone Number Can't Be Blank!" \ +--button=gtk-ok +$MAIN & +exit +fi + + + +echo "$MESSAGE" | pat compose "$TO" -s "$SUBJECT" + +yad --center --timeout=3 --timeout-indicator=top --no-buttons --text="Message posted to Pat outbox." +$MAIN & +exit + + + + + + + diff --git a/start-vara-fm b/start-vara-fm index c6378d4..6493d92 100755 --- a/start-vara-fm +++ b/start-vara-fm @@ -99,7 +99,7 @@ SETRIG fi echo "starting VARA-FM" -/usr/local/bin/wine /home/pi/.wine/drive_c/VARA\ FM/VARAFM.exe > /dev/null 2>&1 & +/usr/local/bin/wine $HOME/.wine/drive_c/VARA\ FM/VARAFM.exe > /dev/null 2>&1 & sleep 7 #give vara time to start #verify vara has started diff --git a/start-vara-hf b/start-vara-hf index 937d1b1..5a971dd 100755 --- a/start-vara-hf +++ b/start-vara-hf @@ -98,8 +98,8 @@ PIDCTL=$(pidof rigctld) SETRIG fi -echo "starting VARA-FM" -/usr/local/bin/wine /home/pi/.wine/drive_c/VARA/VARA.exe > /dev/null 2>&1 & +echo "starting VARA HF" +/usr/local/bin/wine $HOME/.wine/drive_c/VARA/VARA.exe > /dev/null 2>&1 & sleep 7 #give vara time to start #verify vara has started diff --git a/stop-modems b/stop-modems index 1973876..fe9efe4 100755 --- a/stop-modems +++ b/stop-modems @@ -1,14 +1,19 @@ #!/bin/bash #20191117 km4ack +#20220614 edit by KM4ACK MYPATH=$HOME/patmenu2 LOGO=$MYPATH/pmlogo.png #stop all modems that might be running -sudo killall direwolf piardopc kissattach piARDOP_GUI > /dev/null 2>&1 +sudo killall direwolf piardopc kissattach piARDOP_GUI rigctld > /dev/null 2>&1 sudo rfcomm release /dev/rfcomm0 > /dev/null 2>&1 +VARA=$(ps aux | grep wine | grep VARA | head -1 | awk '{print $2}') +kill -9 $VARA > /dev/null 2>&1 +VARA=$(ps aux | grep wine | grep VARA | head -1 | awk '{print $2}') +kill -9 $VARA > /dev/null 2>&1 yad --title="Modem Stopped" --width=400 --height=100 \ --image $LOGO --window-icon=$LOGO --image-on-top --text-align=center \ @@ -17,4 +22,4 @@ yad --title="Modem Stopped" --width=400 --height=100 \ sleep 2 -exit 0 +exit 0 \ No newline at end of file