0
0
mirror of https://github.com/Doodle3D/doodle3d-firmware.git synced 2024-11-05 14:13:22 +01:00
doodle3d-firmware/src/network/signin.lua

30 lines
814 B
Lua
Raw Normal View History

2013-09-27 18:38:31 +02:00
local log = require('util.logger')
local utils = require('util.utils')
local uci = require('uci').cursor()
local iwinfo = require('iwinfo')
local settings = require('util.settings')
local wifi = require("network.wlanconfig")
2013-09-27 18:38:31 +02:00
local M = {}
--- Signin to connect.doodle3d.com server
--
function M.signin()
local baseurl = "http://connect.doodle3d.com/api/signin.php"
2013-09-27 18:38:31 +02:00
local localip = wifi.getLocalIP();
if localip == nil then
log:error("signin failed no local ip found")
2013-10-02 14:41:15 +02:00
return false
end
2013-09-27 18:38:31 +02:00
local wifiboxid = wifi.getSubstitutedSsid(settings.get('network.cl.wifiboxid'))
2013-09-27 18:38:31 +02:00
local cmd = "wget -q -T 2 -t 1 -O - "..baseurl.."?wifiboxid="..wifiboxid.."\\&localip="..localip;
local output = utils.captureCommandOutput(cmd);
2013-09-27 18:38:31 +02:00
log:info("signin: "..output)
return string.len(output) > 0, output
2013-09-27 18:38:31 +02:00
end
return M