16 #include "CommandConfig.h" |
16 #include "CommandConfig.h" |
17 #include "CommandData.h" |
17 #include "CommandData.h" |
18 #include "CommandDebug.h" |
18 #include "CommandDebug.h" |
19 #include "CommandDomains.h" |
19 #include "CommandDomains.h" |
20 #include "CommandDownload.h" |
20 #include "CommandDownload.h" |
|
21 #include "CommandFoeRead.h" |
|
22 #include "CommandFoeWrite.h" |
21 #include "CommandMaster.h" |
23 #include "CommandMaster.h" |
22 #include "CommandPdos.h" |
24 #include "CommandPdos.h" |
23 #include "CommandPhyRead.h" |
25 #include "CommandPhyRead.h" |
24 #include "CommandPhyWrite.h" |
26 #include "CommandPhyWrite.h" |
25 #include "CommandSdos.h" |
27 #include "CommandSdos.h" |
101 { |
104 { |
102 int c, argCount; |
105 int c, argCount; |
103 stringstream str; |
106 stringstream str; |
104 |
107 |
105 static struct option longOptions[] = { |
108 static struct option longOptions[] = { |
106 //name, has_arg, flag, val |
109 //name, has_arg, flag, val |
107 {"master", required_argument, NULL, 'm'}, |
110 {"master", required_argument, NULL, 'm'}, |
108 {"alias", required_argument, NULL, 'a'}, |
111 {"alias", required_argument, NULL, 'a'}, |
109 {"position", required_argument, NULL, 'p'}, |
112 {"position", required_argument, NULL, 'p'}, |
110 {"domain", required_argument, NULL, 'd'}, |
113 {"domain", required_argument, NULL, 'd'}, |
111 {"type", required_argument, NULL, 't'}, |
114 {"type", required_argument, NULL, 't'}, |
112 {"force", no_argument, NULL, 'f'}, |
115 {"output-file", required_argument, NULL, 'o'}, |
113 {"quiet", no_argument, NULL, 'q'}, |
116 {"force", no_argument, NULL, 'f'}, |
114 {"verbose", no_argument, NULL, 'v'}, |
117 {"quiet", no_argument, NULL, 'q'}, |
115 {"help", no_argument, NULL, 'h'}, |
118 {"verbose", no_argument, NULL, 'v'}, |
|
119 {"help", no_argument, NULL, 'h'}, |
116 {} |
120 {} |
117 }; |
121 }; |
118 |
122 |
119 do { |
123 do { |
120 c = getopt_long(argc, argv, "m:a:p:d:t:fqvh", longOptions, NULL); |
124 c = getopt_long(argc, argv, "m:a:p:d:t:o:fqvh", longOptions, NULL); |
121 |
125 |
122 switch (c) { |
126 switch (c) { |
123 case 'm': |
127 case 'm': |
124 str.clear(); |
128 str.clear(); |
125 str.str(""); |
129 str.str(""); |
262 commandList.push_back(new CommandConfig()); |
270 commandList.push_back(new CommandConfig()); |
263 commandList.push_back(new CommandData()); |
271 commandList.push_back(new CommandData()); |
264 commandList.push_back(new CommandDebug()); |
272 commandList.push_back(new CommandDebug()); |
265 commandList.push_back(new CommandDomains()); |
273 commandList.push_back(new CommandDomains()); |
266 commandList.push_back(new CommandDownload()); |
274 commandList.push_back(new CommandDownload()); |
|
275 commandList.push_back(new CommandFoeRead()); |
|
276 commandList.push_back(new CommandFoeWrite()); |
267 commandList.push_back(new CommandMaster()); |
277 commandList.push_back(new CommandMaster()); |
268 commandList.push_back(new CommandPdos()); |
278 commandList.push_back(new CommandPdos()); |
269 commandList.push_back(new CommandPhyRead()); |
279 commandList.push_back(new CommandPhyRead()); |
270 commandList.push_back(new CommandPhyWrite()); |
280 commandList.push_back(new CommandPhyWrite()); |
271 commandList.push_back(new CommandSdos()); |
281 commandList.push_back(new CommandSdos()); |
290 cmd->setVerbosity(verbosity); |
300 cmd->setVerbosity(verbosity); |
291 cmd->setAlias(slaveAlias); |
301 cmd->setAlias(slaveAlias); |
292 cmd->setPosition(slavePosition); |
302 cmd->setPosition(slavePosition); |
293 cmd->setDomain(domainIndex); |
303 cmd->setDomain(domainIndex); |
294 cmd->setDataType(dataTypeStr); |
304 cmd->setDataType(dataTypeStr); |
|
305 cmd->setOutputFile(outputFile); |
295 cmd->setForce(force); |
306 cmd->setForce(force); |
296 cmd->execute(masterDev, commandArgs); |
307 cmd->execute(masterDev, commandArgs); |
297 } catch (InvalidUsageException &e) { |
308 } catch (InvalidUsageException &e) { |
298 cerr << e.what() << endl << endl; |
309 cerr << e.what() << endl << endl; |
299 cerr << binaryBaseName << " " << cmd->helpString(); |
310 cerr << binaryBaseName << " " << cmd->helpString(); |