~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/providers/geoclue/geoclue.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_PROVIDERS_GEOCLUE_GEOCLUE_H_
 
2
#define LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROVIDERS_GEOCLUE_GEOCLUE_H_
 
3
 
 
4
#include "org/freedesktop/dbus/service.h"
 
5
#include "org/freedesktop/dbus/traits/service.h"
 
6
#include "org/freedesktop/dbus/types/struct.h"
 
7
#include "org/freedesktop/dbus/types/stl/tuple.h"
 
8
 
 
9
#include <string>
 
10
 
 
11
namespace dbus = org::freedesktop::dbus;
 
12
 
 
13
namespace org
 
14
{
 
15
namespace freedesktop
 
16
{
 
17
struct Geoclue
 
18
{
 
19
    enum class Status : int
 
20
    {
 
21
        error,
 
22
        unavailable,
 
23
        acquiring,
 
24
        available
 
25
    };
 
26
 
 
27
    friend std::ostream& operator<<(std::ostream& out, const Status& status)
 
28
    {
 
29
        static std::map<Status, std::string> lut = 
 
30
                {
 
31
                    {Status::error, "error"},
 
32
                    {Status::unavailable, "unavailable"},
 
33
                    {Status::acquiring, "acquiring"},
 
34
                    {Status::available, "available"}
 
35
                };
 
36
 
 
37
        return out << lut[status];
 
38
    }
 
39
 
 
40
    struct GetProviderInfo
 
41
    {
 
42
        inline static std::string name()
 
43
        {
 
44
            return "GetProviderInfo";
 
45
        } 
 
46
        typedef Geoclue Interface;
 
47
        typedef std::tuple<std::string, std::string> ResultType;
 
48
        inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
 
49
    };
 
50
 
 
51
    struct GetStatus
 
52
    {
 
53
        inline static std::string name()
 
54
        {
 
55
            return "GetStatus";
 
56
        } 
 
57
        typedef Geoclue Interface;
 
58
        typedef int32_t ResultType;
 
59
        inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
 
60
    };
 
61
 
 
62
    struct AddReference
 
63
    {
 
64
        inline static std::string name()
 
65
        {
 
66
            return "AddReference";
 
67
        } 
 
68
        typedef Geoclue Interface;
 
69
        typedef void ResultType;
 
70
        inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
 
71
    };
 
72
 
 
73
    struct RemoveReference
 
74
    {
 
75
        inline static std::string name()
 
76
        {
 
77
            return "RemoveReference";
 
78
        } 
 
79
        typedef Geoclue Interface;
 
80
        typedef void ResultType;
 
81
        inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
 
82
    };
 
83
 
 
84
    struct Address
 
85
    {
 
86
        struct GetAddress
 
87
        {
 
88
            inline static std::string name()
 
89
            {
 
90
                return "GetAddress";
 
91
            } 
 
92
            typedef Address Interface;
 
93
            typedef std::tuple<int32_t, std::map<std::string, std::string>, dbus::types::Struct<std::tuple<int32_t, double, double>>> ResultType;
 
94
            inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
 
95
        };
 
96
 
 
97
        struct Signals
 
98
        {
 
99
            struct AddressChanged
 
100
            {
 
101
                inline static std::string name()
 
102
                {
 
103
                    return "PositionChanged";
 
104
                };
 
105
                typedef Address Interface;
 
106
                typedef std::tuple<int32_t, std::map<std::string, std::string>, dbus::types::Struct<std::tuple<int32_t, double, double>>> ArgumentType;
 
107
            };
 
108
        };
 
109
    };
 
110
 
 
111
    struct Position
 
112
    {
 
113
        struct Field
 
114
        {
 
115
            Field() = delete;
 
116
 
 
117
            static const int none = 0;
 
118
            static const int latitude = 1;
 
119
            static const int longitude = 2;
 
120
            static const int altitude = 3;
 
121
        };
 
122
 
 
123
        typedef std::bitset<4> FieldFlags;
 
124
 
 
125
        struct GetPosition
 
126
        {
 
127
            inline static std::string name()
 
128
            {
 
129
                return "GetPosition";
 
130
            } 
 
131
            typedef Position Interface;
 
132
            typedef std::tuple<int32_t, int32_t, double, double, double, dbus::types::Struct<std::tuple<int32_t, double, double>>> ResultType;
 
133
            inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
 
134
        };
 
135
 
 
136
        struct Signals
 
137
        {
 
138
            struct PositionChanged
 
139
            {
 
140
                inline static std::string name()
 
141
                {
 
142
                    return "PositionChanged";
 
143
                };
 
144
                typedef Position Interface;
 
145
                typedef std::tuple<int32_t, int32_t, double, double, double, dbus::types::Struct<std::tuple<int32_t, double, double>>> ArgumentType;
 
146
            };
 
147
        };
 
148
    };
 
149
 
 
150
    struct Velocity
 
151
    {
 
152
        struct Field
 
153
        {
 
154
            Field() = delete;
 
155
 
 
156
            static const int none = 0;
 
157
            static const int speed = 1;
 
158
            static const int direction = 2;
 
159
            static const int climb = 3;
 
160
        };
 
161
 
 
162
        typedef std::bitset<4> FieldFlags;
 
163
 
 
164
        struct GetVelocity
 
165
        {
 
166
            inline static std::string name()
 
167
            {
 
168
                return "GetVelocity";
 
169
            } 
 
170
            typedef Velocity Interface;
 
171
            typedef std::tuple<int32_t, int32_t, double, double, double> ResultType;
 
172
            inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
 
173
        };
 
174
        struct Signals
 
175
        {
 
176
            struct VelocityChanged
 
177
            {
 
178
                inline static std::string name()
 
179
                {
 
180
                    return "VelocityChanged";
 
181
                };
 
182
                typedef Velocity Interface;
 
183
                typedef std::tuple<int32_t, int32_t, double, double, double> ArgumentType;
 
184
            };
 
185
        };
 
186
    };
 
187
};
 
188
}
 
189
}
 
190
 
 
191
namespace org
 
192
{
 
193
namespace freedesktop
 
194
{
 
195
namespace dbus
 
196
{
 
197
namespace traits
 
198
{
 
199
template<>
 
200
struct Service<org::freedesktop::Geoclue>
 
201
{
 
202
    inline static const std::string& interface_name()
 
203
    {
 
204
        static const std::string s{"org.freedesktop.Geoclue"};
 
205
        return s;
 
206
    }
 
207
};
 
208
 
 
209
template<>
 
210
struct Service<org::freedesktop::Geoclue::Address>
 
211
{
 
212
    inline static const std::string& interface_name()
 
213
    {
 
214
        static const std::string s{"org.freedesktop.Geoclue.Address"};
 
215
        return s;
 
216
    }
 
217
};
 
218
 
 
219
template<>
 
220
struct Service<org::freedesktop::Geoclue::Position>
 
221
{
 
222
    inline static const std::string& interface_name()
 
223
    {
 
224
        static const std::string s{"org.freedesktop.Geoclue.Position"};
 
225
        return s;
 
226
    }
 
227
};
 
228
 
 
229
template<>
 
230
struct Service<org::freedesktop::Geoclue::Velocity>
 
231
{
 
232
    inline static const std::string& interface_name()
 
233
    {
 
234
        static const std::string s{"org.freedesktop.Geoclue.Velocity"};
 
235
        return s;
 
236
    }
 
237
};
 
238
}
 
239
}
 
240
}
 
241
}
 
242
 
 
243
#endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROVIDERS_GEOCLUE_GEOCLUE_H_