21 |
22 |
22 static unsigned int masterIndex = DEFAULT_MASTER; |
23 static unsigned int masterIndex = DEFAULT_MASTER; |
23 static int slavePosition = DEFAULT_SLAVEPOSITION; |
24 static int slavePosition = DEFAULT_SLAVEPOSITION; |
24 static int domainIndex = DEFAULT_DOMAININDEX; |
25 static int domainIndex = DEFAULT_DOMAININDEX; |
25 static string command = DEFAULT_COMMAND; |
26 static string command = DEFAULT_COMMAND; |
|
27 vector<string> commandArgs; |
26 |
28 |
27 /*****************************************************************************/ |
29 /*****************************************************************************/ |
28 |
30 |
29 void printUsage() |
31 void printUsage() |
30 { |
32 { |
31 cerr |
33 cerr |
32 << "Usage: ethercat <COMMAND> [OPTIONS]" << endl |
34 << "Usage: ethercat <COMMAND> [OPTIONS]" << endl |
33 << "Commands:" << endl |
35 << "Commands:" << endl |
34 << " data Output binary domain process data." << endl |
36 << " data Output binary domain process data." << endl |
|
37 << " debug Set the master debug level." << endl |
35 << " domain Show domain information." << endl |
38 << " domain Show domain information." << endl |
36 << " list (ls, slaves) List all slaves (former 'lsec')." << endl |
39 << " list (ls, slaves) List all slaves (former 'lsec')." << endl |
37 << " pdos List Pdo mapping of given slaves." << endl |
40 << " pdos List Pdo mapping of given slaves." << endl |
38 << " xml Generate slave information xml." << endl |
41 << " xml Generate slave information xml." << endl |
39 << "Global options:" << endl |
42 << "Global options:" << endl |
144 try { |
149 try { |
145 master.open(masterIndex); |
150 master.open(masterIndex); |
146 |
151 |
147 if (command == "data") { |
152 if (command == "data") { |
148 master.outputData(domainIndex); |
153 master.outputData(domainIndex); |
|
154 } else if (command == "debug") { |
|
155 master.setDebug(commandArgs); |
149 } else if (command == "domain") { |
156 } else if (command == "domain") { |
150 master.showDomains(domainIndex); |
157 master.showDomains(domainIndex); |
151 } else if (command == "list" || command == "ls" || command == "slaves") { |
158 } else if (command == "list" || command == "ls" || command == "slaves") { |
152 master.listSlaves(); |
159 master.listSlaves(); |
153 } else if (command == "pdos") { |
160 } else if (command == "pdos") { |