Comply to new betos module. Add comments.
authorasterix <asterix@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 22 Sep 2011 08:55:48 +0000 (08:55 +0000)
committerasterix <asterix@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 22 Sep 2011 08:55:48 +0000 (08:55 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@5087 38d2e660-2303-0410-9eaa-f027e97ec537

boards/sam3x-ek/examples/sam3x-ek_http_server/main.c
boards/sam3x-ek/examples/sam3x-ek_http_server/project.bertos
boards/sam3x-ek/examples/sam3x-ek_http_server/sam3x-ek_http_server.mk

index d7b3770640bba46325eb82dc66afdff3c4ebbe93..78cf8d09636ad24fe1eae571ad0418c963c5c949 100644 (file)
  * invalidate any other reasons why the executable file might be covered by
  * the GNU General Public License.
  *
- * Copyright 2010,2011 Develer S.r.l. (http://www.develer.com/)
+ * Copyright 2011 Develer S.r.l. (http://www.develer.com/)
  *
  * -->
  *
  * \author Andrea Righi <arighi@develer.com>
+ * \author Daniele Basile <asterix@develer.com>
  *
- * \brief lwIP TCP/IP echo server listening on port 80.
+ * \brief Simple Http server.
+ *
+ * This simple web server read the site's pages from SD card, and manage
+ * the cases where SD is not present or page not found, using embedded pages.
+ * Quering from browser the /status page, the server return a json dictionary where are store
+ * some board status info, like board temperature, up-time, etc.
  */
 
-#include "bertos.c"
 
 #include "hw/hw_sd.h"
 #include "hw/hw_adc.h"
@@ -65,6 +70,8 @@
 
 #include <fs/fat.h>
 
+#include <icons/bertos.h>
+
 #include <stdio.h>
 #include <string.h>
 
@@ -152,7 +159,7 @@ static const char http_html_hdr_404[] = "HTTP/1.1 404 Not Found\r\nContent-type:
 static const char http_file_not_found[] = "\
 <!DOCTYPE html PUBLIC \"-//IETF//DTD HTML 2.0//EN\"> \
 <html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\"> \
-<title>404 Not Found</title></head><body><img src=\"bertos_jpg.jpg\"><h1>404 Not Found</h1>\
+<title>404 Not Found</title></head><body><img src=\"bertos_logo_jpg.jpg\"><h1>404 Not Found</h1>\
 <p>The requested URL was not found on this server.</p><hr>\
 <address>BeRTOS simple HTTP server</address></body></html>";
 
@@ -160,7 +167,7 @@ static const char http_file_not_found[] = "\
 static const char http_sd_not_present[] = " \
 <!DOCTYPE html PUBLIC \"-//IETF//DTD HTML 2.0//EN\">  \
 <html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">  \
-<title>BeRTOS simple HTTP Server</title></head><body><img src=\"bertos_jpg.jpg\"> \
+<title>BeRTOS simple HTTP Server</title></head><body><img src=\"bertos_logo_jpg.jpg\"> \
 <h1>BeRTOS simple HTTP Server</h1><p>Simple Http server, the site's pages are stored on SD card, check it if is present.</p><hr>\
 <a href=\"http://www.bertos.org\">www.BeRTOS.org</a></body></html> \
 ";
@@ -225,9 +232,9 @@ int main(void)
                                if (strlen(file_name) == 0)
                                        strcpy(file_name, "index.htm");
 
-                               if (!strcmp("bertos_jpg.jpg", file_name))
+                               if (!strcmp("bertos_logo_jpg.jpg", file_name))
                                {
-                                       netconn_write(client, bertos_jpg, sizeof(bertos_jpg), NETCONN_NOCOPY);
+                                       netconn_write(client, bertos_logo_jpg, bertos_logo_jpg_len, NETCONN_NOCOPY);
                                }
                                else if (!strcmp("status", file_name))
                                {
index 26e0bc8056ed8cae30f2c7f8be6a3d1e39b8a70f..2a18650d2f373e15cea6cf25d9939b07985e291c 100644 (file)
@@ -30,62 +30,64 @@ p14
 (lp15
 S'adc'
 p16
-aS'debug'
+aS'bertos'
 p17
-aS'eth'
+aS'debug'
 p18
-aS'fat'
+aS'eth'
 p19
-aS'formatwr'
+aS'fat'
 p20
-aS'heap'
+aS'formatwr'
 p21
-aS'i2s'
+aS'heap'
 p22
-aS'kblock'
+aS'i2s'
 p23
-aS'kernel'
+aS'kblock'
 p24
-aS'kfile'
+aS'kernel'
 p25
-aS'lcd_hx8347'
+aS'kfile'
 p26
-aS'lwip'
+aS'lcd_hx8347'
 p27
-aS'monitor'
+aS'lwip'
 p28
-aS'msg'
+aS'monitor'
 p29
-aS'sd'
+aS'msg'
 p30
-aS'signal'
+aS'sd'
 p31
-aS'sprintf'
+aS'signal'
 p32
-aS'timer'
+aS'sprintf'
 p33
-asS'CPU_NAME'
+aS'timer'
 p34
-VSAM3X8
+asS'CPU_NAME'
 p35
-sS'PROJECT_HW_PATH'
+VSAM3X8
 p36
-S'../..'
+sS'PROJECT_HW_PATH'
 p37
-sS'PROJECT_SRC_PATH'
+S'../..'
 p38
-S'.'
+sS'PROJECT_SRC_PATH'
 p39
-sS'PRESET'
+S'.'
 p40
+sS'PRESET'
+p41
 I01
 sS'PROJECT_SRC_PATH_FROM_MAKEFILE'
-p41
-Vboards/sam3x-ek/examples/sam3x-ek_http_server
 p42
-sS'OUTPUT'
+Vboards/sam3x-ek/examples/sam3x-ek_http_server
 p43
-(lp44
+sS'OUTPUT'
+p44
+(lp45
 S'codelite'
-p45
+p46
 as.
\ No newline at end of file
index e1a4102df1ac205614d2932ec9c2332b26dc758d..2dcfd7b1152f4d096f3e3359d0bc0bed00391266 100644 (file)
@@ -33,6 +33,7 @@ sam3x-ek_http_server_WIZARD_CSRC = \
        bertos/fs/fat.c \
        bertos/fs/fatfs/diskio.c \
        bertos/fs/fatfs/ff.c \
+       bertos/icons/bertos.c \
        bertos/io/kblock.c \
        bertos/io/kfile.c \
        bertos/kern/monitor.c \