Time: 17:33 Date: 10/12/2017 Description: Task 1,7,8 Currently Functioning
Dependencies: BME280 BMP280 TextLCD
Working Repository
NETWORK.hpp@45:875f7e18a386, 2018-01-08 (annotated)
- Committer:
- thomasmorris
- Date:
- Mon Jan 08 18:43:58 2018 +0000
- Revision:
- 45:875f7e18a386
- Parent:
- 37:7c4d7f206039
- Child:
- 47:6d128e500875
Finished Coursework
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 | 36:a0098306fc58 | 16 | |
thomasmorris | 35:26b0a9b55d82 | 17 | |
thomasmorris | 35:26b0a9b55d82 | 18 | #define HTTP_STATUS_LINE "HTTP/1.0 200 OK" |
thomasmorris | 35:26b0a9b55d82 | 19 | #define HTTP_HEADER_FIELDS "Content-Type: text/html; charset=utf-8" |
thomasmorris | 35:26b0a9b55d82 | 20 | #define HTTP_MESSAGE_BODY1 "" \ |
thomasmorris | 35:26b0a9b55d82 | 21 | "<html>" "\r\n" \ |
thomasmorris | 35:26b0a9b55d82 | 22 | " <body style=\"display:flex;text-align:center\">" "\r\n" \ |
thomasmorris | 35:26b0a9b55d82 | 23 | " <div style=\"margin:auto\">" "\r\n" \ |
thomasmorris | 36:a0098306fc58 | 24 | " <h1>Data</h1>" "\r\n" \ |
thomasmorris | 36:a0098306fc58 | 25 | " <p>The Date is " |
thomasmorris | 35:26b0a9b55d82 | 26 | |
thomasmorris | 35:26b0a9b55d82 | 27 | #define HTTP_MESSAGE_BODY2 "" \ |
thomasmorris | 35:26b0a9b55d82 | 28 | "</p>" "\r\n" \ |
thomasmorris | 35:26b0a9b55d82 | 29 | " </div>" "\r\n" \ |
thomasmorris | 35:26b0a9b55d82 | 30 | " </body>" "\r\n" \ |
thomasmorris | 35:26b0a9b55d82 | 31 | "</html>" |
thomasmorris | 35:26b0a9b55d82 | 32 | |
thomasmorris | 35:26b0a9b55d82 | 33 | #define HTTP_RESPONSE HTTP_STATUS_LINE "\r\n" \ |
thomasmorris | 35:26b0a9b55d82 | 34 | HTTP_HEADER_FIELDS "\r\n" \ |
thomasmorris | 35:26b0a9b55d82 | 35 | "\r\n" \ |
thomasmorris | 35:26b0a9b55d82 | 36 | HTTP_MESSAGE_BODY "\r\n" |
thomasmorris | 35:26b0a9b55d82 | 37 | |
thomasmorris | 35:26b0a9b55d82 | 38 | #define IP "10.0.0.10" |
thomasmorris | 35:26b0a9b55d82 | 39 | #define NETMASK "255.0.0.0" |
thomasmorris | 35:26b0a9b55d82 | 40 | #define GATEWAY "10.0.0.1" |
thomasmorris | 35:26b0a9b55d82 | 41 | |
thomasmorris | 35:26b0a9b55d82 | 42 | |
thomasmorris | 37:7c4d7f206039 | 43 | int Network_Init(); |
thomasmorris | 45:875f7e18a386 | 44 | void Networking(int network_day, int network_month, int network_year, int network_hours, int network_minute,int network_seconds, float network_temperature, float network_pressure, float network_light); |
thomasmorris | 35:26b0a9b55d82 | 45 | |
thomasmorris | 35:26b0a9b55d82 | 46 | #endif |