Ignore:
Timestamp:
May 27, 2011, 1:34:43 PM (8 years ago)
Author:
tbretz
Message:
Added debug options to address the fake fad boards (debug-port and debug-num); Adapted Execute and fStatus2 to the fact that g_NumConnected has to be continous.
File:
1 edited

Legend:

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

    r10844 r10859  
    812812            switch (fStatus2[i->first])
    813813            {
    814             case 0: str << "1-7:not connected)"; break;
    815             case 1: str << "1-7:connecting [" << GetNumConnected(i->first) << "])";   break;
    816             case 2: str << "1-7:connected)";    break;
     814            case 0:  str << "1-7:not connected)"; break;
     815            case 7:  str << "1-7:connected)";    break;
     816            default: str << "1-7:connecting [" << fStatus2[i->first] << "])";   break;
    817817            }
    818818
     
    882882    {
    883883        vector<string> addr;
    884         for (BoardList::iterator i=fBoards.begin(); i!=fBoards.end(); i++)
     884
     885        for (BoardList::const_iterator i=fBoards.begin(); i!=fBoards.end(); i++)
    885886            addr.push_back(i->second.first);
    886887
     
    959960        vector<char> stat1(40);
    960961        vector<char> stat2(40);
     962
     963        int cnt = 0;
    961964        for (BoardList::const_iterator i=fBoards.begin(); i!=fBoards.end(); i++)
    962965        {
    963966            const ConnectionFAD &c = *i->second.second;
    964 
    965             const int &idx = i->first;
    966967
    967968            // ----- Command socket -----
    968969            if (c.IsConnecting())
    969970            {
    970                 stat1[idx] = 1;
     971                stat1[i->first] = 1;
    971972                nconnecting1++;
    972973            }
    973974            if (c.IsConnected())
    974975            {
    975                 stat1[idx] = 2;
     976                stat1[i->first] = 2;
    976977                nconnected1++;
    977978            }
    978979
    979980            // ----- Event builder -----
    980             if (!IsConnected(idx) && !IsDisconnected(idx))
    981             {
    982                 stat2[idx] = 1;
     981            stat2[i->first] = GetNumConnected(cnt);
     982
     983            if (!IsConnected(cnt) && !IsDisconnected(cnt))
    983984                nconnecting2++;
    984             }
    985 
    986             if (IsConnected(idx))
    987             {
    988                 stat2[idx] = 2;
     985
     986            if (IsConnected(cnt))
    989987                nconnected2++;
    990             }
    991988        }
    992989
     
    11951192        SetMaxMemory(conf.Get<unsigned int>("max-mem"));
    11961193
     1194        // vvvvv for debugging vvvvv
     1195        if (conf.Has("debug-port"))
     1196        {
     1197            const int port = conf.Get<unsigned int>("debug-port");
     1198            const int num  = conf.Get<unsigned int>("debug-num");
     1199            for (int i=0; i<num; i++)
     1200            {
     1201                ostringstream str;
     1202                str << "localhost:" << port+8*i;
     1203                AddEndpoint(str.str());
     1204            }
     1205            Connect();
     1206            return true;
     1207        }
     1208        // ^^^^^ for debugging ^^^^^
     1209
    11971210        if (!(conf.Has("base-addr") ^ conf.Has("addr")))
    11981211        {
     
    13551368    po::options_description control("FAD control options");
    13561369    control.add_options()
    1357 //        ("addr,a",        var<string>("localhost:5000"),  "Network address of FTM")
    13581370        ("quiet,q",    po_bool(),  "Disable printing contents of all received messages in clear text.")
    13591371        ("hex-out",    po_bool(),  "Enable printing contents of all printed messages also as hex data.")
    13601372        ("data-out",   po_bool(),  "Enable printing received event data.")
     1373        ;
     1374
     1375    po::options_description builder("Event builder options");
     1376    builder.add_options()
     1377        ("max-mem,m",  var<unsigned int>(100), "Maximum memory the event builder thread is allowed to consume for its event buffer")
     1378        ;
     1379
     1380    po::options_description connect("FAD connection options");
     1381    connect.add_options()
    13611382        ("addr",       vars<string>(),     "Network address of FAD")
    13621383        ("base-addr",  var<string>(),      "Base address of all FAD")
    1363         ("max-mem,m",  var<unsigned int>(100), "Maximum memory the event builder thread is allowed to consume for its event buffer")
     1384        ("debug-num,n",  var<unsigned int>(40),  "Sets the number of fake boards to be connected locally")
     1385        ("debug-port,p", var<unsigned int>(),    "Sets <debug-num> addresses to 'localhost:<debug-port>' in steps of 8")
    13641386        ;
    13651387
     
    13681390    conf.AddOptions(config);
    13691391    conf.AddOptions(control);
     1392    conf.AddOptions(builder);
     1393    conf.AddOptions(connect);
    13701394}
    13711395
Note: See TracChangeset for help on using the changeset viewer.