author | Florian Pose <fp@igh-essen.com> |
Wed, 23 Jul 2008 07:26:19 +0000 | |
changeset 1134 | 3356141fa2f8 |
parent 1130 | bb1c11adb2db |
child 1136 | a0982873d655 |
permissions | -rw-r--r-- |
1126
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/***************************************************************************** |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
* |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
* $Id$ |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
* |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
****************************************************************************/ |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
|
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
#include <sstream> |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8 |
#include <iomanip> |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9 |
using namespace std; |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
10 |
|
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
11 |
#include "globals.h" |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
12 |
|
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
/*****************************************************************************/ |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
14 |
|
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
15 |
const char *help_debug = |
1130
bb1c11adb2db
Updated first part of command documentation.
Florian Pose <fp@igh-essen.com>
parents:
1126
diff
changeset
|
16 |
"<LEVEL>\n" |
1126
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
17 |
"\n" |
1130
bb1c11adb2db
Updated first part of command documentation.
Florian Pose <fp@igh-essen.com>
parents:
1126
diff
changeset
|
18 |
"Set the master debug level.\n" |
1126
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
19 |
"\n" |
1130
bb1c11adb2db
Updated first part of command documentation.
Florian Pose <fp@igh-essen.com>
parents:
1126
diff
changeset
|
20 |
"Debug messages are printed to syslog.\n" |
bb1c11adb2db
Updated first part of command documentation.
Florian Pose <fp@igh-essen.com>
parents:
1126
diff
changeset
|
21 |
"\n" |
bb1c11adb2db
Updated first part of command documentation.
Florian Pose <fp@igh-essen.com>
parents:
1126
diff
changeset
|
22 |
"Arguments:\n" |
bb1c11adb2db
Updated first part of command documentation.
Florian Pose <fp@igh-essen.com>
parents:
1126
diff
changeset
|
23 |
" LEVEL must be an unsigned integer, specified\n" |
bb1c11adb2db
Updated first part of command documentation.
Florian Pose <fp@igh-essen.com>
parents:
1126
diff
changeset
|
24 |
" either in decimal (no prefix), octal (prefix '0')\n" |
bb1c11adb2db
Updated first part of command documentation.
Florian Pose <fp@igh-essen.com>
parents:
1126
diff
changeset
|
25 |
" or hexadecimal (prefix '0x').\n" |
bb1c11adb2db
Updated first part of command documentation.
Florian Pose <fp@igh-essen.com>
parents:
1126
diff
changeset
|
26 |
" 0 stands for no debugging output,\n" |
bb1c11adb2db
Updated first part of command documentation.
Florian Pose <fp@igh-essen.com>
parents:
1126
diff
changeset
|
27 |
" 1 means some debug messages, and\n" |
bb1c11adb2db
Updated first part of command documentation.
Florian Pose <fp@igh-essen.com>
parents:
1126
diff
changeset
|
28 |
" 2 outputs all frame data (use with caution!).\n"; |
1126
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
|
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
/****************************************************************************/ |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
|
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
void command_debug(void) |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
{ |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
stringstream str; |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
int debugLevel; |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
|
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
if (commandArgs.size() != 1) { |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
stringstream err; |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
err << "'debug' takes exactly one argument!"; |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
throw MasterDeviceException(err.str()); |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
} |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
|
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
str << commandArgs[0]; |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
str >> resetiosflags(ios::basefield) // guess base from prefix |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
45 |
>> debugLevel; |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
|
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
47 |
if (str.fail()) { |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
48 |
stringstream err; |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
49 |
err << "Invalid debug level '" << commandArgs[0] << "'!"; |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
50 |
throw MasterDeviceException(err.str()); |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
51 |
} |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
52 |
|
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
53 |
masterDev.open(MasterDevice::ReadWrite); |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
54 |
masterDev.setDebug(debugLevel); |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
55 |
} |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
56 |
|
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
57 |
/*****************************************************************************/ |