LoRa radio can be controlled via command line and web interface

master
marcel 2 years ago
parent e2b8a4b085
commit 1eea07e765
  1. 3
      CHANGELOG.md
  2. 2
      aprs_utils/beacon_ax2.txt
  3. 2
      aprs_utils/crontab.pe1rxf
  4. 33
      aprs_utils/pe1rxf-aprs-server.cfg
  5. 33
      aprs_utils/pe1rxf-aprs-server.cfg.defaults
  6. 18
      aprs_utils/process_traffic.sh
  7. 52
      aprs_utils/send_beacon_lora_radio.sh
  8. 30
      aprs_utils/send_message.sh
  9. 42
      aprs_utils/set_beacon.sh
  10. 130
      web-interface/index.php
  11. 339
      web-interface/send_message.php

@ -12,7 +12,8 @@ All notable changes to this project will be documented in this file.
## [0.0.1] - 2022-01-31
### Added
- Lora support fo an SX1278 connected to the RPi GPIO
- Lora support for an SX1278 connected to the RPi GPIO (driver)
- Lora radio can be controlled via web interface and command line the same way the other two radios already could.
### Deprecated
- RPi-LoRa-KISS-TNC shall be moved to a seperate repository

@ -1 +1 @@
/usr/sbin/beacon -d "APRX29" -s ax2 '!5302.78NL00707.91E&LoRa APRS RX iGATE (https://meezenest.nl/pe1rxf)'
/usr/sbin/beacon -d "APRX29" -s ax2 '!5302.78N/00707.91E-https://meezenest.nl/pe1rxf'

@ -40,4 +40,4 @@
#* * * * * /home/marcel/ham/aprs_utils/send_beacon_external_radio.sh
#Send beacon on AX2 (LoRa internal radio)
#* * * * * /home/marcel/ham/aprs_utils/send_beacon_internal_lora.sh
#* * * * * /home/marcel/ham/aprs_utils/send_beacon_lora_radio.sh

@ -71,3 +71,36 @@ ax1_message4_id=Message 4
ax1_message4_text=Fourth message
ax1_message4_destination=PE1RXF-7
ax1_message4_path=WIDE2-2
# LoRa radio settings
ax2_name=Digipeater LoRa
ax2_frequency=433.775 MHz
# Beacon time LoRa radio (ax2) in minutes. 0-60, where 0 disables beaconing.
ax2_beacon_time=0
ax2_beacon_destination=APRX29
ax2_beacon_path=none
ax2_beacon_position=!5302.78N/00707.91E-
ax2_beacon_comment=https://meezenest.nl/pe1rxf
ax2_beacon_file=/home/marcel/ham/aprs_utils/beacon_ax2.txt
# Predefined messages
ax2_message1_id=Message 1
ax2_message1_text=First message
ax2_message1_destination=PE1RXF-7
ax2_message1_path=WIDE2-2
ax2_message2_id=Message 2
ax2_message2_text=Second message
ax2_message2_destination=PE1RXF-7
ax2_message2_path=WIDE2-2
ax2_message3_id=Message 3
ax2_message3_text=Thirth message
ax2_message3_destination=PE1RXF-7
ax2_message3_path=WIDE2-2
ax2_message4_id=Message 4
ax2_message4_text=Fourth message
ax2_message4_destination=PE1RXF-7
ax2_message4_path=WIDE2-2

@ -69,3 +69,36 @@ ax1_message4_text=Fourth message
ax1_message4_destination=PE1RXF-7
ax1_message4_path=WIDE2-2
# LoRa radio settings
ax2_name=Digipeater LoRa
ax2_frequency=433.775 MHz
# Beacon time LoRa radio (ax2) in minutes. 0-60, where 0 disables beaconing.
ax2_beacon_time=0
ax2_beacon_destination=APRX29
ax2_beacon_path=none
ax2_beacon_position=!5302.78N/00707.91E-
ax2_beacon_comment=https://meezenest.nl/pe1rxf
ax2_beacon_file=/home/marcel/ham/aprs_utils/beacon_ax2.txt
# Predefined messages
ax2_message1_id=Message 1
ax2_message1_text=First message
ax2_message1_destination=PE1RXF-7
ax2_message1_path=WIDE2-2
ax2_message2_id=Message 2
ax2_message2_text=Second message
ax2_message2_destination=PE1RXF-7
ax2_message2_path=WIDE2-2
ax2_message3_id=Message 3
ax2_message3_text=Thirth message
ax2_message3_destination=PE1RXF-7
ax2_message3_path=WIDE2-2
ax2_message4_id=Message 4
ax2_message4_text=Fourth message
ax2_message4_destination=PE1RXF-7
ax2_message4_path=WIDE2-2

@ -82,7 +82,15 @@ while read LINE
PORT="ax1"
fi
# Lets do something with the frame from channel 1 or 2
# If call is still empty, frame not from channel 1 or 2, maybe from channel 3?
if [ -z $CALL ]; then
#CALL="$(grep -o -P "(?<=PE1RXF-3 R \*).+?\>"<<<$LINE)"
CALL="$(grep -oP "(?<=PE1RXF-3 R ).+?\>"<<<$LINE)"
PORT="ax2"
fi
# Lets do something with the frame from channel 1, 2 or 3
if [[ $CALL ]]; then
# Remove last character from string
@ -92,10 +100,12 @@ while read LINE
if [ $PORT == "ax0" ]; then
#FULL_PATH="$(grep -o -P '(?<=PE1RXF-1 R \*).+?:'<<<$LINE)"
FULL_PATH="$(grep -oP "(?<=PE1RXF-1 R ).+?:"<<<$LINE)"
else
#FULL_PATH="$(grep -o -P '(?<=PE1RXF-2 R \*).+?:'<<<$LINE)"
elif [ $PORT == "ax1" ]; then
#FULL_PATH="$(grep -o -P '(?<=PE1RXF-1 R \*).+?:'<<<$LINE)"
FULL_PATH="$(grep -oP "(?<=PE1RXF-2 R ).+?:"<<<$LINE)"
else
#FULL_PATH="$(grep -o -P '(?<=PE1RXF-3 R \*).+?:'<<<$LINE)"
FULL_PATH="$(grep -oP "(?<=PE1RXF-3 R ).+?:"<<<$LINE)"
fi
FULL_PATH="$(grep -o -P '(?<=\>).*'<<<$FULL_PATH)"

