X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=boards%2Fsam3x-ek%2Fexamples%2Fsam3x-ek_http_server%2Fmain.c;h=3b50cfaf233d7b5fd1009592f4d80c1fd3f0c08d;hb=85cd1996d4e3a8cb4bacaad35507dd39244c3fa1;hp=d8087c65b63c4a974d4aaaff27388b2f2f98fd84;hpb=f3ce42cfd746ed096afcf3d1ee287dfddba3bdef;p=bertos.git 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 }