Jump to content

Recommended Posts

Posted (edited)

:local serverURL "https://gpsmap.am/server/api/api_loc.php"
:local fakeImei "свой имей xxxxxxxxxx" 
:local SIMslot "0"
:local button "0"

:global isDebug


# :put $isDebug - check current state
# :set $isDebug "terminal" - log to terminal
# :set $isDebug "off" - logging off

# Current Debug status
:set $isDebug "off"

:local gpsDateTime
:local lat
:local lon
:local alt
:local gpsSpeed
:local bearing
:local gpsValid
:local sats
:local hdop
:local DateTime
:local outputURL


#Check and set coordinate format and get data from GPS
:if ( [/system gps get coordinate-format ] != "dd") do={/system gps set coordinate-format=dd}


/system gps monitor once do={
:set $gpsDateTime $("date-and-time")
:set $lat [:pick $("latitude") 0 7]
:set $lon [:pick $("longitude") 0 8]
:set $alt $("altitude")
:set $gpsSpeed $("speed")
:set $bearing $("true-bearing")
:set $gpsValid $("valid")
:set $sats $("satellites")
:set $hdop $("horizontal-dilution")}

:set $alt [:pick $alt 0 [:find $alt "."]]
:set $gpsSpeed ([:pick $gpsSpeed 0 [:find $gpsSpeed "."]].".0")
:set $bearing ([:pick $bearing 0 [:find $bearing "."]].".0")

# Reformating date and time.
:local day [ :pick $gpsDateTime 4 6 ]
:local month [ :pick $gpsDateTime 0 3 ]
:local year [ :pick $gpsDateTime 7 11 ]
:local time [ :pick $gpsDateTime 12 19]
:local DateTime "$year-$month-$day $time"

:set $outputURL ("$serverURL?imei=$fakeImei&dt=$DateTime&lat=$lat&lng=$lon&altitude=$alt&angle=$bearing&speed=$gpsSpeed&loc_valid=1")

:if ($isDebug = "terminal") do={
:put $gpsDateTime
:put $DateTime
:put $lat
:put $lon
:put $alt
:put $gpsSpeed
:put $bearing
:put $gpsValid
:put $sats
:put $hdop
:put $serverURL
:put $fakeImei
:put $battVoltage
:put  $SIMslot
:put  $button
:put $outputURL
}


/tool fetch http-method=post url="$outputURL" output=none

Edited by GPSMapArmenia

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...
На сайте используются файлы cookie и сервисы аналитики для корректной работы форума и улучшения качества обслуживания. Продолжая использовать сайт, вы соглашаетесь с использованием файлов cookie и с Политикой конфиденциальности.