18
18
#ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_INTERFACE_H_
19
19
#define LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_INTERFACE_H_
21
#include "com/ubuntu/location/channel.h"
22
#include "com/ubuntu/location/heading.h"
23
#include "com/ubuntu/location/position.h"
24
#include "com/ubuntu/location/provider.h"
25
#include "com/ubuntu/location/update.h"
26
#include "com/ubuntu/location/velocity.h"
21
#include <com/ubuntu/location/heading.h>
22
#include <com/ubuntu/location/position.h>
23
#include <com/ubuntu/location/provider.h>
24
#include <com/ubuntu/location/update.h>
25
#include <com/ubuntu/location/velocity.h>
28
#include <core/dbus/codec.h>
29
#include <core/dbus/traits/service.h>
30
#include <core/dbus/types/object_path.h>
27
#include <core/property.h>
40
* @brief Models a session with the location service.
47
typedef com::ubuntu::location::service::session::Interface Interface;
49
inline static const std::string& name()
51
static const std::string s
58
typedef void ResultType;
60
inline static const std::chrono::milliseconds default_timeout() { return std::chrono::milliseconds{250}; }
65
typedef com::ubuntu::location::service::session::Interface Interface;
67
inline static const std::string& name()
69
static const std::string s
76
typedef void ResultType;
78
inline static const std::chrono::milliseconds default_timeout() { return std::chrono::milliseconds{250}; }
83
typedef com::ubuntu::location::service::session::Interface Interface;
85
inline static const std::string& name()
87
static const std::string s
94
typedef void ResultType;
96
inline static const std::chrono::milliseconds default_timeout() { return std::chrono::milliseconds{250}; }
99
struct StartPositionUpdates
101
typedef com::ubuntu::location::service::session::Interface Interface;
103
inline static const std::string& name()
105
static const std::string s
107
"StartPositionUpdates"
112
typedef void ResultType;
114
inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
117
struct StopPositionUpdates
119
typedef com::ubuntu::location::service::session::Interface Interface;
121
inline static const std::string& name()
123
static const std::string s
125
"StopPositionUpdates"
130
typedef void ResultType;
132
inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
135
struct StartVelocityUpdates
137
typedef com::ubuntu::location::service::session::Interface Interface;
139
inline static const std::string& name()
141
static const std::string s
143
"StartVelocityUpdates"
148
typedef void ResultType;
150
inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
153
struct StopVelocityUpdates
155
typedef com::ubuntu::location::service::session::Interface Interface;
157
inline static const std::string& name()
159
static const std::string s
161
"StopVelocityUpdates"
166
typedef void ResultType;
168
inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
171
struct StartHeadingUpdates
173
typedef com::ubuntu::location::service::session::Interface Interface;
175
inline static const std::string& name()
177
static const std::string s
179
"StartHeadingUpdates"
184
typedef void ResultType;
186
inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
189
struct StopHeadingUpdates
191
typedef com::ubuntu::location::service::session::Interface Interface;
193
inline static const std::string& name()
195
static const std::string s
202
typedef void ResultType;
204
inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
45
struct UpdatePosition;
46
struct UpdateVelocity;
49
struct StartPositionUpdates;
50
struct StopPositionUpdates;
52
struct StartVelocityUpdates;
53
struct StopVelocityUpdates;
55
struct StartHeadingUpdates;
56
struct StopHeadingUpdates;
209
struct ErrorParsingUpdate { inline static std::string name() { return "com.ubuntu.location.Service.Session.ErrorParsingUpdate"; } };
210
struct ErrorStartingUpdate { inline static std::string name() { return "com.ubuntu.location.Service.Session.ErrorStartingUpdate"; } };
211
struct ErrorStoppingUpdate { inline static std::string name() { return "com.ubuntu.location.Service.Session.ErrorStoppingUpdate"; } };
60
struct ErrorParsingUpdate;
61
struct ErrorStartingUpdate;
64
* @brief Encapsulates updates provided for this session, and the ability to enable/disable updates.
69
* @brief The Status enum models the possible states of updates.
73
enabled, ///< Updates are enabled and delivered to this session.
74
disabled ///< Updates are disabled and not delivered to this session.
78
* @brief Updates for position measurements.
80
core::Property<Update<Position>> position{};
82
* @brief Status of position updates, mutable.
84
core::Property<Status> position_status{Status::disabled};
87
* @brief Updates for the heading measurements.
89
core::Property<Update<Heading>> heading{};
91
* @brief Status of position updates, mutable.
93
core::Property<Status> heading_status{Status::disabled};
96
* @brief Updates for velocity measurements.
98
core::Property<Update<Velocity>> velocity{};
100
* @brief Status of velocity updates, mutable.
102
core::Property<Status> velocity_status{Status::disabled};
214
105
typedef std::shared_ptr<Interface> Ptr;
217
108
virtual ~Interface() noexcept;
218
109
Interface& operator=(const Interface&) = delete;
220
virtual const core::dbus::types::ObjectPath& path() const = 0;
222
ChannelConnection install_position_updates_handler(std::function<void(const Update<Position>&)> handler);
223
ChannelConnection install_velocity_updates_handler(std::function<void(const Update<Velocity>&)> handler);
224
ChannelConnection install_heading_updates_handler(std::function<void(const Update<Heading>&)> handler);
226
virtual void start_position_updates() = 0;
227
virtual void stop_position_updates() noexcept = 0;
228
virtual void start_velocity_updates() = 0;
229
virtual void stop_velocity_updates() noexcept = 0;
230
virtual void start_heading_updates() = 0;
231
virtual void stop_heading_updates() noexcept = 0;
112
* @brief Provides access to the updates delivered for this session.
113
* @return A mutable reference to updates.
115
virtual Updates& updates();
236
Channel<Update<Position>>& access_position_updates_channel();
237
Channel<Update<Heading>>& access_heading_updates_channel();
238
Channel<Update<Velocity>>& access_velocity_updates_channel();
242
std::unique_ptr<Private> d;
256
struct Service<com::ubuntu::location::service::session::Interface>
258
static const std::string& interface_name()
260
static const std::string s
262
"com.ubuntu.location.Service.Session"
272
#include "com/ubuntu/location/codec.h"
122
std::shared_ptr<Private> d;
274
130
#endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_INTERFACE_H_