~thomas-voss/location-service/add-ichnaea-provider-next

« back to all changes in this revision

Viewing changes to src/location/service_with_engine.h

  • Committer: Thomas Voß
  • Date: 2016-06-30 20:34:35 UTC
  • mfrom: (259.1.3 introduce-locationd)
  • Revision ID: thomas.voss@canonical.com-20160630203435-yindku9czqzl1d1f
Merge lp:~thomas-voss/location-service/introduce-locationd.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright © 2016 Canonical Ltd.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify it
 
5
 * under the terms of the GNU Lesser General Public License version 3,
 
6
 * as published by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authored by: Thomas Voß <thomas.voss@canonical.com>
 
17
 */
 
18
#ifndef LOCATION_SERVICE_WITH_ENGINE_H_
 
19
#define LOCATION_SERVICE_WITH_ENGINE_H_
 
20
 
 
21
#include <location/engine.h>
 
22
#include <location/service.h>
 
23
 
 
24
namespace location
 
25
{
 
26
class ServiceWithEngine : public Service
 
27
{
 
28
public:
 
29
    ServiceWithEngine(const Engine::Ptr& engine);
 
30
 
 
31
    // From Service
 
32
    const core::Property<State>& state() const override;
 
33
    core::Property<bool>& does_satellite_based_positioning() override;
 
34
    core::Property<bool>& is_online() override;
 
35
    core::Property<bool>& does_report_cell_and_wifi_ids() override;
 
36
    core::Property<std::map<SpaceVehicle::Key, SpaceVehicle>>& visible_space_vehicles() override;
 
37
    Session::Ptr create_session_for_criteria(const Criteria& criteria) override;
 
38
 
 
39
private:
 
40
    Engine::Ptr engine; // The engine instance we use for positioning.
 
41
 
 
42
    // Properties of the service implementation.
 
43
    core::Property<State> state_;
 
44
    core::Property<bool> does_satellite_based_positioning_;
 
45
    core::Property<bool> is_online_;
 
46
    core::Property<bool> does_report_cell_and_wifi_ids_;
 
47
    core::Property<std::map<SpaceVehicle::Key, SpaceVehicle>> visible_space_vehicles_;
 
48
 
 
49
    struct
 
50
    {
 
51
        core::ScopedConnection is_online;
 
52
        core::ScopedConnection does_report_cell_and_wifi_ids;
 
53
        core::ScopedConnection does_satellite_based_positioning;
 
54
        core::ScopedConnection engine_state;
 
55
        core::ScopedConnection satellite_based_positioning_state;
 
56
        core::ScopedConnection visible_space_vehicles;
 
57
    } connections;      // All event connections are automatically cut on destruction.
 
58
};
 
59
}
 
60
 
 
61
#endif // LOCATION_SERVICE_WITH_ENGINE_H_