@ -0,0 +1,52 @@
#!/bin/bash
##################################################################################
# Send beacon via APRS channel 2 (ax1) #
# #
# (C)2021 M.T. Konstapel https://meezenest.nl/mees #
# #
# This file is part of PE1RXF-APRS-server. #
# #
# PE1RXF-APRS-server is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# PE1RXF-APRS-server is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with PE1RXF-APRS-server. If not, see <https://www.gnu.org/licenses/>. #
# #
##################################################################################
source /home/marcel/ham/aprs_utils/config.shlib; # load the config library functions
ConfigFile="/home/marcel/ham/aprs_utils/pe1rxf-aprs-server.cfg"
BEACON_FILE="$(config_get ax2_beacon_file $ConfigFile)"
if [ -f "$BEACON_FILE" ]; then
BEACON_TEXT=$(cat "$BEACON_FILE")
# The BEACON_FILE holds the command for sending a beacon. So make this file part of the script.
# I shouldn't really do this, as it is a potential security risk. But the BEACON_FILE is as safe as this script itself.
# The BEACON_FILE can not be altered via the web interface, but only by the main program. So it should be ok.
# But this makes the code potential self altering, which is bad! Realy realy bad!
# But than again, is it really not the same as calling an external program from the script, as this program can also be alterred.
# Anyway, enough of my rambling, let's continue with the script.
# To be safe, lets do some minimal safety checks before executing the external file:
# BEACON_FILE should only have one line:
NR_OF_LINES=$(awk 'END { print NR }' $BEACON_FILE)
# And this line should contain the beacon command:
RESULT=$(grep "/usr/sbin/beacon" $BEACON_FILE)
if [ -n "$RESULT" ] && [ $NR_OF_LINES -eq 1 ]; then
# Send the beacon
. $BEACON_FILE
fi
fi

@ -43,7 +43,7 @@ Help()
echo
echo "Syntax: set_beacon.sh [-i <interface>|-c <call>|-p <path>|-m <message>]"
echo "Options:"
echo "-i AX.25 interface (ax0 or ax1)"
echo "-i AX.25 interface (ax0, ax1 or ax2)"
echo "-c Destination call"
echo "-p Path: 0=none, WIDE2-1, WIDE2-2, WIDE3-3 or call of digipeater"
echo "-m Message to send."
@ -101,7 +101,7 @@ if [ "$Interface" == "ax0" ]; then
echo "$APRS_FRAME" > "$AX0_APRS_TRANSMIT_DIR"message.msg
#echo "$APRS_FRAME $AX0_APRS_TRANSMIT_DIR"
else
elif [ "$Interface" == "ax1" ]; then
# Log message
echo "$CURRENT_DATE_TIME,ax1,$Call,APRX29,$Message" >> $APRS_RECEIVED_MESSAGES_DIR$MESSAGE_FILE
@ -126,6 +126,32 @@ else
#"$APRS_CMD" > tmp.tmp
/usr/sbin/beacon "${args[@]}"
elif [ "$Interface" == "ax2" ]; then
# Log message
echo "$CURRENT_DATE_TIME,ax2,$Call,APRX29,$Message" >> $APRS_RECEIVED_MESSAGES_DIR$MESSAGE_FILE
# if call is less than 9 characters, add spaces at the end (according to the APRS protocol)
printf -v Call %-9.9s "$Call"
if [ "$Path" == "0" ]; then
APRS_FRAME="PE1RXF-3>APRX29::$Call:$Message"
args[0]=-d
args[1]="APRX29"
args[2]=-s
args[3]=ax2
args[4]=":$Call:$Message"
else
APRS_FRAME="PE1RXF-3>APRX29,$Path::$Call:$Message"
args[0]=-d
args[1]="APRX29 $Path"
args[2]=-s
args[3]=ax2
args[4]=":$Call:$Message"
fi
#echo "$APRS_FRAME"
#"$APRS_CMD" > tmp.tmp
/usr/sbin/beacon "${args[@]}"
fi

