00001 #pragma ident "$Id: AshtechALB.cpp 646 2007-06-25 03:23:28Z 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 "StringUtils.hpp" 00040 #include "BinUtils.hpp" 00041 00042 #include "AshtechALB.hpp" 00043 #include "AshtechStream.hpp" 00044 00045 using namespace std; 00046 00047 namespace gpstk 00048 { 00049 const char* AshtechALB::myId = "ALB"; 00050 00051 //--------------------------------------------------------------------------- 00052 void AshtechALB::reallyGetRecord(FFStream& ffs) 00053 throw(std::exception, FFStreamError, EndOfFile) 00054 { 00055 AshtechStream& stream=dynamic_cast<AshtechStream&>(ffs); 00056 00057 // make sure the object is reset before starting the search 00058 clear(fmtbit | lenbit | crcbit); 00059 string& rawData = stream.rawData; 00060 00061 // If this object doesn't have an id set yet, assume that the streams 00062 // most recent read id is what we need to be 00063 if (id == "" && rawData.size()>=11 && 00064 rawData.substr(0,7) == preamble && 00065 rawData[10]==',') 00066 id = rawData.substr(7,3); 00067 00068 // If that didn't work, or this is object is not of the right type, 00069 // then give up. 00070 if (id == "" || !checkId(id)) 00071 return; 00072 00073 readBody(stream); 00074 } 00075 00076 //--------------------------------------------------------------------------- 00077 void AshtechALB::decode(const std::string& data) 00078 throw(std::exception, FFStreamError) 00079 { 00080 using BinUtils::decodeVar; 00081 00082 string str(data); 00083 if (debugLevel>1) 00084 cout << "ALB " << str.length() << " " << endl; 00085 if (str.length() == 138) 00086 { 00087 ascii=false; 00088 header = str.substr(0,11); str.erase(0,11); 00089 svid = decodeVar<uint16_t>(str); 00090 str.erase(0,1); 00091 00092 for (int w=0; w<10; w++) 00093 word[w] = decodeVar<uint32_t>(str); 00094 00095 unsigned cksum = decodeVar<uint16_t>(str); 00096 clear(ios_base::goodbit); 00097 } 00098 } 00099 00100 //--------------------------------------------------------------------------- 00101 void AshtechALB::dump(ostream& out) const throw() 00102 { 00103 ostringstream oss; 00104 using gpstk::StringUtils::asString; 00105 using gpstk::StringUtils::leftJustify; 00106 00107 AshtechData::dump(out); 00108 oss << getName() << "1:" 00109 << " svid:" << svid 00110 << " S0W0: ..." 00111 << endl; 00112 out << oss.str() << flush; 00113 } 00114 00115 } // namespace gpstk
1.3.9.1