Plymouth ELEC351 Group T / Mbed OS ELEC351

Dependencies:   BME280 BMP280 TextLCD

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers NETWORK.hpp Source File

NETWORK.hpp

00001 #if !FEATURE_LWIP
00002     #error [NOT_SUPPORTED] LWIP not supported for this target
00003 #endif
00004 
00005 #ifndef _NETWORK_HPP_ //Known as header guards
00006 #define _NETWORK_HPP_
00007 
00008 #include "mbed.h"
00009 #include "rtos.h"
00010 #include "EthernetInterface.h"
00011 #include "TCPServer.h"
00012 #include "TCPSocket.h"
00013 #include <iostream>
00014 #include <string> 
00015 #include "TIME.hpp"
00016 #include "SERIAL.hpp"
00017 
00018 #define NetworkWait 5000
00019 
00020 
00021 #define HTTP_STATUS_LINE "HTTP/1.0 200 OK"
00022 #define HTTP_HEADER_FIELDS "Content-Type: text/html; charset=utf-8"
00023 #define HTTP_MESSAGE_BODY1 ""                                    \
00024 "<html>" "\r\n"                                                  \
00025 "<title>Environment Sensing </title>"                            \
00026 "  <body style=\"display:flex;text-align:center\">" "\r\n"       \
00027 "    <div style=\"margin:auto\">" "\r\n"                         \
00028 "      <h1>Data</h1>" "\r\n"                              \
00029 "      <p>The Date is "                                     
00030 
00031 #define HTTP_MESSAGE_BODY2 ""                                    \
00032        "</p>" "\r\n"                                             \
00033 "    </div>" "\r\n"                                              \
00034 "  </body>" "\r\n"                                               \
00035 "</html>"
00036 
00037 #define HTTP_RESPONSE HTTP_STATUS_LINE "\r\n"   \
00038                       HTTP_HEADER_FIELDS "\r\n" \
00039                       "\r\n"                    \
00040                       HTTP_MESSAGE_BODY "\r\n"
00041 
00042 #define IP        "10.0.0.10"
00043 #define NETMASK   "255.0.0.0"
00044 #define GATEWAY   "10.0.0.1"
00045 
00046 
00047 int Network_Init();
00048 void Networking();
00049 
00050 #endif