Temp Publish
Diff: NetWorking.hpp
- Revision:
- 0:4ccd12e1d789
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/NetWorking.hpp Tue Jan 08 16:21:39 2019 +0000 @@ -0,0 +1,70 @@ +/*------------------------------------------------------------------------------ +Creator : Jonathan Wheadon +Date : +Module : ELEC351 +Project : ELEC351_GroupA +Dependencies : +Purpose : +------------------------------------------------------------------------------*/ +//#if !FEATURE_LWIP +// #error [NOT_SUPPORTED] LWIP not supported for this target +//#endif + +#include "mbed.h" +#include "EthernetInterface.h" +#include "TCPServer.h" +#include "TCPSocket.h" +#include <iostream> +#include <string> +#include "General.hpp" + +#define HTTP_STATUS_LINE "HTTP/1.0 200 OK" +#define HTTP_HEADER_FIELDS "Content-Type: text/html; charset=utf-8" +#define HTTP_OPEN "" \ +"<html>" "\n\r" \ +"<head>" "\n\r" \ +" <meta charset=\"utf-8\">" "\n\r" \ +" <title> ELEC 351 </title>" "\n\r" \ +" <meta http-equiv=\"refresh\" content=\"5\">" "\n\r" \ +"</head>" "\n\r" \ +"<body style=\"display:flex;text-align:center\" bgcolor=\"black\" text=\"white\">" "\n\r" \ +" <div style=\"margin:auto\">" "\n\r" \ +" <img src=\"https://scontent-lhr3-1.xx.fbcdn.net/v/t1.0-9/46878948_2350013835069200_1354076263555268608_o.jpg?_nc_cat=104&_nc_ht=scontent-lhr3-1.xx&oh=347a7ea2c45a8f6d874c912b120dc396&oe=5C658958\" alt=\"Plymouth UNI logo\" width=\"768\" height=\"191\">" "\n\r"\ +" <h1> Low Power Enviromental Sensor : Network Conection </h1>" "\n\r" \ +" <table align=\"center\" BORDER=\"1\" BORDERCOLOR=\"white\"> " "\n\r" \ +" <tr>" "\n\r" \ +" <th> Date and Time </th>" "\n\r" \ +" <th> Light (V) </th>" "\n\r" \ +" <th> Pressure (mbar) </th>" "\n\r" \ +" <th> Temperature (C) </th>" "\n\r" \ +" </tr>" "\n\r" \ +" <tr>" "\n\r" \ +" <th> " + +#define NextColumb "" \ +" </th>" "\n\r" \ +" <th> " + +#define NextRow "" \ +" </tr>" "\n\r" \ +" <tr> " "\n\r" \ +" <th>" + +#define HTTP_CLOSE "" \ +" </th>" "\n\r" \ +" </tr>" "\n\r" \ +" </table>" "\n\r" \ +" </div>" "\n\r" \ +"</body>" "\n\r" \ +"</html>" + +#define HTTP_RESPONSE HTTP_STATUS_LINE "\r\n" \ + HTTP_HEADER_FIELDS "\r\n" \ + "\r\n" \ + HTTP_MESSAGE_BODY "\r\n" + +#define IP "10.0.0.10" +#define NETMASK "255.0.0.0" +#define GATEWAY "10.0.0.1" + +void NetWorkingThread(void);