Changeset 17669 for trunk/FACT++


Ignore:
Timestamp:
04/16/14 18:43:26 (11 years ago)
Author:
tbretz
Message:
Implemented the possibility to start more than one agilentctrl to read from all agilents.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/agilentctrl.cc

    r17361 r17669  
    2424class ConnectionAgilent : public Connection
    2525{
     26public:
     27    static string fMode;
     28
     29private:
    2630    bool fIsVerbose;
    2731    bool fDebugRx;
     
    285289};
    286290
     291string ConnectionAgilent::fMode;
     292
    287293// ------------------------------------------------------------------------
    288294
     
    303309    ConnectionDimAgilent(ba::io_service& ioservice, MessageImp &imp) :
    304310        ConnectionAgilent(ioservice, imp),
    305         fDim("AGILENT_CONTROL/DATA", "F:1;F:1;F:1;F:1",
     311        fDim("AGILENT_CONTROL_"+fMode+"/DATA", "F:1;F:1;F:1;F:1",
    306312             "|U_nom[V]: Nominal output voltage"
    307313             "|U_mes[V]: Measured output voltage"
     
    418424public:
    419425    StateMachineAgilent(ostream &out=cout) :
    420         StateMachineAsio<T>(out, "AGILENT_CONTROL"), fAgilent(*this, *this)
     426        StateMachineAsio<T>(out, "AGILENT_CONTROL_"+S::fMode), fAgilent(*this, *this)
    421427    {
    422428        // State names
     
    481487        fAgilent.SetInterval(conf.Get<uint16_t>("interval"));
    482488
    483         SetEndpoint(conf.Get<string>("addr"));
     489        SetEndpoint(conf.Get<string>("addr.", S::fMode));
     490
     491        const std::vector<std::string> opts = conf.GetWildcardOptions("addr.*");
     492        for (auto it=opts.begin(); it!=opts.end(); it++)
     493            conf.Get<string>(*it);
    484494
    485495        return -1;
     
    502512    control.add_options()
    503513        ("no-dim",    po_bool(),         "Disable dim services")
    504         ("addr,a",    var<string>("10.0.100.220:5025"),  "network address of Agilent")
     514        ("mode,m",    var<string>()->required(), "Mode (e.g. 24V, 50V, 80V)")
     515        ("addr.*",    var<string>(),     "Network address of Agilent specified by mode")
    505516        ("debug-rx",  po_bool(false),    "Enable raw debug output wehen receiving data")
    506517        ("interval",  var<uint16_t>(15), "Interval in seconds in which the Agilent status is requested")
     
    508519        ;
    509520
     521    po::positional_options_description p;
     522    p.add("mode", 1); // The first positional options
     523
    510524    conf.AddOptions(control);
     525    conf.SetArgumentPositions(p);
    511526}
    512527
     
    523538{
    524539    cout <<
    525         "The agilentctrl controls the FACT camera power supply.\n\n"
     540        "The agilentctrl controls the FACT Agilent power supplies.\n\n"
    526541        "\n"
    527542        "The default is that the program is started without user intercation. "
     
    530545        "help message about the usuage can be brought to the screen.\n"
    531546        "\n"
    532         "Usage: agilentctrl [-c type] [OPTIONS]\n"
    533         "  or:  agilentctrl [OPTIONS]\n";
     547        "Usage: agilentctrl [-c type] [OPTIONS] mode\n"
     548        "  or:  agilentctrl [OPTIONS] mode\n";
    534549    cout << endl;
    535550}
     
    550565        return 127;
    551566
     567    ConnectionAgilent::fMode = conf.Get<string>("mode");
     568
    552569    //try
    553570    {
Note: See TracChangeset for help on using the changeset viewer.