lomiri-location-service ..
An aggregating location service providing positioning and geocoding capabilities to applications.
providers/remote/interface.h
Go to the documentation of this file.
1/*
2 * Copyright © 2014 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: Manuel de la Pena <manuel.delapena@canonical.com>
17 */
18
19#ifndef LOCATION_SERVICE_COM_LOMIRI_LOCATION_SERVICE_PROVIDERS_REMOTE_INTERFACE_H_
20#define LOCATION_SERVICE_COM_LOMIRI_LOCATION_SERVICE_PROVIDERS_REMOTE_INTERFACE_H_
21
22#include <core/dbus/macros.h>
23#include <core/dbus/object.h>
24#include <core/dbus/property.h>
25#include <core/dbus/signal.h>
26
27#include <core/dbus/traits/service.h>
28
31
35
36namespace com
37{
38namespace lomiri
39{
40namespace location
41{
42namespace providers
43{
44namespace remote
45{
47{
48 static const std::string& name()
49 {
50 static const std::string s{"com.lomiri.remote.Service.Provider"};
51 return s;
52 }
53
54 // Checks if a provider satisfies a set of accuracy criteria.
55 DBUS_CPP_METHOD_DEF(MatchesCriteria, remote::Interface)
56 // Checks if the provider has got a specific requirement.
57 DBUS_CPP_METHOD_DEF(Requires, remote::Interface)
58 // Checks if the provider supports a specific feature.
59 DBUS_CPP_METHOD_DEF(Supports, remote::Interface)
60 // Called by the engine whenever the wifi and cell ID reporting state changes.
61 DBUS_CPP_METHOD_DEF(OnWifiAndCellIdReportingStateChanged, remote::Interface)
62 // Called by the engine whenever the reference location changed.
63 DBUS_CPP_METHOD_DEF(OnReferenceLocationChanged, remote::Interface)
64 // Called by the engine whenever the reference heading changed.
65 DBUS_CPP_METHOD_DEF(OnReferenceHeadingChanged, remote::Interface)
66 // Called by the engine whenever the reference velocity changed.
67 DBUS_CPP_METHOD_DEF(OnReferenceVelocityChanged, remote::Interface)
68
69 DBUS_CPP_METHOD_DEF(StartPositionUpdates, remote::Interface)
70 DBUS_CPP_METHOD_DEF(StopPositionUpdates, remote::Interface)
71 DBUS_CPP_METHOD_DEF(StartHeadingUpdates, remote::Interface)
72 DBUS_CPP_METHOD_DEF(StopHeadingUpdates, remote::Interface)
73 DBUS_CPP_METHOD_DEF(StartVelocityUpdates, remote::Interface)
74 DBUS_CPP_METHOD_DEF(StopVelocityUpdates, remote::Interface)
75
76 struct Signals
77 {
78 DBUS_CPP_SIGNAL_DEF(PositionChanged, remote::Interface, com::lomiri::location::Position)
79 DBUS_CPP_SIGNAL_DEF(HeadingChanged, remote::Interface, com::lomiri::location::Heading)
80 DBUS_CPP_SIGNAL_DEF(VelocityChanged, remote::Interface, com::lomiri::location::Velocity)
81 };
82
84 {
85 DBUS_CPP_READABLE_PROPERTY_DEF(HasPosition, remote::Interface, bool)
86 DBUS_CPP_READABLE_PROPERTY_DEF(HasVelocity, remote::Interface, bool)
87 DBUS_CPP_READABLE_PROPERTY_DEF(HasHeading, remote::Interface, bool)
88 DBUS_CPP_READABLE_PROPERTY_DEF(RequiresSatellites, remote::Interface, bool)
89 DBUS_CPP_READABLE_PROPERTY_DEF(RequiresCellNetwork, remote::Interface, bool)
90 DBUS_CPP_READABLE_PROPERTY_DEF(RequiresDataNetwork, remote::Interface, bool)
91 DBUS_CPP_READABLE_PROPERTY_DEF(RequiresMonetarySpending, remote::Interface, bool)
92 DBUS_CPP_READABLE_PROPERTY_DEF(ArePositionUpdatesRunning, remote::Interface, bool)
93 DBUS_CPP_READABLE_PROPERTY_DEF(AreHeadingUpdatesRunning, remote::Interface, bool)
94 DBUS_CPP_READABLE_PROPERTY_DEF(AreVelocityUpdatesRunning, remote::Interface, bool)
95 };
96
97 struct Skeleton
98 {
99 // Creates a new skeleton instance and installs the interface
100 // com::lomiri::remote::Interface on it.
101 Skeleton(const core::dbus::Object::Ptr& object)
102 : object{object},
104 {
105 object->get_property<Properties::HasPosition>(),
106 object->get_property<Properties::HasVelocity>(),
107 object->get_property<Properties::HasHeading>(),
108 object->get_property<Properties::RequiresSatellites>(),
109 object->get_property<Properties::RequiresCellNetwork>(),
110 object->get_property<Properties::RequiresDataNetwork>(),
111 object->get_property<Properties::RequiresMonetarySpending>(),
112 object->get_property<Properties::ArePositionUpdatesRunning>(),
113 object->get_property<Properties::AreHeadingUpdatesRunning>(),
114 object->get_property<Properties::AreVelocityUpdatesRunning>()
115 },
116 signals
117 {
118 object->get_signal<Signals::PositionChanged>(),
119 object->get_signal<Signals::HeadingChanged>(),
120 object->get_signal<Signals::VelocityChanged>()
121 }
122 {
123 }
124
125 // The object that the interface is installed on.
126 core::dbus::Object::Ptr object;
127 // All known properties.
128 struct
129 {
130 std::shared_ptr<core::dbus::Property<Properties::HasPosition>> has_position;
131 std::shared_ptr<core::dbus::Property<Properties::HasVelocity>> has_velocity;
132 std::shared_ptr<core::dbus::Property<Properties::HasHeading>> has_heading;
133 std::shared_ptr<core::dbus::Property<Properties::RequiresSatellites>> requires_satellites;
134 std::shared_ptr<core::dbus::Property<Properties::RequiresCellNetwork>> requires_cell_network;
135 std::shared_ptr<core::dbus::Property<Properties::RequiresDataNetwork>> requires_data_network;
136 std::shared_ptr<core::dbus::Property<Properties::RequiresMonetarySpending>> requires_monetary_spending;
137 std::shared_ptr<core::dbus::Property<Properties::ArePositionUpdatesRunning>> are_position_updates_running;
138 std::shared_ptr<core::dbus::Property<Properties::AreHeadingUpdatesRunning>> are_heading_updates_running;
139 std::shared_ptr<core::dbus::Property<Properties::AreVelocityUpdatesRunning>> are_velocity_updates_running;
141 // All known signals.
142 struct
143 {
144 std::shared_ptr<core::dbus::Signal<
145 Signals::PositionChanged,
146 Signals::PositionChanged::ArgumentType
148
149 std::shared_ptr<core::dbus::Signal<
150 Signals::HeadingChanged,
151 Signals::HeadingChanged::ArgumentType
153
154 std::shared_ptr<core::dbus::Signal<
155 Signals::VelocityChanged,
156 Signals::VelocityChanged::ArgumentType
159 };
160
161 struct Stub
162 {
163 // Creates a new skeleton instance and installs the interface
164 // com::lomiri::remote::Interface on it.
165 Stub(const core::dbus::Object::Ptr& object)
166 : object{object},
168 {
169 object->get_property<Properties::HasPosition>(),
170 object->get_property<Properties::HasVelocity>(),
171 object->get_property<Properties::HasHeading>(),
172 object->get_property<Properties::RequiresSatellites>(),
173 object->get_property<Properties::RequiresCellNetwork>(),
174 object->get_property<Properties::RequiresDataNetwork>(),
175 object->get_property<Properties::RequiresMonetarySpending>(),
176 object->get_property<Properties::ArePositionUpdatesRunning>(),
177 object->get_property<Properties::AreHeadingUpdatesRunning>(),
178 object->get_property<Properties::AreVelocityUpdatesRunning>()
179 },
180 signals
181 {
182 object->get_signal<Signals::PositionChanged>(),
183 object->get_signal<Signals::HeadingChanged>(),
184 object->get_signal<Signals::VelocityChanged>()
185 }
186 {
187 }
188
189 // The object that the interface is installed on.
190 core::dbus::Object::Ptr object;
191 // All known properties.
192 struct
193 {
194 std::shared_ptr<core::dbus::Property<Properties::HasPosition>> has_position;
195 std::shared_ptr<core::dbus::Property<Properties::HasVelocity>> has_velocity;
196 std::shared_ptr<core::dbus::Property<Properties::HasHeading>> has_heading;
197 std::shared_ptr<core::dbus::Property<Properties::RequiresSatellites>> requires_satellites;
198 std::shared_ptr<core::dbus::Property<Properties::RequiresCellNetwork>> requires_cell_network;
199 std::shared_ptr<core::dbus::Property<Properties::RequiresDataNetwork>> requires_data_network;
200 std::shared_ptr<core::dbus::Property<Properties::RequiresMonetarySpending>> requires_monetary_spending;
201 std::shared_ptr<core::dbus::Property<Properties::ArePositionUpdatesRunning>> are_position_updates_running;
202 std::shared_ptr<core::dbus::Property<Properties::AreHeadingUpdatesRunning>> are_heading_updates_running;
203 std::shared_ptr<core::dbus::Property<Properties::AreVelocityUpdatesRunning>> are_velocity_updates_running;
205 // All known signals.
206 struct
207 {
208 std::shared_ptr<core::dbus::Signal<
209 Signals::PositionChanged,
210 Signals::PositionChanged::ArgumentType
212
213 std::shared_ptr<core::dbus::Signal<
214 Signals::HeadingChanged,
215 Signals::HeadingChanged::ArgumentType
217
218 std::shared_ptr<core::dbus::Signal<
219 Signals::VelocityChanged,
220 Signals::VelocityChanged::ArgumentType
223 };
224
225};
226}
227}
228}
229}
230}
231#endif // LOCATION_SERVICE_COM_LOMIRI_LOCATION_SERVICE_PROVIDERS_REMOTE_INTERFACE_H_
units::Quantity< units::PlaneAngle > Heading
Definition heading.h:30
units::Quantity< units::Velocity > Velocity
Velocity is measured in m/s.
Definition velocity.h:30
Definition accuracy.h:24
The Position struct models a position in the wgs84 coordinate system.
Definition position.h:40
std::shared_ptr< core::dbus::Property< Properties::HasVelocity > > has_velocity
std::shared_ptr< core::dbus::Signal< Signals::PositionChanged, Signals::PositionChanged::ArgumentType > > position_changed
std::shared_ptr< core::dbus::Property< Properties::RequiresCellNetwork > > requires_cell_network
std::shared_ptr< core::dbus::Property< Properties::ArePositionUpdatesRunning > > are_position_updates_running
std::shared_ptr< core::dbus::Signal< Signals::HeadingChanged, Signals::HeadingChanged::ArgumentType > > heading_changed
std::shared_ptr< core::dbus::Property< Properties::RequiresMonetarySpending > > requires_monetary_spending
std::shared_ptr< core::dbus::Property< Properties::AreVelocityUpdatesRunning > > are_velocity_updates_running
struct com::lomiri::location::providers::remote::Interface::Skeleton::@2 signals
std::shared_ptr< core::dbus::Property< Properties::RequiresDataNetwork > > requires_data_network
struct com::lomiri::location::providers::remote::Interface::Skeleton::@1 properties
std::shared_ptr< core::dbus::Signal< Signals::VelocityChanged, Signals::VelocityChanged::ArgumentType > > velocity_changed
std::shared_ptr< core::dbus::Property< Properties::AreHeadingUpdatesRunning > > are_heading_updates_running
std::shared_ptr< core::dbus::Property< Properties::HasPosition > > has_position
std::shared_ptr< core::dbus::Property< Properties::RequiresSatellites > > requires_satellites
std::shared_ptr< core::dbus::Property< Properties::HasHeading > > has_heading
std::shared_ptr< core::dbus::Property< Properties::RequiresDataNetwork > > requires_data_network
std::shared_ptr< core::dbus::Property< Properties::HasVelocity > > has_velocity
std::shared_ptr< core::dbus::Property< Properties::RequiresMonetarySpending > > requires_monetary_spending
std::shared_ptr< core::dbus::Signal< Signals::HeadingChanged, Signals::HeadingChanged::ArgumentType > > heading_changed
std::shared_ptr< core::dbus::Property< Properties::HasHeading > > has_heading
std::shared_ptr< core::dbus::Property< Properties::HasPosition > > has_position
std::shared_ptr< core::dbus::Signal< Signals::PositionChanged, Signals::PositionChanged::ArgumentType > > position_changed
std::shared_ptr< core::dbus::Property< Properties::RequiresSatellites > > requires_satellites
struct com::lomiri::location::providers::remote::Interface::Stub::@3 properties
std::shared_ptr< core::dbus::Property< Properties::AreHeadingUpdatesRunning > > are_heading_updates_running
std::shared_ptr< core::dbus::Property< Properties::ArePositionUpdatesRunning > > are_position_updates_running
std::shared_ptr< core::dbus::Property< Properties::RequiresCellNetwork > > requires_cell_network
struct com::lomiri::location::providers::remote::Interface::Stub::@4 signals
std::shared_ptr< core::dbus::Property< Properties::AreVelocityUpdatesRunning > > are_velocity_updates_running
std::shared_ptr< core::dbus::Signal< Signals::VelocityChanged, Signals::VelocityChanged::ArgumentType > > velocity_changed