Moved slaveState() to Command::alStateString().
authorFlorian Pose <fp@igh-essen.com>
Fri, 25 Jul 2008 08:52:45 +0000
changeset 1146 f18d124d7fbc
parent 1145 133cf4631fcc
child 1147 0eac1ee8512a
Moved slaveState() to Command::alStateString().
tool/Command.cpp
tool/Command.h
tool/CommandSlaves.cpp
tool/CommandSlaves.h
--- a/tool/Command.cpp	Thu Jul 24 15:06:47 2008 +0000
+++ b/tool/Command.cpp	Fri Jul 25 08:52:45 2008 +0000
@@ -79,3 +79,16 @@
 }
 
 /****************************************************************************/
+
+string Command::alStateString(uint8_t state)
+{
+    switch (state) {
+        case 1: return "INIT";
+        case 2: return "PREOP";
+        case 4: return "SAFEOP";
+        case 8: return "OP";
+        default: return "???";
+    }
+}
+
+/****************************************************************************/
--- a/tool/Command.h	Thu Jul 24 15:06:47 2008 +0000
+++ b/tool/Command.h	Fri Jul 25 08:52:45 2008 +0000
@@ -83,6 +83,8 @@
         void throwCommandException(const stringstream &);
 
 		enum {BreakAfterBytes = 16};
+        
+        static string alStateString(uint8_t);
 
     private:
 		string name;
--- a/tool/CommandSlaves.cpp	Thu Jul 24 15:06:47 2008 +0000
+++ b/tool/CommandSlaves.cpp	Fri Jul 25 08:52:45 2008 +0000
@@ -126,7 +126,7 @@
             info.relPos = str.str();
             str.str("");
 
-            info.state = slaveState(slave.state);
+            info.state = alStateString(slave.state);
             info.flag = (slave.error_flag ? 'E' : '+');
 
             if (strlen(slave.name)) {
@@ -186,7 +186,7 @@
         cout << "Alias: " << slave.alias << endl;
 
     cout
-        << "State: " << slaveState(slave.state) << endl
+        << "State: " << alStateString(slave.state) << endl
         << "Flag: " << (slave.error_flag ? 'E' : '+') << endl
         << "Identity:" << endl
         << "  Vendor Id:       0x"
@@ -274,17 +274,4 @@
     }
 }
 
-/****************************************************************************/
-
-string CommandSlaves::slaveState(uint8_t state)
-{
-    switch (state) {
-        case 1: return "INIT";
-        case 2: return "PREOP";
-        case 4: return "SAFEOP";
-        case 8: return "OP";
-        default: return "???";
-    }
-}
-
 /*****************************************************************************/
--- a/tool/CommandSlaves.h	Thu Jul 24 15:06:47 2008 +0000
+++ b/tool/CommandSlaves.h	Fri Jul 25 08:52:45 2008 +0000
@@ -32,8 +32,6 @@
 
         void listSlaves(MasterDevice &, int);
         void showSlave(MasterDevice &, uint16_t);
-
-        static string slaveState(uint8_t);
 };
 
 /****************************************************************************/