~thomas-voss/location-service/next

« back to all changes in this revision

Viewing changes to src/location/providers/remote/provider.cpp

Merge lp:~thomas-voss/location-service/refactor-location-position.

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
    }
87
87
}
88
88
 
89
 
void remote::Provider::Observer::Stub::on_new_heading(const Update<Heading>& update)
 
89
void remote::Provider::Observer::Stub::on_new_heading(const Update<units::Degrees>& update)
90
90
{
91
91
    try
92
92
    {
104
104
    }
105
105
}
106
106
 
107
 
void remote::Provider::Observer::Stub::on_new_velocity(const Update<Velocity>& update)
 
107
void remote::Provider::Observer::Stub::on_new_velocity(const Update<units::MetersPerSecond>& update)
108
108
{
109
109
    try
110
110
    {
136
136
    object->install_method_handler<remote::Interface::Observer::UpdateHeading>([this](const core::dbus::Message::Ptr& msg)
137
137
    {
138
138
        VLOG(50) << "remote::Interface::Observer::UpdateHeading";
139
 
        location::Update<location::Heading> update; msg->reader() >> update;
 
139
        location::Update<location::units::Degrees> update; msg->reader() >> update;
140
140
        on_new_heading(update);
141
141
        Skeleton::bus->send(dbus::Message::make_method_return(msg));
142
142
    });
144
144
    object->install_method_handler<remote::Interface::Observer::UpdateVelocity>([this](const core::dbus::Message::Ptr& msg)
145
145
    {
146
146
        VLOG(50) << "remote::Interface::Observer::UpdateVelocity";
147
 
        location::Update<location::Velocity> update; msg->reader() >> update;
 
147
        location::Update<location::units::MetersPerSecond> update; msg->reader() >> update;
148
148
        on_new_velocity(update);
149
149
        Skeleton::bus->send(dbus::Message::make_method_return(msg));
150
150
    });
155
155
    impl->on_new_position(update);
156
156
}
157
157
 
158
 
void remote::Provider::Observer::Skeleton::on_new_heading(const Update<Heading>& update)
 
158
void remote::Provider::Observer::Skeleton::on_new_heading(const Update<units::Degrees>& update)
159
159
{
160
160
    impl->on_new_heading(update);
161
161
}
162
162
 
163
 
void remote::Provider::Observer::Skeleton::on_new_velocity(const Update<Velocity>& update)
 
163
void remote::Provider::Observer::Skeleton::on_new_velocity(const Update<units::MetersPerSecond>& update)
164
164
{
165
165
    impl->on_new_velocity(update);
166
166
}
189
189
    struct
190
190
    {
191
191
        core::Signal<location::Update<location::Position>> position;
192
 
        core::Signal<location::Update<location::Heading>> heading;
193
 
        core::Signal<location::Update<location::Velocity>> velocity;
 
192
        core::Signal<location::Update<location::units::Degrees>> heading;
 
193
        core::Signal<location::Update<location::units::MetersPerSecond>> velocity;
194
194
    } updates;
195
195
};
196
196
 
250
250
    d->updates.position(update);
251
251
}
252
252
 
253
 
void remote::Provider::Stub::on_new_heading(const Update<Heading>& update)
 
253
void remote::Provider::Stub::on_new_heading(const Update<units::Degrees>& update)
254
254
{
255
255
    d->updates.heading(update);
256
256
}
257
257
 
258
 
void remote::Provider::Stub::on_new_velocity(const Update<Velocity>& update)
 
258
void remote::Provider::Stub::on_new_velocity(const Update<units::MetersPerSecond>& update)
259
259
{
260
260
    d->updates.velocity(update);
261
261
}
328
328
    return d->updates.position;
329
329
}
330
330
 
331
 
const core::Signal<location::Update<location::Heading>>& remote::Provider::Stub::heading_updates() const
 
331
const core::Signal<location::Update<location::units::Degrees>>& remote::Provider::Stub::heading_updates() const
332
332
{
333
333
    return d->updates.heading;
334
334
}
335
335
 
336
 
const core::Signal<location::Update<location::Velocity>>& remote::Provider::Stub::velocity_updates() const
 
336
const core::Signal<location::Update<location::units::MetersPerSecond>>& remote::Provider::Stub::velocity_updates() const
337
337
{
338
338
    return d->updates.velocity;
339
339
}
352
352
                      for (const auto& observer : observers)
353
353
                          observer->on_new_position(position);
354
354
                  }),
355
 
                  impl->heading_updates().connect([this](const cul::Update<cul::Heading>& heading)
 
355
                  impl->heading_updates().connect([this](const location::Update<location::units::Degrees>& heading)
356
356
                  {
357
357
                      VLOG(100) << "Heading changed reported by impl: " << heading;
358
358
                      for (const auto& observer : observers)
359
359
                          observer->on_new_heading(heading);
360
360
                  }),
361
 
                  impl->velocity_updates().connect([this](const cul::Update<cul::Velocity>& velocity)
 
361
                  impl->velocity_updates().connect([this](const location::Update<location::units::MetersPerSecond>& velocity)
362
362
                  {
363
363
                      VLOG(100) << "Velocity changed reported by impl: " << velocity;
364
364
                      for (const auto& observer : observers)
515
515
    return d->impl->position_updates();
516
516
}
517
517
 
518
 
const core::Signal<location::Update<location::Heading>>& remote::Provider::Skeleton::heading_updates() const
 
518
const core::Signal<location::Update<location::units::Degrees>>& remote::Provider::Skeleton::heading_updates() const
519
519
{
520
520
    return d->impl->heading_updates();
521
521
}
522
522
 
523
 
const core::Signal<location::Update<location::Velocity>>& remote::Provider::Skeleton::velocity_updates() const
 
523
const core::Signal<location::Update<location::units::MetersPerSecond>>& remote::Provider::Skeleton::velocity_updates() const
524
524
{
525
525
    return d->impl->velocity_updates();
526
526
}