2
* Copyright © 2012-2013 Canonical Ltd.
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.
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.
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/>.
16
* Authored by: Thomas Voß <thomas.voss@canonical.com>
18
#ifndef LOCATION_PROVIDERS_GEOCLUE_GEOCLUE_H_
19
#define LOCATION_PROVIDERS_GEOCLUE_GEOCLUE_H_
21
#include <core/dbus/service.h>
22
#include <core/dbus/traits/service.h>
23
#include <core/dbus/types/struct.h>
24
#include <core/dbus/types/stl/tuple.h>
28
namespace dbus = core::dbus;
36
enum class Status : int
44
friend std::ostream& operator<<(std::ostream& out, const Status& status)
46
static std::map<Status, std::string> lut =
48
{Status::error, "error"},
49
{Status::unavailable, "unavailable"},
50
{Status::acquiring, "acquiring"},
51
{Status::available, "available"}
54
return out << lut[status];
57
struct GetProviderInfo
59
inline static std::string name()
61
return "GetProviderInfo";
63
typedef Geoclue Interface;
64
typedef std::tuple<std::string, std::string> ResultType;
65
inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
70
inline static std::string name()
74
typedef Geoclue Interface;
75
typedef int32_t ResultType;
76
inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
81
inline static std::string name()
83
return "AddReference";
85
typedef Geoclue Interface;
86
typedef void ResultType;
87
inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
90
struct RemoveReference
92
inline static std::string name()
94
return "RemoveReference";
96
typedef Geoclue Interface;
97
typedef void ResultType;
98
inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
105
inline static std::string name()
109
typedef Address Interface;
110
typedef std::tuple<int32_t, std::map<std::string, std::string>, dbus::types::Struct<std::tuple<int32_t, double, double>>> ResultType;
111
inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
116
struct AddressChanged
118
inline static std::string name()
120
return "PositionChanged";
122
typedef Address Interface;
123
typedef std::tuple<int32_t, std::map<std::string, std::string>, dbus::types::Struct<std::tuple<int32_t, double, double>>> ArgumentType;
134
static const int none = 0;
135
static const int latitude = 1;
136
static const int longitude = 2;
137
static const int altitude = 3;
140
typedef std::bitset<4> FieldFlags;
144
inline static std::string name()
146
return "GetPosition";
148
typedef Position Interface;
149
typedef std::tuple<int32_t, int32_t, double, double, double, dbus::types::Struct<std::tuple<int32_t, double, double>>> ResultType;
150
inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
155
struct PositionChanged
157
inline static std::string name()
159
return "PositionChanged";
161
typedef Position Interface;
162
typedef std::tuple<int32_t, int32_t, double, double, double, dbus::types::Struct<std::tuple<int32_t, double, double>>> ArgumentType;
173
static const int none = 0;
174
static const int speed = 1;
175
static const int direction = 2;
176
static const int climb = 3;
179
typedef std::bitset<4> FieldFlags;
183
inline static std::string name()
185
return "GetVelocity";
187
typedef Velocity Interface;
188
typedef std::tuple<int32_t, int32_t, double, double, double> ResultType;
189
inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
193
struct VelocityChanged
195
inline static std::string name()
197
return "VelocityChanged";
199
typedef Velocity Interface;
200
typedef std::tuple<int32_t, int32_t, double, double, double> ArgumentType;
215
struct Service<org::freedesktop::Geoclue>
217
inline static const std::string& interface_name()
219
static const std::string s{"org.freedesktop.Geoclue"};
225
struct Service<org::freedesktop::Geoclue::Address>
227
inline static const std::string& interface_name()
229
static const std::string s{"org.freedesktop.Geoclue.Address"};
235
struct Service<org::freedesktop::Geoclue::Position>
237
inline static const std::string& interface_name()
239
static const std::string s{"org.freedesktop.Geoclue.Position"};
245
struct Service<org::freedesktop::Geoclue::Velocity>
247
inline static const std::string& interface_name()
249
static const std::string s{"org.freedesktop.Geoclue.Velocity"};
257
#endif // LOCATION_PROVIDERS_GEOCLUE_GEOCLUE_H_