GLOFNavHealth.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 //
28 // This software was developed by Applied Research Laboratories at the
29 // University of Texas at Austin, under contract to an agency or agencies
30 // within the U.S. Department of Defense. The U.S. Government retains all
31 // rights to use, duplicate, distribute, disclose, or release this software.
32 //
33 // Pursuant to DoD Directive 523024
34 //
35 // DISTRIBUTION STATEMENT A: This software has been approved for public
36 // release, distribution is unlimited.
37 //
38 //==============================================================================
39 #include "GLOFNavHealth.hpp"
40 
41 using namespace std;
42 
43 namespace gnsstk
44 {
45  GLOFNavHealth ::
46  GLOFNavHealth()
47  {
48  // Allow the data fields to default to invalid via ValidType.
49  msgLenSec = 2.0;
50  }
51 
52 
53  bool GLOFNavHealth ::
54  validate() const
55  {
56  return (healthBits.is_valid() || ln.is_valid() || Cn.is_valid());
57  }
58 
59 
60  void GLOFNavHealth ::
61  dump(std::ostream& s, DumpDetail dl) const
62  {
63  const ios::fmtflags oldFlags = s.flags();
64  s.setf(ios::fixed, ios::floatfield);
65  s.setf(ios::right, ios::adjustfield);
66  s.setf(ios::uppercase);
67  s.precision(0);
68  s.fill(' ');
69  switch (dl)
70  {
71  case DumpDetail::OneLine:
72  NavData::dump(s,dl);
73  break;
74  case DumpDetail::Brief:
75  NavData::dump(s,dl);
76  if (healthBits.is_valid())
77  {
78  s << " Bn = " << hex << (unsigned)healthBits;
79  }
80  if (ln.is_valid())
81  {
82  s << " ln = " << hex << (unsigned)ln;
83  }
84  if (Cn.is_valid())
85  {
86  s << " Cn = " << hex << (unsigned)Cn;
87  }
88  s << endl;
89  break;
90  case DumpDetail::Full:
91  // "header"
92  s << "*************************************************************"
93  << "***************" << endl
94  << "Satellite Health"
95  << endl
96  << endl
97  << getSignalString() << endl
98  << " TIMES OF INTEREST"
99  << endl << endl
100  << " " << getDumpTimeHdr(dl) << endl
101  << "Transmit: " << getDumpTime(dl, timeStamp) << endl
102  << endl
103  << " HEALTH DATA" << endl;
104  if (healthBits.is_valid())
105  {
106  s << "Bn 0x" << hex << setw(1) << setfill('0')
107  << (unsigned)healthBits << endl;
108  }
109  if (ln.is_valid())
110  {
111  s << "ln 0x" << hex << setw(1) << setfill('0')
112  << (unsigned)ln << endl;
113  }
114  if (Cn.is_valid())
115  {
116  s << "Cn 0x" << hex << setw(1) << setfill('0')
117  << (unsigned)Cn << endl;
118  }
119  s << "Status " << StringUtils::asString(getHealth())
120  << endl;
121  break;
122  }
123  s.flags(oldFlags);
124  }
125 
126 
127  SVHealth GLOFNavHealth ::
128  getHealth() const
129  {
130  // healthBits + ln = ephemeris
131  if (healthBits.is_valid() && ln.is_valid())
132  {
133  return ((ln.get_value() != false) || (healthBits & 0x04)
134  ? SVHealth::Unhealthy
135  : SVHealth::Healthy);
136  }
137  // Cn + ln = almanac (we ignore ln in this case, though)
138  if (Cn.is_valid())
139  {
140  return (Cn ? SVHealth::Healthy : SVHealth::Unhealthy);
141  }
142  // ln on its own = string 5
143  if (ln.is_valid())
144  {
145  return (ln ? SVHealth::Healthy : SVHealth::Unhealthy);
146  }
147  return SVHealth::Unknown;
148  }
149 
150 }
gnsstk::dump
void dump(vector< SatPass > &SatPassList, ostream &os, bool rev, bool dbug)
Definition: SatPassUtilities.cpp:59
gnsstk::StringUtils::asString
std::string asString(IonexStoreStrategy e)
Convert a IonexStoreStrategy to a whitespace-free string name.
Definition: IonexStoreStrategy.cpp:46
gnsstk::SVHealth
SVHealth
Identify different types of SV health states.
Definition: SVHealth.hpp:52
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::DumpDetail
DumpDetail
Specify level of detail for dump output.
Definition: DumpDetail.hpp:51
GLOFNavHealth.hpp
std
Definition: Angle.hpp:142


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