S5-P05 / ConfigurationFile

Dependencies:   ConfigFile

Dependents:   Ethernet

Revision:
1:5b6c5c2a33d0
Parent:
0:1405a58a7e8d
Child:
2:5af11ca8e085
diff -r 1405a58a7e8d -r 5b6c5c2a33d0 ConfigurationFile.cpp
--- a/ConfigurationFile.cpp	Sun Apr 03 15:44:20 2016 +0000
+++ b/ConfigurationFile.cpp	Mon Apr 04 22:04:09 2016 +0000
@@ -2,13 +2,10 @@
 
 ConfigurationFile::ConfigurationFile()
 {
-    PC_Comm _pc;
-    pc = _pc.pc;
 }
 
 ConfigurationFile::~ConfigurationFile()
 {
-    
 }
 
 void ConfigurationFile::setIP()
@@ -91,6 +88,26 @@
     return url;
 }
 
+void ConfigurationFile::setServerAddress()
+{
+    char value[BUFSIZ];
+    if (cfg.getValue( "SERVER", &value[0], sizeof(value))) 
+    {
+        printf("'%s'='%s'\n", "Server Address", value);
+        string s = value;
+        serverAddress = s;
+    }
+    else
+    {
+        error("Failure to read Server Address key");
+    }
+}
+
+string ConfigurationFile::getServerAddress()
+{
+    return serverAddress;
+}
+
 
 void ConfigurationFile::readServerEthernetConfiguration()
 {
@@ -105,6 +122,23 @@
     setIP();
     setMask();
     setGateway();
+    setServerAddress();
+}
+
+void ConfigurationFile::getServerConfiguration()
+{
+    getIP();
+    getMask();
+    getGateway();
+    getURL();
+}
+
+void ConfigurationFile::getNodeConfiguration()
+{
+    getIP();
+    getMask();
+    getGateway();
+    getServerAddress();
 }
 
 void ConfigurationFile::readConfigurationFile(char *pathName)