lomiri-location-service ..
An aggregating location service providing positioning and geocoding capabilities to applications.
service/interface.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_SERVICE_INTERFACE_H_
19#define LOCATION_SERVICE_COM_LOMIRI_LOCATION_SERVICE_INTERFACE_H_
20
23
25
26#include <core/dbus/service.h>
27#include <core/dbus/traits/service.h>
28#include <core/dbus/types/object_path.h>
29#include <core/dbus/types/stl/vector.h>
30
31#include <chrono>
32#include <functional>
33
34namespace dbus = core::dbus;
35
36namespace com
37{
38namespace lomiri
39{
40namespace location
41{
42struct Criteria;
43namespace service
44{
49{
50 protected:
51 struct Errors
52 {
54 {
55 inline static std::string name()
56 {
57 return "com.lomiri.location.Service.Error.InsufficientPermissions";
58 }
59 };
61 {
62 inline static std::string name()
63 {
64 return "com.lomiri.location.Service.Error.CreatingSession";
65 }
66 };
67 };
68
70 {
72
73 inline static const std::string& name()
74 {
75 static const std::string s
76 {
77 "CreateSessionForCriteria"
78 };
79 return s;
80 }
81
82 typedef dbus::types::ObjectPath ResultType;
83
84 inline static const std::chrono::milliseconds default_timeout()
85 {
86 return std::chrono::seconds{25};
87 }
88 };
89
91 {
92 struct State
93 {
94 inline static const std::string& name()
95 {
96 static const std::string s
97 {
98 "State"
99 };
100 return s;
101 }
102
105 static const bool readable = true;
106 static const bool writable = true;
107 };
108
110 {
111 inline static const std::string& name()
112 {
113 static const std::string s
114 {
115 "DoesSatelliteBasedPositioning"
116 };
117 return s;
118 }
119
121 typedef bool ValueType;
122 static const bool readable = true;
123 static const bool writable = true;
124 };
125
127 {
128 inline static const std::string& name()
129 {
130 static const std::string s
131 {
132 "DoesReportCellAndWifiIds"
133 };
134 return s;
135 }
136
138 typedef bool ValueType;
139 static const bool readable = true;
140 static const bool writable = true;
141 };
142
143 struct IsOnline
144 {
145 inline static const std::string& name()
146 {
147 static const std::string s
148 {
149 "IsOnline"
150 };
151 return s;
152 }
153
155 typedef bool ValueType;
156 static const bool readable = true;
157 static const bool writable = true;
158 };
159
161 {
162 inline static const std::string& name()
163 {
164 static const std::string s
165 {
166 "VisibleSpaceVehicles"
167 };
168 return s;
169 }
170
172 typedef std::map<com::lomiri::location::SpaceVehicle::Key, com::lomiri::location::SpaceVehicle> ValueType;
173
174 static const bool readable = true;
175 static const bool writable = false;
176 };
177
179 {
180 inline static const std::string& name()
181 {
182 static const std::string s
183 {
184 "ClientApplications"
185 };
186 return s;
187 }
188
190 typedef std::vector<std::string> ValueType;
191 static const bool readable = true;
192 static const bool writable = false;
193 };
194 };
195
196 Interface() = default;
197
198 public:
199 typedef std::shared_ptr<Interface> Ptr;
200
204 inline static const std::string& path()
205 {
206 static const std::string s{"/com/lomiri/location/Service"};
207 return s;
208 }
209
210 Interface(const Interface&) = delete;
211 Interface& operator=(const Interface&) = delete;
212 virtual ~Interface() = default;
213
218 virtual const core::Property<State>& state() const = 0;
219
224 virtual core::Property<bool>& does_satellite_based_positioning() = 0;
225
230 virtual core::Property<bool>& is_online() = 0;
231
241 virtual core::Property<bool>& does_report_cell_and_wifi_ids() = 0;
242
246 virtual core::Property<std::map<SpaceVehicle::Key, SpaceVehicle>>& visible_space_vehicles() = 0;
247
255
260 virtual core::Property<std::vector<std::string>>& client_applications() = 0;
261};
262}
263}
264}
265}
266
267namespace core
268{
269namespace dbus
270{
271namespace traits
272{
273template<>
274struct Service<com::lomiri::location::service::Interface>
275{
276 static const std::string& interface_name()
277 {
278 static const std::string s
279 {
280 "com.lomiri.location.Service"
281 };
282 return s;
283 }
284};
285}
286}
287}
288
290
291#endif // LOCATION_SERVICE_COM_LOMIRI_LOCATION_SERVICE_INTERFACE_H_
The Interface class models the primary interface to the location service.
Interface(const Interface &)=delete
virtual const core::Property< State > & state() const =0
The overall state of the service.
Interface & operator=(const Interface &)=delete
virtual core::Property< std::map< SpaceVehicle::Key, SpaceVehicle > > & visible_space_vehicles()=0
All space vehicles currently visible.
virtual core::Property< bool > & does_satellite_based_positioning()=0
Whether the service uses satellite-based positioning.
static const std::string & path()
Queries the path that this object is known under.
virtual core::Property< std::vector< std::string > > & client_applications()=0
List of application IDs currently requesting position information.
virtual core::Property< bool > & does_report_cell_and_wifi_ids()=0
Whether the engine and its providers/reporters do call home to report reference locations together wi...
virtual session::Interface::Ptr create_session_for_criteria(const Criteria &criteria)=0
Starts a new session for the given criteria.
virtual core::Property< bool > & is_online()=0
Whether the overall service and its positioning engine is online or not.
State
State enumerates the known states of the service.
Definition state.h:27
Definition accuracy.h:24
Definition codec.h:39
Summarizes criteria of a client session with respect to functionality and accuracy for position,...
Definition criteria.h:35
std::map< com::lomiri::location::SpaceVehicle::Key, com::lomiri::location::SpaceVehicle > ValueType