Moved slaveState() to Command::alStateString().
This commit is contained in:
parent
e3caba45ab
commit
884f83e29d
|
|
@ -79,3 +79,16 @@ void Command::throwCommandException(const stringstream &s)
|
|||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
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 "???";
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -83,6 +83,8 @@ class Command
|
|||
void throwCommandException(const stringstream &);
|
||||
|
||||
enum {BreakAfterBytes = 16};
|
||||
|
||||
static string alStateString(uint8_t);
|
||||
|
||||
private:
|
||||
string name;
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ void CommandSlaves::listSlaves(
|
|||
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 @@ void CommandSlaves::showSlave(
|
|||
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 @@ void CommandSlaves::showSlave(
|
|||
}
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
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 "???";
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -32,8 +32,6 @@ class CommandSlaves:
|
|||
|
||||
void listSlaves(MasterDevice &, int);
|
||||
void showSlave(MasterDevice &, uint16_t);
|
||||
|
||||
static string slaveState(uint8_t);
|
||||
};
|
||||
|
||||
/****************************************************************************/
|
||||
|
|
|
|||
Loading…
Reference in New Issue