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