Changeset 14110


Ignore:
Timestamp:
06/07/12 16:16:46 (12 years ago)
Author:
tbretz
Message:
Added an observation list.
File:
1 edited

Legend:

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

    r14045 r14110  
    388388    string   fMcpConfigurationName;
    389389    Time     fMcpConfigurationRunStart;
     390    Time     fMcpConfigurationLastTime;
     391    deque<string> fMcpConfigurationHist;
    390392
    391393    enum weather_t { kWeatherBegin=0, kTemp = kWeatherBegin, kDew, kHum, kPress, kWind, kGusts, kDir, kWeatherEnd = kDir+1 };
     
    694696        }
    695697
    696         // If a run ends and no script is running play a tirili
    697         if (fMcpConfigurationState==MCP::State::kTakingData && d.GetQoS()==MCP::State::kIdle && fDimControl.state()<-2)
    698             SetAudio("sound_10");
    699 
    700         // If a run ends and a script is running just play a simple 'tick'
    701         if (fMcpConfigurationState==MCP::State::kTakingData && d.GetQoS()==MCP::State::kIdle && fDimControl.state()>=-2)
    702             SetAudio("losticks");
     698        if (d.GetTime()>fMcpConfigurationLastTime+boost::posix_time::hours(12))
     699            fMcpConfigurationHist.clear();
     700
     701        // If a run ends...
     702        if (fMcpConfigurationState==MCP::State::kTakingData && d.GetQoS()==MCP::State::kIdle)
     703        {
     704            //...and no script is running just play a simple 'tick'
     705            if (fDimControl.state()<-2)
     706                SetAudio("sound_10");
     707
     708            // ...and a script is running just play a simple 'tick'
     709            if (fDimControl.state()>=-2)
     710                SetAudio("losticks");
     711
     712            ostringstream out;
     713            out << HTML::kBlue << '\t' << d.GetTimeAsStr("%H:%M:%S") << " " << d.Ptr<char>(16);
     714            if (!fDriveControlSourceName.empty())
     715                out << " [" << fDriveControlSourceName << "]\n";
     716            fMcpConfigurationHist.push_back(out.str());
     717        }
    703718
    704719        if (d.GetQoS()==MCP::State::kTakingData)
     
    706721            fMcpConfigurationRunStart = Time();
    707722            SetAudio("losticks");
     723
     724            ostringstream out;
     725            out << HTML::kGreen << '\t' << d.GetTimeAsStr("%H:%M:%S") << " " << fMcpConfigurationName << '\n';
     726            fMcpConfigurationHist.push_back(out.str());
     727            if (!fDriveControlSourceName.empty())
     728                out << " [" << fDriveControlSourceName << "]\n";
    708729        }
    709730
     
    712733        fMcpConfigurationMaxEvents = d.Get<uint64_t>(8);
    713734        fMcpConfigurationName      = d.Ptr<char>(16);
     735        fMcpConfigurationLastTime  = d.GetTime();
     736
     737        ostringstream out;
     738        out << d.GetJavaDate() << '\n';
     739        for (auto it=fMcpConfigurationHist.rbegin(); it!=fMcpConfigurationHist.rend(); it++)
     740            out << *it;
     741
     742        ofstream(fPath+"/observations.txt") << out.str();
    714743
    715744        return GetCurrentState();
Note: See TracChangeset for help on using the changeset viewer.