Changeset 8840 for trunk


Ignore:
Timestamp:
01/30/08 15:41:38 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy/tcpip
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/tcpip/MCeCoCom.cc

    r8378 r8840  
    22
    33#include <iostream>
     4
     5#include "MLog.h"
    46
    57#include "MString.h"
     
    79using namespace std;
    810
     11/*
     12 // THIS COULD NEVER WORK BECAUSE IT IGNORES WHETHER
     13 // WE SEND STARGUIDER OR DRIVE REPORTS!
     14bool MCeCoCom::SendMsg(const char *msg, bool force=kFALSE)
     15{
     16    const MTime t(-1);
     17
     18    if ((double)t-(double)fTime<0.001*fSendInterval && !force)
     19          return true;
     20
     21    if (lout.Lock("MTcpIpIO::Send"))
     22    {
     23        //const Int_t rc = lout.IsOutputDeviceEnabled(MLog::eGui);
     24        //lout.DisableOutputDevice(MLog::eGui);
     25        lout << msg << flush;
     26        lout.UnLock("MTcpIpIO::Send");
     27        //if (rc)
     28        //    lout.EnableOutputDevice(MLog::eGui);
     29    }
     30
     31    fTime = t;
     32
     33    return Send(msg, strlen(msg));
     34}
     35*/
    936bool MCeCoCom::InterpreteCmd(TString cmd, TString str)
    1037{
     
    114141             str);
    115142
    116     const bool rc = MTcpIpIO::Send(msg, force);
     143    // Send report to CC
     144    const bool rc = Send(msg, strlen(msg));
    117145    fComStat = rc ? kNoCmdReceived : kComProblem;
     146
     147    // Write report to stream
     148    if (fOut)
     149        if (fOut->Lock("MTcpIpIO::Send"))
     150        {
     151            *fOut << msg << flush;
     152            fOut->UnLock("MTcpIpIO::Send");
     153        }
     154
    118155    return rc;
    119156}
  • trunk/MagicSoft/Cosy/tcpip/MCeCoCom.h

    r8378 r8840  
    2424    };
    2525
    26     //TString fCommand;     // report string of the current system
     26    MLog *fOut;           // Stream to which reports are written in addition
     27
     28//    Int_t fSendInterval; // [ms]
     29//    MTime fTime;
     30
    2731    MTime   fT;           // time of last report received
    2832    char    fStatus;      // current status of this system
     
    4448
    4549public:
    46     MCeCoCom::MCeCoCom(const char *cmd, MLog &out=gLog)
    47         : MTcpIpIO(out), /*fCommand(cmd),*/ fStatus(0), fComStat(kNoCmdReceived), fSolarRadiation(-1)
     50    MCeCoCom(MLog *out)
     51        : MTcpIpIO(7304, 7404), fOut(out), fStatus(0), fComStat(kNoCmdReceived),
     52        fHumidity(0), fTemperature(0), fWindSpeed(0), fSolarRadiation(-1),
     53        fAlarmCounter(0)
    4854    {
    4955    }
     56    //virtual bool SendMsg(const char *msg, bool force);
    5057
    5158    bool SendRep(const char *cmd, const char *str, bool force);
Note: See TracChangeset for help on using the changeset viewer.