mirror of
https://github.com/kevinveenbirkenbach/physical-interface.git
synced 2024-12-04 23:17:20 +01:00
Created an extra template file
This commit is contained in:
parent
98c67cf169
commit
7722947263
@ -2,43 +2,3 @@ const String titel = "Physical Interface";
|
|||||||
// Setup for wifi connection.
|
// Setup for wifi connection.
|
||||||
const char *ssid = ""; //SSID
|
const char *ssid = ""; //SSID
|
||||||
const char *password = ""; //Wlan-Passwort
|
const char *password = ""; //Wlan-Passwort
|
||||||
|
|
||||||
const String homepage =
|
|
||||||
"<!DOCTYPE html>"
|
|
||||||
"<html>"
|
|
||||||
"<head>"
|
|
||||||
"<title>"+String(titel)+"</title>"
|
|
||||||
"<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css\">"
|
|
||||||
"<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js\"></script>"
|
|
||||||
"<script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js\"></script>"
|
|
||||||
"</head>"
|
|
||||||
"<body>"
|
|
||||||
"<div class=\"container\">"
|
|
||||||
"<h1>"+String(titel)+"</h1>"
|
|
||||||
"<p>An REST-API Arduino microcontroller, which allows you to interact with hardware and the physical environment.</p>"
|
|
||||||
"<h2>Actors</h2>"
|
|
||||||
"<h3>Remote Plug Interface</h3>"
|
|
||||||
"<form method=\"get\" >"
|
|
||||||
"<div class=\"form-group\">"
|
|
||||||
"<label for=\"plug_id\">Plug-ID:</label>"
|
|
||||||
"<input type=\"number\" class= \"form-control\" id=\"plug_id\" name=\"plug_id\">"
|
|
||||||
"</div>"
|
|
||||||
"<div class=\"form-group\">"
|
|
||||||
"<label class=\"checkbox-inline\" for=\"on\">"
|
|
||||||
"<input type=\"radio\" id=\"on\" name=\"status\" value=\"1\">"
|
|
||||||
"on"
|
|
||||||
"</label>"
|
|
||||||
"<label class=\"checkbox-inline\" for=\"off\">"
|
|
||||||
"<input type=\"radio\" id=\"off\" name=\"status\" value=\"0\">"
|
|
||||||
"off"
|
|
||||||
"</label>"
|
|
||||||
"</div>"
|
|
||||||
"<input type=\"submit\" class=\"btn btn-secondary\">"
|
|
||||||
"</form>"
|
|
||||||
"<h2>Sensors</h2>"
|
|
||||||
"<p>The sensor datas can be reached <a href=\"?format=json\">here</a>.</p>"
|
|
||||||
"<hr />"
|
|
||||||
"<p><small>Please check out the <a href=\"https://github.com/kevinveenbirkenbach/physical-interface\">git-repository</a> to get more information about this software.</small></p>"
|
|
||||||
"</div>"
|
|
||||||
"<body>"
|
|
||||||
"<html>";
|
|
||||||
|
43
main/homepage_template.h
Normal file
43
main/homepage_template.h
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
String homepage_template(void){
|
||||||
|
return
|
||||||
|
"<!DOCTYPE html>"
|
||||||
|
"<html>"
|
||||||
|
"<head>"
|
||||||
|
"<title>"+String(titel)+"</title>"
|
||||||
|
"<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css\">"
|
||||||
|
"<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js\"></script>"
|
||||||
|
"<script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js\"></script>"
|
||||||
|
"<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css\">"
|
||||||
|
"<script src=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/js/all.min.js\"></script>"
|
||||||
|
"</head>"
|
||||||
|
"<body>"
|
||||||
|
"<div class=\"container\">"
|
||||||
|
"<h1>"+String(titel)+"</h1>"
|
||||||
|
"<p>An REST-API Arduino microcontroller, which allows you to interact with hardware and the physical environment.</p>"
|
||||||
|
"<h2>Actors <i class=\"fas fa-cogs\"></i></h2>"
|
||||||
|
"<h3>Remote Plugs <i class=\"fas fa-plug\"></i></h3>"
|
||||||
|
"<form method=\"get\" >"
|
||||||
|
"<div class=\"form-group\">"
|
||||||
|
"<label for=\"plug_id\">Plug-ID:</label>"
|
||||||
|
"<input type=\"number\" class= \"form-control\" id=\"plug_id\" name=\"plug_id\">"
|
||||||
|
"</div>"
|
||||||
|
"<div class=\"form-group\">"
|
||||||
|
"<label class=\"checkbox-inline\" for=\"on\">"
|
||||||
|
"<input type=\"radio\" id=\"on\" name=\"status\" value=\"1\">"
|
||||||
|
"<i class=\"fas fa-toggle-on\"></i> on"
|
||||||
|
"</label>"
|
||||||
|
"<label class=\"checkbox-inline\" for=\"off\">"
|
||||||
|
"<input type=\"radio\" id=\"off\" name=\"status\" value=\"0\">"
|
||||||
|
"<i class=\"fas fa-toggle-off\"></i> off"
|
||||||
|
"</label>"
|
||||||
|
"</div>"
|
||||||
|
"<input type=\"submit\" class=\"btn btn-secondary\">"
|
||||||
|
"</form>"
|
||||||
|
"<h2>Sensors <i class=\"fas fa-thermometer\"></i></h2>"
|
||||||
|
"<p>The sensor datas can be reached <a href=\"?format=json\">here</a>.</p>"
|
||||||
|
"<hr />"
|
||||||
|
"<p><small>Please check out the <a href=\"https://github.com/kevinveenbirkenbach/physical-interface\">git-repository</a> to get more information about this software.</small></p>"
|
||||||
|
"</div>"
|
||||||
|
"<body>"
|
||||||
|
"<html>";
|
||||||
|
}
|
@ -11,6 +11,7 @@
|
|||||||
#include <NewRemoteTransmitter.h>
|
#include <NewRemoteTransmitter.h>
|
||||||
#include <DHT.h>
|
#include <DHT.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "homepage_template.h"
|
||||||
|
|
||||||
// Define Constants
|
// Define Constants
|
||||||
const int pin_ritter = 13;
|
const int pin_ritter = 13;
|
||||||
@ -116,6 +117,7 @@ String getJson(void){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void handleRequest(void){
|
void handleRequest(void){
|
||||||
|
Serial.println("Website was called.");
|
||||||
if(server.arg("plug_id") && server.arg("status")){
|
if(server.arg("plug_id") && server.arg("status")){
|
||||||
if(server.arg("plug_id")=="group"){
|
if(server.arg("plug_id")=="group"){
|
||||||
setRitterGroup(server.arg("status").toInt());
|
setRitterGroup(server.arg("status").toInt());
|
||||||
@ -126,7 +128,7 @@ void handleRequest(void){
|
|||||||
if(server.arg("format")=="json"){
|
if(server.arg("format")=="json"){
|
||||||
server.send ( 200, "text/html", getJson());
|
server.send ( 200, "text/html", getJson());
|
||||||
}else{
|
}else{
|
||||||
server.send ( 200, "text/html", homepage);
|
server.send ( 200, "text/html", homepage_template());
|
||||||
}
|
}
|
||||||
delay(100);
|
delay(100);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user