64
65
template<typename T>
66
struct Codec<com::ubuntu::location::Optional<T>>
68
static void encode_argument(Message::Writer& writer, const com::ubuntu::location::Optional<T>& in)
71
Codec<bool>::encode_argument(writer, has_value);
73
Codec<typename com::ubuntu::location::Optional<T>::value_type>::encode_argument(writer, *in);
76
static void decode_argument(Message::Reader& reader, com::ubuntu::location::Optional<T>& in)
78
bool has_value{false};
79
Codec<bool>::decode_argument(reader, has_value);
82
typename com::ubuntu::location::Optional<T>::value_type value;
83
Codec<typename com::ubuntu::location::Optional<T>::value_type>::decode_argument(reader, value);
65
93
struct Codec<com::ubuntu::location::units::Quantity<T>>
67
static void encode_argument(core::dbus::Message::Writer& out, const com::ubuntu::location::units::Quantity<T>& in)
95
static void encode_argument(Message::Writer& writer, const com::ubuntu::location::units::Quantity<T>& in)
69
Codec<typename com::ubuntu::location::units::Quantity<T>::value_type>::encode_argument(out, in.value());
97
Codec<typename com::ubuntu::location::units::Quantity<T>::value_type>::encode_argument(writer, in.value());
72
static void decode_argument(core::dbus::Message::Reader& out, com::ubuntu::location::units::Quantity<T>& in)
100
static void decode_argument(Message::Reader& reader, com::ubuntu::location::units::Quantity<T>& in)
74
102
typename com::ubuntu::location::units::Quantity<T>::value_type value;
75
Codec<typename com::ubuntu::location::units::Quantity<T>::value_type>::decode_argument(out, value);
103
Codec<typename com::ubuntu::location::units::Quantity<T>::value_type>::decode_argument(reader, value);
76
104
in = com::ubuntu::location::units::Quantity<T>::from_value(value);
82
template<typename T, typename U>
83
struct TypeMapper<com::ubuntu::location::wgs84::Coordinate<T,U>>
85
constexpr static ArgumentType type_value()
87
return ArgumentType::structure;
89
constexpr static bool is_basic_type()
93
constexpr static bool requires_signature()
98
static std::string signature()
100
static const std::string s =
101
DBUS_STRUCT_BEGIN_CHAR_AS_STRING +
102
TypeMapper<com::ubuntu::location::units::Quantity<U>>::signature() +
103
DBUS_STRUCT_END_CHAR_AS_STRING;
109
108
template<typename T, typename U>
110
109
struct Codec<com::ubuntu::location::wgs84::Coordinate<T,U>>
112
static void encode_argument(core::dbus::Message::Writer& out, const com::ubuntu::location::wgs84::Coordinate<T, U>& in)
114
Codec<com::ubuntu::location::units::Quantity<U>>::encode_argument(out, in.value);
117
static void decode_argument(core::dbus::Message::Reader& out, com::ubuntu::location::wgs84::Coordinate<T, U>& in)
119
Codec<com::ubuntu::location::units::Quantity<U>>::decode_argument(out, in.value);
126
struct TypeMapper<com::ubuntu::location::Position>
128
constexpr static ArgumentType type_value()
130
return ArgumentType::structure;
132
constexpr static bool is_basic_type()
136
constexpr static bool requires_signature()
141
static std::string signature()
143
static const std::string s =
144
TypeMapper<uint64_t>::signature() +
145
TypeMapper<com::ubuntu::location::wgs84::Latitude>::signature() +
146
TypeMapper<com::ubuntu::location::wgs84::Longitude>::signature() +
147
TypeMapper<com::ubuntu::location::wgs84::Altitude>::signature();
111
static void encode_argument(Message::Writer& writer, const com::ubuntu::location::wgs84::Coordinate<T, U>& in)
113
Codec<com::ubuntu::location::units::Quantity<U>>::encode_argument(writer, in.value);
116
static void decode_argument(Message::Reader& reader, com::ubuntu::location::wgs84::Coordinate<T, U>& in)
118
Codec<com::ubuntu::location::units::Quantity<U>>::decode_argument(reader, in.value);
154
123
struct Codec<com::ubuntu::location::Position>
156
static void encode_argument(core::dbus::Message::Writer& out, const com::ubuntu::location::Position& in)
158
Codec<uint64_t>::encode_argument(out, in.flags().to_ulong());
159
if (in.has_latitude())
160
Codec<com::ubuntu::location::wgs84::Latitude>::encode_argument(out, in.latitude());
161
if (in.has_longitude())
162
Codec<com::ubuntu::location::wgs84::Longitude>::encode_argument(out, in.longitude());
163
if (in.has_altitude())
164
Codec<com::ubuntu::location::wgs84::Altitude>::encode_argument(out, in.altitude());
167
static void decode_argument(core::dbus::Message::Reader& out, com::ubuntu::location::Position& in)
169
com::ubuntu::location::wgs84::Latitude lat;
170
com::ubuntu::location::wgs84::Longitude lon;
171
com::ubuntu::location::wgs84::Altitude alt;
172
uint64_t flags_on_wire;
173
Codec<uint64_t>::decode_argument(out, flags_on_wire);
175
com::ubuntu::location::Position::Flags flags{flags_on_wire};
176
if (flags.test(com::ubuntu::location::Position::latitude_flag))
178
Codec<com::ubuntu::location::wgs84::Latitude>::decode_argument(out, lat);
181
if (flags.test(com::ubuntu::location::Position::latitude_flag))
183
Codec<com::ubuntu::location::wgs84::Longitude>::decode_argument(out, lon);
186
if (flags.test(com::ubuntu::location::Position::altitude_flag))
188
Codec<com::ubuntu::location::wgs84::Altitude>::decode_argument(out, alt);
197
struct TypeMapper<com::ubuntu::location::Velocity>
199
constexpr static ArgumentType type_value()
201
return ArgumentType::structure;
203
constexpr static bool is_basic_type()
207
constexpr static bool requires_signature()
212
static std::string signature()
214
static const std::string s =
215
DBUS_STRUCT_BEGIN_CHAR_AS_STRING +
216
TypeMapper<typename com::ubuntu::location::Velocity::Quantity>::signature() +
217
DBUS_STRUCT_END_CHAR_AS_STRING;
224
struct Codec<com::ubuntu::location::Velocity>
226
static void encode_argument(core::dbus::Message::Writer& out, const com::ubuntu::location::Velocity& in)
228
Codec<typename com::ubuntu::location::Velocity::Quantity>::encode_argument(out, in.value);
231
static void decode_argument(core::dbus::Message::Reader& out, com::ubuntu::location::Velocity& in)
233
Codec<typename com::ubuntu::location::Velocity::Quantity>::decode_argument(out, in.value);
240
struct TypeMapper<com::ubuntu::location::Heading>
242
constexpr static ArgumentType type_value()
244
return ArgumentType::structure;
246
constexpr static bool is_basic_type()
250
constexpr static bool requires_signature()
255
static std::string signature()
257
static const std::string s =
258
DBUS_STRUCT_BEGIN_CHAR_AS_STRING +
259
TypeMapper<typename com::ubuntu::location::Heading::Quantity>::signature() +
260
DBUS_STRUCT_END_CHAR_AS_STRING;
267
struct Codec<com::ubuntu::location::Heading>
269
static void encode_argument(core::dbus::Message::Writer& out, const com::ubuntu::location::Heading& in)
271
Codec<typename com::ubuntu::location::Heading::Quantity>::encode_argument(out, in.value);
274
static void decode_argument(core::dbus::Message::Reader& out, com::ubuntu::location::Heading& in)
276
Codec<typename com::ubuntu::location::Heading::Quantity>::decode_argument(out, in.value);
283
struct TypeMapper<com::ubuntu::location::Accuracy<T>>
285
constexpr static ArgumentType type_value()
287
return ArgumentType::structure;
289
constexpr static bool is_basic_type()
293
constexpr static bool requires_signature()
298
static std::string signature()
300
static const std::string s =
301
DBUS_STRUCT_BEGIN_CHAR_AS_STRING +
302
TypeMapper<T>::signature() +
303
DBUS_STRUCT_END_CHAR_AS_STRING;
310
struct Codec<com::ubuntu::location::Accuracy<T>>
312
static void encode_argument(core::dbus::Message::Writer& out, const com::ubuntu::location::Accuracy<T>& in)
314
Codec<T>::encode_argument(out, in.value);
317
static void decode_argument(core::dbus::Message::Reader& out, com::ubuntu::location::Accuracy<T>& in)
319
Codec<T>::decode_argument(out, in.value);
326
struct TypeMapper<com::ubuntu::location::Criteria>
328
constexpr static ArgumentType type_value()
330
return ArgumentType::structure;
332
constexpr static bool is_basic_type()
336
constexpr static bool requires_signature()
341
static std::string signature()
343
static const std::string s =
344
DBUS_STRUCT_BEGIN_CHAR_AS_STRING +
345
helper::TypeMapper<com::ubuntu::location::Accuracy<com::ubuntu::location::wgs84::Latitude>>::signature() +
346
helper::TypeMapper<com::ubuntu::location::Accuracy<com::ubuntu::location::wgs84::Longitude>>::signature() +
347
helper::TypeMapper<com::ubuntu::location::Accuracy<com::ubuntu::location::wgs84::Altitude>>::signature() +
348
helper::TypeMapper<com::ubuntu::location::Accuracy<com::ubuntu::location::Velocity>>::signature() +
349
helper::TypeMapper<com::ubuntu::location::Accuracy<com::ubuntu::location::Heading>>::signature() +
350
DBUS_STRUCT_END_CHAR_AS_STRING;
125
typedef com::ubuntu::location::Position::Accuracy::Horizontal HorizontalAccuracy;
126
typedef com::ubuntu::location::Position::Accuracy::Vertical VerticalAccuracy;
128
static void encode_argument(Message::Writer& writer, const com::ubuntu::location::Position& in)
130
Codec<com::ubuntu::location::wgs84::Latitude>::encode_argument(writer, in.latitude);
131
Codec<com::ubuntu::location::wgs84::Longitude>::encode_argument(writer, in.longitude);
132
Codec<com::ubuntu::location::Optional<com::ubuntu::location::wgs84::Altitude>>::encode_argument(writer, in.altitude);
134
Codec<com::ubuntu::location::Optional<HorizontalAccuracy>>::encode_argument(writer, in.accuracy.horizontal);
135
Codec<com::ubuntu::location::Optional<VerticalAccuracy>>::encode_argument(writer, in.accuracy.vertical);
138
static void decode_argument(Message::Reader& reader, com::ubuntu::location::Position& in)
140
Codec<com::ubuntu::location::wgs84::Latitude>::decode_argument(reader, in.latitude);
141
Codec<com::ubuntu::location::wgs84::Longitude>::decode_argument(reader, in.longitude);
142
Codec<com::ubuntu::location::Optional<com::ubuntu::location::wgs84::Altitude>>::decode_argument(reader, in.altitude);
144
Codec<com::ubuntu::location::Optional<HorizontalAccuracy>>::decode_argument(reader, in.accuracy.horizontal);
145
Codec<com::ubuntu::location::Optional<VerticalAccuracy>>::decode_argument(reader, in.accuracy.vertical);
153
struct TypeMapper<com::ubuntu::location::SpaceVehicle::Key>
155
constexpr static ArgumentType type_value()
157
return ArgumentType::structure;
159
constexpr static bool is_basic_type()
163
constexpr static bool requires_signature()
168
static std::string signature()
170
static const std::string s =
171
helper::TypeMapper<std::uint32_t>::signature() +
172
helper::TypeMapper<std::uint32_t>::signature();
177
struct TypeMapper<com::ubuntu::location::SpaceVehicle>
179
constexpr static ArgumentType type_value()
181
return ArgumentType::structure;
183
constexpr static bool is_basic_type()
187
constexpr static bool requires_signature()
192
inline static std::string signature()
195
DBUS_STRUCT_BEGIN_CHAR_AS_STRING +
196
helper::TypeMapper<com::ubuntu::location::SpaceVehicle::Key>::signature() +
197
helper::TypeMapper<float>::signature() +
198
helper::TypeMapper<bool>::signature() +
199
helper::TypeMapper<bool>::signature() +
200
helper::TypeMapper<bool>::signature() +
201
helper::TypeMapper<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::signature() +
202
helper::TypeMapper<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::signature() +
203
DBUS_STRUCT_END_CHAR_AS_STRING;
210
struct Codec<com::ubuntu::location::SpaceVehicle::Key>
212
static void encode_argument(Message::Writer& writer, const com::ubuntu::location::SpaceVehicle::Key& in)
214
writer.push_uint32(static_cast<std::uint32_t>(in.type));
215
writer.push_uint32(in.id);
218
static void decode_argument(Message::Reader& reader, com::ubuntu::location::SpaceVehicle::Key& in)
220
in.type = static_cast<com::ubuntu::location::SpaceVehicle::Type>(reader.pop_uint32());
221
in.id = reader.pop_uint32();
226
struct Codec<com::ubuntu::location::SpaceVehicle>
228
inline static void encode_argument(Message::Writer& writer, const com::ubuntu::location::SpaceVehicle& in)
230
auto sub = writer.open_structure();
232
Codec<com::ubuntu::location::SpaceVehicle::Key>::encode_argument(sub, in.key);
233
sub.push_floating_point(in.snr);
234
sub.push_boolean(in.has_almanac_data);
235
sub.push_boolean(in.has_ephimeris_data);
236
sub.push_boolean(in.used_in_fix);
237
Codec<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::encode_argument(sub, in.azimuth);
238
Codec<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::encode_argument(sub, in.elevation);
240
writer.close_structure(std::move(sub));
243
inline static void decode_argument(Message::Reader& reader, com::ubuntu::location::SpaceVehicle& in)
245
auto sub = reader.pop_structure();
247
Codec<com::ubuntu::location::SpaceVehicle::Key>::decode_argument(sub, in.key);
248
in.snr = sub.pop_floating_point();
249
in.has_almanac_data = sub.pop_boolean();
250
in.has_ephimeris_data = sub.pop_boolean();
251
in.used_in_fix = sub.pop_boolean();
252
Codec<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::decode_argument(sub, in.azimuth);
253
Codec<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::decode_argument(sub, in.elevation);
260
struct TypeMapper<std::map<com::ubuntu::location::SpaceVehicle::Key, com::ubuntu::location::SpaceVehicle>>
262
constexpr static ArgumentType type_value()
264
return ArgumentType::array;
266
constexpr static bool is_basic_type()
270
constexpr static bool requires_signature()
275
static std::string signature()
277
static const std::string s = DBUS_TYPE_ARRAY_AS_STRING + TypeMapper<com::ubuntu::location::SpaceVehicle>::signature();
283
struct Codec<std::map<com::ubuntu::location::SpaceVehicle::Key, com::ubuntu::location::SpaceVehicle>>
285
inline static void encode_argument(Message::Writer& writer, const std::map<com::ubuntu::location::SpaceVehicle::Key, com::ubuntu::location::SpaceVehicle>& arg)
287
types::Signature signature(helper::TypeMapper<com::ubuntu::location::SpaceVehicle>::signature());
288
auto sub = writer.open_array(signature);
290
for(const auto& element : arg)
292
Codec<com::ubuntu::location::SpaceVehicle>::encode_argument(sub, element.second);
295
writer.close_array(std::move(sub));
298
inline static void decode_argument(Message::Reader& reader, std::map<com::ubuntu::location::SpaceVehicle::Key, com::ubuntu::location::SpaceVehicle>& out)
300
auto sub = reader.pop_array();
301
while (sub.type() != ArgumentType::invalid)
303
com::ubuntu::location::SpaceVehicle sv;
304
Codec<com::ubuntu::location::SpaceVehicle>::decode_argument(sub, sv);
305
out.insert(std::make_pair(sv.key, sv));
357
311
struct Codec<com::ubuntu::location::Criteria>
359
static void encode_argument(core::dbus::Message::Writer& out, const com::ubuntu::location::Criteria& in)
361
Codec<com::ubuntu::location::Accuracy<com::ubuntu::location::wgs84::Latitude>>::encode_argument(out, in.latitude_accuracy);
362
Codec<com::ubuntu::location::Accuracy<com::ubuntu::location::wgs84::Longitude>>::encode_argument(out, in.longitude_accuracy);
363
Codec<com::ubuntu::location::Accuracy<com::ubuntu::location::wgs84::Altitude>>::encode_argument(out, in.altitude_accuracy);
364
Codec<com::ubuntu::location::Accuracy<com::ubuntu::location::Velocity>>::encode_argument(out, in.velocity_accuracy);
365
Codec<com::ubuntu::location::Accuracy<com::ubuntu::location::Heading>>::encode_argument(out, in.heading_accuracy);
368
static void decode_argument(core::dbus::Message::Reader& out, com::ubuntu::location::Criteria& in)
370
Codec<com::ubuntu::location::Accuracy<com::ubuntu::location::wgs84::Latitude>>::decode_argument(out, in.latitude_accuracy);
371
Codec<com::ubuntu::location::Accuracy<com::ubuntu::location::wgs84::Longitude>>::decode_argument(out, in.longitude_accuracy);
372
Codec<com::ubuntu::location::Accuracy<com::ubuntu::location::wgs84::Altitude>>::decode_argument(out, in.altitude_accuracy);
373
Codec<com::ubuntu::location::Accuracy<com::ubuntu::location::Velocity>>::decode_argument(out, in.velocity_accuracy);
374
Codec<com::ubuntu::location::Accuracy<com::ubuntu::location::Heading>>::decode_argument(out, in.heading_accuracy);
313
typedef com::ubuntu::location::units::Quantity<com::ubuntu::location::units::Length> HorizontalAccuracy;
314
typedef com::ubuntu::location::units::Quantity<com::ubuntu::location::units::Length> VerticalAccuracy;
315
typedef com::ubuntu::location::units::Quantity<com::ubuntu::location::units::Velocity> VelocityAccuracy;
316
typedef com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle> HeadingAccuracy;
318
static void encode_argument(Message::Writer& writer, const com::ubuntu::location::Criteria& in)
320
Codec<bool>::encode_argument(writer, in.requires.position);
321
Codec<bool>::encode_argument(writer, in.requires.altitude);
322
Codec<bool>::encode_argument(writer, in.requires.heading);
323
Codec<bool>::encode_argument(writer, in.requires.velocity);
325
Codec<HorizontalAccuracy>::encode_argument(writer, in.accuracy.horizontal);
326
Codec<com::ubuntu::location::Optional<VerticalAccuracy>>::encode_argument(writer, in.accuracy.vertical);
327
Codec<com::ubuntu::location::Optional<VelocityAccuracy>>::encode_argument(writer, in.accuracy.velocity);
328
Codec<com::ubuntu::location::Optional<HeadingAccuracy>>::encode_argument(writer, in.accuracy.heading);
331
static void decode_argument(Message::Reader& reader, com::ubuntu::location::Criteria& in)
333
Codec<bool>::decode_argument(reader, in.requires.position);
334
Codec<bool>::decode_argument(reader, in.requires.altitude);
335
Codec<bool>::decode_argument(reader, in.requires.heading);
336
Codec<bool>::decode_argument(reader, in.requires.velocity);
338
Codec<HorizontalAccuracy>::decode_argument(reader, in.accuracy.horizontal);
339
Codec<com::ubuntu::location::Optional<VerticalAccuracy>>::decode_argument(reader, in.accuracy.vertical);
340
Codec<com::ubuntu::location::Optional<VelocityAccuracy>>::decode_argument(reader, in.accuracy.velocity);
341
Codec<com::ubuntu::location::Optional<HeadingAccuracy>>::decode_argument(reader, in.accuracy.heading);