LOGGER
Logger
Data Logging using ESP8266
|
#include <arduino.h>
#include <ESP8266WiFi.h>
#include <Time.h>
#include "webservices.h"
#include "webincludes.h"
#include "webpages.h"
#include "espserver.h"
#include "i2cservices.h"
#include "networkservices.h"
#include "parameters.h"
#include "security.h"
#include "version.h"
#include "webregistrations.h"
Classes | |
class | WebPrinter |
A generic printer for web output. More... | |
Macros | |
#define | webservicesEdit 2 |
version of this module | |
Functions | |
EXTERNDEF void | webStartPage (const char *pName) |
EXTERNDEF void | webEndPage () |
EXTERNDEF void | webXMLstartFile () |
Start a XML file output. | |
EXTERNDEF void | webXMLendFile () |
End an XML file output. | |
EXTERNDEF void | emitButton (Print *pPrint, const char *pTitle, const char *pValue, bool highlight, bool enabled) |
EXTERNDEF void | emitButtonTD (Print *pPrint, const char *pTitle, const char *pValue, bool highlight, bool enabled) |
EXTERNDEF void | emitNumberInput (Print *pPrint, String prefix, String name, int32_t defaultValue, int digits, int minAllowed, int maxAllowed) |
EXTERNDEF void | emitGenericSelector (Print *pPrint, String prefix, const char *pName, String selectedName, const char *const pNames[], bool isEnabled) |
EXTERNDEF void | emitMonthSelector (Print *pPrint, String prefix, const char *pName, uint8_t month) |
EXTERNDEF void | servicePageArguments () |
EXTERNDEF void | handleNetworkConfigurationPage () |
display the network configuration page | |
EXTERNDEF void | webServicesLoop () |
Perform periodic tasks managing web services. | |
EXTERNDEF String | getDefaultedArgument (String name, String defaultValue) |
EXTERNDEF bool | webservicesDoesArgumentExist (const char *pName) |
EXTERNDEF void | webservicesSetPermanentVariableFromArguments () |
EXTERNDEF void | versionPage () |
Report version information. | |
Variables | |
WebPrinter | webPrint |
Printer that emits to the web server. | |
EXTERNVAR Print * | pWebPrint = &webPrint |
< version of this include file More... | |
Web page Service Routines. The general purpose services for putting up web pages are in this module. Application specific routines are defined in webpages.h. Some of those interfaces are used here. The file webregistrations.h is the list of registrations for local pages.
EXTERNDEF void emitButton | ( | Print * | pPrint, |
const char * | pTitle, | ||
const char * | pValue, | ||
bool | highlight = false , |
||
bool | enabled = true |
||
) |
Emit the control for a button. When pressed a post is done with the name 'ButtonPress' and value of pName to indicate which button was pressed. The button is placed in its own table to help with formatting on the page.
pPrint | where to send the output |
pTitle | presented to the user in the button image |
pValue | value of the buttonPress argument showing what was pressed |
highlight | true to highlight the value |
enabled | true if button can be clicked |
EXTERNDEF void emitButtonTD | ( | Print * | pPrint, |
const char * | pTitle, | ||
const char * | pValue, | ||
bool | highlight = false , |
||
bool | enabled = true |
||
) |
Emit a button in a TD element
pPrint | where to send the output |
pTitle | presented to the user in the button image |
pValue | value of the buttonPress argument showing what was pressed |
highlight | true to highlight the value |
enabled | true if button can be clicked |
EXTERNDEF void emitGenericSelector | ( | Print * | pPrint, |
String | prefix, | ||
const char * | pName, | ||
String | selectedName, | ||
const char *const | pNames[], | ||
bool | isEnabled = true |
||
) |
Make a Generic chooser
Forms a select list with one line per option:
/// <select name=selectName> /// <option VALUE="opt1">opt1 /// ... /// </select> ///
@param pPrint where to send the output @param prefix string to prefix the object name with @param pName name of the object @param selectedName which option is currently selected @param pNames list of names with a NULL at the end @param isEnabled true to allow selection
EXTERNDEF void emitMonthSelector | ( | Print * | pPrint, |
String | prefix, | ||
const char * | pName, | ||
uint8_t | month | ||
) |
Make a Month chooser
Forms a select list with one line per month:
/// <select name=selectName> /// <option VALUE="1">January /// ... /// </select> ///
@param pPrint where to send the output @param prefix string to prefix the object name with @param pName name of the object @param month current selected month as an integer 1-12
EXTERNDEF void emitNumberInput | ( | Print * | pPrint, |
String | prefix, | ||
String | name, | ||
int32_t | defaultValue, | ||
int | digits, | ||
int | minAllowed, | ||
int | maxAllowed | ||
) |
Emit a field of a form that inputs a number. When the minimum and maximum allowed values are both 0 then any positive value is allowed. When both are -1 than any value is allowed. When the maximum is less than the minimum no maximum constraint is used.
pPrint | where to send the output |
prefix | prefix string for the field name |
name | remainder of the field name |
defaultValue | value for the field |
digits | number of digits expected |
minAllowed | minimum allowed value |
maxAllowed | maximum allowed value |
EXTERNDEF String getDefaultedArgument | ( | String | name, |
String | defaultValue = "" |
||
) |
Get a server argument with a default value if the argument is not passed.
name | name of the argument to read |
defaultValue | value to use if the argument is missing |
EXTERNDEF void servicePageArguments | ( | ) |
Service arguments to the page. This will call application specific code with argument values read from the page arguments. It is expected that pages which handle arguments (i.e. button presses) will call this routine at the correct time in their display output to process the arguments and display the results of that processing.
EXTERNDEF void webEndPage | ( | ) |
End a web page. This emits the matching framework to a webStartPage().
EXTERNDEF bool webservicesDoesArgumentExist | ( | const char * | pName | ) |
Test to see if an argument exists
EXTERNDEF void webservicesSetPermanentVariableFromArguments | ( | ) |
Check the arguments to the web page. If the permanentname and the permanentvalue argument are both present set the permanent variable to the new value. Security checking is the responsibility of the caller.
EXTERNDEF void webStartPage | ( | const char * | pName = "" | ) |
Start a web page. This emits a framework for the page and initiates a table that has a menu in the left column a header across the top and a footer at the bottom. This call ends by emitting a
for a cell for the page unique content is the content. The for this cell will be emitted in the webEndPage() call.
pName | name of the page |
EXTERNVAR Print* pWebPrint = &webPrint |
< version of this include file
Global pointer to where to send output for the current web page