Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: WIZnetInterface mbed
Fork of WIZ_Proto_Makers_3th_Lab2 by
Revision 1:a4e5ec9f59cc, committed 2016-02-03
- Comitter:
- Ricky_Kwon
- Date:
- Wed Feb 03 03:08:13 2016 +0000
- Parent:
- 0:722e7ff3a065
- Child:
- 2:6a79ff33db7f
- Commit message:
- WIZ Proto Makers 3th Lab 1
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Feb 03 03:04:46 2016 +0000
+++ b/main.cpp Wed Feb 03 03:08:13 2016 +0000
@@ -2,10 +2,6 @@
#include "EthernetInterface.h"
#define WEB_SERVER_PORT 80
-char send_dat[1024]={0,};
-uint16_t calcu_len(void);
-
-DigitalOut myled(LED1);
int main (void)
{
@@ -34,12 +30,6 @@
printf("Connection from: %s\r\n", client.get_address());
char buffer[256];
- char dat[128];
- char *dat_temp;
-
- memset(dat, 0, sizeof(dat));
- memset(send_dat, 0, sizeof(send_dat));
- memset(buffer, 0, sizeof(buffer));
while (true) {
@@ -49,92 +39,11 @@
//buffer[n] = '\0';
printf("rev_dat : %s\r\n", buffer);
-
-
- if((buffer[0]=='G')&&(buffer[1]=='E')&&(buffer[2]=='T')&&(buffer[3]==' '))// GET_Request
- {
- if((buffer[13]=='?'))
- {
- if((buffer[18]=='O')&&(buffer[19]=='F'))
- {
- printf("---LED OFF---\r\n");
- myled = 1;
- dat_temp = "HTTP/1.1 200 OK\r\n"; strcat(dat, dat_temp);
- dat_temp = "Content-Type: text/html\r\n"; strcat(dat, dat_temp);
- dat_temp = "Connection: close\r\n"; strcat(dat, dat_temp);
-
- sprintf(dat, "%sContent-Length: %d\r\n", dat, calcu_len()); strcat(dat, dat_temp);
-
- client.send(dat, strlen(dat));
- printf("send_dat : %s\r\n", dat);
-
- client.send(send_dat, sizeof(send_dat));
- printf("send_dat : %s\r\n", send_dat);
-
- memset(dat, 0, sizeof(dat));
- memset(send_dat, 0, sizeof(send_dat));
- memset(buffer, 0, sizeof(buffer));
- }
- else
- {
- printf("---LED ON---\r\n");
- myled = 0;
- dat_temp = "HTTP/1.1 200 OK\r\n"; strcat(dat, dat_temp);
- dat_temp = "Content-Type: text/html\r\n"; strcat(dat, dat_temp);
- dat_temp = "Connection: close\r\n"; strcat(dat, dat_temp);
-
- sprintf(dat, "%sContent-Length: %d\r\n", dat, calcu_len()); strcat(dat, dat_temp);
-
- client.send(dat, strlen(dat));
- printf("send_dat : %s\r\n", dat);
-
- client.send(send_dat, sizeof(send_dat));
- printf("send_dat : %s\r\n", send_dat);
-
- memset(dat, 0, sizeof(dat));
- memset(send_dat, 0, sizeof(send_dat));
- memset(buffer, 0, sizeof(buffer));
- }
- }
-
- else
- {
- dat_temp = "HTTP/1.1 200 OK\r\n"; strcat(dat, dat_temp);
- dat_temp = "Content-Type: text/html\r\n"; strcat(dat, dat_temp);
- dat_temp = "Connection: close\r\n"; strcat(dat, dat_temp);
- //len = calcu_len();
- sprintf(dat, "%sContent-Length: %d\r\n", dat, calcu_len()); strcat(dat, dat_temp);
-
- client.send(dat, strlen(dat));
- printf("send_dat : %s\r\n", dat);
-
- client.send(send_dat, sizeof(send_dat));
- printf("send_dat : %s\r\n", send_dat);
-
- memset(dat, 0, sizeof(dat));
- memset(send_dat, 0, sizeof(send_dat));
- memset(buffer, 0, sizeof(buffer));
- }
- }
-
+
}
client.close();
}
}
-uint16_t calcu_len(void)
-{
- char * dat_temp;
-
- dat_temp = "<html>\r\n"\
- "<body>\r\n"\
- "<a href='led.html?LED=ON'>LED ON</a>\r\n"\
- "<br>\r\n"\
- "<a href='led.html?LED=OFF'>LED OFF</a>\r\n"\
- "<body>\r\n"\
- "<html>\r\n";
- strcat(send_dat, dat_temp);
- return strlen(send_dat);
-}
\ No newline at end of file