tool/CommandVersion.cpp
author Florian Pose <fp@igh-essen.com>
Wed, 05 Nov 2008 13:41:56 +0000
branchstable-1.4
changeset 1669 9edbe472941d
parent 1165 c5d6e28eec91
child 1363 11c0b2caa253
permissions -rw-r--r--
Nomenclature and index.
1165
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/*****************************************************************************
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
 *
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     3
 * $Id$
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     4
 *
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     5
 ****************************************************************************/
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     6
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     7
#include <iostream>
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     8
using namespace std;
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     9
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    10
#include "CommandVersion.h"
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    11
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    12
/*****************************************************************************/
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    13
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    14
CommandVersion::CommandVersion():
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    15
    Command("version", "Show version information.")
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    16
{
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    17
}
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    18
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    19
/****************************************************************************/
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    20
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    21
string CommandVersion::helpString() const
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    22
{
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    23
    stringstream str;
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    24
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    25
	str << getName() << " [OPTIONS]" << endl
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    26
    	<< endl
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    27
    	<< getBriefDescription() << endl;
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    28
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
	return str.str();
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    30
}
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    31
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
/****************************************************************************/
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    34
void CommandVersion::execute(MasterDevice &m, const StringVector &args)
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    35
{
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36
    cout << "IgH EtherCAT master " << EC_MASTER_VERSION << endl;
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    37
}
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    38
c5d6e28eec91 Added 'ethercat version' command.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    39
/*****************************************************************************/