networking library files

Dependents:   ELEC350_Project2

Revision:
10:b8214cc88e85
Parent:
9:e22fd5795831
--- a/Networking.cpp	Fri Dec 28 12:04:38 2018 +0000
+++ b/Networking.cpp	Wed Jan 02 19:45:02 2019 +0000
@@ -7,9 +7,12 @@
     EthernetInterface eth;
     eth.set_network(IP, NETMASK, GATEWAY);
     eth.connect();
+    /*
     printlock.lock();
     pc->printf("The target IP address is '%s'\n\n\n\r", eth.get_ip_address());
     printlock.unlock();
+    */
+    printQueue.call(printf, "The target IP address is '%s'\n\n\n\r", eth.get_ip_address());
     
     //Now setup a web server
     TCPServer srv;           //TCP/IP Server
@@ -34,9 +37,12 @@
         
         if(logging)
         {
+            /*
             printlock.lock();
             printf("Incoming connection accepted on %s:%d\r\n", clt_addr.get_ip_address(), clt_addr.get_port());
             printlock.unlock();
+            */
+            printQueue.call(printf,"Incoming connection accepted on %s:%d\r\n", clt_addr.get_ip_address(), clt_addr.get_port()); 
         }
         
         //Uses a C++ string to make it easier to concatinate
@@ -54,7 +60,7 @@
             bufferLock.unlock();        
             
             //Convert to a C String
-            printlock.lock(); //necessary?
+            //printlock.lock(); //necessary?
             sprintf(temp_str, "%5.2f", temp);
             sprintf(press_str, "%5.2f", press);
             sprintf(light_str, "%5.2f", light);
@@ -78,16 +84,19 @@
             response += HTTP_MESSAGE_FOOT;
             
             response += "\r\n"; 
-            printlock.unlock();
+            //printlock.unlock();
                     
             //Send static HTML response (as a C string)
             clt_sock.send(response.c_str(), response.size());
             
             if(logging)
             {
+                /*
                 printlock.lock();
                 pc->printf("Network thread responded with time: %s, temperature: %s, pressure:%s and light level: %s\r\n\n",time_str, temp_str, press_str, light_str);
-                printlock.unlock();   
+                printlock.unlock(); 
+                */
+                printQueue.call(printf, "Network thread responded with time: %s, temperature: %s, pressure:%s and light level: %s\r\n\n",time_str, temp_str, press_str, light_str);  
             } 
         }
         network_tout.detach();