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

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

skeleton.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_SESSION_SKELETON_H_
19 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_SKELETON_H_
20
21 #include <com/ubuntu/location/service/session/interface.h>
22
23 #include <com/ubuntu/location/heading.h>
24 #include <com/ubuntu/location/position.h>
25 #include <com/ubuntu/location/provider.h>
26 #include <com/ubuntu/location/update.h>
27 #include <com/ubuntu/location/velocity.h>
28
29 #include <core/dbus/message.h>
30 #include <core/dbus/object.h>
31 #include <core/dbus/skeleton.h>
32
33 #include <memory>
34
35 namespace com
36 {
37 namespace ubuntu
38 {
39 namespace location
40 {
41 namespace service
42 {
43 namespace session
44 {
45 class Skeleton : public core::dbus::Skeleton<Interface>
46 {
47 public:
48 // All local, i.e., in-process creation-time properties of the Skeleton.
49 struct Local
50 {
51 // The actual implementation of com::ubuntu::location::service::session::Interface.
52 Interface::Ptr impl;
53 // The bus connection that the object is exposed upon.
54 core::dbus::Bus::Ptr bus;
55 };
56
57 // We communicate position, heading and velocity updates to the client
58 // via an explicit function call. The reason is simple: We want to know
59 // whether the client is still alive and responding as expected to make sure
60 // that we stop positioning as early as possible.
61 struct Remote
62 {
63 // The remote object corresponding to the client, implementing
64 // com.ubuntu.location.service.session.Interface
65 core::dbus::Object::Ptr object;
66 };
67
68 struct Configuration
69 {
70 // The object path of the session object, shared between clients and service.
71 core::dbus::types::ObjectPath path;
72 // Local attributes
73 Local local;
74 // Remote attributes
75 Remote remote;
76 };
77
78 Skeleton(const Configuration& configuration);
79 virtual ~Skeleton() noexcept;
80
81 virtual const core::dbus::types::ObjectPath& path() const;
82
83 private:
84 // Handle incoming requests for Start/StopPositionUpdates
85 virtual void on_start_position_updates(const core::dbus::Message::Ptr&);
86 virtual void on_stop_position_updates(const core::dbus::Message::Ptr&);
87 // Handles incoming requests for Start/StopHeadingUpdates
88 virtual void on_start_heading_updates(const core::dbus::Message::Ptr&);
89 virtual void on_stop_heading_updates(const core::dbus::Message::Ptr&);
90 // Handles incoming requests for Start/StopVelocityUpdates
91 virtual void on_start_velocity_updates(const core::dbus::Message::Ptr&);
92 virtual void on_stop_velocity_updates(const core::dbus::Message::Ptr&);
93
94 // Invoked whenever the actual session impl. for the session reports a position update.
95 virtual void on_position_changed(const Update<Position>& position);
96 // Invoked whenever the actual session impl. reports a heading update.
97 virtual void on_heading_changed(const Update<Heading>& heading);
98 // Invoked whenever the actual session impl. reports a velocity update.
99 virtual void on_velocity_changed(const Update<Velocity>& velocity);
100
101 // Stores all attributes passed at creation time.
102 Configuration configuration;
103 // The DBus object corresponding to the session.
104 core::dbus::Object::Ptr object;
105 // Scoped connections for automatically disconnecting on destruction
106 struct
107 {
108 // Corresponds to position updates coming in from the actual implementation instance.
109 core::ScopedConnection position_changed;
110 // Corresponds to heading updates coming in from the actual implementation instance.
111 core::ScopedConnection heading_changed;
112 // Corresponds to velocity updates coming in from the actual implementation instance.
113 core::ScopedConnection velocity_changed;
114 } connections;
115 };
116 }
117 }
118 }
119 }
120 }
121
122 #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_SKELETON_H_
com::ubuntu::location::service::session::Interface::Ptr
std::shared_ptr< Interface > Ptr
Definition: interface.h:105
com::ubuntu::location::service::session::Skeleton
Definition: skeleton.h:46
com::ubuntu::location::service::session::Skeleton::position_changed
core::ScopedConnection position_changed
Definition: skeleton.h:109
com::ubuntu::location::service::session::Skeleton::heading_changed
core::ScopedConnection heading_changed
Definition: skeleton.h:111
com::ubuntu::location::service::session::Skeleton::path
virtual const core::dbus::types::ObjectPath & path() const
com::ubuntu::location::service::session::Skeleton::~Skeleton
virtual ~Skeleton() noexcept
com::ubuntu::location::service::session::Skeleton::Skeleton
Skeleton(const Configuration &configuration)
com::ubuntu::location::service::session::Skeleton::velocity_changed
core::ScopedConnection velocity_changed
Definition: skeleton.h:113
core::dbus::Skeleton
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
core::dbus
Definition: codec.h:41
core
Definition: codec.h:39
position.h
provider.h
interface.h
com::ubuntu::location::Position
The Position struct models a position in the wgs84 coordinate system.
Definition: position.h:40
com::ubuntu::location::Update
Templated class that wraps a value and timestamp.
Definition: update.h:37
com::ubuntu::location::service::session::Skeleton::Configuration
Definition: skeleton.h:69
com::ubuntu::location::service::session::Skeleton::Configuration::local
Local local
Definition: skeleton.h:73
com::ubuntu::location::service::session::Skeleton::Configuration::remote
Remote remote
Definition: skeleton.h:75
com::ubuntu::location::service::session::Skeleton::Configuration::path
core::dbus::types::ObjectPath path
Definition: skeleton.h:71
com::ubuntu::location::service::session::Skeleton::Local
Definition: skeleton.h:50
com::ubuntu::location::service::session::Skeleton::Local::bus
core::dbus::Bus::Ptr bus
Definition: skeleton.h:54
com::ubuntu::location::service::session::Skeleton::Local::impl
Interface::Ptr impl
Definition: skeleton.h:52
com::ubuntu::location::service::session::Skeleton::Remote
Definition: skeleton.h:62
com::ubuntu::location::service::session::Skeleton::Remote::object
core::dbus::Object::Ptr object
Definition: skeleton.h:65
update.h
velocity.h