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
26namespace com
27{
28namespace lomiri
29{
30namespace 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
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
95inline 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"},
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_
boost::units::quantity< Unit, double > Quantity
Definition units.h:60
bool roughly_equals(const Quantity< Unit > &lhs, const Quantity< Unit > &rhs)
Definition units.h:69
std::ostream & operator<<(std::ostream &out, const Accuracy< T > &update)
Definition accuracy.h:68
Definition accuracy.h:24
Uniquely identifies a space vehicle, given its type and its id.
Id id
Unique id of the space vehicle.
bool operator<(const SpaceVehicle::Key &rhs) const
bool operator==(const SpaceVehicle::Key &rhs) const
Type type
The positioning system this vehicle belongs to.
A space-vehicle as visible to providers.
Type
Enumerates all known space-vehicle types.
@ gps
Fully operational worldwide.
@ galileo
A global system being developed by the European Union and other partner countries,...
@ qzss
Japanese regional system covering Asia and Oceania.
@ compass
People's Republic of China's global system, planned to be operational by 2020.
@ glonass
Russia's global navigation system. Fully operational worldwide.
@ unknown
Unknown (and thus invalid) type.
@ irnss
India's regional navigation system, planned to be operational by 2014, covering India and Northern In...
@ beidou
People's Republic of China's regional system, currently limited to Asia and the West Pacific.
Key key
Unique key identifying an instance.
bool operator==(const SpaceVehicle &rhs) const
units::Quantity< units::PlaneAngle > azimuth
Azimuth of SV.
bool has_almanac_data
Almanac data available for this vehicle.
std::uint32_t Id
Numeric Id of an individual SpaceVehicle.
bool operator<(const SpaceVehicle &rhs) const
units::Quantity< units::PlaneAngle > elevation
Elevation of SV.
bool used_in_fix
This vehicle has been used to obtain a fix.
bool has_ephimeris_data
Ephimeris data is available for this vehicle.
float snr
Signal to noise ratio;.