Plymouth ELEC351 Group T / Mbed OS ELEC351_Group_T

Fork of ELEC351 by Plymouth ELEC351 Group T

Committer:
thomasmorris
Date:
Mon Jan 08 21:53:40 2018 +0000
Revision:
47:6d128e500875
Parent:
45:875f7e18a386
Child:
48:244d6d81bb52
FINAL working copy

Who changed what in which revision?

UserRevisionLine numberNew 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 35:26b0a9b55d82 18
thomasmorris 35:26b0a9b55d82 19 #define HTTP_STATUS_LINE "HTTP/1.0 200 OK"
thomasmorris 35:26b0a9b55d82 20 #define HTTP_HEADER_FIELDS "Content-Type: text/html; charset=utf-8"
thomasmorris 35:26b0a9b55d82 21 #define HTTP_MESSAGE_BODY1 "" \
thomasmorris 35:26b0a9b55d82 22 "<html>" "\r\n" \
thomasmorris 35:26b0a9b55d82 23 " <body style=\"display:flex;text-align:center\">" "\r\n" \
thomasmorris 35:26b0a9b55d82 24 " <div style=\"margin:auto\">" "\r\n" \
thomasmorris 36:a0098306fc58 25 " <h1>Data</h1>" "\r\n" \
thomasmorris 36:a0098306fc58 26 " <p>The Date is "
thomasmorris 35:26b0a9b55d82 27
thomasmorris 35:26b0a9b55d82 28 #define HTTP_MESSAGE_BODY2 "" \
thomasmorris 35:26b0a9b55d82 29 "</p>" "\r\n" \
thomasmorris 35:26b0a9b55d82 30 " </div>" "\r\n" \
thomasmorris 35:26b0a9b55d82 31 " </body>" "\r\n" \
thomasmorris 35:26b0a9b55d82 32 "</html>"
thomasmorris 35:26b0a9b55d82 33
thomasmorris 35:26b0a9b55d82 34 #define HTTP_RESPONSE HTTP_STATUS_LINE "\r\n" \
thomasmorris 35:26b0a9b55d82 35 HTTP_HEADER_FIELDS "\r\n" \
thomasmorris 35:26b0a9b55d82 36 "\r\n" \
thomasmorris 35:26b0a9b55d82 37 HTTP_MESSAGE_BODY "\r\n"
thomasmorris 35:26b0a9b55d82 38
thomasmorris 35:26b0a9b55d82 39 #define IP "10.0.0.10"
thomasmorris 35:26b0a9b55d82 40 #define NETMASK "255.0.0.0"
thomasmorris 35:26b0a9b55d82 41 #define GATEWAY "10.0.0.1"
thomasmorris 35:26b0a9b55d82 42
thomasmorris 35:26b0a9b55d82 43
thomasmorris 37:7c4d7f206039 44 int Network_Init();
thomasmorris 47:6d128e500875 45 void Networking();
thomasmorris 35:26b0a9b55d82 46
thomasmorris 35:26b0a9b55d82 47 #endif