AshtechEPB.cpp
Go to the documentation of this file.
1 //==============================================================================
2 //
3 // This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
4 //
5 // The GNSSTk is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published
7 // by the Free Software Foundation; either version 3.0 of the License, or
8 // any later version.
9 //
10 // The GNSSTk is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with GNSSTk; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 //
19 // This software was developed by Applied Research Laboratories at the
20 // University of Texas at Austin.
21 // Copyright 2004-2022, The Board of Regents of The University of Texas System
22 //
23 //==============================================================================
24 
25 //==============================================================================
26 //
27 // This software was developed by Applied Research Laboratories at the
28 // University of Texas at Austin, under contract to an agency or agencies
29 // within the U.S. Department of Defense. The U.S. Government retains all
30 // rights to use, duplicate, distribute, disclose, or release this software.
31 //
32 // Pursuant to DoD Directive 523024
33 //
34 // DISTRIBUTION STATEMENT A: This software has been approved for public
35 // release, distribution is unlimited.
36 //
37 //==============================================================================
38 
39 #include "StringUtils.hpp"
40 #include "BinUtils.hpp"
41 
42 #include "AshtechEPB.hpp"
43 #include "AshtechStream.hpp"
44 
45 using namespace std;
46 
47 namespace gnsstk
48 {
49  const char* AshtechEPB::myId = "EPB";
50 
51  //---------------------------------------------------------------------------
52  void AshtechEPB::reallyGetRecord(FFStream& ffs)
53  {
54  AshtechStream& stream=dynamic_cast<AshtechStream&>(ffs);
55 
56  // make sure the object is reset before starting the search
57  clear(fmtbit | lenbit | crcbit);
58  string& rawData = stream.rawData;
59 
60  // If this object doesn't have an id set yet, assume that the streams
61  // most recent read id is what we need to be
62  if (id == "" && rawData.size()>=10 &&
63  rawData.substr(0,7) == preamble)
64  id = rawData.substr(7,3);
65 
66  // If that didn't work, or this is object is not of the right type,
67  // then give up.
68  if (id == "" || !checkId(id))
69  return;
70 
71  readBody(stream);
72  }
73 
74  //---------------------------------------------------------------------------
75  void AshtechEPB::decode(const std::string& data)
76  {
77  using BinUtils::decodeVar;
79 
80  string str(data);
81 
82  if (str.length() == 138)
83  {
84  ascii = false;
85  header = str.substr(0,11); str.erase(0,11);
86  prn = asInt(str.substr(0,2));
87  str.erase(0,3);
88 
89  for (int s=1; s<=3; s++)
90  for (int w=1; w<=10; w++)
91  word[s][w] = decodeVar<uint32_t>(str);
92 
93  (void)decodeVar<uint16_t>(str); // ignore checksum
94  clear(ios_base::goodbit);
95  }
96  }
97 
98  //---------------------------------------------------------------------------
99  void AshtechEPB::dump(ostream& out) const noexcept
100  {
101  ostringstream oss;
104 
105  AshtechData::dump(out);
106  oss << getName() << "0:" << " prn:" << prn << endl;
107 
108  oss << setfill('0') << hex;
109  for (int s=1; s<=3; s++)
110  {
111  for (int w=1; w<=10; w++)
112  {
113  if ((w % 5) == 1)
114  oss << getName() << s*2+w/5-1 << ": ";
115  oss << setw(8) << uppercase << word[s][w] << " ";
116  if ((w % 5) == 0)
117  oss << endl;
118  }
119  }
120 
121  out << oss.str() << flush;
122  }
123 } // namespace gnsstk
gnsstk::dump
void dump(vector< SatPass > &SatPassList, ostream &os, bool rev, bool dbug)
Definition: SatPassUtilities.cpp:59
gnsstk::StringUtils::asInt
long asInt(const std::string &s)
Definition: StringUtils.hpp:713
example3.header
header
Definition: example3.py:22
gnsstk::StringUtils::word
std::string word(const std::string &s, const std::string::size_type wordNum=0, const char delimiter=' ')
Definition: StringUtils.hpp:1112
gnsstk::lenbit
static const std::ios_base::iostate lenbit
Definition: DataStatus.hpp:88
gnsstk::FFStream
Definition: FFStream.hpp:119
StringUtils.hpp
gnsstk::crcbit
static const std::ios_base::iostate crcbit
Define additional/other bits are the data requires.
Definition: DataStatus.hpp:86
AshtechEPB.hpp
gnsstk::StringUtils::asString
std::string asString(IonexStoreStrategy e)
Convert a IonexStoreStrategy to a whitespace-free string name.
Definition: IonexStoreStrategy.cpp:46
gnsstk::fmtbit
static const std::ios_base::iostate fmtbit
Definition: DataStatus.hpp:87
AshtechStream.hpp
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::AshtechStream
Definition: AshtechStream.hpp:54
BinUtils.hpp
example3.data
data
Definition: example3.py:22
std
Definition: Angle.hpp:142
gnsstk::StringUtils::leftJustify
std::string & leftJustify(std::string &s, const std::string::size_type length, const char pad=' ')
Definition: StringUtils.hpp:1582
gnsstk::AshtechStream::rawData
std::string rawData
The raw bytes read from the file.
Definition: AshtechStream.hpp:78
gnsstk::BinUtils::decodeVar
T decodeVar(const std::string &str, std::string::size_type pos)
Definition: BinUtils.hpp:366


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:38