@ -50,6 +50,8 @@ UpdateCrontab()
# All those escaped characters were a nightmare, but in the end the resulting string was perfect. But executing the string directly from this script proved to be another nightmare:
# It appears that bash inserts additional escape characters, resulting in the command not working. The solution below is not very elegant, but hey...it works!
# Let's make a bash script, execute is and remove it again.
echo "#!/bin/bash"
echo "$sed_string"
echo "#!/bin/bash" > $sed_tmp_command_file
echo "$sed_string" >> $sed_tmp_command_file
chmod u+x $sed_tmp_command_file
@ -82,7 +84,7 @@ ConstructBeaconFile()
echo $ConstructBeaconFile_Beacon
echo $ConstructBeaconFile_Beacon > $ConstructBeaconFile_File
else
elif [ "${1}" == "ax1" ]; then
ConstructBeaconFile_Destination="$(config_get ax1_beacon_destination $ConfigFile)"
ConstructBeaconFile_Path="$(config_get ax1_beacon_path $ConfigFile)"
ConstructBeaconFile_Position="$(config_get ax1_beacon_position $ConfigFile)"
@ -104,6 +106,30 @@ ConstructBeaconFile()
ConstructBeaconFile_Beacon="/usr/sbin/beacon -d \"$ConstructBeaconFile_Destination $ConstructBeaconFile_Path\" -s ax1 '$ConstructBeaconFile_Position$ConstructBeaconFile_Comment'"
fi
echo $ConstructBeaconFile_Beacon > $ConstructBeaconFile_File
elif [ "${1}" == "ax2" ]; then
ConstructBeaconFile_Destination="$(config_get ax2_beacon_destination $ConfigFile)"
ConstructBeaconFile_Path="$(config_get ax2_beacon_path $ConfigFile)"
ConstructBeaconFile_Position="$(config_get ax2_beacon_position $ConfigFile)"
ConstructBeaconFile_Comment="$(config_get ax2_beacon_comment $ConfigFile)"
ConstructBeaconFile_File="$(config_get ax2_beacon_file $ConfigFile)"
if [ "$ConstructBeaconFile_Path" == "none" ]; then
ConstructBeaconFile_Beacon="PE1RXF-3>$ConstructBeaconFile_Destination:$ConstructBeaconFile_Position$ConstructBeaconFile_Comment"
else
ConstructBeaconFile_Beacon="PE1RXF-3>$ConstructBeaconFile_Destination,$ConstructBeaconFile_Path:$ConstructBeaconFile_Position$ConstructBeaconFile_Comment"
fi
echo "Beacon for ax2:"
echo $ConstructBeaconFile_Beacon
if [ "$ConstructBeaconFile_Path" == "none" ]; then
ConstructBeaconFile_Beacon="/usr/sbin/beacon -d \"$ConstructBeaconFile_Destination\" -s ax2 '$ConstructBeaconFile_Position$ConstructBeaconFile_Comment'"
else
ConstructBeaconFile_Beacon="/usr/sbin/beacon -d \"$ConstructBeaconFile_Destination $ConstructBeaconFile_Path\" -s ax2 '$ConstructBeaconFile_Position$ConstructBeaconFile_Comment'"
fi
echo $ConstructBeaconFile_Beacon > $ConstructBeaconFile_File
fi
@ -120,6 +146,7 @@ TimeInterval="-1"
crontab_time_string="* * * * *"
crontab_command_string_ax0="/home/marcel/ham/aprs_utils/send_beacon_internal_radio.sh"
crontab_command_string_ax1="/home/marcel/ham/aprs_utils/send_beacon_external_radio.sh"
crontab_command_string_ax2="/home/marcel/ham/aprs_utils/send_beacon_lora_radio.sh"
crontab_full_string="#* * * * * /home/marcel/ham/aprs_utils/send_beacon_internal_radio.sh"
crontab_intermediate_file="/home/marcel/ham/aprs_utils/crontab.pe1rxf"
sed_tmp_command_file="/home/marcel/ham/aprs_utils/sed.cmd"
@ -153,13 +180,15 @@ done
if [ "$work_with_config_file" -eq "1" ]; then
for ax_port in ax0 ax1
for ax_port in ax0 ax1 ax2
do
Interface="$ax_port"
if [ "$Interface" == "ax0" ]; then
TimeInterval="$(config_get ax0_beacon_time $ConfigFile)"
else
elif [ "$Interface" == "ax1" ]; then
TimeInterval="$(config_get ax1_beacon_time $ConfigFile)"
elif [ "$Interface" == "ax2" ]; then
TimeInterval="$(config_get ax2_beacon_time $ConfigFile)"
fi
# Let's generate new beacon files according to values in configuration file
@ -186,6 +215,9 @@ if [ "$work_with_config_file" -eq "1" ]; then
elif [ "$Interface" == "ax1" ]; then
crontab_full_string="$crontab_time_string $crontab_command_string_ax1"
sed_string="sed -i \"/send_beacon_external_radio/c\\$crontab_full_string\" $crontab_intermediate_file"
elif [ "$Interface" == "ax2" ]; then
crontab_full_string="$crontab_time_string $crontab_command_string_ax2"
sed_string="sed -i \"/send_beacon_lora_radio/c\\$crontab_full_string\" $crontab_intermediate_file"
else
echo "No valid value. Using default."
crontab_full_string="$crontab_time_string $crontab_command_string_ax0"
@ -199,6 +231,7 @@ if [ "$work_with_config_file" -eq "1" ]; then
printf -- "Values read from file: %s$ConfigFile\n";
printf -- "ax0 beacon time: %s\n" "$(config_get ax0_beacon_time $ConfigFile)";
printf -- "ax1 beacon time: %s\n" "$(config_get ax1_beacon_time $ConfigFile)";
printf -- "ax2 beacon time: %s\n" "$(config_get ax2_beacon_time $ConfigFile)";
# Read values from command line arguments
else
@ -224,6 +257,9 @@ else
elif [ "$Interface" == "ax1" ]; then
crontab_full_string="$crontab_time_string $crontab_command_string_ax1"
sed_string="sed -i \"/send_beacon_external_radio/c\\$crontab_full_string\" $crontab_intermediate_file"
elif [ "$Interface" == "ax2" ]; then
crontab_full_string="$crontab_time_string $crontab_command_string_ax2"
sed_string="sed -i \"/send_beacon_external_radio/c\\$crontab_full_string\" $crontab_intermediate_file"
else
echo "Syntax error!"
Help

