author | Florian Pose <fp@igh-essen.com> |
Mon, 14 Dec 2009 13:25:50 +0100 | |
changeset 1586 | eb9185dfa8ac |
parent 1524 | e7bdab4d6189 |
child 1826 | ec6223c3b7ec |
permissions | -rw-r--r-- |
1485 | 1 |
/***************************************************************************** |
2 |
* |
|
1524
e7bdab4d6189
Committed misteriously modified files...
Florian Pose <fp@igh-essen.com>
parents:
1485
diff
changeset
|
3 |
* $Id$ |
1485 | 4 |
* |
5 |
* Copyright (C) 2006-2009 Florian Pose, Ingenieurgemeinschaft IgH |
|
6 |
* |
|
7 |
* This file is part of the IgH EtherCAT Master. |
|
8 |
* |
|
9 |
* The IgH EtherCAT Master is free software; you can redistribute it and/or |
|
10 |
* modify it under the terms of the GNU General Public License version 2, as |
|
11 |
* published by the Free Software Foundation. |
|
12 |
* |
|
13 |
* The IgH EtherCAT Master is distributed in the hope that it will be useful, |
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
|
16 |
* Public License for more details. |
|
17 |
* |
|
18 |
* You should have received a copy of the GNU General Public License along |
|
19 |
* with the IgH EtherCAT Master; if not, write to the Free Software |
|
20 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
21 |
* |
|
22 |
* --- |
|
23 |
* |
|
24 |
* The license mentioned above concerns the source code only. Using the |
|
25 |
* EtherCAT technology and brand is only permitted in compliance with the |
|
26 |
* industrial property and similar rights of Beckhoff Automation GmbH. |
|
27 |
* |
|
28 |
****************************************************************************/ |
|
29 |
||
30 |
#include <iostream> |
|
31 |
#include <iomanip> |
|
32 |
#include <list> |
|
33 |
#include <string.h> |
|
34 |
using namespace std; |
|
35 |
||
36 |
#include "CommandEoe.h" |
|
37 |
||
38 |
/*****************************************************************************/ |
|
39 |
||
40 |
CommandEoe::CommandEoe(): |
|
41 |
Command("eoe", "Display Ethernet over EtherCAT statictics.") |
|
42 |
{ |
|
43 |
} |
|
44 |
||
45 |
/*****************************************************************************/ |
|
46 |
||
47 |
string CommandEoe::helpString() const |
|
48 |
{ |
|
49 |
stringstream str; |
|
50 |
||
51 |
str << getName() << endl |
|
52 |
<< endl |
|
53 |
<< getBriefDescription() << endl |
|
54 |
<< endl |
|
55 |
<< "The TxRate and RxRate are displayed in Byte/s." << endl |
|
56 |
<< endl; |
|
57 |
||
58 |
return str.str(); |
|
59 |
} |
|
60 |
||
61 |
/****************************************************************************/ |
|
62 |
||
63 |
void CommandEoe::execute(MasterDevice &m, const StringVector &args) |
|
64 |
{ |
|
65 |
ec_ioctl_master_t master; |
|
66 |
unsigned int i; |
|
67 |
ec_ioctl_eoe_handler_t eoe; |
|
68 |
||
69 |
if (args.size()) { |
|
70 |
stringstream err; |
|
71 |
err << "'" << getName() << "' takes no arguments!"; |
|
72 |
throwInvalidUsageException(err); |
|
73 |
} |
|
74 |
||
75 |
m.open(MasterDevice::Read); |
|
76 |
m.getMaster(&master); |
|
77 |
||
78 |
cout << "Interface Slave State " |
|
79 |
<< "RxBytes RxRate " |
|
80 |
<< "TxBytes TxRate TxQueue" |
|
81 |
<< endl; |
|
82 |
||
83 |
for (i = 0; i < master.eoe_handler_count; i++) { |
|
84 |
stringstream queue; |
|
85 |
||
86 |
m.getEoeHandler(&eoe, i); |
|
87 |
||
88 |
queue << eoe.tx_queued_frames << "/" << eoe.tx_queue_size; |
|
89 |
||
90 |
cout |
|
91 |
<< setw(9) << eoe.name << " " |
|
92 |
<< setw(5) << dec << eoe.slave_position << " " |
|
93 |
<< setw(5) << (eoe.open ? "up" : "down") << " " |
|
94 |
<< setw(7) << eoe.rx_bytes << " " |
|
95 |
<< setw(6) << eoe.rx_rate << " " |
|
96 |
<< setw(7) << eoe.tx_bytes << " " |
|
97 |
<< setw(6) << eoe.tx_rate << " " |
|
98 |
<< setw(7) << queue.str() |
|
99 |
<< endl; |
|
100 |
} |
|
101 |
} |
|
102 |
||
103 |
/*****************************************************************************/ |