diff options
author | Christian Hesse <mail@eworm.de> | 2018-09-13 12:21:54 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2018-09-13 12:21:54 +0200 |
commit | dcf795464b29236fa58ad23fe996e4f77480525b (patch) | |
tree | d0d996eb1bc157feb2cc581fe1a9ebe4b843b18b /gps-track | |
parent | 6ee72324080ea1fe716f3b7c696d66d6a9204743 (diff) |
gps-track: simplify gps value handling
Diffstat (limited to 'gps-track')
-rw-r--r-- | gps-track | 24 |
1 files changed, 9 insertions, 15 deletions
@@ -7,17 +7,9 @@ :global "identity"; :global "gps-track-url"; -:local gpslat; -:local gpslon; -:local gpsvalid; +:local gps [ / system gps monitor once as-value ]; -/ system gps monitor once do={ - :set $gpslat $("latitude"); - :set $gpslon $("longitude"); - :set $gpsvalid $("valid"); -} - -if ($gpsvalid) do={ +if ($gps->"valid" = true) do={ :tool fetch mode=http \ url=$"gps-track-url" \ check-certificate=yes-without-crl \ @@ -25,11 +17,13 @@ if ($gpsvalid) do={ http-method=post \ http-content-type="application/json" \ http-data=("{" . \ - "\"lat\":\"" . $gpslat . "\"," . \ - "\"lon\":\"" . $gpslon . "\"," . \ + "\"lat\":\"" . ($gps->"latitude") . "\"," . \ + "\"lon\":\"" . ($gps->"longitude") . "\"," . \ "\"identity\":\"" . $identity . "\"" . \ "}"); - :log debug ("Sending gps data for tracking: " . \ - "lat: " . $gpslat . " " . \ - "lon: " . $gpslon); + :log debug ("Sending GPS data for tracking: " . \ + "lat: " . ($gps->"latitude") . " " . \ + "lon: " . ($gps->"longitude")); +} else={ + :log debug ("GPS data not valid."); } |