OmWebPages

Declared In:

Introduction

A class that routes and serves web pages, and manages control values, typically works with OmWebServer for the network interface



Classes

UrlHandler


Member Functions

addButton

Add a button on the current page. Calls the action proc with value 1 for press, 0 for release.

addButtonWithLink

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.

addCheckbox

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

addCheckboxX

Add additional checkboxes

addColor

Add a color-input, int value is 0xRRGGBB

addHtml

Add a block of custom HTML to the page. Your proc is called each time the page is requested.

addPageLink

Add a link on the current page that goes to another page. Also can call an action proc.

addSelect

Begin a menu select control. Choices are added with addSelectOption()

addSelectOption

Add one selectable item, and its integer value if selected

addSlider(const char *, OmWebActionProc, int, int, void *)

Add a slider control on the current page. The range is 0 to 100, and calls your param proc when changed.

addSlider(int, int, const char *, OmWebActionProc, int, int, void *)

Add a slider control on the current page, with a specific range.

addTime

Add a time-input

addUrlHandler(const char *, OmUrlHandlerProc, int, void *)

Add an arbitrary URL handler.

addUrlHandler(OmUrlHandlerProc, int, void *)

Add a wildcard url handler, if no page or specific handler gets it.

allowFooter

By default, any footer proc is used on every page. Disable for current page here.

allowHeader

By default, any header proc is used on every page. Disable for current page here.

beginPage

Start defining a new page. Subsequent calls like addButton() affect this page.

handleRequest

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.

OmWebPages
renderHttpResponseHeader

in a OmUrlHandlerProc, set the mimetype (like "text/plain") and response code (200 is OK)

renderPageBeginning

in a OmUrlHandlerProc Render the beginning of the page, leaving element open and ready.

renderPageButton

Within an HtmlProc: Adds a floating link-button to another page.

renderTopMenu
setBgColor

set the background color for next web request, 0xRRGGBB

setBuildDateAndTime

say p.setBuildDateAndTime(__DATE__, __TIME__) so the info web page can display it.

setFooterProc

Override the default footer html

setHeaderProc

Override the default header html


addButton


Add a button on the current page. Calls the action proc with value 1 for press, 0 for release.

public

OmWebPageItem *addButton( const char *buttonName, OmWebActionProc proc = NULL, int ref1 = 0, void *ref2 = 0);

addButtonWithLink


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.

public

OmWebPageItem *addButtonWithLink( const char *buttonName, const char *url, OmWebActionProc proc = NULL, int ref1 = 0, void *ref2 = 0);

addCheckbox


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

public

OmWebPageItem *addCheckbox( const char *itemName, const char *checkboxName, OmWebActionProc proc = NULL, int value = 0, int ref1 = 0, void *ref2 = 0);

addCheckboxX


Add additional checkboxes

public

void addCheckboxX( const char *checkboxName, int value = 0);

addColor


Add a color-input, int value is 0xRRGGBB

public

OmWebPageItem *addColor( const char *itemName, OmWebActionProc proc = NULL, int value = 0, int ref1 = 0, void *ref2 = 0);

addHtml


Add a block of custom HTML to the page. Your proc is called each time the page is requested.

public

void addHtml( HtmlProc proc, int ref1 = 0, void *ref2 = 0);

addPageLink


Add a link on the current page that goes to another page. Also can call an action proc.

public

void addPageLink( const char *pageLink, OmWebActionProc proc = NULL, int ref1 = 0, void *ref2 = 0);

addSelect


Begin a menu select control. Choices are added with addSelectOption()

public

OmWebPageItem *addSelect( const char *itemName, OmWebActionProc proc = NULL, int value = 0, int ref1 = 0, void *ref2 = 0);

addSelectOption


Add one selectable item, and its integer value if selected

public

void addSelectOption( const char *optionName, int optionValue);

addSlider(const char *, OmWebActionProc, int, int, void *)


Add a slider control on the current page. The range is 0 to 100, and calls your param proc when changed.

public

OmWebPageItem *addSlider( const char *sliderName, OmWebActionProc proc = NULL, int value = 0, int ref1 = 0, void *ref2 = 0);

addSlider(int, int, const char *, OmWebActionProc, int, int, void *)


Add a slider control on the current page, with a specific range.

public

OmWebPageItem *addSlider( int rangeLow, int rangeHigh, const char *sliderName, OmWebActionProc proc = NULL, int value = 0, int ref1 = 0, void *ref2 = 0);

addTime


Add a time-input

public

OmWebPageItem *addTime( const char *itemName, OmWebActionProc proc = NULL, int value = 0, int ref1 = 0, void *ref2 = 0);

addUrlHandler(const char *, OmUrlHandlerProc, int, void *)


Add an arbitrary URL handler.

public

void addUrlHandler( const char *path, OmUrlHandlerProc proc, int ref1 = 0, void *ref2 = 0);

addUrlHandler(OmUrlHandlerProc, int, void *)


Add a wildcard url handler, if no page or specific handler gets it.

public

void addUrlHandler( OmUrlHandlerProc proc, int ref1 = 0, void *ref2 = 0);

allowFooter


By default, any footer proc is used on every page. Disable for current page here.

public

void allowFooter( bool allowFooter);

allowHeader


By default, any header proc is used on every page. Disable for current page here.

public

void allowHeader( bool allowHeader);

beginPage


Start defining a new page. Subsequent calls like addButton() affect this page.

public

void beginPage( const char *pageName);

handleRequest


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.

public

bool handleRequest( OmIByteStream *consumer, const char *pathAndQuery, OmRequestInfo *requestInfo);

OmWebPages


public

OmWebPages();
Discussion

No argument constructor


renderHttpResponseHeader


in a OmUrlHandlerProc, set the mimetype (like "text/plain") and response code (200 is OK)

public

void renderHttpResponseHeader( const char *contentType, int response);

renderPageBeginning


in a OmUrlHandlerProc Render the beginning of the page, leaving element open and ready.

public

void renderPageBeginning( OmXmlWriter &w, const char *pageTitle = "", int bgColor = 0xffffff);

renderPageButton


Within an HtmlProc: Adds a floating link-button to another page.

public

void renderPageButton( OmXmlWriter &w, const char *pageName);

renderTopMenu


public

void renderTopMenu( OmXmlWriter &w);
Discussion

Render a simple menu of all the known pages. It's the default page, too.


setBgColor


set the background color for next web request, 0xRRGGBB

public

void setBgColor( int bgColor);

setBuildDateAndTime


say p.setBuildDateAndTime(__DATE__, __TIME__) so the info web page can display it.

public

void setBuildDateAndTime( const char *date, const char *time);

setFooterProc


Override the default footer html

public

void setFooterProc( HtmlProc footerProc);

setHeaderProc


Override the default header html

public

void setHeaderProc( HtmlProc headerProc);

Member Data

greatestRenderLength
requestsAll
requestsParam

greatestRenderLength


public

unsigned int greatestRenderLength = 0;
Discussion

Maximum size of pages served


requestsAll


public

unsigned int requestsAll = 0;
Discussion

Total number of requests served


requestsParam


public

unsigned int requestsParam = 0;
Discussion

Total number of parameter-change requests served