Add other cgi example.
authorasterix <asterix@38d2e660-2303-0410-9eaa-f027e97ec537>
Wed, 28 Sep 2011 17:25:29 +0000 (17:25 +0000)
committerasterix <asterix@38d2e660-2303-0410-9eaa-f027e97ec537>
Wed, 28 Sep 2011 17:25:29 +0000 (17:25 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@5119 38d2e660-2303-0410-9eaa-f027e97ec537

boards/sam3x-ek/examples/sam3x-ek_http_server/main.c

index d8087c65b63c4a974d4aaaff27388b2f2f98fd84..3b50cfaf233d7b5fd1009592f4d80c1fd3f0c08d 100644 (file)
@@ -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 }