author | Dave Page <dave.page@gleeble.com> |
Thu, 26 Mar 2015 15:16:21 -0400 | |
changeset 2609 | 777d1a8b3a27 |
parent 2589 | 2b9c78543663 |
permissions | -rw-r--r-- |
1961 | 1 |
/***************************************************************************** |
2 |
* |
|
3 |
* $Id$ |
|
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 |
* vim: expandtab |
|
29 |
* |
|
30 |
****************************************************************************/ |
|
31 |
||
32 |
#include <sstream> |
|
33 |
#include <iomanip> |
|
34 |
using namespace std; |
|
35 |
||
36 |
#include "CommandRescan.h" |
|
37 |
#include "MasterDevice.h" |
|
38 |
||
39 |
/*****************************************************************************/ |
|
40 |
||
41 |
CommandRescan::CommandRescan(): |
|
42 |
Command("rescan", "Rescan the bus.") |
|
43 |
{ |
|
44 |
} |
|
45 |
||
46 |
/*****************************************************************************/ |
|
47 |
||
1968
4f682084c643
Implemented drive_no for command-line tool; binary base name is now a
Florian Pose <fp@igh-essen.com>
parents:
1961
diff
changeset
|
48 |
string CommandRescan::helpString(const string &binaryBaseName) const |
1961 | 49 |
{ |
50 |
stringstream str; |
|
51 |
||
1968
4f682084c643
Implemented drive_no for command-line tool; binary base name is now a
Florian Pose <fp@igh-essen.com>
parents:
1961
diff
changeset
|
52 |
str << binaryBaseName << " " << getName() << endl |
1961 | 53 |
<< endl |
54 |
<< getBriefDescription() << endl |
|
55 |
<< endl |
|
56 |
<< "Command a bus rescan. Gathered slave information will be" << endl |
|
57 |
<< "forgotten and slaves will be read in again." << endl |
|
58 |
<< endl; |
|
59 |
||
60 |
return str.str(); |
|
61 |
} |
|
62 |
||
63 |
/****************************************************************************/ |
|
64 |
||
65 |
void CommandRescan::execute(const StringVector &args) |
|
66 |
{ |
|
67 |
MasterIndexList masterIndices; |
|
2589
2b9c78543663
Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents:
1968
diff
changeset
|
68 |
|
1961 | 69 |
if (args.size() != 0) { |
70 |
stringstream err; |
|
71 |
err << "'" << getName() << "' takes no arguments!"; |
|
72 |
throwInvalidUsageException(err); |
|
73 |
} |
|
74 |
||
75 |
masterIndices = getMasterIndices(); |
|
76 |
MasterIndexList::const_iterator mi; |
|
77 |
for (mi = masterIndices.begin(); |
|
78 |
mi != masterIndices.end(); mi++) { |
|
79 |
MasterDevice m(*mi); |
|
80 |
m.open(MasterDevice::ReadWrite); |
|
81 |
m.rescan(); |
|
82 |
} |
|
83 |
} |
|
84 |
||
85 |
/*****************************************************************************/ |