ubuntu-location-service: /build/location-service-git/src/location-service/include/location_service/com/ubuntu/location/service/interface.h Source File

ubuntu-location-service .. An aggregating location service providing positioning and geocoding capabilities to applications.

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_UBUNTU_LOCATION_SERVICE_INTERFACE_H_
19 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_INTERFACE_H_
20
21 #include <com/ubuntu/location/service/state.h>
22 #include <com/ubuntu/location/service/session/interface.h>
23
24 #include <com/ubuntu/location/space_vehicle.h>
25
26 #include <core/dbus/service.h>
27 #include <core/dbus/traits/service.h>
28 #include <core/dbus/types/object_path.h>
29
30 #include <chrono>
31 #include <functional>
32
33 namespace dbus = core::dbus;
34
35 namespace com
36 {
37 namespace ubuntu
38 {
39 namespace location
40 {
41 struct Criteria;
42 namespace service
43 {
47 class Interface
48 {
49 protected:
50 struct Errors
51 {
52 struct InsufficientPermissions
53 {
54 inline static std::string name()
55 {
56 return "com.ubuntu.location.Service.Error.InsufficientPermissions";
57 }
58 };
59 struct CreatingSession
60 {
61 inline static std::string name()
62 {
63 return "com.ubuntu.location.Service.Error.CreatingSession";
64 }
65 };
66 };
67
68 struct CreateSessionForCriteria
69 {
70 typedef com::ubuntu::location::service::Interface Interface;
71
72 inline static const std::string& name()
73 {
74 static const std::string s
75 {
76 "CreateSessionForCriteria"
77 };
78 return s;
79 }
80
81 typedef dbus::types::ObjectPath ResultType;
82
83 inline static const std::chrono::milliseconds default_timeout()
84 {
85 return std::chrono::seconds{25};
86 }
87 };
88
89 struct Properties
90 {
91 struct State
92 {
93 inline static const std::string& name()
94 {
95 static const std::string s
96 {
97 "State"
98 };
99 return s;
100 }
101
102 typedef com::ubuntu::location::service::Interface Interface;
103 typedef com::ubuntu::location::service::State ValueType;
104 static const bool readable = true;
105 static const bool writable = true;
106 };
107
108 struct DoesSatelliteBasedPositioning
109 {
110 inline static const std::string& name()
111 {
112 static const std::string s
113 {
114 "DoesSatelliteBasedPositioning"
115 };
116 return s;
117 }
118
119 typedef com::ubuntu::location::service::Interface Interface;
120 typedef bool ValueType;
121 static const bool readable = true;
122 static const bool writable = true;
123 };
124
125 struct DoesReportCellAndWifiIds
126 {
127 inline static const std::string& name()
128 {
129 static const std::string s
130 {
131 "DoesReportCellAndWifiIds"
132 };
133 return s;
134 }
135
136 typedef com::ubuntu::location::service::Interface Interface;
137 typedef bool ValueType;
138 static const bool readable = true;
139 static const bool writable = true;
140 };
141
142 struct IsOnline
143 {
144 inline static const std::string& name()
145 {
146 static const std::string s
147 {
148 "IsOnline"
149 };
150 return s;
151 }
152
153 typedef com::ubuntu::location::service::Interface Interface;
154 typedef bool ValueType;
155 static const bool readable = true;
156 static const bool writable = true;
157 };
158
159 struct VisibleSpaceVehicles
160 {
161 inline static const std::string& name()
162 {
163 static const std::string s
164 {
165 "VisibleSpaceVehicles"
166 };
167 return s;
168 }
169
170 typedef com::ubuntu::location::service::Interface Interface;
171 typedef std::map<com::ubuntu::location::SpaceVehicle::Key, com::ubuntu::location::SpaceVehicle> ValueType;
172
173 static const bool readable = true;
174 static const bool writable = false;
175 };
176 };
177
178 Interface() = default;
179
180 public:
181 typedef std::shared_ptr<Interface> Ptr;
182
186 inline static const std::string& path()
187 {
188 static const std::string s{"/com/ubuntu/location/Service"};
189 return s;
190 }
191
192 Interface(const Interface&) = delete;
193 Interface& operator=(const Interface&) = delete;
194 virtual ~Interface() = default;
195
200 virtual const core::Property<State>& state() const = 0;
201
206 virtual core::Property<bool>& does_satellite_based_positioning() = 0;
207
212 virtual core::Property<bool>& is_online() = 0;
213
223 virtual core::Property<bool>& does_report_cell_and_wifi_ids() = 0;
224
228 virtual core::Property<std::map<SpaceVehicle::Key, SpaceVehicle>>& visible_space_vehicles() = 0;
229
236 virtual session::Interface::Ptr create_session_for_criteria(const Criteria& criteria) = 0;
237 };
238 }
239 }
240 }
241 }
242
243 namespace core
244 {
245 namespace dbus
246 {
247 namespace traits
248 {
249 template<>
250 struct Service<com::ubuntu::location::service::Interface>
251 {
252 static const std::string& interface_name()
253 {
254 static const std::string s
255 {
256 "com.ubuntu.location.Service"
257 };
258 return s;
259 }
260 };
261 }
262 }
263 }
264
265 #include <com/ubuntu/location/codec.h>
266
267 #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_INTERFACE_H_
com::ubuntu::location::service::Interface
The Interface class models the primary interface to the location service.
Definition: interface.h:48
com::ubuntu::location::service::Interface::state
virtual const core::Property< State > & state() const =0
The overall state of the service.
com::ubuntu::location::service::Interface::Interface
Interface()=default
com::ubuntu::location::service::Interface::does_satellite_based_positioning
virtual core::Property< bool > & does_satellite_based_positioning()=0
Whether the service uses satellite-based positioning.
com::ubuntu::location::service::Interface::operator=
Interface & operator=(const Interface &)=delete
com::ubuntu::location::service::Interface::path
static const std::string & path()
Queries the path that this object is known under.
Definition: interface.h:186
com::ubuntu::location::service::Interface::does_report_cell_and_wifi_ids
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...
com::ubuntu::location::service::Interface::~Interface
virtual ~Interface()=default
com::ubuntu::location::service::Interface::visible_space_vehicles
virtual core::Property< std::map< SpaceVehicle::Key, SpaceVehicle > > & visible_space_vehicles()=0
All space vehicles currently visible.
com::ubuntu::location::service::Interface::is_online
virtual core::Property< bool > & is_online()=0
Whether the overall service and its positioning engine is online or not.
com::ubuntu::location::service::Interface::Interface
Interface(const Interface &)=delete
com::ubuntu::location::service::Interface::create_session_for_criteria
virtual session::Interface::Ptr create_session_for_criteria(const Criteria &criteria)=0
Starts a new session for the given criteria.
com::ubuntu::location::service::Interface::Ptr
std::shared_ptr< Interface > Ptr
Definition: interface.h:181
com::ubuntu::location::service::session::Interface::Ptr
std::shared_ptr< Interface > Ptr
Definition: interface.h:105
codec.h
com::ubuntu::location::service::State
State
State enumerates the known states of the service.
Definition: state.h:27
com
Definition: accuracy.h:24
core::dbus
Definition: codec.h:41
core
Definition: codec.h:39
interface.h
space_vehicle.h
state.h
com::ubuntu::location::Criteria
Summarizes criteria of a client session with respect to functionality and accuracy for position,...
Definition: criteria.h:35
com::ubuntu::location::service::Interface::CreateSessionForCriteria
Definition: interface.h:69
com::ubuntu::location::service::Interface::CreateSessionForCriteria::default_timeout
static const std::chrono::milliseconds default_timeout()
Definition: interface.h:83
com::ubuntu::location::service::Interface::CreateSessionForCriteria::ResultType
dbus::types::ObjectPath ResultType
Definition: interface.h:81
com::ubuntu::location::service::Interface::CreateSessionForCriteria::name
static const std::string & name()
Definition: interface.h:72
com::ubuntu::location::service::Interface::CreateSessionForCriteria::Interface
com::ubuntu::location::service::Interface Interface
Definition: interface.h:70
com::ubuntu::location::service::Interface::Errors::CreatingSession
Definition: interface.h:60
com::ubuntu::location::service::Interface::Errors::CreatingSession::name
static std::string name()
Definition: interface.h:61
com::ubuntu::location::service::Interface::Errors::InsufficientPermissions
Definition: interface.h:53
com::ubuntu::location::service::Interface::Errors::InsufficientPermissions::name
static std::string name()
Definition: interface.h:54
com::ubuntu::location::service::Interface::Errors
Definition: interface.h:51
com::ubuntu::location::service::Interface::Properties::DoesReportCellAndWifiIds
Definition: interface.h:126
com::ubuntu::location::service::Interface::Properties::DoesReportCellAndWifiIds::writable
static const bool writable
Definition: interface.h:139
com::ubuntu::location::service::Interface::Properties::DoesReportCellAndWifiIds::ValueType
bool ValueType
Definition: interface.h:137
com::ubuntu::location::service::Interface::Properties::DoesReportCellAndWifiIds::Interface
com::ubuntu::location::service::Interface Interface
Definition: interface.h:136
com::ubuntu::location::service::Interface::Properties::DoesReportCellAndWifiIds::name
static const std::string & name()
Definition: interface.h:127
com::ubuntu::location::service::Interface::Properties::DoesReportCellAndWifiIds::readable
static const bool readable
Definition: interface.h:138
com::ubuntu::location::service::Interface::Properties::DoesSatelliteBasedPositioning
Definition: interface.h:109
com::ubuntu::location::service::Interface::Properties::DoesSatelliteBasedPositioning::ValueType
bool ValueType
Definition: interface.h:120
com::ubuntu::location::service::Interface::Properties::DoesSatelliteBasedPositioning::name
static const std::string & name()
Definition: interface.h:110
com::ubuntu::location::service::Interface::Properties::DoesSatelliteBasedPositioning::writable
static const bool writable
Definition: interface.h:122
com::ubuntu::location::service::Interface::Properties::DoesSatelliteBasedPositioning::Interface
com::ubuntu::location::service::Interface Interface
Definition: interface.h:119
com::ubuntu::location::service::Interface::Properties::DoesSatelliteBasedPositioning::readable
static const bool readable
Definition: interface.h:121
com::ubuntu::location::service::Interface::Properties::IsOnline
Definition: interface.h:143
com::ubuntu::location::service::Interface::Properties::IsOnline::name
static const std::string & name()
Definition: interface.h:144
com::ubuntu::location::service::Interface::Properties::IsOnline::Interface
com::ubuntu::location::service::Interface Interface
Definition: interface.h:153
com::ubuntu::location::service::Interface::Properties::IsOnline::readable
static const bool readable
Definition: interface.h:155
com::ubuntu::location::service::Interface::Properties::IsOnline::ValueType
bool ValueType
Definition: interface.h:154
com::ubuntu::location::service::Interface::Properties::IsOnline::writable
static const bool writable
Definition: interface.h:156
com::ubuntu::location::service::Interface::Properties::State
Definition: interface.h:92
com::ubuntu::location::service::Interface::Properties::State::ValueType
com::ubuntu::location::service::State ValueType
Definition: interface.h:103
com::ubuntu::location::service::Interface::Properties::State::readable
static const bool readable
Definition: interface.h:104
com::ubuntu::location::service::Interface::Properties::State::writable
static const bool writable
Definition: interface.h:105
com::ubuntu::location::service::Interface::Properties::State::name
static const std::string & name()
Definition: interface.h:93
com::ubuntu::location::service::Interface::Properties::State::Interface
com::ubuntu::location::service::Interface Interface
Definition: interface.h:102
com::ubuntu::location::service::Interface::Properties::VisibleSpaceVehicles
Definition: interface.h:160
com::ubuntu::location::service::Interface::Properties::VisibleSpaceVehicles::writable
static const bool writable
Definition: interface.h:174
com::ubuntu::location::service::Interface::Properties::VisibleSpaceVehicles::Interface
com::ubuntu::location::service::Interface Interface
Definition: interface.h:170
com::ubuntu::location::service::Interface::Properties::VisibleSpaceVehicles::ValueType
std::map< com::ubuntu::location::SpaceVehicle::Key, com::ubuntu::location::SpaceVehicle > ValueType
Definition: interface.h:171
com::ubuntu::location::service::Interface::Properties::VisibleSpaceVehicles::readable
static const bool readable
Definition: interface.h:173
com::ubuntu::location::service::Interface::Properties::VisibleSpaceVehicles::name
static const std::string & name()
Definition: interface.h:161
com::ubuntu::location::service::Interface::Properties
Definition: interface.h:90
core::dbus::traits::Service< com::ubuntu::location::service::Interface >::interface_name
static const std::string & interface_name()
Definition: interface.h:252