MDPSelftestStatus.cpp

Go to the documentation of this file.
00001 #pragma ident "$Id: MDPSelftestStatus.cpp 1420 2008-10-27 20:14:08Z ocibu $"
00002 
00003 //============================================================================
00004 //
00005 //  This file is part of GPSTk, the GPS Toolkit.
00006 //
00007 //  The GPSTk is free software; you can redistribute it and/or modify
00008 //  it under the terms of the GNU Lesser General Public License as published
00009 //  by the Free Software Foundation; either version 2.1 of the License, or
00010 //  any later version.
00011 //
00012 //  The GPSTk is distributed in the hope that it will be useful,
00013 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 //  GNU Lesser General Public License for more details.
00016 //
00017 //  You should have received a copy of the GNU Lesser General Public
00018 //  License along with GPSTk; if not, write to the Free Software Foundation,
00019 //  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 //  
00021 //  Copyright 2004, The University of Texas at Austin
00022 //
00023 //============================================================================
00024 
00025 //============================================================================
00026 //
00027 //This software developed by Applied Research Laboratories at the University of
00028 //Texas at Austin, under contract to an agency or agencies within the U.S. 
00029 //Department of Defense. The U.S. Government retains all rights to use,
00030 //duplicate, distribute, disclose, or release this software. 
00031 //
00032 //Pursuant to DoD Directive 523024 
00033 //
00034 // DISTRIBUTION STATEMENT A: This software has been approved for public 
00035 //                           release, distribution is unlimited.
00036 //
00037 //=============================================================================
00038 
00039 #include <sstream>
00040 
00041 #include "StringUtils.hpp"
00042 #include "BinUtils.hpp"
00043 
00044 #include "MDPSelftestStatus.hpp"
00045 #include "MDPStream.hpp"
00046 
00047 using gpstk::StringUtils::asString;
00048 using gpstk::BinUtils::encodeVar;
00049 using gpstk::BinUtils::decodeVar;
00050 using namespace std;
00051 
00052 namespace gpstk
00053 {
00054    //---------------------------------------------------------------------------
00055    MDPSelftestStatus::MDPSelftestStatus()
00056       throw() :
00057       selfTestTime(gpstk::DayTime::BEGINNING_OF_TIME),
00058       firstPVTTime(gpstk::DayTime::BEGINNING_OF_TIME),
00059       antennaTemp(0), receiverTemp(0), status(0xffffffff),
00060       cpuLoad(0), extFreqStatus(0)
00061    {
00062       id = myId;
00063    } // MDPSelftestStatus::MDPSelftestStatus()
00064 
00065 
00066    //---------------------------------------------------------------------------
00067    string MDPSelftestStatus::encode() const
00068       throw()
00069    {
00070       string str;
00071       str += encodeVar( (float)    antennaTemp);
00072       str += encodeVar( (float)    receiverTemp);
00073       str += encodeVar( (uint32_t) status);
00074       str += encodeVar( (float)    cpuLoad);
00075       str += encodeVar( (uint32_t) 100*selfTestTime.GPSsecond());
00076       str += encodeVar( (uint16_t) selfTestTime.GPSfullweek());
00077       str += encodeVar( (uint16_t) firstPVTTime.GPSfullweek());
00078       str += encodeVar( (uint32_t) 100*firstPVTTime.GPSsecond());
00079       str += encodeVar( (uint16_t) extFreqStatus);
00080       str += encodeVar( (uint16_t) saasmStatusWord);
00081       return str;
00082    } // MDPSelftestStatus::encode()
00083 
00084       
00085    //---------------------------------------------------------------------------
00086    void MDPSelftestStatus::decode(string str)
00087       throw()
00088    {
00089       if (str.length() != myLength)
00090          return;
00091 
00092       clearstate(lenbit);
00093       
00094       
00095       long sow100;
00096       int week;
00097 
00098       antennaTemp   = decodeVar<float>(str);
00099       receiverTemp  = decodeVar<float>(str);
00100       status        = decodeVar<uint32_t>(str);
00101       cpuLoad       = decodeVar<float>(str);
00102       sow100        = decodeVar<uint32_t>(str);
00103       week          = decodeVar<uint16_t>(str);
00104       selfTestTime.setGPSfullweek(week, double(sow100)*0.01);
00105       week          = decodeVar<uint16_t>(str);
00106       sow100        = decodeVar<uint32_t>(str);
00107       firstPVTTime.setGPSfullweek(week, double(sow100)*0.01);
00108       extFreqStatus = decodeVar<uint16_t>(str);
00109       saasmStatusWord  = decodeVar<uint16_t>(str);
00110       
00111       clearstate(fmtbit);
00112    } // MDPSelftestStatus::decode()
00113 
00114 
00115    //---------------------------------------------------------------------------
00116    void MDPSelftestStatus::dump(ostream& out) const
00117       throw()
00118    {
00119       ostringstream oss;
00120       using gpstk::StringUtils::asString;
00121       using gpstk::StringUtils::leftJustify;
00122 
00123       MDPHeader::dump(oss);
00124       oss << getName() << "1:"
00125           << " Tst:" << selfTestTime.printf("%4F/%9.2g")
00126           << " Tpvt:" << firstPVTTime.printf("%4F/%9.2g")
00127           << " Ant. Temp:" << antennaTemp
00128           << " Rx. Temp:" << receiverTemp
00129           << " status:" << hex << status << dec
00130           << " cpuLoad:" << cpuLoad
00131           << " extFreq:" << hex << extFreqStatus << dec
00132           << " ssw:" << hex << saasmStatusWord << dec
00133           << endl;
00134       out << oss.str() << flush;
00135    } // MDPSelftestStatus::dump()
00136 
00137 }

Generated on Wed Feb 8 03:31:00 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1