Coursework template

Dependencies:   BMP280 TextLCD BME280

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Networkbits.hpp Source File

Networkbits.hpp

00001 #ifndef MBED_NETWORKBITS_H
00002 #define MBED_NETWORKBITS_H
00003 
00004 #include "mbed.h"
00005 #include "EthernetInterface.h"
00006 #include "TCPServer.h"
00007 #include "TCPSocket.h"
00008 #include <iostream>
00009 #include <string> 
00010 
00011 
00012 #define HTTP_STATUS_LINE "HTTP/1.0 200 OK"
00013 #define HTTP_HEADER_FIELDS "Content-Type: text/html; charset=utf-8"
00014 #define HTTP_MESSAGE_BODY1 ""                                    \
00015 "<html>" "\r\n"                                                  \
00016 "  <body style=\"display:flex;text-align:center\">" "\r\n"       \
00017 "    <div style=\"margin:auto\">" "\r\n"                         \
00018 "      <h1>Hello World</h1>" "\r\n"                              \
00019 "      <p>The temperature is "                                     
00020 
00021 #define HTTP_MESSAGE_BODY2 ""                                    \
00022        "</p>" "\r\n"                                             \
00023 "    </div>" "\r\n"                                              \
00024 "  </body>" "\r\n"                                               \
00025 "</html>"
00026 
00027 #define HTTP_RESPONSE HTTP_STATUS_LINE "\r\n"   \
00028                       HTTP_HEADER_FIELDS "\r\n" \
00029                       "\r\n"                    \
00030                       HTTP_MESSAGE_BODY "\r\n"
00031 
00032 #define IP        "10.0.0.10"
00033 #define NETMASK   "255.0.0.0"
00034 #define GATEWAY   "10.0.0.1"
00035 
00036 extern void networktest();
00037 
00038 #endif