@ -28,6 +28,11 @@
$_SESSION['period_ax1'] = $_POST['period_ax1'];
$_SESSION['path_ax1'] = $_POST['path_ax1'];
}
if ($_POST['comment_ax2']) {
$_SESSION['comment_ax2'] = $_POST['comment_ax2'];
$_SESSION['period_ax2'] = $_POST['period_ax2'];
$_SESSION['path_ax2'] = $_POST['path_ax2'];
}
header("HTTP/1.1 303 See Other");
header("Location: http://$_SERVER[HTTP_HOST]/index.php");
@ -54,7 +59,15 @@
# Wait for the changes to take effect
sleep(1);
}
else if (isset($_SESSION['comment_ax2'])){
$comment_ax2 = $_SESSION['comment_ax2'];
$period_ax2 = $_SESSION['period_ax2'];
$path_ax2 = $_SESSION['path_ax2'];
//echo "Set ax2: $comment_ax2, $period_ax2, $path_ax2";
save_settings("ax2", $period_ax2, 0, $path_ax2, 0, $comment_ax2);
# Wait for the changes to take effect
sleep(1);
}
session_unset();
session_destroy();
@ -124,6 +137,11 @@
if ($c) change_parameter_value("ax1_beacon_path", $c);
if ($e) change_parameter_value("ax1_beacon_comment", $e);
}
else if ($form == "ax2" ) {
change_parameter_value("ax2_beacon_time", $a);
if ($c) change_parameter_value("ax2_beacon_path", $c);
if ($e) change_parameter_value("ax2_beacon_comment", $e);
}
# now make new file with new configuration for the main loop to find.
shell_exec("cp $destination_config_file $newly_made_config_file");
@ -168,6 +186,12 @@
$ax1_beacon_time = search_parameter_in_config_file("ax1_beacon_time");
$ax1_beacon_path = search_parameter_in_config_file("ax1_beacon_path");
$ax2_name = search_parameter_in_config_file("ax2_name");
$ax2_frequency = search_parameter_in_config_file("ax2_frequency");
$ax2_beacon_comment = search_parameter_in_config_file("ax2_beacon_comment");
$ax2_beacon_time = search_parameter_in_config_file("ax2_beacon_time");
$ax2_beacon_path = search_parameter_in_config_file("ax2_beacon_path");
?>
<div class="header">
@ -184,6 +208,13 @@
<li onclick="openForm_ax0()">Beacon interval: <b><?php if ($ax0_beacon_time == 0) echo "OFF";else echo $ax0_beacon_time; ?></b></li>
<li onclick="openForm_ax0()">Path: <b><?php echo $ax0_beacon_path; ?></b></li>
</ul>
<ul>
<li><h3><?php echo $ax2_name ?> (<?php echo $ax2_frequency ?>)</h3></li>
<li onclick="openForm_ax2()">Beacon: <b><?php echo $ax2_beacon_comment; ?></b></li>
<li onclick="openForm_ax2()">Beacon interval: <b><?php if ($ax2_beacon_time == 0) echo "OFF";else echo $ax2_beacon_time; ?></b></li>
<li onclick="openForm_ax2()">Path: <b><?php echo $ax2_beacon_path; ?></b></li>
</ul>
</div>
<div class="col-6 col-s-9" id="main_page">
@ -213,7 +244,7 @@
<h1>Heard last 24 hours</h1>
<div class="col-6 col-s-12">
<div class="col-4 col-s-12">
<h1><?php echo $ax0_frequency ?></h1>
<h3 align="center">
<b style="color:Blue">DIRECT</b><br><br>
@ -240,7 +271,7 @@
</h3>
</div>
<div class="col-6 col-s-12">
<div class="col-4 col-s-12">
<h1><?php echo $ax1_frequency ?></h1>
<h3 align="center">
<b style="color:Blue">DIRECT</b><br><br>
@ -266,6 +297,34 @@
?>
</h3>
</div>
<div class="col-4 col-s-12">
<h1><?php echo $ax2_frequency ?></h1>
<h3 align="center">
<b style="color:Blue">DIRECT</b><br><br>
<?php
$csv = array_map('str_getcsv', file("/home/marcel/ham/aprs_utils/aprs_log/aprs_stations_heard_direct.log"));
for ($i = 0; $i < count($csv); $i++) {
if ($csv[$i][1] == "ax2") {
echo $csv[$i][2];
echo "<br>";
}
}
echo "<br><b style=\"color:Blue\">DIGIPEATED</b><br><br>";
$csv = array_map('str_getcsv', file("/home/marcel/ham/aprs_utils/aprs_log/aprs_stations_heard_digipeated.log"));
for ($i = 0; $i < count($csv); $i++) {
if ($csv[$i][1] == "ax2") {
echo $csv[$i][2];
echo "<br>";
}
}
?>
</h3>
</div>
<a href=""><h1 style="color:Black;" onclick="show_main_page()"><i class="fa fa-arrow-left" aria-hidden="true"></i>&nbsp; Back</h1></a>
</div>
@ -310,6 +369,23 @@
?>
</h3>
<h2 align="left"><?php echo $ax2_name ?> (<?php echo $ax2_frequency ?>)</h2>
<h3 align="left">
<?php
$csv = array_map('str_getcsv', file("/home/marcel/ham/aprs_utils/aprs_log/aprs_received_messages.log"));
for ($i = 0; $i < count($csv); $i++) {
if ($csv[$i][1] == "ax2") {
echo $csv[$i][2];
echo ": ";
echo $csv[$i][4];
echo "<br>";
}
}
?>
</h3>
<a href=""><h1 style="color:Black;" onclick="show_main_page()"><i class="fa fa-arrow-left" aria-hidden="true"></i>&nbsp; Back</h1></a>
</div>
@ -391,6 +467,39 @@
</form>
</div>
</div>
<div class="loginPopup">
<div class="formPopup" id="popup_ax2_beacon">
<form action="" class="formContainer" method="post">
<h2>Beacon <?php echo $ax2_frequency ?></h2>
<label for="email">
<strong>Comment</strong>
</label>
<input type="text" id="email" placeholder="comment" name="comment_ax2" value="<?php echo $ax2_beacon_comment; ?>" required>
<label for="psw">
<strong>Period</strong>
</label>
<input type="number" id="psw" placeholder="Period" name="period_ax2" min="0" max="60" step="10" value="<?php echo $ax2_beacon_time; ?>" required>
<label for="path">
<strong>Path<br></strong>
</label>
<div class="radioLeft">
<input type="radio" class="formContainer radio" id="path_none" name="path_ax2" value="none"<?php if ($ax2_beacon_path == "none") echo "checked"; ?>>
<label for="path_none">none</label><br>
<input type="radio" class="formContainer radio" id="path_wide21" name="path_ax2" value="WIDE2-1" <?php if ($ax2_beacon_path == "WIDE2-1") echo "checked"; ?> >
<label for="path_wide21">WIDE2-1</label><br>
<input type="radio" class="formContainer radio" id="path_wide22" name="path_ax2" value="WIDE2-2" <?php if ($ax2_beacon_path == "WIDE2-2") echo "checked"; ?> >
<label for="path_wide22">WIDE2-2</label><br>
<input type="radio" class="formContainer radio" id="path_wide33" name="path_ax2" value="WIDE3-3" <?php if ($ax2_beacon_path == "WIDE3-3") echo "checked"; ?> >
<label for="path_wide33">WIDE3-3</label><br>
</div>
<div id="submit_ax2"><button type="submit" class="btn" onclick="SubmitClicked_ax2()">Submit</button></div>
<div id="submit_done_ax2" style="display:none;"><button type="button" class="btn wait"><img src="images/preload.gif">Please wait...</button></div>
<div id="cancel_ax2"><button type="button" class="btn cancel" onclick="closeForm_ax2()">Cancel</button>
</form>
</div>
</div>
</div>
<div class="footer">
<p>Open source hardware and software. Visit https://www.meezenest.nl/mees for more information.</p>
@ -409,6 +518,12 @@
function closeForm_ax1() {
document.getElementById("popup_ax1_beacon").style.display = "none";
}
function openForm_ax2() {
document.getElementById("popup_ax2_beacon").style.display = "block";
}
function closeForm_ax2() {
document.getElementById("popup_ax2_beacon").style.display = "none";
}
function show_heard_stations() {
document.getElementById("main_page").style.display = "none";
@ -446,6 +561,14 @@
modify this software provided this
notice appears on all copies.
*/
function SubmitClicked_ax2()
{
document.getElementById("submit_ax2").style.display = "none"; // to undisplay
document.getElementById("submit_done_ax2").style.display = "block"; // to display
document.getElementById("cancel_ax2").style.display = "none"; // to display
return true;
}
function SubmitClicked_ax1()
{
document.getElementById("submit_ax1").style.display = "none"; // to undisplay
@ -453,6 +576,7 @@
document.getElementById("cancel_ax1").style.display = "none"; // to display
return true;
}
function SubmitClicked_ax0()
{

@ -28,8 +28,12 @@
$_SESSION['ax1_message_text'] = $_POST['ax1_message_text'];
$_SESSION['ax1_message_path'] = $_POST['ax1_message_path'];
$_SESSION['ax1_message_destination'] = $_POST['ax1_message_destination'];
}
if ($_POST['ax2_message_text']) {
$_SESSION['ax2_message_text'] = $_POST['ax2_message_text'];
$_SESSION['ax2_message_path'] = $_POST['ax2_message_path'];
$_SESSION['ax2_message_destination'] = $_POST['ax2_message_destination'];
}
header("HTTP/1.1 303 See Other");
header("Location: http://$_SERVER[HTTP_HOST]/send_message.php");
@ -78,6 +82,26 @@
# Wait for the changes to take effect
sleep(1);
}
else if (isset($_SESSION['ax2_message_text'])){
$ax2_message_text = $_SESSION['ax2_message_text'];
$ax2_message_path = $_SESSION['ax2_message_path'];
$ax2_message_destination = $_SESSION['ax2_message_destination'];
//echo "Send ax2: $ax2_message_text, $ax2_message_path, $ax2_message_destination";
# Send message. NOTE: send_message.sh should be executable by www-data. Also, the ax0 transmit directory should be writable by www-data
if ($ax2_message_path == "none")
$execuatable_string = sprintf("/home/marcel/ham/aprs_utils/send_message.sh -i ax2 -c \"%s\" -m \"%s\"", $ax2_message_destination, $ax2_message_text);
else
$execuatable_string = sprintf("/home/marcel/ham/aprs_utils/send_message.sh -i ax2 -c \"%s\" -p \"%s\" -m \"%s\"", $ax2_message_destination, $ax2_message_path, $ax2_message_text);
//$execuatable_string = sprintf("/home/marcel/ham/aprs_utils/send_message.sh -i ax2 -c \"%s\" -p \"%s\" -m \"%s\"", $ax2_message_destination, $ax2_message_path, $ax2_message_text);
//echo exec("/home/marcel/ham/aprs_utils/send_message.sh -i ax2 -c $ax1_message_destination -p $ax1_message_path -m $ax2_message_text");
//echo ("$execuatable_string");
exec("$execuatable_string");
# Wait for the changes to take effect
sleep(1);
}
session_unset();
session_destroy();
@ -225,6 +249,29 @@
$ax1_message2_path = search_parameter_in_config_file("ax1_message2_path");
$ax1_message3_path = search_parameter_in_config_file("ax1_message3_path");
$ax1_message4_path = search_parameter_in_config_file("ax1_message4_path");
$ax2_name = search_parameter_in_config_file("ax2_name");
$ax2_frequency = search_parameter_in_config_file("ax2_frequency");
$ax2_message1_id = search_parameter_in_config_file("ax2_message1_id");
$ax2_message2_id = search_parameter_in_config_file("ax2_message2_id");
$ax2_message3_id = search_parameter_in_config_file("ax2_message3_id");
$ax2_message4_id = search_parameter_in_config_file("ax2_message4_id");
$ax2_message1_text = search_parameter_in_config_file("ax2_message1_text");
$ax2_message2_text = search_parameter_in_config_file("ax2_message2_text");
$ax2_message3_text = search_parameter_in_config_file("ax2_message3_text");
$ax2_message4_text = search_parameter_in_config_file("ax2_message4_text");
$ax2_message1_destination = search_parameter_in_config_file("ax2_message1_destination");
$ax2_message2_destination = search_parameter_in_config_file("ax2_message2_destination");
$ax2_message3_destination = search_parameter_in_config_file("ax2_message3_destination");
$ax2_message4_destination = search_parameter_in_config_file("ax2_message4_destination");
$ax2_message1_path = search_parameter_in_config_file("ax2_message1_path");
$ax2_message2_path = search_parameter_in_config_file("ax2_message2_path");
$ax2_message3_path = search_parameter_in_config_file("ax2_message3_path");
$ax2_message4_path = search_parameter_in_config_file("ax2_message4_path");
?>
@ -245,6 +292,16 @@
<li onclick="openForm_ax0_message3()"><b><?php echo $ax0_message3_id; ?></b></li>
<li onclick="openForm_ax0_message4()"><b><?php echo $ax0_message4_id; ?></b></li>
</ul>
<ul>
<li><h3><?php echo $ax2_name ?> (<?php echo $ax2_frequency ?>)</h3></li>
<li onclick="openForm_ax2_message0()">Send new message</li>
<li><b>Predefined messages:</b></li>
<li onclick="openForm_ax2_message1()"><b><?php echo $ax2_message1_id; ?></b></li>
<li onclick="openForm_ax2_message2()"><b><?php echo $ax2_message2_id; ?></b></li>
<li onclick="openForm_ax2_message3()"><b><?php echo $ax2_message3_id; ?></b></li>
<li onclick="openForm_ax2_message4()"><b><?php echo $ax2_message4_id; ?></b></li>
</ul>
</div>
<div class="col-6 col-s-9" id="main_page">
@ -298,7 +355,22 @@
?>
</h3>
<h2 align="left"><?php echo $ax2_name ?> (<?php echo $ax2_frequency ?>)</h2>
<h3 align="left">
<?php
$csv = array_map('str_getcsv', file("/home/marcel/ham/aprs_utils/aprs_log/aprs_send_messages.log"));
for ($i = 0; $i < count($csv); $i++) {
if ($csv[$i][1] == "ax2") {
echo $csv[$i][2];
echo ": ";
echo $csv[$i][4];
echo "<br>";
}
}
?>
</h3>
<a href=""><h1 style="color:Black;" onclick="show_main_page()"><i class="fa fa-arrow-left" aria-hidden="true"></i>&nbsp; Back</h1></a>
</div>
@ -340,6 +412,23 @@
?>
</h3>
<h2 align="left"><?php echo $ax2_name ?> (<?php echo $ax2_frequency ?>)</h2>
<h3 align="left">
<?php
$csv = array_map('str_getcsv', file("/home/marcel/ham/aprs_utils/aprs_log/aprs_received_messages.log"));
for ($i = 0; $i < count($csv); $i++) {
if ($csv[$i][1] == "ax2") {
echo $csv[$i][2];
echo ": ";
echo $csv[$i][4];
echo "<br>";
}
}
?>
</h3>
<a href=""><h1 style="color:Black;" onclick="show_main_page()"><i class="fa fa-arrow-left" aria-hidden="true"></i>&nbsp; Back</h1></a>
</div>
@ -717,6 +806,188 @@
</div>
</div>
</div>
<div class="loginPopup">
<div class="formPopup" id="popupForm_ax2_message0">
<form action="" class="formContainer" method="post">
<h2>Message <?php echo $ax2_frequency ?></h2>
<label for="email">
<strong>Message</strong>
</label>
<input type="text" id="email" placeholder="Message" name="ax2_message_text" required>
<label for="psw">
<strong>Destination</strong>
</label>
<input type="text" id="email" placeholder="Destination" name="ax2_message_destination" required>
<label for="path">
<strong>Path<br></strong>
</label>
<div class="radioLeft">
<input type="radio" class="formContainer radio" id="path_none" name="ax2_message_path" value="none" checked>
<label for="path_none">none</label><br>
<input type="radio" class="formContainer radio" id="path_wide21" name="ax2_message_path" value="WIDE2-1" <?php if ($ax2_message0_path == "WIDE2-1") echo "checked"; ?> >
<label for="path_wide21">WIDE2-1</label><br>
<input type="radio" class="formContainer radio" id="path_wide22" name="ax2_message_path" value="WIDE2-2" <?php if ($ax2_message0_path == "WIDE2-2") echo "checked"; ?> >
<label for="path_wide22">WIDE2-2</label><br>
<input type="radio" class="formContainer radio" id="path_wide33" name="ax2_message_path" value="WIDE3-3" <?php if ($ax2_message0_path == "WIDE3-3") echo "checked"; ?> >
<label for="path_wide33">WIDE3-3</label><br>
</div>
<div id="submit_ax2_message0"><button type="submit" class="btn" onclick="SubmitClicked_ax2_message0()">Submit</button></div>
<div id="submit_done_ax2_message0" style="display:none;"><button type="button" class="btn wait"><img src="images/preload.gif">Please wait...</button></div>
<div id="cancel_ax2_message0"><button type="button" class="btn cancel" onclick="closeForm_ax2_message0()">Cancel</button>
</form>
</div>
</div>
</div>
<div class="loginPopup">
<div class="formPopup" id="popupForm_ax2_message1">
<form action="" class="formContainer" method="post">
<h2>Message <?php echo $ax2_frequency ?></h2>
<label for="email">
<strong>Message</strong>
</label>
<input type="text" id="email" placeholder="Message" name="ax2_message_text" value="<?php echo $ax2_message1_text; ?>" required>
<label for="psw">
<strong>Destination</strong>
</label>
<input type="text" id="email" placeholder="Destination" name="ax2_message_destination" value="<?php echo $ax2_message1_destination; ?>" required>
<label for="path">
<strong>Path<br></strong>
</label>
<div class="radioLeft">
<input type="radio" class="formContainer radio" id="path_none" name="ax2_message_path" value="none" <?php if ($ax1_message2_path == "none") echo "checked"; ?>>
<label for="path_none">none</label><br>
<input type="radio" class="formContainer radio" id="path_wide21" name="ax2_message_path" value="WIDE2-1" <?php if ($ax2_message1_path == "WIDE2-1") echo "checked"; ?> >
<label for="path_wide21">WIDE2-1</label><br>
<input type="radio" class="formContainer radio" id="path_wide22" name="ax2_message_path" value="WIDE2-2" <?php if ($ax2_message1_path == "WIDE2-2") echo "checked"; ?> >
<label for="path_wide22">WIDE2-2</label><br>
<input type="radio" class="formContainer radio" id="path_wide33" name="ax2_message_path" value="WIDE3-3" <?php if ($ax2_message1_path == "WIDE3-3") echo "checked"; ?> >
<label for="path_wide33">WIDE3-3</label><br>
</div>
<div id="submit_ax2_message1"><button type="submit" class="btn" onclick="SubmitClicked_ax2_message1()">Submit</button></div>
<div id="submit_done_ax2_message1" style="display:none;"><button type="button" class="btn wait"><img src="images/preload.gif">Please wait...</button></div>
<div id="cancel_ax2_message1"><button type="button" class="btn cancel" onclick="closeForm_ax2_message1()">Cancel</button>
</form>
</div>
</div>
</div>
<div class="loginPopup">
<div class="formPopup" id="popupForm_ax2_message2">
<form action="" class="formContainer" method="post">
<h2>Message <?php echo $ax2_frequency ?></h2>
<label for="email">
<strong>Message</strong>
</label>
<input type="text" id="email" placeholder="Message" name="ax2_message_text" value="<?php echo $ax2_message2_text; ?>" required>
<label for="psw">
<strong>Destination</strong>
</label>
<input type="text" id="email" placeholder="Destination" name="ax2_message_destination" value="<?php echo $ax2_message2_destination; ?>" required>
<label for="path">
<strong>Path<br></strong>
</label>
<div class="radioLeft">
<input type="radio" class="formContainer radio" id="path_none" name="ax2_message_path" value="none" <?php if ($ax2_message2_path == "none") echo "checked"; ?>>
<label for="path_none">none</label><br>
<input type="radio" class="formContainer radio" id="path_wide21" name="ax2_message_path" value="WIDE2-1" <?php if ($ax2_message2_path == "WIDE2-1") echo "checked"; ?> >
<label for="path_wide21">WIDE2-1</label><br>
<input type="radio" class="formContainer radio" id="path_wide22" name="ax2_message_path" value="WIDE2-2" <?php if ($ax2_message2_path == "WIDE2-2") echo "checked"; ?> >
<label for="path_wide22">WIDE2-2</label><br>
<input type="radio" class="formContainer radio" id="path_wide33" name="ax2_message_path" value="WIDE3-3" <?php if ($ax2_message2_path == "WIDE3-3") echo "checked"; ?> >
<label for="path_wide33">WIDE3-3</label><br>
</div>
<div id="submit_ax2"><button type="submit" class="btn" onclick="SubmitClicked_ax2_message2()">Submit</button></div>
<div id="submit_done_ax2" style="display:none;"><button type="button" class="btn wait"><img src="images/preload.gif">Please wait...</button></div>
<div id="cancel_ax2"><button type="button" class="btn cancel" onclick="closeForm_ax2_message2()">Cancel</button>
</form>
</div>
</div>
</div>
<div class="loginPopup">
<div class="formPopup" id="popupForm_ax2_message3">
<form action="" class="formContainer" method="post">
<h2>Message <?php echo $ax2_frequency ?></h2>
<label for="email">
<strong>Message</strong>
</label>
<input type="text" id="email" placeholder="Message" name="ax2_message_text" value="<?php echo $ax2_message3_text; ?>" required>
<label for="psw">
<strong>Destination</strong>
</label>
<input type="text" id="email" placeholder="Destination" name="ax2_message_destination" value="<?php echo $ax2_message3_destination; ?>" required>
<label for="path">
<strong>Path<br></strong>
</label>
<div class="radioLeft">
<input type="radio" class="formContainer radio" id="path_none" name="ax2_message_path" value="none" <?php if ($ax2_message3_path == "none") echo "checked"; ?>>
<label for="path_none">none</label><br>
<input type="radio" class="formContainer radio" id="path_wide21" name="ax2_message_path" value="WIDE2-1" <?php if ($ax2_message3_path == "WIDE2-1") echo "checked"; ?> >
<label for="path_wide21">WIDE2-1</label><br>
<input type="radio" class="formContainer radio" id="path_wide22" name="ax2_message_path" value="WIDE2-2" <?php if ($ax2_message3_path == "WIDE2-2") echo "checked"; ?> >
<label for="path_wide22">WIDE2-2</label><br>
<input type="radio" class="formContainer radio" id="path_wide33" name="ax2_message_path" value="WIDE3-3" <?php if ($ax2_message3_path == "WIDE3-3") echo "checked"; ?> >
<label for="path_wide33">WIDE3-3</label><br>
</div>
<div id="submit_ax2"><button type="submit" class="btn" onclick="SubmitClicked_ax2_message3()">Submit</button></div>
<div id="submit_done_ax2" style="display:none;"><button type="button" class="btn wait"><img src="images/preload.gif">Please wait...</button></div>
<div id="cancel_ax2"><button type="button" class="btn cancel" onclick="closeForm_ax2_message3()">Cancel</button>
</form>
</div>
</div>
</div>
<div class="loginPopup">
<div class="formPopup" id="popupForm_ax2_message4">
<form action="" class="formContainer" method="post">
<h2>Message <?php echo $ax2_frequency ?></h2>
<label for="email">
<strong>Message</strong>
</label>
<input type="text" id="email" placeholder="Message" name="ax2_message_text" value="<?php echo $ax2_message4_text; ?>" required>
<label for="psw">
<strong>Destination</strong>
</label>
<input type="text" id="email" placeholder="Destination" name="ax2_message_destination" value="<?php echo $ax2_message4_destination; ?>" required>
<label for="path">
<strong>Path<br></strong>
</label>
<div class="radioLeft">
<input type="radio" class="formContainer radio" id="path_none" name="ax2_message_path" value="none" <?php if ($ax2_message4_path == "none") echo "checked"; ?>>
<label for="path_none">none</label><br>
<input type="radio" class="formContainer radio" id="path_wide21" name="ax2_message_path" value="WIDE2-1" <?php if ($ax2_message4_path == "WIDE2-1") echo "checked"; ?> >
<label for="path_wide21">WIDE2-1</label><br>
<input type="radio" class="formContainer radio" id="path_wide22" name="ax2_message_path" value="WIDE2-2" <?php if ($ax2_message4_path == "WIDE2-2") echo "checked"; ?> >
<label for="path_wide22">WIDE2-2</label><br>
<input type="radio" class="formContainer radio" id="path_wide33" name="ax2_message_path" value="WIDE3-3" <?php if ($ax2_message4_path == "WIDE3-3") echo "checked"; ?> >
<label for="path_wide33">WIDE3-3</label><br>
</div>
<div id="submit_ax2"><button type="submit" class="btn" onclick="SubmitClicked_ax2_message4()">Submit</button></div>
<div id="submit_done_ax2" style="display:none;"><button type="button" class="btn wait"><img src="images/preload.gif">Please wait...</button></div>
<div id="cancel_ax2"><button type="button" class="btn cancel" onclick="closeForm_ax2_message4()">Cancel</button>
</form>
</div>
</div>
</div>
<div class="footer">
<p>Open source hardware and software. Visit https://www.meezenest.nl/mees for more information.</p>
</div>
@ -784,6 +1055,37 @@
document.getElementById("popupForm_ax1_message4").style.display = "none";
}
function openForm_ax2_message0() {
document.getElementById("popupForm_ax2_message0").style.display = "block";
}
function closeForm_ax2_message0() {
document.getElementById("popupForm_ax2_message0").style.display = "none";
}
function openForm_ax2_message1() {
document.getElementById("popupForm_ax2_message1").style.display = "block";
}
function closeForm_ax2_message1() {
document.getElementById("popupForm_ax2_message1").style.display = "none";
}
function openForm_ax2_message2() {
document.getElementById("popupForm_ax2_message2").style.display = "block";
}
function closeForm_ax2_message2() {
document.getElementById("popupForm_ax2_message2").style.display = "none";
}
function openForm_ax2_message3() {
document.getElementById("popupForm_ax2_message3").style.display = "block";
}
function closeForm_ax2_message3() {
document.getElementById("popupForm_ax2_message3").style.display = "none";
}
function openForm_ax2_message4() {
document.getElementById("popupForm_ax2_message4").style.display = "block";
}
function closeForm_ax2_message4() {
document.getElementById("popupForm_ax2_message4").style.display = "none";
}
function show_send_messages() {
document.getElementById("main_page").style.display = "none";
document.getElementById("received_messages").style.display = "none";
@ -820,6 +1122,41 @@
modify this software provided this
notice appears on all copies.
*/
function SubmitClicked_ax2_message0()
{
document.getElementById("submit_ax2_message0").style.display = "none"; // to undisplay
document.getElementById("submit_done_ax2_message0").style.display = "block"; // to display
document.getElementById("cancel_ax2_message0").style.display = "none"; // to display
return true;
}
function SubmitClicked_ax2_message1()
{
document.getElementById("submit_ax2_message1").style.display = "none"; // to undisplay
document.getElementById("submit_done_ax2_message1").style.display = "block"; // to display
document.getElementById("cancel_ax2_message1").style.display = "none"; // to display
return true;
}function SubmitClicked_ax2_message2()
{
document.getElementById("submit_ax2_message2").style.display = "none"; // to undisplay
document.getElementById("submit_done_ax2_message2").style.display = "block"; // to display
document.getElementById("cancel_ax2_message2").style.display = "none"; // to display
return true;
}
function SubmitClicked_ax2_message3()
{
document.getElementById("submit_ax2_message3").style.display = "none"; // to undisplay
document.getElementById("submit_done_ax2_message3").style.display = "block"; // to display
document.getElementById("cancel_ax2_message3").style.display = "none"; // to display
return true;
}
function SubmitClicked_ax2_message4()
{
document.getElementById("submit_ax2_message4").style.display = "none"; // to undisplay
document.getElementById("submit_done_ax2_message4").style.display = "block"; // to display
document.getElementById("cancel_ax2_message4").style.display = "none"; // to display
return true;
}
function SubmitClicked_ax1_message0()
{
document.getElementById("submit_ax1_message0").style.display = "none"; // to undisplay

Loading…
Cancel
Save