lomiri-location-service  ..
An aggregating location service providing positioning and geocoding capabilities to applications.
space_vehicle.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2012-2013 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Thomas Voß <thomas.voss@canonical.com>
17  */
18 #ifndef LOCATION_SERVICE_COM_LOMIRI_LOCATION_SPACE_VEHICLE_H_
19 #define LOCATION_SERVICE_COM_LOMIRI_LOCATION_SPACE_VEHICLE_H_
20 
22 
23 #include <iostream>
24 #include <map>
25 
26 namespace com
27 {
28 namespace lomiri
29 {
30 namespace location
31 {
34 {
36  typedef std::uint32_t Id;
37 
39  enum class Type
40  {
41  unknown,
42  beidou,
43  galileo,
44  glonass,
45  gps,
46  compass,
47  irnss,
48  qzss
49  };
50 
52  struct Key
53  {
55  Id id = 0;
56 
57  inline bool operator==(const SpaceVehicle::Key& rhs) const
58  {
59  return type == rhs.type && id == rhs.id;
60  }
61 
62  inline bool operator<(const SpaceVehicle::Key& rhs) const
63  {
64  if (type != rhs.type)
65  return type < rhs.type;
66 
67  return id < rhs.id;
68  }
69  };
70 
71  inline bool operator==(const SpaceVehicle& rhs) const
72  {
73  return key == rhs.key &&
76  used_in_fix == rhs.used_in_fix &&
79  }
80 
81  inline bool operator<(const SpaceVehicle& rhs) const
82  {
83  return key < rhs.key;
84  }
85 
86  Key key;
87  float snr = -std::numeric_limits<float>::max();
88  bool has_almanac_data = false;
89  bool has_ephimeris_data = false;
90  bool used_in_fix = false;
93 };
94 
95 inline std::ostream& operator<<(std::ostream& out, const SpaceVehicle& sv)
96 {
97  static const std::map<SpaceVehicle::Type, std::string> lut =
98  {
99  {SpaceVehicle::Type::unknown, "unknown"},
100  {SpaceVehicle::Type::beidou, "beidou"},
101  {SpaceVehicle::Type::galileo, "galileo"},
102  {SpaceVehicle::Type::glonass, "glonass"},
103  {SpaceVehicle::Type::gps, "gps"},
104  {SpaceVehicle::Type::compass, "compass"},
105  {SpaceVehicle::Type::irnss, "irnss"},
106  {SpaceVehicle::Type::qzss, "qzss" }
107  };
108  return out << "("
109  << "type: " << lut.at(sv.key.type) << ", "
110  << "prn: " << sv.key.id << ", "
111  << "snr: " << sv.snr << ", "
112  << "has_almanac_data: " << sv.has_almanac_data << ", "
113  << "has_ephimeris_data: " << sv.has_ephimeris_data << ", "
114  << "used_in_fix: " << sv.used_in_fix << ", "
115  << "azimuth: " << sv.azimuth << ", "
116  << "elevation: " << sv.elevation
117  << ")";
118 }
119 }
120 }
121 }
122 
123 #endif // LOCATION_SERVICE_COM_LOMIRI_LOCATION_SPACE_VEHICLE_H_
com::lomiri::location::SpaceVehicle::Key::type
Type type
The positioning system this vehicle belongs to.
Definition: space_vehicle.h:54
com::lomiri::location::SpaceVehicle::Key::id
Id id
Unique id of the space vehicle.
Definition: space_vehicle.h:55
com::lomiri::location::SpaceVehicle::Key
Uniquely identifies a space vehicle, given its type and its id.
Definition: space_vehicle.h:52
com::lomiri::location::SpaceVehicle::operator<
bool operator<(const SpaceVehicle &rhs) const
Definition: space_vehicle.h:81
com::lomiri::location::SpaceVehicle::has_ephimeris_data
bool has_ephimeris_data
Ephimeris data is available for this vehicle.
Definition: space_vehicle.h:89
com::lomiri::location::SpaceVehicle::key
Key key
Unique key identifying an instance.
Definition: space_vehicle.h:86
com::lomiri::location::SpaceVehicle::Type::compass
@ compass
People's Republic of China's global system, planned to be operational by 2020.
com::lomiri::location::SpaceVehicle::Type::glonass
@ glonass
Russia's global navigation system. Fully operational worldwide.
com::lomiri::location::SpaceVehicle::Type::beidou
@ beidou
People's Republic of China's regional system, currently limited to Asia and the West Pacific.
com::lomiri::location::SpaceVehicle::azimuth
units::Quantity< units::PlaneAngle > azimuth
Azimuth of SV.
Definition: space_vehicle.h:91
com::lomiri::location::SpaceVehicle::Type::gps
@ gps
Fully operational worldwide.
com::lomiri::location::SpaceVehicle::snr
float snr
Signal to noise ratio;.
Definition: space_vehicle.h:87
com::lomiri::location::units::Quantity
boost::units::quantity< Unit, double > Quantity
Definition: units.h:60
com::lomiri::location::units::roughly_equals
bool roughly_equals(const Quantity< Unit > &lhs, const Quantity< Unit > &rhs)
Definition: units.h:69
com::lomiri::location::SpaceVehicle::Type::unknown
@ unknown
Unknown (and thus invalid) type.
com::lomiri::location::SpaceVehicle::Type::irnss
@ irnss
India's regional navigation system, planned to be operational by 2014, covering India and Northern In...
com::lomiri::location::operator<<
std::ostream & operator<<(std::ostream &out, const Accuracy< T > &update)
Definition: accuracy.h:68
units.h
com::lomiri::location::SpaceVehicle::Key::operator<
bool operator<(const SpaceVehicle::Key &rhs) const
Definition: space_vehicle.h:62
com::lomiri::location::SpaceVehicle::has_almanac_data
bool has_almanac_data
Almanac data available for this vehicle.
Definition: space_vehicle.h:88
com::lomiri::location::SpaceVehicle::Key::operator==
bool operator==(const SpaceVehicle::Key &rhs) const
Definition: space_vehicle.h:57
com::lomiri::location::SpaceVehicle::operator==
bool operator==(const SpaceVehicle &rhs) const
Definition: space_vehicle.h:71
com
Definition: accuracy.h:23
com::lomiri::location::SpaceVehicle::Type::galileo
@ galileo
A global system being developed by the European Union and other partner countries,...
com::lomiri::location::SpaceVehicle::Type
Type
Enumerates all known space-vehicle types.
Definition: space_vehicle.h:39
com::lomiri::location::SpaceVehicle::used_in_fix
bool used_in_fix
This vehicle has been used to obtain a fix.
Definition: space_vehicle.h:90
com::lomiri::location::SpaceVehicle::Id
std::uint32_t Id
Numeric Id of an individual SpaceVehicle.
Definition: space_vehicle.h:36
com::lomiri::location::SpaceVehicle::elevation
units::Quantity< units::PlaneAngle > elevation
Elevation of SV.
Definition: space_vehicle.h:92
com::lomiri::location::SpaceVehicle::Type::qzss
@ qzss
Japanese regional system covering Asia and Oceania.
com::lomiri::location::SpaceVehicle
A space-vehicle as visible to providers.
Definition: space_vehicle.h:33