# HG changeset patch # User Florian Pose # Date 1217253963 0 # Node ID c5d6e28eec91c5ced6971d60b17d7687ea6b29da # Parent bc6a17d40275fe8518b538d67cda88d39d140ef3 Added 'ethercat version' command. diff -r bc6a17d40275 -r c5d6e28eec91 TODO --- a/TODO Mon Jul 28 14:03:45 2008 +0000 +++ b/TODO Mon Jul 28 14:06:03 2008 +0000 @@ -14,10 +14,7 @@ * Get original driver for r8169. * Race in jiffies frame timeout? * ethercat tool: - - Data type abbreviations. - - Add a -n (numeric) switch. - Check for options, remove global variables. - - Add 'etherlab version'. Future issues: @@ -36,6 +33,9 @@ * Interface/buffers for asynchronous domain IO. * Make scanning and configuration run parallel (each). * File access over EtherCAT (FoE). +* ethercat tool: + - Data type abbreviations. + - Add a -n (numeric) switch. Smaller issues: diff -r bc6a17d40275 -r c5d6e28eec91 tool/CommandVersion.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool/CommandVersion.cpp Mon Jul 28 14:06:03 2008 +0000 @@ -0,0 +1,39 @@ +/***************************************************************************** + * + * $Id$ + * + ****************************************************************************/ + +#include +using namespace std; + +#include "CommandVersion.h" + +/*****************************************************************************/ + +CommandVersion::CommandVersion(): + Command("version", "Show version information.") +{ +} + +/****************************************************************************/ + +string CommandVersion::helpString() const +{ + stringstream str; + + str << getName() << " [OPTIONS]" << endl + << endl + << getBriefDescription() << endl; + + return str.str(); +} + +/****************************************************************************/ + +void CommandVersion::execute(MasterDevice &m, const StringVector &args) +{ + cout << "IgH EtherCAT master " << EC_MASTER_VERSION << endl; +} + +/*****************************************************************************/ diff -r bc6a17d40275 -r c5d6e28eec91 tool/CommandVersion.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool/CommandVersion.h Mon Jul 28 14:06:03 2008 +0000 @@ -0,0 +1,26 @@ +/***************************************************************************** + * + * $Id$ + * + ****************************************************************************/ + +#ifndef __COMMANDVERSION_H__ +#define __COMMANDVERSION_H__ + +#include "Command.h" + +/****************************************************************************/ + +class CommandVersion: + public Command +{ + public: + CommandVersion(); + + string helpString() const; + void execute(MasterDevice &, const StringVector &); +}; + +/****************************************************************************/ + +#endif diff -r bc6a17d40275 -r c5d6e28eec91 tool/Makefile.am --- a/tool/Makefile.am Mon Jul 28 14:03:45 2008 +0000 +++ b/tool/Makefile.am Mon Jul 28 14:06:03 2008 +0000 @@ -37,9 +37,9 @@ ethercat_SOURCES = \ MasterDevice.cpp MasterDevice.h \ - Command.cpp \ CommandAlias.cpp \ CommandConfig.cpp \ + Command.cpp \ CommandData.cpp \ CommandDebug.cpp \ CommandDomains.cpp \ @@ -52,11 +52,18 @@ CommandSlaves.cpp \ CommandStates.cpp \ CommandUpload.cpp \ + CommandVersion.cpp \ CommandXml.cpp \ coe_datatypes.cpp \ sii_crc.cpp \ main.cpp -ethercat_CXXFLAGS = -I../master -Wall +REV = `if test -s $(srcdir)/../svnrevision; then \ + cat $(srcdir)/../svnrevision; \ + else \ + svnversion $(srcdir)/.. 2>/dev/null || echo "unknown"; \ + fi` + +ethercat_CXXFLAGS = -I../master -Wall -DSVNREV=$(REV) #------------------------------------------------------------------------------ diff -r bc6a17d40275 -r c5d6e28eec91 tool/main.cpp --- a/tool/main.cpp Mon Jul 28 14:03:45 2008 +0000 +++ b/tool/main.cpp Mon Jul 28 14:06:03 2008 +0000 @@ -16,15 +16,16 @@ #include "CommandData.h" #include "CommandDebug.h" #include "CommandDomains.h" +#include "CommandDownload.h" #include "CommandMaster.h" #include "CommandPdos.h" #include "CommandSdos.h" -#include "CommandDownload.h" -#include "CommandUpload.h" -#include "CommandSlaves.h" #include "CommandSiiRead.h" #include "CommandSiiWrite.h" +#include "CommandSlaves.h" #include "CommandStates.h" +#include "CommandUpload.h" +#include "CommandVersion.h" #include "CommandXml.h" /*****************************************************************************/ @@ -268,6 +269,7 @@ commandList.push_back(new CommandSlaves()); commandList.push_back(new CommandStates()); commandList.push_back(new CommandUpload()); + commandList.push_back(new CommandVersion()); commandList.push_back(new CommandXml()); getOptions(argc, argv);