Changeset 8862 for trunk


Ignore:
Timestamp:
02/13/08 19:44:39 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/Changelog

    r8861 r8862  
    11                                                                  -*-*- END -*-*-
     2
     3 2008/02/13 Thomas Bretz (La Palma)
     4
     5   * cosy.cc:
     6     - added debug-env command line options
     7     - added config command line option
     8     - added command line options for the ip-addresses
     9     - read in an MEnv
     10
     11   * candrv/canopen.cc:
     12     - commented an obsolete output
     13
     14   * candrv/ethernet.[h,cc]:
     15     - changed some cout to gLog stream
     16     - impoved output
     17     - added some some DEBUG precompiler ifs
     18
     19   * candrv/interface.cc:
     20     - fixed an if: fReceiver instead of !fReceiver
     21
     22   * candrv/network.cc:
     23     - fixed some problems with hex/dec output
     24
     25   * devdrv/shaftencoder.[h,cc]:
     26     - decode all bytes in PDO2
     27     - devide by fTicks instead of a fixed number
     28     - improved some comments
     29
     30   * main/MCosy.[h,cc]:
     31     - removed the arbitrary offset in GetSePos
     32       (FIXME: This needs to become an option in the rc-file)
     33     - take an MEnv instead of a local TEnv
     34     - improved output
     35     - get name for pointing model as argument
     36
     37   * tcpip/MCeCoCom.h, tcpip/MDriveCom.h:
     38     - get ip-address as argument
     39
     40   * tcpip/MTcpIpIO.[h,cc]:
     41     - added GetSocketAddress functions
     42     - changed some cout to gLog
     43     - improved output
     44
     45   * videodev/MVideo.[h,cc]:
     46     - added an argument to Ioctl to suppress an expected error
     47
     48
    249
    350 2008/02/12 Thomas Bretz (La Palma)
  • trunk/MagicSoft/Cosy/candrv/canopen.cc

    r8813 r8862  
    8888// In case of a PDO the conditional semaphore corresponding to this PDO
    8989// is raised (WaitForNextPDO)
    90 //  HandleSDO:       handles a SDO message
    91 //  HandlePDO1/2/3/4:handles received PDOs
     90//  HandleSDO:        handles a SDO message
     91//  HandlePDO1/2/3/4: handles received PDOs
    9292//
    9393void CanOpen::HandleCanMessage(WORD_t cobid, const BYTE_t *data, const timeval_t &tv)
     
    127127            const WORD_t  subidx = data[3];
    128128
    129             cout << "SND NODE: " << (int)node << " " << flush;
     129            //cout << "SDO_rx: node=" << (int)node << hex << " cmd=0x" << (int)cmd << " idx=0x" << idx << " subidx=0x" << subidx << dec << endl;
    130130            HandleSDO(node, cmd, idx, subidx, dat, tv);
    131131
  • trunk/MagicSoft/Cosy/candrv/ethernet.cc

    r8856 r8862  
    3939ClassImp(Ethernet);
    4040
     41#undef DEBUG
     42
    4143using namespace std;
    4244
     
    5456//
    5557Ethernet::Ethernet(const char *addr, const int tx, const int rx, CanOpen *receiver)
    56     : MTcpIpI(rx), Interface(receiver), fTxAddress(addr), fTxPort(tx)
     58    : MTcpIpI(rx),/* MTcpIpO(addr, tx),*/ Interface(receiver), fTxAddress(addr), fTxPort(tx)
    5759{
    5860    gLog << inf2 << "- Ethernet initialized." << endl;
     
    8183    msg.data[1] = 0;
    8284
     85    const TString address = MTcpIpO::GetSocketAddress(rx);
     86
    8387    while (!IsThreadCanceled())
    8488    {
     
    100104        if (len==0)
    101105        {
    102             // THIS MEANS CONNECTIION LOST!!!!
    103             cout << "============> LEN==0 (CONNECTION LOST?)" << endl;
    104             break; // This break is for TEST PURPOSE FIXME!!!
     106            gLog << warn << "WARNING - Connection lost (received 0bytes) to " << address << endl;
     107            //break; // This break is for TEST PURPOSE FIXME!!!
    105108            continue;
    106109        }
     
    109112        if (len>1)
    110113        {
    111             cout << "Data too long!!!" << endl;
     114            gLog << err << "Data received from " << address << " is more than one byte!" << endl;
    112115            break;
    113116        }
     
    117120            if (c>=MSGLEN)
    118121            {
    119                 cout << "Received data too long (> " << MSGLEN << ")" << endl;
     122                cout << "Data received from " << address << " too long (> " << MSGLEN << ")" << endl;
    120123                break;
    121124            }
     
    133136            continue;
    134137
     138#ifdef DEBUG
    135139        cout << "*** RcvdCanFrame len=" << dec << msg.len << ": ";
    136140        for (int i=0; i<msg.len; i++)
    137141            cout << "0x" << setfill('0') << setw(2) << hex << (int)((msg.data+2)[i]) << " ";
    138         cout << endl;
     142        cout << dec << endl;
     143#endif
    139144
    140145        pos = -1;
     
    192197    */
    193198
     199#ifdef DEBUG
    194200    // FIXME: MUST BECOME NON-BLOCKING!!!!!
    195     cout << "*** Send CanFrame over IP" << endl;
     201    cout << "*** Send CanFrame over IP " << endl;
    196202    // FIXME: MUST BECOME NON-BLOCKING!!!!!
     203#endif
    197204
    198205    MTcpIpO::SendFrame(fTxAddress, fTxPort, (char*)(msg.data+1), msg.len-1);
     206    //Send((char*)(msg.data+1), msg.len-1);
    199207
    200208    /*
  • trunk/MagicSoft/Cosy/candrv/ethernet.h

    r8856 r8862  
    1010#endif
    1111
    12 class Ethernet : public MTcpIpI, public Interface
     12class Ethernet : public MTcpIpI, /*public MTcpIpO,*/ public Interface
    1313{
    1414private:
  • trunk/MagicSoft/Cosy/candrv/interface.cc

    r8854 r8862  
    5656void Interface::HandleMessage(const Message &msg) const
    5757{
    58     if (fReceiver)
     58    if (!fReceiver)
    5959        return;
    6060
  • trunk/MagicSoft/Cosy/candrv/network.cc

    r8835 r8862  
    132132        for (int i=0; i<8; i++)
    133133            gLog << " 0x" << (int)data[i];
    134         gLog << endl;
     134        gLog << dec << endl;
    135135        return;
    136136    }
     
    150150        for (int i=0; i<8; i++)
    151151            gLog << " 0x" << (int)data[i];
    152         gLog << endl;
     152        gLog << dec << endl;
    153153        return;
    154154    }
     
    168168        for (int i=0; i<8; i++)
    169169            gLog << " 0x" << (int)data[i];
    170         gLog << endl;
     170        gLog << dec << endl;
    171171        return;
    172172    }
     
    186186        for (int i=0; i<8; i++)
    187187            gLog << " 0x" << (int)data[i];
    188         gLog << endl;
     188        gLog << dec << endl;
    189189        return;
    190190    }
  • trunk/MagicSoft/Cosy/cosy.cc

    r8860 r8862  
    1010#include "vmodican.h"
    1111
     12#include "MEnv.h"
    1213#include "MArgs.h"
    1314#include "MCosy.h"
     
    5051    gLog << " Options:" << endl;
    5152    gLog.Usage();
     53    gLog << "   --debug-env=0             Disable debugging setting resources <default>" << endl;
     54    gLog << "   --debug-env[=1]           Display untouched resources after program execution" << endl;
     55    gLog << "   --debug-env=2             Display untouched resources after eventloop setup" << endl;
     56    gLog << "   --debug-env=3             Debug setting resources from resource file and command line" << endl;
     57    gLog << "   --debug-mem               Debug memory usage" << endl << endl;
    5258    gLog << "   --debug-threads           Debug threads" << endl << endl;
     59    gLog << "   --rc=Name:option          Set or overwrite a resource of the resource file." << endl << endl;
    5360    gLog << "   --version, -V             Show startup message with version number" << endl;
    5461    gLog << "   -?, -h, --help            This help" << endl << endl;
     
    8087    }
    8188
    82     const Int_t  channel       = arg.GetIntAndRemove("--channel=", 0);
    83     const Bool_t kDebugMem     = arg.HasOnlyAndRemove("--debug-mem");
    84     const Bool_t kDebugThreads = arg.HasOnlyAndRemove("--debug-threads");
     89    const Int_t   channel       = arg.GetIntAndRemove("--channel=", 0);
     90    const Bool_t  kDebugMem     = arg.HasOnlyAndRemove("--debug-mem");
     91    const Bool_t  kDebugThreads = arg.HasOnlyAndRemove("--debug-threads");
     92    const TString sps           = arg.GetStringAndRemove("--sps=", "127.0.0.1");
     93    const TString ceco          = arg.GetStringAndRemove("--cc=", "ceco"); // ceco
     94    const TString pointing      = arg.GetStringAndRemove("--pointing-model=", "bending2.txt"); // ceco
     95    const TString kConfig       = arg.GetStringAndRemove("--config=", ".cosyrc"); // ceco
     96    Int_t  kDebugEnv = arg.HasOnlyAndRemove("--debug-env") ? 1 : 0;
     97    kDebugEnv = arg.GetIntAndRemove("--debug-env=", kDebugEnv);
    8598
    8699    //
     
    93106        return 2;
    94107    }
    95 /*
     108
    96109    //
    97110    // Now we access/read the resource file. This will remove all
     
    108121    if (!env.TakeEnv(arg, kDebugEnv>2))
    109122        return 0xfd;
    110 */
     123
    111124    //
    112125    // check for the right usage of the program (number of options)
     
    178191        }
    179192*/
    180     MCosy *cosy = new MCosy();
    181 
    182     Interface *interface = new Ethernet("127.0.0.1", 5357, 5358, cosy);
     193    MCosy *cosy = new MCosy(env, ceco, pointing);
     194
     195    Interface *interface = new Ethernet(sps, 5357, 5358, cosy);
    183196    // Interface *interface = new VmodIcan(cosy, "/dev/dpm_00", 125);
    184197
    185198    gLog << all << "- Starting MCosy." << endl;
    186199
    187     cosy->Start();
     200    cosy->Start(env);
     201
     202    // FIXME: Is this the right position?
     203    if (kDebugEnv>0)
     204        env.PrintUntouched();
     205
    188206
    189207    MStarguider *client=0;
  • trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc

    r8835 r8862  
    278278    // Decode information, we have a 14bit only
    279279    //
    280     LWORDS_t pos = data[0] | (data[1]<<8) | (data[2]<<16); // | (data[3]<<24);
     280    LWORDS_t pos = data[0] | (data[1]<<8) | (data[2]<<16) | (data[3]<<24);
    281281
    282282    fVel = data[4] | (data[5]<<8);
     
    465465        return;
    466466
    467     fPos  = pre%16384;
    468     fTurn = pre/16384;
     467    fPos  = pre%fTicks;
     468    fTurn = pre/fTicks;
    469469    fDirChangedPos = fPos;
    470470    fOffset = fMotor ? fMotor->GetPdoPos() : 0;
  • trunk/MagicSoft/Cosy/devdrv/shaftencoder.h

    r8835 r8862  
    2222    WORDS_t  fAcc;   // ticks per 25ms^2
    2323    WORDS_t  fTurn;  // Number of turn
    24     LWORD_t  fTicks; // Number of ticks per turn
     24    LWORD_t  fTicks; // Number of ticks per revolution (resolution)
    2525    WORD_t   fTurns; // Number of possible turns
    2626
  • trunk/MagicSoft/Cosy/main/MCosy.cc

    r8856 r8862  
    1616#include "MLogManip.h"
    1717
     18#include "MEnv.h"
    1819#include "MTime.h"
    1920#include "MPointing.h"
     
    140141
    141142    //
    142     // Get the values
    143     //
    144     int p1 =  (fZd1->GetPos()+8192)%16384;
    145     int p2 = -(fZd2->GetPos()+8192)%16384;
     143    // Get the values          (FIXME!)
     144    //
     145    int p1 =  (fZd1->GetPos()/*+8192*/)%fZd1->GetPhysRes();
     146    int p2 = -(fZd2->GetPos()/*+8192*/)%fZd2->GetPhysRes();
    146147
    147148    if (fZd1->IsZombieNode())
     
    930931}
    931932
    932 void MCosy::ReadConfig()
    933 {
    934     gLog << inf2 << "Reading configuration file..." << flush;
    935     TEnv env(".cosyrc");
    936     gLog << "done." << endl;
    937 
     933void MCosy::ReadConfig(MEnv &env)
     934{
    938935    gLog << inf2 << "Reading telescope range..." << flush;
    939936    const Double_t amin = env.GetValue("Az_Min[deg]", -95.0);
     
    946943    gLog << "done." << endl;
    947944
    948     gLog << all << " * Min:  " << zmin << "deg  " << amin << "deg" << endl;
    949     gLog << all << " * Max:  " << zmax << "deg  " << amax << "deg" << endl;
     945    gLog << all << flush;
     946
     947    gLog << " * Min:  " << zmin << "deg  " << amin << "deg" << endl;
     948    gLog << " * Max:  " << zmax << "deg  " << amax << "deg" << endl;
    950949
    951950    fMin = fBending.AddOffsets(fMin/TMath::RadToDeg());
    952951    fMax = fBending.AddOffsets(fMax/TMath::RadToDeg());
    953952
    954     gLog << all << " * Min': " << fMin.Zd()*TMath::RadToDeg() << "deg  " << fMin.Az()*TMath::RadToDeg() << "deg" << endl;
    955     gLog << all << " * Max': " << fMax.Zd()*TMath::RadToDeg() << "deg  " << fMax.Az()*TMath::RadToDeg() << "deg" << endl;
    956 
    957     gLog << inf2 << "Reading gear ratios..." << flush;
    958 //    kGear.X(env.GetValue("Zd_GearRatio[U_mot/U_tel]", 1000.0));
    959 //    kGear.Y(env.GetValue("Az_GearRatio[U_mot/U_tel]", 1000.0));
     953    gLog << " * Min': " << fMin.Zd()*TMath::RadToDeg() << "deg  " << fMin.Az()*TMath::RadToDeg() << "deg" << endl;
     954    gLog << " * Max': " << fMax.Zd()*TMath::RadToDeg() << "deg  " << fMax.Az()*TMath::RadToDeg() << "deg" << endl;
     955
    960956    kGear.Set(env.GetValue("Zd_GearRatio[U_mot/U_tel]", 1000.0),
    961957              env.GetValue("Az_GearRatio[U_mot/U_tel]", 1000.0));
     
    975971    kResRE.Set(x,y);
    976972
    977     x = zd1 ? fZd1->GetPhysRes() : (zd2 ? fZd2->GetPhysRes() : env.GetValue("Zd_ResSE[se/U_mot]", 16384));
    978     y = az  ? fAz->GetPhysRes() : env.GetValue("Az_ResSE[se/U_mot]", 16384);
     973    gLog << " * Az RE resolution: " << x << " re/U_mot" << endl;
     974    gLog << " * Zd RE resolution: " << y << " re/U_mot" << endl;
     975
     976    x = zd1 ? fZd1->GetPhysRes() : (zd2 ? fZd2->GetPhysRes() : env.GetValue("Zd_ResSE[se/U_tel]", 16384));
     977    y = az  ? fAz->GetPhysRes() : env.GetValue("Az_ResSE[se/U_tel]", 16384);
    979978    kResSE.Set(x,y);
     979
     980    gLog << " * Az SE resolution: " << x << " se/U_tel" << endl;
     981    gLog << " * Zd SE resolution: " << y << " se/U_tel" << endl;
    980982
    981983    /*
     
    10191021//    kGearTot = kResRE*kGear;
    10201022
    1021     gLog << "done." << endl;
    1022 
    1023     gLog << all;
    1024     gLog << " * Setting Gear Ratios:" << endl;
    1025     gLog << "   --------------------" << endl;
     1023//    gLog << all;
     1024//    gLog << " * Setting Gear Ratios:" << endl;
     1025 //   gLog << "   --------------------" << endl;
    10261026    gLog << " *  X: " << kGear.X() << "*" << kResRE.X()/4 << "/" << kResSE.X() << "=4*" << kGearTot.X() << "/" << kResSE.X() << endl;
    10271027    gLog << " *  Y: " << kGear.Y() << "*" << kResRE.Y()/4 << "/" << kResSE.Y() << "=4*" << kGearTot.Y() << "/" << kResSE.Y() << endl;
     
    10651065
    10661066    gLog << inf2 << "Starting Shaftencoder Test..." << endl;
     1067
     1068    gLog << err << "Build in values!!!" << endl;
    10671069
    10681070    while (fBackground==kBgdSeTest)
     
    14341436// turn on the gui update
    14351437//
    1436 void MCosy::Start()
     1438void MCosy::Start(MEnv &env)
    14371439{
    14381440    // Don't call this function twice!
     
    14411443    CheckForError();
    14421444
    1443     ReadConfig();
     1445    ReadConfig(env);
    14441446
    14451447    gLog << inf << "- Starting TX Thread." << endl;
     
    16101612}
    16111613
    1612 MCosy::MCosy()
     1614MCosy::MCosy(MEnv &env, const char *addr, const char *pointing)
    16131615: Network(), fObservatory(MObservatory::kMagic1), fStarguider(NULL),
    16141616fZd1(0), fZd2(0), fAz(0), fMac1(0), fMac2(0), fMac3(0),
     
    16161618fOutTp(0), fOutRep(0)
    16171619{
    1618     TEnv env(".cosyrc");
    16191620    const Int_t id1 = env.GetValue("Az_Id-MAC1", 1); //1
    16201621    const Int_t id2 = env.GetValue("Az_Id-MAC2", 2); //2
     
    16371638    {
    16381639    case 0:
    1639         gLog << "<<Standard mode>>" << endl;*/
    1640         fBending.Load("bending.txt");
     1640    gLog << "<<Standard mode>>" << endl;*/
     1641        gLog << all << "Reading pointing model from " << pointing << "..." << endl;
     1642        if (fBending.Load(pointing))
     1643            gLog << all << "Reading pointing model from " << pointing << " successfull." << endl;
     1644        else
     1645            gLog << err << "ERROR - Reading pointing model from " << pointing << endl;
    16411646        Constructor(id1, id2, id3, id4, id5, id6);/*
    16421647        break;
     
    16511656    }
    16521657*/
     1658
    16531659    gLog.SetOutputGui(fWin->GetLog(), kTRUE);
    16541660
     
    16571663    fAz->SetDisplay(fWin->GetLabel1());
    16581664
    1659     fCom = new MDriveCom(this, fOutRep);
     1665    fCom = new MDriveCom(this, addr, fOutRep);
    16601666//    fCom->Start();
    16611667}
  • trunk/MagicSoft/Cosy/main/MCosy.h

    r8859 r8862  
    5252class MStarguider;
    5353class MDriveCom;
     54class MEnv;
    5455
    5556class MTTalk : public MThread
     
    173174    //void ConstructorDemo();
    174175
    175     void ReadConfig();
     176    void ReadConfig(MEnv &env);
    176177
    177178    bool CheckNetwork();
    178179
     180    void Start() { }
     181
    179182public:
    180     MCosy();
     183    MCosy(MEnv &env, const char *addr, const char *pointing);
    181184    ~MCosy();
    182185
    183     void Start();
     186    void Start(MEnv &env);
    184187    void Stop();
    185188
  • trunk/MagicSoft/Cosy/tcpip/MCeCoCom.h

    r8856 r8862  
    4848
    4949public:
    50     MCeCoCom(MLog *out)
    51         : MTcpIpIO("ceco", 7304, 7404), fOut(out), fStatus(0), fComStat(kNoCmdReceived),
     50    MCeCoCom(const char *addr, MLog *out)
     51        : MTcpIpIO(addr, 7304, 7404), fOut(out), fStatus(0), fComStat(kNoCmdReceived),
    5252        fHumidity(0), fTemperature(0), fWindSpeed(0), fSolarRadiation(-1),
    5353        fAlarmCounter(0)
  • trunk/MagicSoft/Cosy/tcpip/MDriveCom.h

    r8816 r8862  
    4141    };
    4242
    43     MDriveCom(MsgQueue *q, MLog *out) : MCeCoCom(out), fQueue(q) {}
     43    MDriveCom(MsgQueue *q, const char *addr, MLog *out) : MCeCoCom(addr, out), fQueue(q) {}
    4444
    4545    bool SendReport(UInt_t stat, RaDec rd, ZdAz so, ZdAz is, ZdAz er);
  • trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.cc

    r8856 r8862  
    88#include "MLog.h"
    99#include "MLogManip.h"
     10
     11#include "MString.h"
    1012
    1113#undef DEBUG
     
    5557}
    5658
     59TString MTcpIpO::GetSocketAddress(const TSocket &s)
     60{
     61    if (!s.IsValid())
     62        return "n/a";
     63
     64    const TInetAddress &a = s.GetInetAddress();
     65    if (!a.IsValid())
     66        return "undefined";
     67
     68    return MString::Format("%s:%d", a.GetHostAddress(), a.GetPort());
     69}
     70
     71TString MTcpIpO::GetSocketAddress() const
     72{
     73    return GetSocketAddress(*fTxSocket);
     74}
     75
    5776bool MTcpIpO::SendFrame(TSocket &tx, const char *msg, int len)
    5877{
    5978    if (!tx.IsValid())
    6079    {
    61         //cout << "*!* Transmit socket invalid!" << endl;
     80        //gLog << warn << "WARNING - No transmission to " << GetSocketAddress(tx) << " possible." << endl;
    6281        return false;
    6382    }
     
    6685    if (l<0)
    6786    {
    68         cout << "ERROR - Sending Message" << endl;
     87        gLog << err << "ERROR - Sending TCP/IP frame to " << GetSocketAddress(tx) << endl;
    6988        return false;
    7089    }
     
    7291    if (l!=len)
    7392    {
    74         cout << "Send wrong number (" << l << ") of Bytes." << endl;
     93        gLog << err << "ERROR - Sent wrong number (" << l << ") of bytes to " << GetSocketAddress(tx) << endl;
    7594        return false;
    7695    }
     
    86105{
    87106    //    R__LOCKGUARD2(myMutex);
    88 
     107#ifdef DEBUG
    89108    cout << "Connecting to " << addr << ":" << port << endl;
     109#endif
    90110
    91111    // FIXME: Set tx-socket to nonblocking?
    92112    TSocket tx(addr, port);
    93     //    return SendFrame(tx, msg, len);
    94 
     113    return SendFrame(tx, msg, len);
     114/*
    95115    if (!tx.IsValid())
    96116    {
    97         //cout << "*!* Transmit socket invalid!" << endl;
    98         return false;
    99     }
    100 
    101     cout << "Sending to " << addr << ":" << port << endl;
     117        gLog << warn << "WARNING - No transmission to " << addr << ":" << port << " possible." << endl;
     118        return false;
     119    }
     120
     121    gLog << dbg << "Sending to " << addr << ":" << port << endl;
    102122
    103123    const Int_t l = tx.SendRaw(msg, len, kDontBlock);
    104124    if (l<0)
    105125    {
    106         cout << "ERROR - Sending Message" << endl;
     126        gLog << err << "ERROR - Sending TCP/IP frame to " << addr << ":" << port << endl;
    107127        return false;
    108128    }
     
    110130    if (l!=len)
    111131    {
    112         cout << "Send wrong number (" << l << ") of Bytes." << endl;
     132        gLog << err << "ERROR - Sent wrong number (" << l << ") of bytes to " << addr << ":" << port << endl;
    113133        return false;
    114134    }
     
    119139
    120140    return true;
     141    */
    121142}
    122143
     
    188209    gLog << inf << "- Starting receiver on port " << fPortRx << "..." << endl;
    189210
     211//    if (fPortRx==7404)
     212//    {
     213//        gLog << err << "CeCo communication skipped." << endl;
     214//        return 0;
     215//    }
     216
    190217    TServerSocket *fServSock=NULL;
    191218    TSocket       *fRxSocket=NULL;
     
    197224        if (!fServSock->IsValid())
    198225        {
    199             cout << "ServerSocket on port " << fPortRx << " invalid: ";
     226            gLog << err << "ServerSocket on port " << fPortRx << " invalid: ";
    200227            switch (fServSock->GetErrorCode())
    201228            {
    202             case  0: cout << "No error." << endl; break;
    203             case -1: cout << "low level socket() call failed." << endl; break;
    204             case -2: cout << "low level bind() call failed." << endl; break;
    205             case -3: cout << "low level listen() call failed." << endl; break;
    206             default: cout << "Unknown." << endl; break;
     229            case  0: gLog << "No error." << endl; break;
     230            case -1: gLog << "low level socket() call failed." << endl; break;
     231            case -2: gLog << "low level bind() call failed." << endl; break;
     232            case -3: gLog << "low level listen() call failed." << endl; break;
     233            default: gLog << "Unknown." << endl; break;
    207234            }
    208235            delete fServSock;
     
    214241        fServSock->SetOption(kNoBlock, 1);
    215242
    216         cout << "Waiting for connection on port " << fPortRx << "..." << endl;
     243        gLog << all << "Waiting for connection on port " << fPortRx << "..." << endl;
    217244//        while (!HasStopFlag() && (Long_t)fRxSocket<=0)
    218245        while (!IsThreadCanceled() && (Long_t)fRxSocket<=0)
     
    247274        }
    248275
    249         cout << "Connection established on port " << fPortRx << "." << endl;
     276        gLog << all << "Connection established on port " << fPortRx << "." << endl;
    250277
    251278        fRxSocket->SetOption(kNoBlock, 1);
  • trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.h

    r8856 r8862  
    4040    ~MTcpIpO();
    4141
    42     static bool SendFrame(TSocket &tx, const char *msg, int len);
    43     static bool SendFrame(const char *addr, int port, const char *msg, int len);
     42    static TString GetSocketAddress(const TSocket &s);
     43    static bool    SendFrame(TSocket &tx, const char *msg, int len);
     44    static bool    SendFrame(const char *addr, int port, const char *msg, int len);
    4445
    45     bool Send(const char *msg, int len);
     46    TString GetSocketAddress() const;
     47    bool    Send(const char *msg, int len);
    4648};
    4749
  • trunk/MagicSoft/Cosy/videodev/MVideo.cc

    r8861 r8862  
    101101// Mapper around ioctl for easier access to the device
    102102//
    103 int MVideo::Ioctl(int req, void *opt, bool allowirq) const
     103int MVideo::Ioctl(int req, void *opt, bool allowirq, bool force) const
    104104{
    105105    if (fFileDesc<0)
     
    129129        }
    130130
    131         gLog << err << "ERROR - MVideo::Ioctl 0x" << hex << req << ": errno=" << dec << errno << " - ";
    132         gLog << strerror(errno) << " (rc=" << rc << ")" << endl;
     131        if (!force)
     132        {
     133            gLog << err << "ERROR - MVideo::Ioctl 0x" << hex << req << ": errno=" << dec << errno << " - ";
     134            gLog << strerror(errno) << " (rc=" << rc << ")" << endl;
     135        }
    133136        return rc;
    134137    }
     
    186189    while (1)
    187190    {
    188         if (Ioctl (VIDIOC_QUERYCTRL, &qctrl)==-1)
     191        if (Ioctl(VIDIOC_QUERYCTRL, &qctrl, true, true)==-1)
    189192            break;
    190193
     
    769772void MVideo::Print() const
    770773{
    771     gLog << all;
     774    gLog << all << dec;
    772775
    773776    gLog << "Device " << fPath << " " << (IsOpen()?"open":"closed") << "." << endl;
     
    818821    gLog  << dec << endl;
    819822
    820     gLog << "Controls:" << endl;
     823    gLog << inf2 << "Controls:" << endl;
    821824    fControls.Print();
    822825}
  • trunk/MagicSoft/Cosy/videodev/MVideo.h

    r8861 r8862  
    6262
    6363private:
    64     int Ioctl(int req, void *opt, bool allowirq=true) const;
     64    int Ioctl(int req, void *opt, bool allowirq=true, bool force=false) const;
    6565
    6666    void Reset();
Note: See TracChangeset for help on using the changeset viewer.