Plymouth ELEC351 Group T / Mbed OS ELEC351

Dependencies:   BME280 BMP280 TextLCD

Revision:
47:6d128e500875
Parent:
45:875f7e18a386
Child:
48:244d6d81bb52
--- a/NETWORK.cpp	Mon Jan 08 19:03:49 2018 +0000
+++ b/NETWORK.cpp	Mon Jan 08 21:53:40 2018 +0000
@@ -32,8 +32,23 @@
     srv.listen(5);
     return 0;
 }
-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)
+void Networking()
 {    
+        if(Log_Value==1){pc.printf("In Network Thread\n");}
+        
+        time_t Time = Data_Buffer[(Write_Pointer - 1)].get_time();
+        tm* Time_Pointer = localtime(&Time);
+        int temp_day = Time_Pointer->tm_mday;
+        int temp_month = (Time_Pointer->tm_mon+1);//Set to current month
+        int temp_year = (Time_Pointer->tm_year+1900);//Set to current year
+        
+        int temp_hours = Time_Pointer->tm_hour;
+        int temp_minute = Time_Pointer->tm_min;
+        int temp_seconds = Time_Pointer->tm_sec;
+        
+        float temp_temperature = Data_Buffer[(Write_Pointer - 1)].get_temperature();
+        float temp_pressure = Data_Buffer[(Write_Pointer - 1)].get_pressure();
+        float temp_light = Data_Buffer[(Write_Pointer - 1)].get_light();
         //using namespace std;
         //Block and wait on an incoming connection
         srv.accept(&clt_sock, &clt_addr);
@@ -52,15 +67,15 @@
         char output9_str[64];
         
         //Convert to a C String
-        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:%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
+        sprintf(output1_str, "%02d/" , temp_day);//Print Day
+        sprintf(output2_str, "%02d/" , temp_month);//Print Month
+        sprintf(output3_str, "%d   " , temp_year);//Print Year
+        sprintf(output4_str, "Time:%02d:" , temp_hours);//Print Hours
+        sprintf(output5_str, "%02d:" , temp_minute);//Print Minute
+        sprintf(output6_str, "%02d   " , temp_seconds);//Print Seconds
+        sprintf(output7_str, "Temperature is : %1.1f   " , temp_temperature);//Print temperature
+        sprintf(output8_str, "Pressure is : %1.1f   " , temp_pressure);//Print Pressure
+        sprintf(output9_str, "Light is : %5.3f   " , temp_light);//Print Light level
         
         
         //Build the C++ string response