mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-06-26 19:48:40 +02:00
gps-track: add error handling
This commit is contained in:
parent
679c971ea6
commit
1e29eeb388
1 changed files with 14 additions and 10 deletions
|
@ -24,16 +24,20 @@ $WaitFullyConnected;
|
|||
:local Gps [ /system/gps/monitor once as-value ];
|
||||
|
||||
:if ($Gps->"valid" = true) do={
|
||||
/tool/fetch check-certificate=yes-without-crl $GpsTrackUrl output=none \
|
||||
http-method=post http-header-field="Content-Type: application/json" \
|
||||
http-data=("{" . \
|
||||
"\"lat\":\"" . ($Gps->"latitude") . "\"," . \
|
||||
"\"lon\":\"" . ($Gps->"longitude") . "\"," . \
|
||||
"\"identity\":\"" . $Identity . "\"" . \
|
||||
"}") as-value;
|
||||
$LogPrintExit2 debug $0 ("Sending GPS data in " . $CoordinateFormat . " format: " . \
|
||||
"lat: " . ($Gps->"latitude") . " " . \
|
||||
"lon: " . ($Gps->"longitude")) false;
|
||||
:do {
|
||||
/tool/fetch check-certificate=yes-without-crl $GpsTrackUrl output=none \
|
||||
http-method=post http-header-field="Content-Type: application/json" \
|
||||
http-data=("{" . \
|
||||
"\"lat\":\"" . ($Gps->"latitude") . "\"," . \
|
||||
"\"lon\":\"" . ($Gps->"longitude") . "\"," . \
|
||||
"\"identity\":\"" . $Identity . "\"" . \
|
||||
"}") as-value;
|
||||
$LogPrintExit2 debug $0 ("Sending GPS data in " . $CoordinateFormat . " format: " . \
|
||||
"lat: " . ($Gps->"latitude") . " " . \
|
||||
"lon: " . ($Gps->"longitude")) false;
|
||||
} on-error={
|
||||
$LogPrintExit2 warning $0 ("Failed sending GPS data!") false;
|
||||
}
|
||||
} else={
|
||||
$LogPrintExit2 debug $0 ("GPS data not valid.") false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue