mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
gps-track: add error handling
This commit is contained in:
parent
679c971ea6
commit
1e29eeb388
|
@ -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…
Reference in a new issue