ubuntu-location-service: /build/location-service-git/src/location-service/include/location_service/com/ubuntu/location/providers/remote/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 © 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_UBUNTU_LOCATION_SERVICE_PROVIDERS_REMOTE_INTERFACE_H_
20 #define LOCATION_SERVICE_COM_UBUNTU_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
29 #include <com/ubuntu/location/codec.h>
30 #include <com/ubuntu/location/update.h>
31
32 #include <com/ubuntu/location/heading.h>
33 #include <com/ubuntu/location/position.h>
34 #include <com/ubuntu/location/velocity.h>
35
36 namespace com
37 {
38 namespace ubuntu
39 {
40 namespace location
41 {
42 namespace providers
43 {
44 namespace remote
45 {
46 struct Interface
47 {
48 static const std::string& name()
49 {
50 static const std::string s{"com.ubuntu.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::ubuntu::location::Position)
79 DBUS_CPP_SIGNAL_DEF(HeadingChanged, remote::Interface, com::ubuntu::location::Heading)
80 DBUS_CPP_SIGNAL_DEF(VelocityChanged, remote::Interface, com::ubuntu::location::Velocity)
81 };
82
83 struct Properties
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::ubuntu::remote::Interface on it.
101 Skeleton(const core::dbus::Object::Ptr& object)
102 : object{object},
103 properties
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;
140 } properties;
141 // All known signals.
142 struct
143 {
144 std::shared_ptr<core::dbus::Signal<
145 Signals::PositionChanged,
146 Signals::PositionChanged::ArgumentType
147 >> position_changed;
148
149 std::shared_ptr<core::dbus::Signal<
150 Signals::HeadingChanged,
151 Signals::HeadingChanged::ArgumentType
152 >> heading_changed;
153
154 std::shared_ptr<core::dbus::Signal<
155 Signals::VelocityChanged,
156 Signals::VelocityChanged::ArgumentType
157 >> velocity_changed;
158 } signals;
159 };
160
161 struct Stub
162 {
163 // Creates a new skeleton instance and installs the interface
164 // com::ubuntu::remote::Interface on it.
165 Stub(const core::dbus::Object::Ptr& object)
166 : object{object},
167 properties
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;
204 } properties;
205 // All known signals.
206 struct
207 {
208 std::shared_ptr<core::dbus::Signal<
209 Signals::PositionChanged,
210 Signals::PositionChanged::ArgumentType
211 >> position_changed;
212
213 std::shared_ptr<core::dbus::Signal<
214 Signals::HeadingChanged,
215 Signals::HeadingChanged::ArgumentType
216 >> heading_changed;
217
218 std::shared_ptr<core::dbus::Signal<
219 Signals::VelocityChanged,
220 Signals::VelocityChanged::ArgumentType
221 >> velocity_changed;
222 } signals;
223 };
224
225 };
226 }
227 }
228 }
229 }
230 }
231 #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_PROVIDERS_REMOTE_INTERFACE_H_
codec.h
heading.h
com::ubuntu::location::Velocity
units::Quantity< units::Velocity > Velocity
Velocity is measured in m/s.
Definition: velocity.h:30
com::ubuntu::location::Heading
units::Quantity< units::PlaneAngle > Heading
Definition: heading.h:30
com
Definition: accuracy.h:24
position.h
com::ubuntu::location::Position
The Position struct models a position in the wgs84 coordinate system.
Definition: position.h:40
com::ubuntu::location::providers::remote::Interface::Properties
Definition: interface.h:84
com::ubuntu::location::providers::remote::Interface::Signals
Definition: interface.h:77
com::ubuntu::location::providers::remote::Interface::Skeleton
Definition: interface.h:98
com::ubuntu::location::providers::remote::Interface::Skeleton::has_heading
std::shared_ptr< core::dbus::Property< Properties::HasHeading > > has_heading
Definition: interface.h:132
com::ubuntu::location::providers::remote::Interface::Skeleton::properties
struct com::ubuntu::location::providers::remote::Interface::Skeleton::@1 properties
com::ubuntu::location::providers::remote::Interface::Skeleton::has_velocity
std::shared_ptr< core::dbus::Property< Properties::HasVelocity > > has_velocity
Definition: interface.h:131
com::ubuntu::location::providers::remote::Interface::Skeleton::position_changed
std::shared_ptr< core::dbus::Signal< Signals::PositionChanged, Signals::PositionChanged::ArgumentType > > position_changed
Definition: interface.h:147
com::ubuntu::location::providers::remote::Interface::Skeleton::requires_monetary_spending
std::shared_ptr< core::dbus::Property< Properties::RequiresMonetarySpending > > requires_monetary_spending
Definition: interface.h:136
com::ubuntu::location::providers::remote::Interface::Skeleton::heading_changed
std::shared_ptr< core::dbus::Signal< Signals::HeadingChanged, Signals::HeadingChanged::ArgumentType > > heading_changed
Definition: interface.h:152
com::ubuntu::location::providers::remote::Interface::Skeleton::velocity_changed
std::shared_ptr< core::dbus::Signal< Signals::VelocityChanged, Signals::VelocityChanged::ArgumentType > > velocity_changed
Definition: interface.h:157
com::ubuntu::location::providers::remote::Interface::Skeleton::requires_satellites
std::shared_ptr< core::dbus::Property< Properties::RequiresSatellites > > requires_satellites
Definition: interface.h:133
com::ubuntu::location::providers::remote::Interface::Skeleton::has_position
std::shared_ptr< core::dbus::Property< Properties::HasPosition > > has_position
Definition: interface.h:130
com::ubuntu::location::providers::remote::Interface::Skeleton::are_velocity_updates_running
std::shared_ptr< core::dbus::Property< Properties::AreVelocityUpdatesRunning > > are_velocity_updates_running
Definition: interface.h:139
com::ubuntu::location::providers::remote::Interface::Skeleton::are_heading_updates_running
std::shared_ptr< core::dbus::Property< Properties::AreHeadingUpdatesRunning > > are_heading_updates_running
Definition: interface.h:138
com::ubuntu::location::providers::remote::Interface::Skeleton::signals
struct com::ubuntu::location::providers::remote::Interface::Skeleton::@2 signals
com::ubuntu::location::providers::remote::Interface::Skeleton::object
core::dbus::Object::Ptr object
Definition: interface.h:126
com::ubuntu::location::providers::remote::Interface::Skeleton::requires_cell_network
std::shared_ptr< core::dbus::Property< Properties::RequiresCellNetwork > > requires_cell_network
Definition: interface.h:134
com::ubuntu::location::providers::remote::Interface::Skeleton::requires_data_network
std::shared_ptr< core::dbus::Property< Properties::RequiresDataNetwork > > requires_data_network
Definition: interface.h:135
com::ubuntu::location::providers::remote::Interface::Skeleton::Skeleton
Skeleton(const core::dbus::Object::Ptr &object)
Definition: interface.h:101
com::ubuntu::location::providers::remote::Interface::Skeleton::are_position_updates_running
std::shared_ptr< core::dbus::Property< Properties::ArePositionUpdatesRunning > > are_position_updates_running
Definition: interface.h:137
com::ubuntu::location::providers::remote::Interface::Stub
Definition: interface.h:162
com::ubuntu::location::providers::remote::Interface::Stub::requires_data_network
std::shared_ptr< core::dbus::Property< Properties::RequiresDataNetwork > > requires_data_network
Definition: interface.h:199
com::ubuntu::location::providers::remote::Interface::Stub::has_position
std::shared_ptr< core::dbus::Property< Properties::HasPosition > > has_position
Definition: interface.h:194
com::ubuntu::location::providers::remote::Interface::Stub::signals
struct com::ubuntu::location::providers::remote::Interface::Stub::@4 signals
com::ubuntu::location::providers::remote::Interface::Stub::are_velocity_updates_running
std::shared_ptr< core::dbus::Property< Properties::AreVelocityUpdatesRunning > > are_velocity_updates_running
Definition: interface.h:203
com::ubuntu::location::providers::remote::Interface::Stub::properties
struct com::ubuntu::location::providers::remote::Interface::Stub::@3 properties
com::ubuntu::location::providers::remote::Interface::Stub::Stub
Stub(const core::dbus::Object::Ptr &object)
Definition: interface.h:165
com::ubuntu::location::providers::remote::Interface::Stub::has_heading
std::shared_ptr< core::dbus::Property< Properties::HasHeading > > has_heading
Definition: interface.h:196
com::ubuntu::location::providers::remote::Interface::Stub::are_position_updates_running
std::shared_ptr< core::dbus::Property< Properties::ArePositionUpdatesRunning > > are_position_updates_running
Definition: interface.h:201
com::ubuntu::location::providers::remote::Interface::Stub::position_changed
std::shared_ptr< core::dbus::Signal< Signals::PositionChanged, Signals::PositionChanged::ArgumentType > > position_changed
Definition: interface.h:211
com::ubuntu::location::providers::remote::Interface::Stub::heading_changed
std::shared_ptr< core::dbus::Signal< Signals::HeadingChanged, Signals::HeadingChanged::ArgumentType > > heading_changed
Definition: interface.h:216
com::ubuntu::location::providers::remote::Interface::Stub::object
core::dbus::Object::Ptr object
Definition: interface.h:190
com::ubuntu::location::providers::remote::Interface::Stub::requires_satellites
std::shared_ptr< core::dbus::Property< Properties::RequiresSatellites > > requires_satellites
Definition: interface.h:197
com::ubuntu::location::providers::remote::Interface::Stub::velocity_changed
std::shared_ptr< core::dbus::Signal< Signals::VelocityChanged, Signals::VelocityChanged::ArgumentType > > velocity_changed
Definition: interface.h:221
com::ubuntu::location::providers::remote::Interface::Stub::has_velocity
std::shared_ptr< core::dbus::Property< Properties::HasVelocity > > has_velocity
Definition: interface.h:195
com::ubuntu::location::providers::remote::Interface::Stub::requires_monetary_spending
std::shared_ptr< core::dbus::Property< Properties::RequiresMonetarySpending > > requires_monetary_spending
Definition: interface.h:200
com::ubuntu::location::providers::remote::Interface::Stub::requires_cell_network
std::shared_ptr< core::dbus::Property< Properties::RequiresCellNetwork > > requires_cell_network
Definition: interface.h:198
com::ubuntu::location::providers::remote::Interface::Stub::are_heading_updates_running
std::shared_ptr< core::dbus::Property< Properties::AreHeadingUpdatesRunning > > are_heading_updates_running
Definition: interface.h:202
com::ubuntu::location::providers::remote::Interface
Definition: interface.h:47
com::ubuntu::location::providers::remote::Interface::name
static const std::string & name()
Definition: interface.h:48
update.h
velocity.h