tool/main.cpp
branch1.4-foe
changeset 1707 11ec009e145d
parent 1636 b26170e168d9
--- a/tool/main.cpp	Mon Jan 19 10:17:21 2009 +0000
+++ b/tool/main.cpp	Mon Jan 19 10:18:41 2009 +0000
@@ -18,6 +18,8 @@
 #include "CommandDebug.h"
 #include "CommandDomains.h"
 #include "CommandDownload.h"
+#include "CommandFoeRead.h"
+#include "CommandFoeWrite.h"
 #include "CommandMaster.h"
 #include "CommandPdos.h"
 #include "CommandSdos.h"
@@ -49,6 +51,7 @@
 Command::Verbosity verbosity = Command::Normal;
 bool force = false;
 bool helpRequested = false;
+string outputFile;
 
 /*****************************************************************************/
 
@@ -101,21 +104,22 @@
     stringstream str;
 
     static struct option longOptions[] = {
-        //name,      has_arg,           flag, val
-        {"master",   required_argument, NULL, 'm'},
-        {"alias",    required_argument, NULL, 'a'},
-        {"position", required_argument, NULL, 'p'},
-        {"domain",   required_argument, NULL, 'd'},
-        {"type",     required_argument, NULL, 't'},
-        {"force",    no_argument,       NULL, 'f'},
-        {"quiet",    no_argument,       NULL, 'q'},
-        {"verbose",  no_argument,       NULL, 'v'},
-        {"help",     no_argument,       NULL, 'h'},
+        //name,         has_arg,           flag, val
+        {"master",      required_argument, NULL, 'm'},
+        {"alias",       required_argument, NULL, 'a'},
+        {"position",    required_argument, NULL, 'p'},
+        {"domain",      required_argument, NULL, 'd'},
+        {"type",        required_argument, NULL, 't'},
+        {"output-file", required_argument, NULL, 'o'},
+        {"force",       no_argument,       NULL, 'f'},
+        {"quiet",       no_argument,       NULL, 'q'},
+        {"verbose",     no_argument,       NULL, 'v'},
+        {"help",        no_argument,       NULL, 'h'},
         {}
     };
 
     do {
-        c = getopt_long(argc, argv, "m:a:p:d:t:fqvh", longOptions, NULL);
+        c = getopt_long(argc, argv, "m:a:p:d:t:o:fqvh", longOptions, NULL);
 
         switch (c) {
             case 'm':
@@ -175,6 +179,10 @@
                 dataTypeStr = optarg;
                 break;
 
+            case 'o':
+                outputFile = optarg;
+                break;
+
             case 'f':
                 force = true;
                 break;
@@ -262,6 +270,8 @@
     commandList.push_back(new CommandDebug());
     commandList.push_back(new CommandDomains());
     commandList.push_back(new CommandDownload());
+    commandList.push_back(new CommandFoeRead());
+    commandList.push_back(new CommandFoeWrite());
     commandList.push_back(new CommandMaster());
     commandList.push_back(new CommandPdos());
     commandList.push_back(new CommandSdos());
@@ -288,6 +298,7 @@
                     cmd->setPosition(slavePosition);
                     cmd->setDomain(domainIndex);
                     cmd->setDataType(dataTypeStr);
+                    cmd->setOutputFile(outputFile);
                     cmd->setForce(force);
                     cmd->execute(masterDev, commandArgs);
                 } catch (InvalidUsageException &e) {