diff --git a/WIFI_sniffer/cret_project/boot.lua b/WIFI_sniffer/cret_project/boot.lua index 3ded0b5..109c0a4 100644 --- a/WIFI_sniffer/cret_project/boot.lua +++ b/WIFI_sniffer/cret_project/boot.lua @@ -1,13 +1,13 @@ -- Scripts à charger après le boot pour démarrer le core system -print("\n boot.lua zf191030.2012 \n") +print("\n boot.lua zf191124.1920 \n") function boot() --f= "led_rgb.lua" if file.exists(f) then dofile(f) end f= "telnet_srv2.lua" if file.exists(f) then dofile(f) end f= "wifi_init.lua" if file.exists(f) then dofile(f) end --f= "web_ide2.lua" if file.exists(f) then dofile(f) end - --ff= "web_srv2.lua" if file.exists(f) then dofile(f) end + --f= "web_srv2.lua" if file.exists(f) then dofile(f) end end boot() diff --git a/WIFI_sniffer/cret_project/boot2.lua b/WIFI_sniffer/cret_project/boot2.lua index 2ccc65b..4a581b3 100644 --- a/WIFI_sniffer/cret_project/boot2.lua +++ b/WIFI_sniffer/cret_project/boot2.lua @@ -1,6 +1,6 @@ -- Scripts à charger après le boot pour démarrer son projet -print("\n boot2.lua zf191030.2038 \n") +print("\n boot2.lua zf191124.1922 \n") function boot2() second_chance=nil initz=nil boot=nil @@ -27,7 +27,8 @@ function boot2() f= "secrets_project.lua" if file.exists(f) then dofile(f) end f= "set_time.lua" if file.exists(f) then dofile(f) end collectgarbage() - f= "b.lua" if file.exists(f) then dofile(f) end + --- f= "b.lua" if file.exists(f) then dofile(f) end + f= "web_srv2.lua" if file.exists(f) then dofile(f) end f=nil diff --git a/WIFI_sniffer/cret_project/cat.lua b/WIFI_sniffer/cret_project/cat.lua index 856a52d..8a2e29c 100644 --- a/WIFI_sniffer/cret_project/cat.lua +++ b/WIFI_sniffer/cret_project/cat.lua @@ -1,18 +1,22 @@ -- fonction cat() pour afficher le contenu d'un fichier dans la flash -print("\n cat.lua zf192026.0858 \n") +print("\n cat.lua zf191124.2204 \n") + +function zread_line() + local zline = "" + while true do + local t = zf:read(1) if t == nil then return end + zline = zline..t + if t == "\n" then return string.sub(zline,1,string.len(zline)-1) end + end +end function cat(zfile) print("\n"..zfile.."\n-------------------------------") - - zfilei = file.open(zfile, "r") - i=1 - zline=file.readline() - repeat --- print(i..": "..string.sub(zline,1,string.len(zline)-1)) - print(string.sub(zline,1,string.len(zline)-1)) - i=i+1 zline=file.readline() - until zline== nil - file.close(zfilei) - + zf = file.open(zfile, "r") + while true do + zline = zread_line() if zline == nil then break end + print(zline) + end + zf:close() print("-------------------------------") end diff --git a/WIFI_sniffer/cret_project/web_srv2.lua b/WIFI_sniffer/cret_project/web_srv2.lua index 2389b01..2384e89 100644 --- a/WIFI_sniffer/cret_project/web_srv2.lua +++ b/WIFI_sniffer/cret_project/web_srv2.lua @@ -15,7 +15,7 @@ function send_file(zclient, zfilename) zclient:send("HTTP/1.1 200 OK\n") zclient:send("Content-Type: text/html\n\n") zzclient = zclient -- export le port sur l'environnement global ! - if zfilename == "" then zfilename = "z_index.html" end + if zfilename == "" then zfilename = "z_index.html" end file_web = file.open(zfilename, "r") if file_web then repeat @@ -34,10 +34,11 @@ function send_file(zclient, zfilename) -- print(line) lua_code = lua_code..line -- récupère le code lua inline else + print(line) zclient:send(line) -- envoie le code HTML end end - until not line + until not line file_web:close() file_web = nil else zclient:send("

"..zfilename.." not found - 404 error

Home
") @@ -49,11 +50,11 @@ srv = net.createServer() srv:listen(80, function(conn) conn:on("receive", function(client, request) _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP") - + print("zrequest: \n---\n"..request.."---") - + -- print("method: ", method) print("path: ", path) print("vars: ", vars) - + if not string.find(request, "/favicon.ico") then print("coucou") if (method == nil) then @@ -69,10 +70,8 @@ srv:listen(80, function(conn) end file_html=string.gsub(path, "/", "") -- print("file_html: ",file_html) - send_file(client, file_html) + send_file(client, file_html) end end) conn:on("sent", function(c) c:close() end) end) - - diff --git a/WIFI_sniffer/cret_project/wifi_config.html b/WIFI_sniffer/cret_project/wifi_config.html new file mode 100644 index 0000000..792ffa4 --- /dev/null +++ b/WIFI_sniffer/cret_project/wifi_config.html @@ -0,0 +1,26 @@ + + + + + + WIFI config + + + +

WIFI config 191124.1931

+
+ Coucou c'est la page 1 !
+ Retour à la home page...


+ +La température est: + +<% +ztemp=ztemp+1 +zout(ztemp.."°C") +%> + +
Mais il fait encore trop froid !
+ + + + diff --git a/WIFI_sniffer/cret_project/z_index.html b/WIFI_sniffer/cret_project/z_index.html index 79c5352..dd294eb 100644 --- a/WIFI_sniffer/cret_project/z_index.html +++ b/WIFI_sniffer/cret_project/z_index.html @@ -7,15 +7,27 @@ -

ESP8266 home page 190727.0941

+

ESP8266 home page 191124.2054

Différentes pages HTML:

Page 1, affichage de la température dynamique en code Lua inline.
Page 2, tableau dynamique écrit en Lua inline.
Page 3, affichage du capteur non linéaire corrigé.
- Page 4, test de récupération d'arguments pour un web service.
- API HUB Temp, test d'un web service hub de mesures de température.
+toto + Page 4, toto tutu titi toto tutu titi toto tutu titi pour un web service.
+tutu +tutu2 +tutu3 + +test de récupération d'arguments +?field1=11&field2=12&field3=13 + + API HUB Temp, + test d'un web service hub de mesures de température.
+tata Affichage des températures, affiche les températures mesurées.
+ WIFI configuration.
+ Page qui n'existe pas !