author | Florian Pose <fp@igh-essen.com> |
Fri, 17 Oct 2008 13:37:29 +0000 | |
changeset 1280 | dc1327c2ef5b |
parent 1222 | 7348d6abb6cb |
child 1335 | 09c6fce1ae45 |
permissions | -rw-r--r-- |
922
fede1d8f5b71
Added the new ethercat comman-line tool with lsec functionality.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/***************************************************************************** |
fede1d8f5b71
Added the new ethercat comman-line tool with lsec functionality.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
* |
fede1d8f5b71
Added the new ethercat comman-line tool with lsec functionality.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
* $Id$ |
fede1d8f5b71
Added the new ethercat comman-line tool with lsec functionality.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
* |
fede1d8f5b71
Added the new ethercat comman-line tool with lsec functionality.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
****************************************************************************/ |
fede1d8f5b71
Added the new ethercat comman-line tool with lsec functionality.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
|
fede1d8f5b71
Added the new ethercat comman-line tool with lsec functionality.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
#include <getopt.h> |
1118 | 8 |
#include <libgen.h> // basename() |
1222
7348d6abb6cb
Applied patch by Karsten Schwinne, adding a few header files necessary
Florian Pose <fp@igh-essen.com>
parents:
1200
diff
changeset
|
9 |
#include <stdlib.h> |
922
fede1d8f5b71
Added the new ethercat comman-line tool with lsec functionality.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
10 |
|
fede1d8f5b71
Added the new ethercat comman-line tool with lsec functionality.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
11 |
#include <iostream> |
1126
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
1125
diff
changeset
|
12 |
#include <iomanip> |
922
fede1d8f5b71
Added the new ethercat comman-line tool with lsec functionality.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
using namespace std; |
fede1d8f5b71
Added the new ethercat comman-line tool with lsec functionality.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
14 |
|
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
15 |
#include "CommandAlias.h" |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
16 |
#include "CommandConfig.h" |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
17 |
#include "CommandData.h" |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
18 |
#include "CommandDebug.h" |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
19 |
#include "CommandDomains.h" |
1165
c5d6e28eec91
Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
1158
diff
changeset
|
20 |
#include "CommandDownload.h" |
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
21 |
#include "CommandMaster.h" |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
22 |
#include "CommandPdos.h" |
1200 | 23 |
#include "CommandPhyRead.h" |
24 |
#include "CommandPhyWrite.h" |
|
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
25 |
#include "CommandSdos.h" |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
26 |
#include "CommandSiiRead.h" |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
27 |
#include "CommandSiiWrite.h" |
1165
c5d6e28eec91
Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
1158
diff
changeset
|
28 |
#include "CommandSlaves.h" |
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
29 |
#include "CommandStates.h" |
1165
c5d6e28eec91
Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
1158
diff
changeset
|
30 |
#include "CommandUpload.h" |
c5d6e28eec91
Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
1158
diff
changeset
|
31 |
#include "CommandVersion.h" |
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
32 |
#include "CommandXml.h" |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
33 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
34 |
/*****************************************************************************/ |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
35 |
|
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
36 |
typedef list<Command *> CommandList; |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
37 |
CommandList commandList; |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
38 |
|
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
39 |
MasterDevice masterDev; |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
40 |
|
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
41 |
string binaryBaseName; |
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
42 |
string commandName; |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
43 |
Command::StringVector commandArgs; |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
44 |
|
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
45 |
// option variables |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
46 |
unsigned int masterIndex = 0; |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
47 |
int slavePosition = -1; |
1151 | 48 |
int slaveAlias = -1; |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
49 |
int domainIndex = -1; |
968
b0e894257743
Implemented sdo_upload command.
Florian Pose <fp@igh-essen.com>
parents:
966
diff
changeset
|
50 |
string dataTypeStr; |
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
51 |
Command::Verbosity verbosity = Command::Normal; |
980
c07dd38243ba
Implemented SII writing (including alias writing) via ethercat command.
Florian Pose <fp@igh-essen.com>
parents:
978
diff
changeset
|
52 |
bool force = false; |
1121 | 53 |
bool helpRequested = false; |
922
fede1d8f5b71
Added the new ethercat comman-line tool with lsec functionality.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
54 |
|
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
55 |
/*****************************************************************************/ |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
56 |
|
1144
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
57 |
string usage() |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
58 |
{ |
1144
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
59 |
stringstream str; |
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
60 |
CommandList::const_iterator ci; |
1126
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
1125
diff
changeset
|
61 |
size_t maxWidth = 0; |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
1125
diff
changeset
|
62 |
|
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
63 |
for (ci = commandList.begin(); ci != commandList.end(); ci++) { |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
64 |
if ((*ci)->getName().length() > maxWidth) { |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
65 |
maxWidth = (*ci)->getName().length(); |
1126
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
1125
diff
changeset
|
66 |
} |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
1125
diff
changeset
|
67 |
} |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
1125
diff
changeset
|
68 |
|
1144
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
69 |
str << "Usage: " << binaryBaseName << " <COMMAND> [OPTIONS] [ARGUMENTS]" |
1137
a73c0f54be42
Added command-line help for every ethercat command.
Florian Pose <fp@igh-essen.com>
parents:
1136
diff
changeset
|
70 |
<< endl << endl |
a73c0f54be42
Added command-line help for every ethercat command.
Florian Pose <fp@igh-essen.com>
parents:
1136
diff
changeset
|
71 |
<< "Commands (can be abbreviated):" << endl; |
1126
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
1125
diff
changeset
|
72 |
|
1144
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
73 |
str << left; |
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
74 |
for (ci = commandList.begin(); ci != commandList.end(); ci++) { |
1144
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
75 |
str << " " << setw(maxWidth) << (*ci)->getName() |
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
76 |
<< " " << (*ci)->getBriefDescription() << endl; |
1126
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
1125
diff
changeset
|
77 |
} |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
1125
diff
changeset
|
78 |
|
1144
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
79 |
str << endl |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
80 |
<< "Global options:" << endl |
1137
a73c0f54be42
Added command-line help for every ethercat command.
Florian Pose <fp@igh-essen.com>
parents:
1136
diff
changeset
|
81 |
<< " --master -m <master> Index of the master to use. Default: 0." |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
82 |
<< endl |
1137
a73c0f54be42
Added command-line help for every ethercat command.
Florian Pose <fp@igh-essen.com>
parents:
1136
diff
changeset
|
83 |
<< " --force -f Force a command." << endl |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
84 |
<< " --quiet -q Output less information." << endl |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
85 |
<< " --verbose -v Output more information." << endl |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
86 |
<< " --help -h Show this help." << endl |
1137
a73c0f54be42
Added command-line help for every ethercat command.
Florian Pose <fp@igh-essen.com>
parents:
1136
diff
changeset
|
87 |
<< endl |
1144
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
88 |
<< Command::numericInfo() |
1137
a73c0f54be42
Added command-line help for every ethercat command.
Florian Pose <fp@igh-essen.com>
parents:
1136
diff
changeset
|
89 |
<< endl |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
90 |
<< "Call '" << binaryBaseName |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
91 |
<< " <COMMAND> --help' for command-specific help." << endl |
1137
a73c0f54be42
Added command-line help for every ethercat command.
Florian Pose <fp@igh-essen.com>
parents:
1136
diff
changeset
|
92 |
<< endl |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
93 |
<< "Send bug reports to " << PACKAGE_BUGREPORT << "." << endl; |
1144
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
94 |
|
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
95 |
return str.str(); |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
96 |
} |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
97 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
98 |
/*****************************************************************************/ |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
99 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
100 |
void getOptions(int argc, char **argv) |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
101 |
{ |
1158
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
102 |
int c, argCount; |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
103 |
stringstream str; |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
104 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
105 |
static struct option longOptions[] = { |
1151 | 106 |
//name, has_arg, flag, val |
107 |
{"master", required_argument, NULL, 'm'}, |
|
108 |
{"alias", required_argument, NULL, 'a'}, |
|
109 |
{"position", required_argument, NULL, 'p'}, |
|
110 |
{"domain", required_argument, NULL, 'd'}, |
|
111 |
{"type", required_argument, NULL, 't'}, |
|
112 |
{"force", no_argument, NULL, 'f'}, |
|
113 |
{"quiet", no_argument, NULL, 'q'}, |
|
114 |
{"verbose", no_argument, NULL, 'v'}, |
|
115 |
{"help", no_argument, NULL, 'h'}, |
|
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
116 |
{} |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
117 |
}; |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
118 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
119 |
do { |
1158
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
120 |
c = getopt_long(argc, argv, "m:a:p:d:t:fqvh", longOptions, NULL); |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
121 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
122 |
switch (c) { |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
123 |
case 'm': |
1158
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
124 |
str.clear(); |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
125 |
str.str(""); |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
126 |
str << optarg; |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
127 |
str >> resetiosflags(ios::basefield) // guess base from prefix |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
128 |
>> masterIndex; |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
129 |
if (str.fail() || masterIndex < 0) { |
1144
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
130 |
cerr << "Invalid master number " << optarg << "!" << endl |
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
131 |
<< endl << usage(); |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
132 |
exit(1); |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
133 |
} |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
134 |
break; |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
135 |
|
1151 | 136 |
case 'a': |
1158
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
137 |
str.clear(); |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
138 |
str.str(""); |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
139 |
str << optarg; |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
140 |
str >> resetiosflags(ios::basefield) // guess base from prefix |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
141 |
>> slaveAlias; |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
142 |
if (str.fail() || slaveAlias < 0 || slaveAlias > 0xFFFF) { |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
143 |
cerr << "Invalid slave alias " << optarg << "!" << endl |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
144 |
<< endl << usage(); |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
145 |
exit(1); |
1151 | 146 |
} |
147 |
break; |
|
148 |
||
149 |
case 'p': |
|
1158
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
150 |
str.clear(); |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
151 |
str.str(""); |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
152 |
str << optarg; |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
153 |
str >> resetiosflags(ios::basefield) // guess base from prefix |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
154 |
>> slavePosition; |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
155 |
if (str.fail() |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
156 |
|| slavePosition < 0 || slavePosition > 0xFFFF) { |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
157 |
cerr << "Invalid slave position " << optarg << "!" << endl |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
158 |
<< endl << usage(); |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
159 |
exit(1); |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
160 |
} |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
161 |
break; |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
162 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
163 |
case 'd': |
1158
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
164 |
str.clear(); |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
165 |
str.str(""); |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
166 |
str << optarg; |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
167 |
str >> resetiosflags(ios::basefield) // guess base from prefix |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
168 |
>> domainIndex; |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
169 |
if (str.fail() || domainIndex < 0) { |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
170 |
cerr << "Invalid domain index " << optarg << "!" << endl |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
171 |
<< endl << usage(); |
f65164fa4a58
Removed parameter values 'all'.
Florian Pose <fp@igh-essen.com>
parents:
1151
diff
changeset
|
172 |
exit(1); |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
173 |
} |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
174 |
break; |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
175 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
176 |
case 't': |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
177 |
dataTypeStr = optarg; |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
178 |
break; |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
179 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
180 |
case 'f': |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
181 |
force = true; |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
182 |
break; |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
183 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
184 |
case 'q': |
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
185 |
verbosity = Command::Quiet; |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
186 |
break; |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
187 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
188 |
case 'v': |
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
189 |
verbosity = Command::Verbose; |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
190 |
break; |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
191 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
192 |
case 'h': |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
193 |
helpRequested = true; |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
194 |
break; |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
195 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
196 |
case '?': |
1144
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
197 |
cerr << endl << usage(); |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
198 |
exit(1); |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
199 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
200 |
default: |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
201 |
break; |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
202 |
} |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
203 |
} |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
204 |
while (c != -1); |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
205 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
206 |
argCount = argc - optind; |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
207 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
208 |
if (!argCount) { |
1144
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
209 |
if (helpRequested) { |
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
210 |
cout << usage(); |
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
211 |
exit(0); |
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
212 |
} else { |
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
213 |
cerr << "Please specify a command!" << endl |
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
214 |
<< endl << usage(); |
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
215 |
exit(1); |
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
216 |
} |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
217 |
} |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
218 |
|
1125 | 219 |
commandName = argv[optind]; |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
220 |
while (++optind < argc) |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
221 |
commandArgs.push_back(string(argv[optind])); |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
222 |
} |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
223 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
224 |
/****************************************************************************/ |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
225 |
|
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
226 |
list<Command *> getMatchingCommands(const string &cmdStr) |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
227 |
{ |
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
228 |
CommandList::iterator ci; |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
229 |
list<Command *> res; |
1125 | 230 |
|
1127 | 231 |
// find matching commands from beginning of the string |
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
232 |
for (ci = commandList.begin(); ci != commandList.end(); ci++) { |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
233 |
if ((*ci)->matchesSubstr(cmdStr)) { |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
234 |
res.push_back(*ci); |
1125 | 235 |
} |
236 |
} |
|
237 |
||
1127 | 238 |
if (!res.size()) { // nothing found |
239 |
// find /any/ matching commands |
|
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
240 |
for (ci = commandList.begin(); ci != commandList.end(); ci++) { |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
241 |
if ((*ci)->matchesAbbrev(cmdStr)) { |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
242 |
res.push_back(*ci); |
1127 | 243 |
} |
244 |
} |
|
245 |
} |
|
246 |
||
1125 | 247 |
return res; |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
248 |
} |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
249 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
250 |
/****************************************************************************/ |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
251 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
252 |
int main(int argc, char **argv) |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
253 |
{ |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
254 |
int retval = 0; |
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
255 |
list<Command *> matchingCommands; |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
256 |
list<Command *>::const_iterator ci; |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
257 |
Command *cmd; |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
258 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
259 |
binaryBaseName = basename(argv[0]); |
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
260 |
|
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
261 |
commandList.push_back(new CommandAlias()); |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
262 |
commandList.push_back(new CommandConfig()); |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
263 |
commandList.push_back(new CommandData()); |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
264 |
commandList.push_back(new CommandDebug()); |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
265 |
commandList.push_back(new CommandDomains()); |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
266 |
commandList.push_back(new CommandDownload()); |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
267 |
commandList.push_back(new CommandMaster()); |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
268 |
commandList.push_back(new CommandPdos()); |
1200 | 269 |
commandList.push_back(new CommandPhyRead()); |
270 |
commandList.push_back(new CommandPhyWrite()); |
|
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
271 |
commandList.push_back(new CommandSdos()); |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
272 |
commandList.push_back(new CommandSiiRead()); |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
273 |
commandList.push_back(new CommandSiiWrite()); |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
274 |
commandList.push_back(new CommandSlaves()); |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
275 |
commandList.push_back(new CommandStates()); |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
276 |
commandList.push_back(new CommandUpload()); |
1165
c5d6e28eec91
Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
1158
diff
changeset
|
277 |
commandList.push_back(new CommandVersion()); |
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
278 |
commandList.push_back(new CommandXml()); |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
279 |
|
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
280 |
getOptions(argc, argv); |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
281 |
|
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
282 |
matchingCommands = getMatchingCommands(commandName); |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
283 |
masterDev.setIndex(masterIndex); |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
284 |
|
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
285 |
if (matchingCommands.size()) { |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
286 |
if (matchingCommands.size() == 1) { |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
287 |
cmd = matchingCommands.front(); |
1125 | 288 |
if (!helpRequested) { |
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
289 |
try { |
1144
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
290 |
cmd->setVerbosity(verbosity); |
1151 | 291 |
cmd->setAlias(slaveAlias); |
292 |
cmd->setPosition(slavePosition); |
|
1166 | 293 |
cmd->setDomain(domainIndex); |
294 |
cmd->setDataType(dataTypeStr); |
|
295 |
cmd->setForce(force); |
|
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
296 |
cmd->execute(masterDev, commandArgs); |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
297 |
} catch (InvalidUsageException &e) { |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
298 |
cerr << e.what() << endl << endl; |
1144
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
299 |
cerr << binaryBaseName << " " << cmd->helpString(); |
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
300 |
retval = 1; |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
301 |
} catch (CommandException &e) { |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
302 |
cerr << e.what() << endl; |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
303 |
retval = 1; |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
304 |
} catch (MasterDeviceException &e) { |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
305 |
cerr << e.what() << endl; |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
306 |
retval = 1; |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
307 |
} |
1125 | 308 |
} else { |
1144
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
309 |
cout << binaryBaseName << " " << cmd->helpString(); |
1125 | 310 |
} |
935
b954e9d91ea5
Added 'pdos' command to ethercat tool.
Florian Pose <fp@igh-essen.com>
parents:
922
diff
changeset
|
311 |
} else { |
1128 | 312 |
cerr << "Ambiguous command abbreviation! Matching:" << endl; |
1142
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
313 |
for (ci = matchingCommands.begin(); |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
314 |
ci != matchingCommands.end(); |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
315 |
ci++) { |
59be91dfcbe1
Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
1139
diff
changeset
|
316 |
cerr << (*ci)->getName() << endl; |
1125 | 317 |
} |
1144
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
318 |
cerr << endl << usage(); |
1125 | 319 |
retval = 1; |
935
b954e9d91ea5
Added 'pdos' command to ethercat tool.
Florian Pose <fp@igh-essen.com>
parents:
922
diff
changeset
|
320 |
} |
1125 | 321 |
} else { |
1144
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
322 |
cerr << "Unknown command " << commandName << "!" << endl |
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
323 |
<< endl << usage(); |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
324 |
retval = 1; |
922
fede1d8f5b71
Added the new ethercat comman-line tool with lsec functionality.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
325 |
} |
fede1d8f5b71
Added the new ethercat comman-line tool with lsec functionality.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
326 |
|
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
1121
diff
changeset
|
327 |
return retval; |
922
fede1d8f5b71
Added the new ethercat comman-line tool with lsec functionality.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
328 |
} |
fede1d8f5b71
Added the new ethercat comman-line tool with lsec functionality.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
329 |
|
fede1d8f5b71
Added the new ethercat comman-line tool with lsec functionality.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
330 |
/****************************************************************************/ |