1
#ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_IMPLEMENTATION_H_
2
#define LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_IMPLEMENTATION_H_
4
#include "com/ubuntu/location/service/session/skeleton.h"
6
#include "com/ubuntu/location/provider.h"
21
class Implementation : public Skeleton
25
const org::freedesktop::dbus::Bus::Ptr& bus,
26
const org::freedesktop::dbus::types::ObjectPath& session_path,
27
const Provider::Ptr& provider)
28
: Skeleton(bus, session_path),
30
controller(provider->state_controller())
32
position_updates_connection =
33
provider->subscribe_to_position_updates([this](const Update<Position>& update)
35
access_position_updates_channel()(update);
37
heading_updates_connection =
38
provider->subscribe_to_heading_updates([this](const Update<Heading>& update)
40
access_heading_updates_channel()(update);
42
velocity_updates_connection =
43
provider->subscribe_to_velocity_updates([this](const Update<Velocity>& update)
45
access_velocity_updates_channel()(update);
49
virtual ~Implementation() noexcept
53
virtual void start_position_updates()
55
controller->start_position_updates();
56
if (controller->cached_position_update().is_valid())
57
access_position_updates_channel()(controller->cached_position_update().value());
60
virtual void stop_position_updates() noexcept
62
controller->stop_position_updates();
65
virtual void start_velocity_updates()
67
controller->start_velocity_updates();
68
if (controller->cached_velocity_update().is_valid())
69
access_velocity_updates_channel()(controller->cached_velocity_update().value());
72
virtual void stop_velocity_updates() noexcept
74
controller->stop_velocity_updates();
77
virtual void start_heading_updates()
79
controller->start_heading_updates();
80
if (controller->cached_heading_update().is_valid())
81
access_heading_updates_channel()(controller->cached_heading_update().value());
84
virtual void stop_heading_updates() noexcept
86
controller->stop_heading_updates();
90
Provider::Ptr provider;
91
Provider::Controller::Ptr controller;
92
ScopedChannelConnection position_updates_connection;
93
ScopedChannelConnection velocity_updates_connection;
94
ScopedChannelConnection heading_updates_connection;
103
#endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_IMPLEMENTATION_H_