No changes
Networkbits.hpp@8:df979097cc71, 2017-12-07 (annotated)
- Committer:
- noutram
- Date:
- Thu Dec 07 15:28:16 2017 +0000
- Revision:
- 8:df979097cc71
Library for ELEC350 and ELEC351 2017
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
noutram | 8:df979097cc71 | 1 | #ifndef MBED_NETWORKBITS_H |
noutram | 8:df979097cc71 | 2 | #define MBED_NETWORKBITS_H |
noutram | 8:df979097cc71 | 3 | |
noutram | 8:df979097cc71 | 4 | #include "mbed.h" |
noutram | 8:df979097cc71 | 5 | #include "EthernetInterface.h" |
noutram | 8:df979097cc71 | 6 | #include "TCPServer.h" |
noutram | 8:df979097cc71 | 7 | #include "TCPSocket.h" |
noutram | 8:df979097cc71 | 8 | #include <iostream> |
noutram | 8:df979097cc71 | 9 | #include <string> |
noutram | 8:df979097cc71 | 10 | |
noutram | 8:df979097cc71 | 11 | |
noutram | 8:df979097cc71 | 12 | #define HTTP_STATUS_LINE "HTTP/1.0 200 OK" |
noutram | 8:df979097cc71 | 13 | #define HTTP_HEADER_FIELDS "Content-Type: text/html; charset=utf-8" |
noutram | 8:df979097cc71 | 14 | #define HTTP_MESSAGE_BODY1 "" \ |
noutram | 8:df979097cc71 | 15 | "<html>" "\r\n" \ |
noutram | 8:df979097cc71 | 16 | " <body style=\"display:flex;text-align:center\">" "\r\n" \ |
noutram | 8:df979097cc71 | 17 | " <div style=\"margin:auto\">" "\r\n" \ |
noutram | 8:df979097cc71 | 18 | " <h1>Hello World</h1>" "\r\n" \ |
noutram | 8:df979097cc71 | 19 | " <p>The temperature is " |
noutram | 8:df979097cc71 | 20 | |
noutram | 8:df979097cc71 | 21 | #define HTTP_MESSAGE_BODY2 "" \ |
noutram | 8:df979097cc71 | 22 | "</p>" "\r\n" \ |
noutram | 8:df979097cc71 | 23 | " </div>" "\r\n" \ |
noutram | 8:df979097cc71 | 24 | " </body>" "\r\n" \ |
noutram | 8:df979097cc71 | 25 | "</html>" |
noutram | 8:df979097cc71 | 26 | |
noutram | 8:df979097cc71 | 27 | #define HTTP_RESPONSE HTTP_STATUS_LINE "\r\n" \ |
noutram | 8:df979097cc71 | 28 | HTTP_HEADER_FIELDS "\r\n" \ |
noutram | 8:df979097cc71 | 29 | "\r\n" \ |
noutram | 8:df979097cc71 | 30 | HTTP_MESSAGE_BODY "\r\n" |
noutram | 8:df979097cc71 | 31 | |
noutram | 8:df979097cc71 | 32 | #define IP "10.0.0.10" |
noutram | 8:df979097cc71 | 33 | #define NETMASK "255.0.0.0" |
noutram | 8:df979097cc71 | 34 | #define GATEWAY "10.0.0.1" |
noutram | 8:df979097cc71 | 35 | |
noutram | 8:df979097cc71 | 36 | extern void networktest(); |
noutram | 8:df979097cc71 | 37 | |
noutram | 8:df979097cc71 | 38 | #endif |