~sil2100/location-service/gps-arm64

« back to all changes in this revision

Viewing changes to src/location_service/com/ubuntu/location/proxy_provider.cpp

  • 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
#include "com/ubuntu/location/proxy_provider.h"
 
2
 
 
3
#include <bitset>
 
4
#include <memory>
 
5
 
 
6
namespace cul = com::ubuntu::location;
 
7
 
 
8
cul::ProxyProvider::ProxyProvider(const cul::ProviderSelection& selection)
 
9
    : Provider(selection.to_feature_flags()),
 
10
      position_updates_provider(selection.position_updates_provider),
 
11
      heading_updates_provider(selection.heading_updates_provider),
 
12
      velocity_updates_provider(selection.velocity_updates_provider)
 
13
{
 
14
}
 
15
 
 
16
cul::ProxyProvider::~ProxyProvider() noexcept
 
17
{
 
18
}
 
19
 
 
20
cul::ChannelConnection cul::ProxyProvider::subscribe_to_position_updates(std::function<void(const cul::Update<cul::Position>&)> f)
 
21
{
 
22
    if (position_updates_provider)
 
23
        return position_updates_provider->subscribe_to_position_updates(f);
 
24
    return ChannelConnection {};
 
25
}
 
26
 
 
27
cul::ChannelConnection cul::ProxyProvider::subscribe_to_heading_updates(std::function<void(const cul::Update<cul::Heading>&)> f)
 
28
{
 
29
    if (heading_updates_provider)
 
30
        return heading_updates_provider->subscribe_to_heading_updates(f);
 
31
    return ChannelConnection {};
 
32
}
 
33
 
 
34
cul::ChannelConnection cul::ProxyProvider::subscribe_to_velocity_updates(std::function<void(const cul::Update<cul::Velocity>&)> f)
 
35
{
 
36
    if (velocity_updates_provider)
 
37
        return velocity_updates_provider->subscribe_to_velocity_updates(f);
 
38
    return ChannelConnection {};
 
39
}
 
40
 
 
41
void cul::ProxyProvider::start_position_updates()
 
42
{
 
43
    if (position_updates_provider)
 
44
        position_updates_provider->state_controller()->start_position_updates();
 
45
}
 
46
 
 
47
void cul::ProxyProvider::stop_position_updates()
 
48
{
 
49
    if (position_updates_provider)
 
50
        position_updates_provider->state_controller()->stop_position_updates();
 
51
}
 
52
 
 
53
void cul::ProxyProvider::start_velocity_updates()
 
54
{
 
55
    if (velocity_updates_provider)
 
56
        position_updates_provider->state_controller()->start_velocity_updates();
 
57
}
 
58
 
 
59
void cul::ProxyProvider::stop_velocity_updates()
 
60
{
 
61
    if (velocity_updates_provider)
 
62
        position_updates_provider->state_controller()->stop_velocity_updates();
 
63
}    
 
64
 
 
65
void cul::ProxyProvider::start_heading_updates()
 
66
{
 
67
    if (heading_updates_provider)
 
68
        position_updates_provider->state_controller()->start_heading_updates();
 
69
}
 
70
 
 
71
void cul::ProxyProvider::stop_heading_updates()
 
72
{
 
73
    if (heading_updates_provider)
 
74
        position_updates_provider->state_controller()->stop_heading_updates();
 
75
}
 
 
b'\\ No newline at end of file'