fp@1126: /***************************************************************************** fp@1126: * fp@1126: * $Id$ fp@1126: * fp@1126: ****************************************************************************/ fp@1126: fp@1126: #include fp@1126: #include fp@1126: using namespace std; fp@1126: fp@1126: #include "globals.h" fp@1126: fp@1126: /*****************************************************************************/ fp@1126: fp@1126: const char *help_debug = fp@1130: "\n" fp@1126: "\n" fp@1130: "Set the master debug level.\n" fp@1126: "\n" fp@1130: "Debug messages are printed to syslog.\n" fp@1130: "\n" fp@1130: "Arguments:\n" fp@1137: " LEVEL can have one of the following values:\n" fp@1137: " 0 for no debugging output,\n" fp@1137: " 1 for some debug messages, or\n" fp@1137: " 2 for printing all frame contents (use with caution!).\n" fp@1137: "\n" fp@1137: "Numerical values can be specified either with decimal (no prefix),\n" fp@1137: "octal (prefix '0') or hexadecimal (prefix '0x') base.\n"; fp@1126: fp@1126: /****************************************************************************/ fp@1126: fp@1126: void command_debug(void) fp@1126: { fp@1126: stringstream str; fp@1126: int debugLevel; fp@1126: fp@1126: if (commandArgs.size() != 1) { fp@1126: stringstream err; fp@1136: err << "'" << commandName << "' takes exactly one argument!"; fp@1136: throw InvalidUsageException(err); fp@1126: } fp@1126: fp@1126: str << commandArgs[0]; fp@1126: str >> resetiosflags(ios::basefield) // guess base from prefix fp@1126: >> debugLevel; fp@1126: fp@1126: if (str.fail()) { fp@1126: stringstream err; fp@1126: err << "Invalid debug level '" << commandArgs[0] << "'!"; fp@1136: throw InvalidUsageException(err); fp@1126: } fp@1126: fp@1126: masterDev.open(MasterDevice::ReadWrite); fp@1126: masterDev.setDebug(debugLevel); fp@1126: } fp@1126: fp@1126: /*****************************************************************************/