Changeset 9432 for trunk/MagicSoft/Cosy


Ignore:
Timestamp:
04/22/09 10:46:59 (15 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/Changelog

    r9418 r9432  
    11                                                                  -*-*- END -*-*-
     2
     3 2009/04/22 Thomas Bretz (La Palma)
     4
     5   * .cosyrc_magic2, prepos_magic2.txt, leds_magic2.txt:
     6     - added
     7
     8   * devdrv/dkc.cc:
     9     - added some initialisation in the constructor
     10     - added Warning E256
     11
     12   * devdrv/shaftencoder.cc:
     13     - removed fTurn
     14     - removed fDirChangedPos
     15     - removed inter-connection with macs/dkc
     16     - added a sanity check for fLabel
     17     - removed obsolete functions
     18
     19   * tcpip/MCeCoCom.[h,cc]:
     20     - added telescope number to reports
     21
     22   * tcpip/MTcpIpIO.[h,cc]:
     23     - reopen send socket if invalid
     24     - added some debug output
     25     - make the timeout a variable
     26
     27
    228
    329 2009/04/01 Thomas Bretz
     
    1945
    2046
    21  
     47
    2248 2009/01/14 Thomas Bretz
    2349
    2450   * slalib/dat.c:
    2551     - added leap second
    26  
    27  
    28  
     52
     53
     54
    2955 2008/08/26 Thomas Bretz (La Palma)
    3056
  • trunk/MagicSoft/Cosy/tcpip/MCeCoCom.cc

    r8998 r9432  
    133133
    134134    const TString msg =
    135         MString::Format("%s "
     135        MString::Format("%s M%d "
    136136             "%02d %04d %02d %02d %02d %02d %02d %03d "
    137137             "%02d %04d %02d %02d %02d %02d %02d %03d "
    138              "%s\n", cmd,
     138             "%s\n", cmd, fTelescope,
    139139             fStatus,  y1, mon1, d1, h1, m1, s1, ms1,
    140140             fComStat, y2, mon2, d2, h2, m2, s2, ms2,
  • trunk/MagicSoft/Cosy/tcpip/MCeCoCom.h

    r8869 r9432  
    3333    int     fCCStatus;    // global status of CC
    3434
     35    Byte_t  fTelescope;
     36
    3537    ComStatus_t fComStat; // communication status
    3638
     
    4951public:
    5052    MCeCoCom(const char *addr, const int tx=7304, const int rx=7404, MLog *out=NULL)
    51         : MTcpIpIO(addr, tx, rx), fOut(out), fStatus(0), fComStat(kNoCmdReceived),
     53        : MTcpIpIO(addr, tx, rx), fOut(out), fStatus(0),
     54        fTelescope(1), fComStat(kNoCmdReceived),
    5255        fHumidity(0), fTemperature(0), fWindSpeed(0), fSolarRadiation(-1),
    5356        fAlarmCounter(0)
     
    6063    bool SendRep(const char *cmd, const char *str, bool force);
    6164    void SetStatus(Byte_t s) { fStatus=s; }
     65
     66    void SetTelescope(Byte_t tel) { fTelescope = tel; }
    6267
    6368    Float_t GetHumidity() const { return fHumidity; }
  • trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.cc

    r8869 r9432  
    1515
    1616#undef DEBUG
     17//#define DEBUG
    1718
    1819using namespace std;
     
    4041     */
    4142
    42 MTcpIpO::MTcpIpO(const char *addr, Int_t tx)
    43 {
     43MTcpIpO::MTcpIpO(const char *addr, Int_t tx) : fPortTx(tx)
     44{
     45    gLog << inf2 << "- Open send socket to " << addr << ":" << tx << endl;
    4446    fTxSocket = new TSocket(addr, tx);
    4547}
     
    147149bool MTcpIpO::Send(const char *msg, Int_t len)
    148150{
     151    if (!fTxSocket->IsValid())
     152    {
     153        const TInetAddress &a = fTxSocket->GetInetAddress();
     154        if (!a.IsValid())
     155            return false;
     156#ifdef DEBUG
     157        cout << "- Reopen send socket to " << a.GetHostAddress() << ":" << fPortTx << endl;
     158#endif
     159        delete fTxSocket;
     160        fTxSocket = new TSocket(a.GetHostAddress(), fPortTx);
     161    }
     162
    149163    return SendFrame(*fTxSocket, msg, len);
    150164}
     
    206220    fConnectionEstablished = kTRUE;
    207221
    208     MTimeout timeout;
     222    MTimeout timeout(fTimeout);
    209223
    210224    // Get connection on port fPortRx and redirected
     
    228242            if (timeout.HasTimedOut())
    229243            {
    230                 gLog << warn << MTime(-1) << " WARNING - Connection to " << MTcpIpO::GetSocketAddress(sock) << " timed out." << endl;
     244                gLog << warn << MTime(-1) << " WARNING - Connection to " << MTcpIpO::GetSocketAddress(sock) << " timed out after " << fTimeout << "ms." << endl;
    231245                return kFALSE;
    232246            }
     
    285299            fConnectionEstablished = kFALSE;
    286300
     301#ifdef DEBUG
     302        cout << "===> DEL SOCKET" << endl;
     303#endif
    287304        delete socket;
    288305    }
     
    314331        }
    315332
     333#ifdef DEBUG
     334        cout << "===> DEL SERVER" << endl;
     335#endif
    316336        delete server;
    317337
  • trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.h

    r8865 r9432  
    4444    TSocket *fTxSocket;
    4545
     46    Int_t fPortTx;
     47
    4648public:
    4749    MTcpIpO(const char *addr, Int_t tx);
Note: See TracChangeset for help on using the changeset viewer.