~thomas-voss/location-service/add-ubx-provider

« back to all changes in this revision

Viewing changes to src/location/providers/ubx/_8/nmea/fusion_adapt.h

  • Committer: Thomas Voß
  • Date: 2016-10-10 09:15:40 UTC
  • Revision ID: thomas.voss@canonical.com-20161010091540-0hk5t9kakm9zqnxn
Add ubx provider implementation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (C) 2016 Thomas Voss <thomas.voss.bochum@gmail.com>
 
2
//
 
3
// This library is free software: you can redistribute it and/or modify
 
4
// it under the terms of the GNU Lesser General Public License as published
 
5
// by the Free Software Foundation, either version 3 of the License, or
 
6
// (at your option) any later version.
 
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 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
#ifndef UBX_8_NMEA_FUSION_ADAPT_H_
 
16
#define UBX_8_NMEA_FUSION_ADAPT_H_
 
17
 
 
18
#define BOOST_SPIRIT_DEBUG
 
19
#define FUSION_MAX_VECTOR_SIZE 15
 
20
 
 
21
#include <location/providers/ubx/_8/nmea/sentence.h>
 
22
 
 
23
#include <boost/fusion/adapted/struct.hpp>
 
24
 
 
25
// clang-format off
 
26
BOOST_FUSION_ADAPT_STRUCT(
 
27
    location::providers::ubx::_8::nmea::Latitude,
 
28
    (uint32_t, degrees)
 
29
    (double, minutes))
 
30
 
 
31
BOOST_FUSION_ADAPT_STRUCT(
 
32
    location::providers::ubx::_8::nmea::Longitude,
 
33
    (uint32_t, degrees)
 
34
    (double, minutes))
 
35
 
 
36
BOOST_FUSION_ADAPT_STRUCT(
 
37
    location::providers::ubx::_8::nmea::Date,
 
38
    (std::uint8_t, day)
 
39
    (std::uint8_t, month)
 
40
    (std::uint8_t, year))
 
41
 
 
42
BOOST_FUSION_ADAPT_STRUCT(
 
43
    location::providers::ubx::_8::nmea::Utc,
 
44
    (std::uint8_t, hours)
 
45
    (std::uint8_t, minutes)
 
46
    (double, seconds))
 
47
 
 
48
BOOST_FUSION_ADAPT_STRUCT(
 
49
    location::providers::ubx::_8::nmea::Gsa,
 
50
    (location::providers::ubx::_8::nmea::Talker, talker)
 
51
    (boost::optional<location::providers::ubx::_8::nmea::Gsa::OperationMode>, operation_mode)
 
52
    (boost::optional<location::providers::ubx::_8::nmea::Gsa::FixMode>, fix_mode)
 
53
    (std::vector<boost::optional<std::uint8_t>>, satellite_ids)
 
54
    (boost::optional<location::providers::ubx::Dop<location::providers::ubx::tag::Positional>>, pdop)
 
55
    (boost::optional<location::providers::ubx::Dop<location::providers::ubx::tag::Horizontal>>, hdop)
 
56
    (boost::optional<location::providers::ubx::Dop<location::providers::ubx::tag::Vertical>>, vdop))
 
57
 
 
58
BOOST_FUSION_ADAPT_STRUCT(
 
59
    location::providers::ubx::_8::nmea::Gga,
 
60
    (location::providers::ubx::_8::nmea::Talker, talker)
 
61
    (boost::optional<location::providers::ubx::_8::nmea::Utc>, utc)
 
62
    (boost::optional<location::providers::ubx::_8::nmea::Latitude>, latitude)
 
63
    (boost::optional<location::providers::ubx::_8::nmea::CardinalDirection>, latitude_direction)
 
64
    (boost::optional<location::providers::ubx::_8::nmea::Longitude>, longitude)
 
65
    (boost::optional<location::providers::ubx::_8::nmea::CardinalDirection>, longitude_direction)
 
66
    (boost::optional<location::providers::ubx::_8::nmea::gps::FixMode>, fix_mode)
 
67
    (boost::optional<std::uint8_t>, satellites_in_use)
 
68
    (boost::optional<location::providers::ubx::Dop<location::providers::ubx::tag::Horizontal>>, hdop)
 
69
    (boost::optional<float>, altitude)
 
70
    (boost::optional<float>, geoidal_separation)
 
71
    (boost::optional<float>, age)
 
72
    (boost::optional<std::uint16_t>, differential_reference_station))
 
