Plymouth ELEC351 Group T / Mbed OS ELEC351_Group_T

Fork of ELEC351 by Plymouth ELEC351 Group T

Revision:
45:875f7e18a386
Parent:
41:859b5e1e3d9a
Child:
47:6d128e500875
--- a/NETWORK.cpp	Mon Jan 08 15:38:53 2018 +0000
+++ b/NETWORK.cpp	Mon Jan 08 18:43:58 2018 +0000
@@ -32,12 +32,12 @@
     srv.listen(5);
     return 0;
 }
-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)
+void Networking(int network_day, int network_month, int network_year, int network_hours, int network_minute,int network_seconds, float network_temperature, float network_pressure, float network_light)
 {    
         //using namespace std;
         //Block and wait on an incoming connection
         srv.accept(&clt_sock, &clt_addr);
-        printf("Networking connection accept %s:%d\n", clt_addr.get_ip_address(), clt_addr.get_port());
+        //printf("Networking connection accept %s:%d\n", clt_addr.get_ip_address(), clt_addr.get_port());
         //Uses a C++ string to make it easier to concatinate
         string response;
         //This is a C string
@@ -49,16 +49,18 @@
         char output6_str[64];
         char output7_str[64];
         char output8_str[64];
+        char output9_str[64];
         
         //Convert to a C String
-        sprintf(output1_str, "%d/" , network_day);//Print Day
-        sprintf(output2_str, "%d/" , network_month);//Print Month
+        sprintf(output1_str, "%02d/" , network_day);//Print Day
+        sprintf(output2_str, "%02d/" , network_month);//Print Month
         sprintf(output3_str, "%d   " , network_year);//Print Year
-        sprintf(output4_str, "Time:%d:" , network_hours);//Print Hours
-        sprintf(output5_str, "%d   " , network_minute);//Print Minute
-        sprintf(output6_str, "Temperature is : %1.1f   " , network_temperature);//Print temperature
-        sprintf(output7_str, "Pressure is : %1.1f   " , network_pressure);//Print Pressure
-        sprintf(output8_str, "Light is : %5.3f   " , network_light);//Print Light level
+        sprintf(output4_str, "Time:%02d:" , network_hours);//Print Hours
+        sprintf(output5_str, "%02d:" , network_minute);//Print Minute
+        sprintf(output6_str, "%02d   " , network_seconds);//Print Seconds
+        sprintf(output7_str, "Temperature is : %1.1f   " , network_temperature);//Print temperature
+        sprintf(output8_str, "Pressure is : %1.1f   " , network_pressure);//Print Pressure
+        sprintf(output9_str, "Light is : %5.3f   " , network_light);//Print Light level
         
         
         //Build the C++ string response
@@ -71,6 +73,7 @@
         response +=output6_str;
         response +=output7_str;
         response +=output8_str;
+        response +=output9_str;
         response += HTTP_MESSAGE_BODY2;
         
         //Send static HTML response (as a C string)