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
40
luci-app-gpoint-main/root/usr/share/gpoint/modems/sierra.lua
Normal file
40
luci-app-gpoint-main/root/usr/share/gpoint/modems/sierra.lua
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
common_path = '/usr/share/gpoint/lib/?.lua;'
|
||||
package.path = common_path .. package.path
|
||||
|
||||
|
||||
local nmea = require("nmea")
|
||||
local serial = require("serial")
|
||||
local nixio = require("nixio.fs")
|
||||
|
||||
local sierra = {}
|
||||
|
||||
local SIERRA_BEGIN_GPS = "$GPS_START"
|
||||
local SIERRA_END_GPS = "$GPS_STOP"
|
||||
|
||||
-- automatic activation of the NMEA port for data transmission
|
||||
function sierra.start(port)
|
||||
local error, resp = true, {warning = {
|
||||
app = {true, "Port is unavailable. Check the modem connections!"},
|
||||
locator = {},
|
||||
server = {}
|
||||
}
|
||||
}
|
||||
local fport = nixio.glob("/dev/tty[A-Z][A-Z]*")
|
||||
for name in fport do
|
||||
if string.find(name, port) then
|
||||
error, resp = serial.write(port, SIERRA_BEGIN_GPS)
|
||||
end
|
||||
end
|
||||
return error, resp
|
||||
end
|
||||
-- stop send data to NMEA port
|
||||
function sierra.stop(port)
|
||||
error, resp = serial.write(port, SIERRA_END_GPS)
|
||||
return error, resp
|
||||
end
|
||||
-- get GNSS data for application
|
||||
function sierra.getGNSSdata(port)
|
||||
return nmea.getAllData(port)
|
||||
end
|
||||
|
||||
return sierra
|
||||
Loading…
Add table
Add a link
Reference in a new issue