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