OmEspHelpers
|
A class that routes and serves web pages, and manages control values, typically works with OmWebServer for the network interface. More...
#include <OmWebPages.h>
Public Member Functions | |
OmWebPages () | |
void | setBuildDateAndTime (const char *date, const char *time, const char *file=NULL) |
say p.setBuildDateAndTime(DATE, TIME) so the info web page can display it. | |
void | beginPage (const char *pageName) |
Start defining a new page. Subsequent calls like addButton() affect this page. If a page of this name already exists, it is reset to empty. You can rebuild the page from scratch, if for example the set of controls needs to change. | |
void | addPageLink (const char *pageLink, OmWebActionProc proc=NULL, int ref1=0, void *ref2=0) |
Add a link on the current page that goes to another page. Also can call an action proc. | |
OmWebPageItem * | addButton (const char *buttonName, OmWebActionProc proc=NULL, int ref1=0, void *ref2=0) |
Add a button on the current page. Calls the action proc with value 1 for press, 0 for release. | |
OmWebPageItem * | addButtonWithLink (const char *buttonName, const char *url, OmWebActionProc proc=NULL, int ref1=0, void *ref2=0) |
Add a button on the current page, which fires a page redirect after the button-up. The OmWebActionProc would often be NULL here, if the button's main purpose is to go to another web page. | |
OmWebPageItem * | addSlider (const char *sliderName, OmWebActionProc proc=NULL, int value=0, int ref1=0, void *ref2=0) |
Add a slider control on the current page. The range is 0 to 100, and calls your param proc when changed. | |
OmWebPageItem * | addSlider (int rangeLow, int rangeHigh, const char *sliderName, OmWebActionProc proc=NULL, int value=0, int ref1=0, void *ref2=0) |
Add a slider control on the current page, with a specific range. | |
OmWebPageItem * | addTime (const char *itemName, OmWebActionProc proc=NULL, int value=0, int ref1=0, void *ref2=0) |
Add a time-input. | |
OmWebPageItem * | addColor (const char *itemName, OmWebActionProc proc=NULL, int value=0, int ref1=0, void *ref2=0) |
Add a color-input, int value is 0xRRGGBB. | |
OmWebPageItem * | addSelect (const char *itemName, OmWebActionProc proc=NULL, int value=0, int ref1=0, void *ref2=0) |
Begin a menu select control. Choices are added with addSelectOption() | |
void | addSelectOption (const char *optionName, int optionValue) |
Add one selectable item, and its integer value if selected. | |
OmWebPageItem * | addCheckbox (const char *itemName, const char *checkboxName, OmWebActionProc proc=NULL, int value=0, int ref1=0, void *ref2=0) |
Add a single checkbox. If checkboxName is NULL, then the first checkbox will be added by addCheckboxX The int value of the control is binary, where the nth checkbox adds 2^(n-1) to the value. | |
void | addCheckboxX (const char *checkboxName, int value=0) |
Add additional checkboxes. | |
void | addHtml (HtmlProc proc, int ref1=0, void *ref2=0) |
Add a block of custom dynamic HTML to the page. Your proc is called each time the page is requested. | |
void | addStaticHtml (String staticHtml) |
Add a string of static prebuilt HTML. Included in web page unchecked, you're on your own! | |
void | allowHeader (bool allowHeader) |
By default, any header proc is used on every page. Disable for current page here. | |
void | allowFooter (bool allowFooter) |
By default, any footer proc is used on every page. Disable for current page here. | |
void | addUrlHandler (const char *path, OmUrlHandlerProc proc, int ref1=0, void *ref2=0) |
Add an arbitrary URL handler. | |
void | addUrlHandler (OmUrlHandlerProc proc, int ref1=0, void *ref2=0) |
Add a wildcard url handler, if no page or specific handler gets it. | |
bool | handleRequest (OmIByteStream *consumer, const char *pathAndQuery, OmRequestInfo *requestInfo) |
Explicitly process a request. (Not typically used.) If you used omWebServer.setHandler(omWebPages), then this is called by the web server on your behalf. In other scenarios you can call it directly with the output buffer and request. The request is the part of the URI after the host name, like "/somepage" or "/info?arg=value". now with streamed variation overloaded on top. | |
void | renderPageButton (OmXmlWriter &w, const char *pageName) |
Within an HtmlProc: Adds a floating link-button to another page. | |
void | setHeaderProc (HtmlProc headerProc) |
Override the default header html. | |
void | setFooterProc (HtmlProc footerProc) |
Override the default footer html. | |
void | setBgColor (int bgColor) |
set the background color for next web request, 0xRRGGBB | |
void | renderInfo (OmXmlWriter &w) |
void | renderStatusXml (OmXmlWriter &w) |
void | renderHttpResponseHeader (const char *contentType, int response) |
in a OmUrlHandlerProc, set the mimetype (like "text/plain") and response code (200 is OK) | |
void | renderDefaultFooter (OmXmlWriter &w) |
void | setValue (const char *pageName, const char *itemName, int value) |
int | getValue (const char *pageName, const char *itemName) |
Static Public Member Functions | |
static void | renderPageBeginning (OmXmlWriter &w, const char *pageTitle="", int bgColor=0xffffff) |
in a OmUrlHandlerProc Render the beginning of the page, leaving <body> element open and ready. More... | |
static void | renderPageBeginningWithRedirect (OmXmlWriter &w, const char *redirectUrl, int redirectSeconds, const char *pageTitle="", int bgColor=0xffffff) |
Public Attributes | |
unsigned int | requestsAll = 0 |
unsigned int | requestsParam = 0 |
unsigned int | greatestRenderLength = 0 |
char | httpBase [32] |
OmRequestInfo * | ri = 0 |
A class that routes and serves web pages, and manages control values, typically works with OmWebServer for the network interface.
OmWebPages::OmWebPages | ( | ) |
No argument constructor
|
static |
in a OmUrlHandlerProc Render the beginning of the page, leaving <body> element open and ready.
Render the beginning of the page, leaving <body> element open and ready.
unsigned int OmWebPages::greatestRenderLength = 0 |
Maximum size of pages served
unsigned int OmWebPages::requestsAll = 0 |
Total number of requests served
unsigned int OmWebPages::requestsParam = 0 |
Total number of parameter-change requests served