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.
Fork of ELEC351 by
NETWORK.hpp@37:7c4d7f206039, 2018-01-07 (annotated)
- Committer:
- thomasmorris
- Date:
- Sun Jan 07 19:21:11 2018 +0000
- Revision:
- 37:7c4d7f206039
- Parent:
- 36:a0098306fc58
- Child:
- 45:875f7e18a386
Working Revision network 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 | 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 | 36:a0098306fc58 | 44 | void Networking(int network_day, int network_month, int network_year, int network_hours, int network_minute, float network_temperature, float network_pressure, float network_light); |
| thomasmorris | 35:26b0a9b55d82 | 45 | |
| thomasmorris | 35:26b0a9b55d82 | 46 | #endif |
