23 lines
682 B
C++
23 lines
682 B
C++
#include <Arduino.h>
|
|
#include "HTMLGenerator.h"
|
|
|
|
const String HTMLGenerator::GetElement(const String &tag, String &content, const String &attributes)
|
|
{
|
|
if (attributes != "")
|
|
{
|
|
content += "<" + tag + " " + attributes + ">" + content + "</" + tag + ">";
|
|
}
|
|
else
|
|
{
|
|
content+= "<" + tag + ">" + content + "</" + tag + ">";
|
|
}
|
|
return content;
|
|
}
|
|
|
|
const String HTMLGenerator::DisplayPinStatus(const String &status, const String &link, bool isOn)
|
|
{
|
|
String element = isOn ? "H4" : "p";
|
|
String content = status + (link != "" ? " <a href=\"" + link + "\">" + (isOn ? "OFF" : "ON") + "</a>" : "");
|
|
return GetElement(element, content,"");
|
|
}
|