~ci-train-bot/location-service/location-service-ubuntu-yakkety-1895

« back to all changes in this revision

Viewing changes to include/location_service/com/ubuntu/location/service/session/interface.h

  • Committer: Thomas Voß
  • Date: 2013-05-28 14:20:45 UTC
  • Revision ID: thomas.voss@canonical.com-20130528142045-kq5umqdmm4o53vwk
Initial push.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_INTERFACE_H_
 
2
#define LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_INTERFACE_H_
 
3
 
 
4
#include "com/ubuntu/location/channel.h"
 
5
#include "com/ubuntu/location/heading.h"
 
6
#include "com/ubuntu/location/position.h"
 
7
#include "com/ubuntu/location/provider.h"
 
8
#include "com/ubuntu/location/update.h"
 
9
#include "com/ubuntu/location/velocity.h"
 
10
 
 
11
#include <org/freedesktop/dbus/codec.h>
 
12
#include <org/freedesktop/dbus/service.h>
 
13
#include <org/freedesktop/dbus/traits/service.h>
 
14
#include <org/freedesktop/dbus/types/object_path.h>
 
15
 
 
16
namespace com
 
17
{
 
18
namespace ubuntu
 
19
{
 
20
namespace location
 
21
{
 
22
namespace service
 
23
{
 
24
namespace session
 
25
{
 
26
class Interface
 
27
{
 
28
public:
 
29
    struct UpdatePosition
 
30
    {
 
31
        typedef com::ubuntu::location::service::session::Interface Interface;
 
32
 
 
33
        inline static const std::string& name()
 
34
        {
 
35
            static const std::string s
 
36
            {
 
37
                "UpdatePosition"
 
38
            };
 
39
            return s;
 
40
        }
 
41
 
 
42
        typedef void ResultType;
 
43
 
 
44
        inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
 
45
    };
 
46
 
 
47
    struct UpdateVelocity
 
48
    {
 
49
        typedef com::ubuntu::location::service::session::Interface Interface;
 
50
 
 
51
        inline static const std::string& name()
 
52
        {
 
53
            static const std::string s
 
54
            {
 
55
                "UpdateVelocity"
 
56
            };
 
57
            return s;
 
58
        }
 
59
 
 
60
        typedef void ResultType;
 
61
 
 
62
        inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
 
63
    };
 
64
 
 
65
    struct UpdateHeading
 
66
    {
 
67
        typedef com::ubuntu::location::service::session::Interface Interface;
 
68
 
 
69
        inline static const std::string& name()
 
70
        {
 
71
            static const std::string s
 
72
            {
 
73
                "UpdateHeading"
 
74
            };
 
75
            return s;
 
76
        }
 
77
 
 
78
        typedef void ResultType;
 
79
 
 
80
        inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
 
81
    };
 
82
 
 
83
    struct StartPositionUpdates 
 
84
    {
 
85
        typedef com::ubuntu::location::service::session::Interface Interface;
 
86
 
 
87
        inline static const std::string& name()
 
88
        {
 
89
            static const std::string s
 
90
            {
 
91
                "StartPositionUpdates"
 
92
            };
 
93
            return s;
 
94
        }
 
95
 
 
96
        typedef void ResultType;
 
97
 
 
98
        inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
 
99
    };
 
100
 
 
101
    struct StopPositionUpdates 
 
102
    {
 
103
        typedef com::ubuntu::location::service::session::Interface Interface;
 
104
 
 
105
        inline static const std::string& name()
 
106
        {
 
107
            static const std::string s
 
108
            {
 
109
                "StopPositionUpdates"
 
110
            };
 
111
            return s;
 
112
        }
 
113
 
 
114
        typedef void ResultType;
 
115
 
 
116
        inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
 
117
    };
 
118
 
 
119
    struct StartVelocityUpdates 
 
120
    {
 
121
        typedef com::ubuntu::location::service::session::Interface Interface;
 
122
 
 
123
        inline static const std::string& name()
 
124
        {
 
125
            static const std::string s
 
126
            {
 
127
                "StartVelocityUpdates"
 
128
            };
 
129
            return s;
 
130
        }
 
131
 
 
132
        typedef void ResultType;
 
133
 
 
134
        inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
 
135
    };
 
136
 
 
137
    struct StopVelocityUpdates 
 
138
    {
 
139
        typedef com::ubuntu::location::service::session::Interface Interface;
 
140
 
 
141
        inline static const std::string& name()
 
142
        {
 
143
            static const std::string s
 
144
            {
 
145
                "StopVelocityUpdates"
 
146
            };
 
147
            return s;
 
148
        }
 
149
 
 
150
        typedef void ResultType;
 
151
 
 
152
        inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
 
153
    };
 
154
 
 
155
    struct StartHeadingUpdates 
 
156
    {
 
157
        typedef com::ubuntu::location::service::session::Interface Interface;
 
158
 
 
159
        inline static const std::string& name()
 
160
        {
 
161
            static const std::string s
 
162
            {
 
163
                "StartHeadingUpdates"
 
164
            };
 
165
            return s;
 
166
        }
 
167
 
 
168
        typedef void ResultType;
 
169
 
 
170
        inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
 
171
    };
 
172
 
 
173
    struct StopHeadingUpdates 
 
174
    {
 
175
        typedef com::ubuntu::location::service::session::Interface Interface;
 
176
 
 
177
        inline static const std::string& name()
 
178
        {
 
179
            static const std::string s
 
180
            {
 
181
                "StopHeadingUpdates"
 
182
            };
 
183
            return s;
 
184
        }
 
185
 
 
186
        typedef void ResultType;
 
187
 
 
188
        inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
 
189
    };
 
190
 
 
191
    struct Errors
 
192
    {
 
193
        struct ErrorParsingUpdate { inline static std::string name() { return "com.ubuntu.location.Service.Session.ErrorParsingUpdate"; } };
 
194
        struct ErrorStartingUpdate { inline static std::string name() { return "com.ubuntu.location.Service.Session.ErrorStartingUpdate"; } };
 
195
    };
 
196
 
 
197
    typedef std::shared_ptr<Interface> Ptr;
 
198
 
 
199
    Interface(const Interface&) = delete;
 
200
    Interface& operator=(const Interface&) = delete;
 
201
    virtual ~Interface() noexcept;
 
202
 
 
203
    virtual const org::freedesktop::dbus::types::ObjectPath& path() const = 0;
 
204
 
 
205
    ChannelConnection install_position_updates_handler(std::function<void(const Update<Position>&)> handler);
 
206
    ChannelConnection install_velocity_updates_handler(std::function<void(const Update<Velocity>&)> handler);
 
207
    ChannelConnection install_heading_updates_handler(std::function<void(const Update<Heading>&)> handler);
 
208
    
 
209
    virtual void start_position_updates() = 0;
 
210
    virtual void stop_position_updates() noexcept = 0;
 
211
    virtual void start_velocity_updates() = 0;
 
212
    virtual void stop_velocity_updates() noexcept = 0;
 
213
    virtual void start_heading_updates() = 0;
 
214
    virtual void stop_heading_updates() noexcept = 0;
 
215
 
 
216
protected:
 
217
    Interface() = default;
 
218
 
 
219
    Channel<Update<Position>>& access_position_updates_channel();
 
220
    Channel<Update<Heading>>& access_heading_updates_channel();
 
221
    Channel<Update<Velocity>>& access_velocity_updates_channel();
 
222
 
 
223
private:
 
224
    Channel<Update<Position>> position_updates_channel;
 
225
    Channel<Update<Heading>> heading_updates_channel;
 
226
    Channel<Update<Velocity>> velocity_updates_channel;
 
227
};
 
228
}
 
229
}
 
230
}
 
231
}
 
232
}
 
233
namespace org
 
234
{
 
235
namespace freedesktop
 
236
{
 
237
namespace dbus
 
238
{
 
239
namespace traits
 
240
{
 
241
template<>
 
242
struct Service<com::ubuntu::location::service::session::Interface>
 
243
{
 
244
    static const std::string& interface_name()
 
245
    {
 
246
        static const std::string s
 
247
        {
 
248
            "com.ubuntu.location.Service.Session"
 
249
        };
 
250
        return s;
 
251
    }
 
252
};
 
253
}
 
254
}
 
255
}
 
256
}
 
257
 
 
258
#include "com/ubuntu/location/codec.h"
 
259
 
 
260
#endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_INTERFACE_H_