73
 
 
74
BOOST_FUSION_ADAPT_STRUCT(
 
75
    location::providers::ubx::_8::nmea::Gll,
 
76
    (location::providers::ubx::_8::nmea::Talker, talker)
 
77
    (boost::optional<location::providers::ubx::_8::nmea::Latitude>, latitude)
 
78
    (boost::optional<location::providers::ubx::_8::nmea::CardinalDirection>, latitude_direction)
 
79
    (boost::optional<location::providers::ubx::_8::nmea::Longitude>, longitude)
 
80
    (boost::optional<location::providers::ubx::_8::nmea::CardinalDirection>, longitude_direction)
 
81
    (boost::optional<location::providers::ubx::_8::nmea::Utc>, utc)
 
82
    (boost::optional<location::providers::ubx::_8::nmea::Status>, status)
 
83
    (boost::optional<location::providers::ubx::_8::nmea::Mode>, mode))
 
84
 
 
85
BOOST_FUSION_ADAPT_STRUCT(
 
86
    location::providers::ubx::_8::nmea::Gsv::Info,
 
87
    (boost::optional<std::uint8_t>, satellite_id)
 
88
    (boost::optional<std::uint8_t>, elevation)
 
89
    (boost::optional<std::uint16_t>, azimuth)
 
90
    (boost::optional<std::uint8_t>, snr))
 
91
 
 
92
BOOST_FUSION_ADAPT_STRUCT(
 
93
    location::providers::ubx::_8::nmea::Gsv,
 
94
    (location::providers::ubx::_8::nmea::Talker, talker)
 
95
    (boost::optional<std::uint8_t>, sentence_count)
 
96
    (boost::optional<std::uint8_t>, sentence_number)
 
97
    (boost::optional<std::uint8_t>, satellites_count)
 
98
    (std::vector<location::providers::ubx::_8::nmea::Gsv::Info>, satellites_info))
 
99
 
 
100
BOOST_FUSION_ADAPT_STRUCT(
 
101
    location::providers::ubx::_8::nmea::Rmc,
 
102
    (location::providers::ubx::_8::nmea::Talker, talker)
 
103
    (boost::optional<location::providers::ubx::_8::nmea::Utc>, utc)
 
104
    (boost::optional<location::providers::ubx::_8::nmea::Status>, status)
 
105
    (boost::optional<location::providers::ubx::_8::nmea::Latitude>, latitude)
 
106
    (boost::optional<location::providers::ubx::_8::nmea::CardinalDirection>, latitude_direction)
 
107
    (boost::optional<location::providers::ubx::_8::nmea::Longitude>, longitude)
 
108
    (boost::optional<location::providers::ubx::_8::nmea::CardinalDirection>, longitude_direction)
 
109
    (boost::optional<float>, speed_over_ground)(boost::optional<float>, course_over_ground)
 
110
    (boost::optional<location::providers::ubx::_8::nmea::Date>, date)
 
111
    (boost::optional<float>, magnetic_variation)
 
112
    (boost::optional<location::providers::ubx::_8::nmea::CardinalDirection>, cardinal_direction)
 
113
    (boost::optional<location::providers::ubx::_8::nmea::Mode>, mode))
 
114
 
 
115
BOOST_FUSION_ADAPT_STRUCT(
 
116
    location::providers::ubx::_8::nmea::Txt,
 
117
    (location::providers::ubx::_8::nmea::Talker, talker)
 
118
    (boost::optional<std::uint8_t>, total_number_of_sentences)
 
119
    (boost::optional<std::uint8_t>, sentence_number)
 
120
    (boost::optional<std::uint8_t>, identifier)
 
121
    (boost::optional<std::string>, message))
 
122
 
 
123
BOOST_FUSION_ADAPT_STRUCT(
 
124
    location::providers::ubx::_8::nmea::Vtg,
 
125
    (location::providers::ubx::_8::nmea::Talker, talker)
 
126
    (boost::optional<float>, cog_true)
 
127
    (boost::optional<float>, cog_magnetic)
 
128
    (boost::optional<float>, sog_knots)
 
129
    (boost::optional<float>, sog_kmh)
 
130
    (boost::optional<location::providers::ubx::_8::nmea::Mode>, mode))
 
131
 
 
132
// clang-format on
 
133
 
 
134
#endif // UBX_8_NMEA_FUSION_ADAPT_H_