~thomas-voss/location-service/fix-1347887

« back to all changes in this revision

Viewing changes to src/location_service/com/ubuntu/location/service/implementation.h

This MP consolidates multiple related changes together, with the goal of:

(1.) Make the service instance accessible via a cli. Useful for testing scenarios.
(2.) To cut down time-to-first-fix (ttff) by:
  (2.1) Leveraging SUPL and other supplementary data downloaded over ordinary data connections.
  (2.2) Enabling network-based positioning providers to acquire fast position estimates.

In more detail:

* Added tests for daemon and cli.
* Unified daemon and cli header and implementation files.
* Add a command-line interface to the service.
* Split up provider selection policy to rely on an interface ProviderEnumerator to ease in testing.
* Trimmed down on types.
* Removed connectivity API draft to prepare for simpler approach.
* Refactored includes.
* Added a configuration option to handle cell and wifi ID reporting.
* Add a mock for a connectivity API exposed to providers and reporters.
* Add units for connectivity api.
* Refactor cell class into namespace radio. Fixes: 1226204, 1248973, 1281817

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
#ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_IMPLEMENTATION_H_
19
19
#define LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_IMPLEMENTATION_H_
20
20
 
21
 
#include "com/ubuntu/location/engine.h"
22
 
#include "com/ubuntu/location/service/skeleton.h"
 
21
#include <com/ubuntu/location/engine.h>
 
22
#include <com/ubuntu/location/connectivity/manager.h>
 
23
#include <com/ubuntu/location/service/harvester.h>
 
24
#include <com/ubuntu/location/service/skeleton.h>
23
25
 
24
26
#include <memory>
25
27
 
35
37
{
36
38
class Implementation : public Skeleton
37
39
{
38
 
  public:
 
40
public:
39
41
    typedef std::shared_ptr<Implementation> Ptr;
40
42
 
41
 
    Implementation(
42
 
        const core::dbus::Bus::Ptr& bus,
43
 
        const Engine::Ptr& engine,
44
 
        const PermissionManager::Ptr& permission_manager);
45
 
    Implementation(const Implementation&) = delete;
46
 
    virtual ~Implementation() noexcept;
47
 
    Implementation& operator=(const Implementation&) = delete;
48
 
 
49
 
    virtual session::Interface::Ptr create_session_for_criteria(const Criteria& criteria);
 
43
    // Summarizes configuration options for the implementation.
 
44
    struct Configuration
 
45
    {
 
46
        // The bus connection to expose the service upon.
 
47
        core::dbus::Bus::Ptr incoming;
 
48
        // The bus connection for querying other services.
 
49
        core::dbus::Bus::Ptr outgoing;
 
50
        // The positioning Engine that the service should use.
 
51
        Engine::Ptr engine;
 
52
        // The permission manager that the service should use.
 
53
        PermissionManager::Ptr permission_manager;
 
54
        // All harvesting specific options.
 
55
        Harvester::Configuration harvester;
 
56
    };
 
57
 
 
58
    // Creates a new instance of the service with the given configuration.
 
59
    // Throws std::runtime_error in case of issues.
 
60
    Implementation(const Configuration& configuration);
 
61
 
 
62
    // Creates a new session for the given criteria.
 
63
    session::Interface::Ptr create_session_for_criteria(const Criteria& criteria);
50
64
 
51
65
  private:
52
 
    struct Private;
53
 
    std::unique_ptr<Private> d;
 
66
    // The service configuration.
 
67
    Configuration configuration;
 
68
    // The harvester instance.
 
69
    Harvester harvester;
 
70
    // All event connections are automatically cut on destruction.
 
71
    struct
 
72
    {
 
73
        core::ScopedConnection is_online;
 
74
        core::ScopedConnection does_report_cell_and_wifi_ids;
 
75
        core::ScopedConnection does_satellite_based_positioning;
 
76
        core::ScopedConnection engine_state;
 
77
        core::ScopedConnection satellite_based_positioning_state;
 
78
        core::ScopedConnection visible_space_vehicles;
 
79
        core::ScopedConnection reference_position;
 
80
    } connections;
54
81
};
55
82
}
56
83
}