本文整理汇总了C++中WebServer::printP方法的典型用法代码示例。如果您正苦于以下问题:C++ WebServer::printP方法的具体用法?C++ WebServer::printP怎么用?C++ WebServer::printP使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebServer
的用法示例。
在下文中一共展示了WebServer::printP方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: web_index
/* ================================================================== *
* Function: web_index
* Description: Static callback function to display the homepage of the web server
* Parameters: See Webduino documentation
* obj is a pointer to the instance of Server that added the callback
* ================================================================== */
void web_index(WebServer &server, WebServer::ConnectionType type, char * c, bool b, void * obj) {
server.httpSuccess();
if (type != WebServer::HEAD) {
server.printP(control_panel);
}
}
示例2: web_input
/* ================================================================== *
* Function: web_input
* Description: Static callback function to handle input to the server
* Parameters: See Webduino documentation
* obj is a pointer to the instance of Server that added the callback
* ================================================================== */
void web_input(WebServer &server, WebServer::ConnectionType type, char * c, bool b, void * obj) {
if (type == WebServer::POST) {
Server * s = (Server *) obj;
bool repeat;
char name[16], value[16];
do {
// Read all POST params, returns false when no more params
repeat = server.readPOSTparam(name, 16, value, 16);
if (strcmp(name, "visualizer") == 0) {
int type = strtol(value, NULL, 10);
// Ensure type is valid, default to VISUALIZER_BARS
switch (type) {
case VISUALIZER_BARS:
case VISUALIZER_BARS_MIDDLE:
case VISUALIZER_PULSE:
case VISUALIZER_PLASMA:
case VISUALIZER_RAINBOW:
case VISUALIZER_WHEEL:
s->set_visualizer(type); break;
default:
s->set_visualizer(VISUALIZER_BARS); break;
}
} else if (strcmp(name, "other") == 0) {
int type = strtol(value, NULL, 10);
// Ensure type is valid, default to BOUNCING_LINES
switch (type) {
case BOUNCING_LINES:
case BAR_TEST:
case PIXEL_TEST:
case AMBIENT_LIGHTING:
s->set_visualizer(type); break;
default:
s->set_visualizer(BOUNCING_LINES); break;
}
} else if (strcmp(name, "power") == 0) {
s->set_power(strtol(value, NULL, 10));
}
} while (repeat);
// after procesing the POST data, tell the web browser to reload
// the page using a GET method.
server.httpSeeOther("/web_input");
return;
}
/* for a GET or HEAD, send the standard "it's all OK headers" */
server.httpSuccess();
/* we don't output the body for a HEAD request */
if (type == WebServer::GET) {
server.printP(control_panel);
}
}