~thomas-voss/location-service/export-glib-context

« back to all changes in this revision

Viewing changes to src/location/dbus/stub/session.cpp

Merge lp:~thomas-voss/location-service/make-client-resilient-against-service-going-away.

Show diffs side-by-side

added added

removed removed

Lines of Context:
191
191
    {
192
192
        if (auto thiz = holder->value.lock())
193
193
        {
194
 
            auto update =
195
 
                location::dbus::decode<
196
 
                    location::Update<location::Position>
197
 
                >(com_ubuntu_location_service_session_get_position(thiz->session_.get()));
 
194
            if (auto variant = com_ubuntu_location_service_session_get_position(thiz->session_.get()))
 
195
            {
 
196
                auto update =
 
197
                    location::dbus::decode<
 
198
                        location::Update<location::Position>
 
199
                    >(variant);
198
200
 
199
 
            if (update)
200
 
                thiz->updates().position = *update;
 
201
                if (update)
 
202
                    thiz->updates().position = *update;
 
203
            }
201
204
        }
202
205
    }
203
206
}
212
215
    {
213
216
        if (auto thiz = holder->value.lock())
214
217
        {
215
 
            auto update =
216
 
                    location::dbus::decode<
217
 
                        location::Update<units::Degrees>
218
 
                    >(com_ubuntu_location_service_session_get_heading(thiz->session_.get()));
 
218
            if (auto variant = com_ubuntu_location_service_session_get_heading(thiz->session_.get()))
 
219
            {
 
220
                auto update =
 
221
                        location::dbus::decode<
 
222
                            location::Update<units::Degrees>
 
223
                        >(variant);
219
224
 
220
 
            if (update)
221
 
                thiz->updates().heading = *update;
 
225
                if (update)
 
226
                    thiz->updates().heading = *update;
 
227
            }
222
228
        }
223
229
    }
224
230
}
233
239
    {
234
240
        if (auto thiz = holder->value.lock())
235
241
        {
236
 
            auto update =
237
 
                    location::dbus::decode<
238
 
                        location::Update<units::MetersPerSecond>
239
 
                    >(com_ubuntu_location_service_session_get_velocity(thiz->session_.get()));
 
242
            if (auto variant = com_ubuntu_location_service_session_get_velocity(thiz->session_.get()))
 
243
            {
 
244
                auto update =
 
245
                        location::dbus::decode<
 
246
                            location::Update<units::MetersPerSecond>
 
247
                        >(variant);
240
248
 
241
 
            if (update)
242
 
                thiz->updates().velocity = *update;
 
249
                if (update)
 
250
                    thiz->updates().velocity = *update;
 
251
            }
243
252
        }
244
253
    }
245
254
}