~thomas-voss/location-service/add-snapcraft-setup-next

« back to all changes in this revision

Viewing changes to src/location/providers/dummy/provider.h

Merge lp:~thomas-voss/location-service/simplify-provider-interface.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#include <location/provider.h>
22
22
#include <location/provider_factory.h>
23
23
 
 
24
#include <thread>
 
25
 
24
26
namespace location
25
27
{
26
28
namespace providers
68
70
    };
69
71
 
70
72
    // Updates are delivered every update_period milliseconds.
71
 
    std::chrono::milliseconds update_period{500};
 
73
    std::chrono::milliseconds update_period{10};
72
74
 
73
75
    // The reference position that is delivered in every upate cycle.
74
76
    Position reference_position
115
117
    // Cleans up all resources and stops the updates.
116
118
    ~Provider() noexcept;
117
119
 
118
 
    // Always returns true.
119
 
    bool matches_criteria(const Criteria&);
120
 
 
121
 
    // Starts up the updater thread and delivers position updates
122
 
    void start_position_updates();
123
 
    // Stops the updater thread.
124
 
    void stop_position_updates();
 
120
    void on_new_event(const Event& event) override;
 
121
 
 
122
    void enable() override;
 
123
    void disable() override;
 
124
    void activate() override;
 
125
    void deactivate() override;
 
126
 
 
127
    Requirements requirements() const override;
 
128
    bool satisfies(const Criteria& criteria) override;
 
129
    const core::Signal<Update<Position>>& position_updates() const override;
 
130
    const core::Signal<Update<Heading>>& heading_updates() const override;
 
131
    const core::Signal<Update<Velocity>>& velocity_updates() const override;
 
132
    void on_wifi_and_cell_reporting_state_changed(WifiAndCellIdReportingState state);
 
133
    void on_reference_location_updated(const Update<Position>& position);
 
134
    void on_reference_velocity_updated(const Update<Velocity>& velocity);
 
135
    void on_reference_heading_updated(const Update<Heading>& heading);
125
136
 
126
137
  private:
127
 
    struct Private;
128
 
    std::unique_ptr<Private> d;
 
138
    dummy::Configuration configuration;
 
139
    std::atomic<bool> stop_requested{false};
 
140
    std::thread worker{};
 
141
 
 
142
    struct
 
143
    {
 
144
        core::Signal<Update<Position>> position;
 
145
        core::Signal<Update<Heading>> heading;
 
146
        core::Signal<Update<Velocity>> velocity;
 
147
    } updates;
129
148
};
130
149
}
131
150
}