Time: 17:33 Date: 10/12/2017 Description: Task 1,7,8 Currently Functioning
Dependencies: BME280 BMP280 TextLCD
Working Repository
NETWORK.hpp@50:3d61ca637399, 2018-01-09 (annotated)
- Committer:
- thomasmorris
- Date:
- Tue Jan 09 12:19:12 2018 +0000
- Revision:
- 50:3d61ca637399
- Parent:
- 48:244d6d81bb52
Dynamic Dating Working
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
thomasmorris | 35:26b0a9b55d82 | 1 | #if !FEATURE_LWIP |
thomasmorris | 35:26b0a9b55d82 | 2 | #error [NOT_SUPPORTED] LWIP not supported for this target |
thomasmorris | 35:26b0a9b55d82 | 3 | #endif |
thomasmorris | 35:26b0a9b55d82 | 4 | |
thomasmorris | 35:26b0a9b55d82 | 5 | #ifndef _NETWORK_HPP_ //Known as header guards |
thomasmorris | 35:26b0a9b55d82 | 6 | #define _NETWORK_HPP_ |
thomasmorris | 35:26b0a9b55d82 | 7 | |
thomasmorris | 35:26b0a9b55d82 | 8 | #include "mbed.h" |
thomasmorris | 35:26b0a9b55d82 | 9 | #include "rtos.h" |
thomasmorris | 35:26b0a9b55d82 | 10 | #include "EthernetInterface.h" |
thomasmorris | 35:26b0a9b55d82 | 11 | #include "TCPServer.h" |
thomasmorris | 35:26b0a9b55d82 | 12 | #include "TCPSocket.h" |
thomasmorris | 35:26b0a9b55d82 | 13 | #include <iostream> |
thomasmorris | 35:26b0a9b55d82 | 14 | #include <string> |
thomasmorris | 36:a0098306fc58 | 15 | #include "TIME.hpp" |
thomasmorris | 47:6d128e500875 | 16 | #include "SERIAL.hpp" |
thomasmorris | 36:a0098306fc58 | 17 | |
thomasmorris | 48:244d6d81bb52 | 18 | #define NetworkWait 5000 |
thomasmorris | 48:244d6d81bb52 | 19 | |
thomasmorris | 35:26b0a9b55d82 | 20 | |
thomasmorris | 35:26b0a9b55d82 | 21 | #define HTTP_STATUS_LINE "HTTP/1.0 200 OK" |
thomasmorris | 35:26b0a9b55d82 | 22 | #define HTTP_HEADER_FIELDS "Content-Type: text/html; charset=utf-8" |
thomasmorris | 35:26b0a9b55d82 | 23 | #define HTTP_MESSAGE_BODY1 "" \ |
thomasmorris | 35:26b0a9b55d82 | 24 | "<html>" "\r\n" \ |
thomasmorris | 48:244d6d81bb52 | 25 | "<title>Environment Sensing </title>" \ |
thomasmorris | 35:26b0a9b55d82 | 26 | " <body style=\"display:flex;text-align:center\">" "\r\n" \ |
thomasmorris | 35:26b0a9b55d82 | 27 | " <div style=\"margin:auto\">" "\r\n" \ |
thomasmorris | 36:a0098306fc58 | 28 | " <h1>Data</h1>" "\r\n" \ |
thomasmorris | 36:a0098306fc58 | 29 | " <p>The Date is " |
thomasmorris | 35:26b0a9b55d82 | 30 | |
thomasmorris | 35:26b0a9b55d82 | 31 | #define HTTP_MESSAGE_BODY2 "" \ |
thomasmorris | 35:26b0a9b55d82 | 32 | "</p>" "\r\n" \ |
thomasmorris | 35:26b0a9b55d82 | 33 | " </div>" "\r\n" \ |
thomasmorris | 35:26b0a9b55d82 | 34 | " </body>" "\r\n" \ |
thomasmorris | 35:26b0a9b55d82 | 35 | "</html>" |
thomasmorris | 35:26b0a9b55d82 | 36 | |
thomasmorris | 35:26b0a9b55d82 | 37 | #define HTTP_RESPONSE HTTP_STATUS_LINE "\r\n" \ |
thomasmorris | 35:26b0a9b55d82 | 38 | HTTP_HEADER_FIELDS "\r\n" \ |
thomasmorris | 35:26b0a9b55d82 | 39 | "\r\n" \ |
thomasmorris | 35:26b0a9b55d82 | 40 | HTTP_MESSAGE_BODY "\r\n" |
thomasmorris | 35:26b0a9b55d82 | 41 | |
thomasmorris | 35:26b0a9b55d82 | 42 | #define IP "10.0.0.10" |
thomasmorris | 35:26b0a9b55d82 | 43 | #define NETMASK "255.0.0.0" |
thomasmorris | 35:26b0a9b55d82 | 44 | #define GATEWAY "10.0.0.1" |
thomasmorris | 35:26b0a9b55d82 | 45 | |
thomasmorris | 35:26b0a9b55d82 | 46 | |
thomasmorris | 37:7c4d7f206039 | 47 | int Network_Init(); |
thomasmorris | 47:6d128e500875 | 48 | void Networking(); |
thomasmorris | 35:26b0a9b55d82 | 49 | |
thomasmorris | 35:26b0a9b55d82 | 50 | #endif |