mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
add gps
This commit is contained in:
parent
f9dffa3b97
commit
c84be29413
47 changed files with 8227 additions and 0 deletions
31
luci-app-gpoint-main/root/usr/share/gpoint/proto/traccar.lua
Normal file
31
luci-app-gpoint-main/root/usr/share/gpoint/proto/traccar.lua
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
-------------------------------------------------------------
|
||||
-- Traccar Client use this protocol to report GPS data to the server side.
|
||||
-- OsmAnd Live Tracking web address format:
|
||||
-- http://demo.traccar.org:5055/?id=123456&lat={0}&lon={1}×tamp={2}&hdop={3}&altitude={4}&speed={5}
|
||||
-------------------------------------------------------------
|
||||
-- Copyright 2021-2022 Vladislav Kadulin <spanky@yandex.ru>
|
||||
-- Licensed to the GNU General Public License v3.0
|
||||
|
||||
local http = require("socket.http")
|
||||
|
||||
local trackcar = {}
|
||||
|
||||
local function OsmAnd(GnssData, serverConfig)
|
||||
local unix = GnssData.warning.rmc[1] and os.time() or GnssData.gp.unix
|
||||
return string.format("http://%s:%s/?id=%s&lat=%s&lon=%s×tamp=%s&hdop=%s&altitude=%s&speed=%s&satellites=%s",
|
||||
serverConfig.address, serverConfig.port, serverConfig.login,
|
||||
GnssData.gp.latitude or '-', GnssData.gp.longitude or '-',
|
||||
unix or '-', GnssData.gp.hdop or '-',
|
||||
GnssData.gp.altitude or '-', GnssData.gp.spkm or '-',
|
||||
GnssData.gp.nsat or '-')
|
||||
end
|
||||
|
||||
-- Send data to server side
|
||||
function trackcar.sendData(GnssData, serverConfig)
|
||||
local data = OsmAnd(GnssData, serverConfig)
|
||||
http.TIMEOUT = 0.5
|
||||
http.request{ method = "POST", url = data}
|
||||
return {false, "OK"}
|
||||
end
|
||||
|
||||
return trackcar
|
||||
Loading…
Add table
Add a link
Reference in a new issue