ubuntu-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_UBUNTU_LOCATION_SPACE_VEHICLE_H_
19 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_SPACE_VEHICLE_H_
20 
22 
23 #include <iostream>
24 #include <map>
25 
26 namespace com
27 {
28 namespace ubuntu
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_UBUNTU_LOCATION_SPACE_VEHICLE_H_
Japanese regional system covering Asia and Oceania.
bool has_almanac_data
Almanac data available for this vehicle.
Definition: space_vehicle.h:88
A global system being developed by the European Union and other partner countries, planned to be operational by 2014 (and fully deployed by 2019).
bool roughly_equals(const Quantity< Unit > &lhs, const Quantity< Unit > &rhs)
Definition: units.h:62
Definition: accuracy.h:23
units::Quantity< units::PlaneAngle > azimuth
Azimuth of SV.
Definition: space_vehicle.h:91
Type type
The positioning system this vehicle belongs to.
Definition: space_vehicle.h:54
float snr
Signal to noise ratio;.
Definition: space_vehicle.h:87
boost::units::quantity< Unit, double > Quantity
Definition: units.h:53
People&#39;s Republic of China&#39;s global system, planned to be operational by 2020.
bool operator==(const SpaceVehicle::Key &rhs) const
Definition: space_vehicle.h:57
bool has_ephimeris_data
Ephimeris data is available for this vehicle.
Definition: space_vehicle.h:89
bool operator<(const SpaceVehicle &rhs) const
Definition: space_vehicle.h:81
Uniquely identifies a space vehicle, given its type and its id.
Definition: space_vehicle.h:52
India&#39;s regional navigation system, planned to be operational by 2014, covering India and Northern In...
bool operator==(const SpaceVehicle &rhs) const
Definition: space_vehicle.h:71
bool operator<(const SpaceVehicle::Key &rhs) const
Definition: space_vehicle.h:62
Russia&#39;s global navigation system. Fully operational worldwide.
Id id
Unique id of the space vehicle.
Definition: space_vehicle.h:55
A space-vehicle as visible to providers.
Definition: space_vehicle.h:33
std::ostream & operator<<(std::ostream &out, const Accuracy< T > &update)
Definition: accuracy.h:68
units::Quantity< units::PlaneAngle > elevation
Elevation of SV.
Definition: space_vehicle.h:92
bool used_in_fix
This vehicle has been used to obtain a fix.
Definition: space_vehicle.h:90
People&#39;s Republic of China&#39;s regional system, currently limited to Asia and the West Pacific...
std::uint32_t Id
Numeric Id of an individual SpaceVehicle.
Definition: space_vehicle.h:36
Key key
Unique key identifying an instance.
Definition: space_vehicle.h:86
Type
Enumerates all known space-vehicle types.
Definition: space_vehicle.h:39