From: asterix Date: Wed, 28 Sep 2011 17:25:29 +0000 (+0000) Subject: Add other cgi example. X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;ds=inline;h=85cd1996d4e3a8cb4bacaad35507dd39244c3fa1;hp=f3ce42cfd746ed096afcf3d1ee287dfddba3bdef;p=bertos.git Add other cgi example. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@5119 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/boards/sam3x-ek/examples/sam3x-ek_http_server/main.c b/boards/sam3x-ek/examples/sam3x-ek_http_server/main.c index d8087c65..3b50cfaf 100644 --- a/boards/sam3x-ek/examples/sam3x-ek_http_server/main.c +++ b/boards/sam3x-ek/examples/sam3x-ek_http_server/main.c @@ -171,9 +171,28 @@ static int cgi_logo(char *revc_buf, struct netconn *client) return 0; } +static int cgi_temp(char *revc_buf, struct netconn *client) +{ + (void)revc_buf; + + sprintf((char *)tx_buf, "[ %d.%d ]", status.internal_temp / 10, status.internal_temp % 10); + + http_sendOk(client); + netconn_write(client, tx_buf, strlen((char *)tx_buf), NETCONN_COPY); + return 0; +} + +static int cgi_echo(char *revc_buf, struct netconn *client) +{ + http_sendOk(client); + netconn_write(client, revc_buf, strlen((char *)revc_buf), NETCONN_COPY); + return 0; +} static HttpCGI cgi_table[] = { + { "echo", cgi_echo }, + { "temp", cgi_temp }, { "status", cgi_status }, { "bertos_logo_jpg.jpg", cgi_logo }, { NULL, NULL }