Changeset 11118


Ignore:
Timestamp:
06/22/11 20:17:06 (13 years ago)
Author:
tbretz
Message:
Added possibility to debug data transmission to the boards.
Location:
trunk/FACT++/src
Files:
3 edited

Legend:

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

    r10983 r11118  
    1919using boost::lexical_cast;
    2020using ba::ip::tcp;
    21 
    22 #define DEBUG_TX
    2321
    2422    // -------- Abbreviations for starting async tasks ---------
     
    177175    else
    178176    {
    179 #ifdef DEBUG_TX
    180         ostringstream msg;
    181         msg << n << " bytes successfully sent to " << URL();
    182         Message(msg);
    183 #endif
     177        if (fDebugTx)
     178        {
     179            ostringstream msg;
     180            msg << n << " bytes successfully sent to " << URL();
     181            Message(msg);
     182        }
    184183    }
    185184
  • trunk/FACT++/src/Connection.h

    r11093 r11118  
    1717    std::string fAddress;
    1818    std::string fPort;
     19
     20    bool fDebugTx;
    1921
    2022    enum ConnectionStatus_t
     
    107109    bool IsConnecting() const   { return fConnectionStatus==kConnecting;   }
    108110
     111    void SetDebugTx(bool b=true) { fDebugTx=b; }
     112
    109113    std::string URL() const { return fAddress + ":" + fPort; }
    110114};
  • trunk/FACT++/src/fadctrl.cc

    r11116 r11118  
    574574    bool fIsHexOutput;
    575575    bool fIsDataOutput;
     576    bool fDebugTx;
    576577
    577578    bool CheckEventSize(size_t has, const char *name, size_t size)
     
    840841            return T::kSM_FatalError;
    841842
    842        for (BoardList::iterator i=fBoards.begin(); i!=fBoards.end(); i++)
     843        for (BoardList::iterator i=fBoards.begin(); i!=fBoards.end(); i++)
    843844            i->second.second->SetDataOutput(evt.GetBool());
     845
     846        return T::GetCurrentState();
     847    }
     848
     849    int SetDebugTx(const EventImp &evt)
     850    {
     851        if (!CheckEventSize(evt.GetSize(), "SetDebugTx", 1))
     852            return T::kSM_FatalError;
     853
     854        for (BoardList::iterator i=fBoards.begin(); i!=fBoards.end(); i++)
     855            i->second.second->SetDebugTx(evt.GetBool());
    844856
    845857        return T::GetCurrentState();
     
    10831095
    10841096        ptr->SetEndpoint(str.str());
    1085         ptr->StartConnect();
     1097        ptr->StartConnect();
    10861098    }
    10871099
     
    12691281        fBoards[i].second->SetHexOutput(fIsHexOutput);
    12701282        fBoards[i].second->SetDataOutput(fIsDataOutput);
     1283        fBoards[i].second->SetDebugTx(fDebugTx);
    12711284    }
    12721285
     
    14051418        T::AddEvent("SET_VERBOSE", "B:1")
    14061419            (boost::bind(&StateMachineFAD::SetVerbosity, this, _1))
    1407             ("set verbosity state"
     1420            ("Set verbosity state"
    14081421             "|verbosity[bool]:disable or enable verbosity for received data (yes/no), except dynamic data");
    14091422
    14101423        T::AddEvent("SET_HEX_OUTPUT", "B:1")
    14111424            (boost::bind(&StateMachineFAD::SetHexOutput, this, _1))
    1412             ("enable or disable hex output for received data"
     1425            ("Enable or disable hex output for received data"
    14131426             "|hexout[bool]:disable or enable hex output for received data (yes/no)");
    14141427
     
    14161429            (boost::bind(&StateMachineFAD::SetDataOutput, this, _1))
    14171430            ("");
     1431
     1432        T::AddEvent("SET_DEBUG_TX", "B:1")
     1433            (boost::bind(&StateMachineFAD::SetDebugTx, this, _1))
     1434            ("Enable or disable the output of messages in case of successfull data transmission to the boards."
     1435             "|debug[bool]:disable or enable debug output for transmitted data (yes/no)");
    14181436
    14191437        T::AddEvent("PRINT_EVENT", "S:1")
     
    15431561        fIsHexOutput = conf.Get<bool>("hex-out");
    15441562        fIsDataOutput = conf.Get<bool>("data-out");
     1563        fDebugTx = conf.Get<bool>("debug-tx");
    15451564
    15461565        SetMaxMemory(conf.Get<unsigned int>("max-mem"));
     
    17121731        ("hex-out",    po_bool(),  "Enable printing contents of all printed messages also as hex data.")
    17131732        ("data-out",   po_bool(),  "Enable printing received event data.")
     1733        ("debug-tx",   po_bool(),  "Enable debugging of ethernet transmission.")
    17141734        ;
    17151735
Note: See TracChangeset for help on using the changeset viewer.