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

« back to all changes in this revision

Viewing changes to include/location_service/com/ubuntu/location/criteria.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_CRITERIA_H_
19
19
#define LOCATION_SERVICE_COM_UBUNTU_LOCATION_CRITERIA_H_
20
20
 
21
 
#include "com/ubuntu/location/accuracy.h"
22
 
#include "com/ubuntu/location/heading.h"
23
 
#include "com/ubuntu/location/velocity.h"
24
 
#include "com/ubuntu/location/wgs84/altitude.h"
25
 
#include "com/ubuntu/location/wgs84/latitude.h"
26
 
#include "com/ubuntu/location/wgs84/longitude.h"
27
 
 
28
 
#include <limits>
29
 
#include <ostream>
30
 
#include <stdexcept>
 
21
#include <com/ubuntu/location/optional.h>
 
22
#include <com/ubuntu/location/units/units.h>
31
23
 
32
24
namespace com
33
25
{
35
27
{
36
28
namespace location
37
29
{
 
30
/**
 
31
 * @brief Summarizes criteria of a client session with respect to functionality
 
32
 * and accuracy for position, velocity and heading measurements.
 
33
 */
38
34
struct Criteria
39
35
{
40
 
    Criteria() : latitude_accuracy(),
41
 
                 longitude_accuracy(),
42
 
                 altitude_accuracy(),
43
 
                 velocity_accuracy(),
44
 
                 heading_accuracy()
45
 
    {
46
 
    }
47
 
    
48
 
    Accuracy<wgs84::Latitude> latitude_accuracy;
49
 
    Accuracy<wgs84::Longitude> longitude_accuracy;
50
 
    Accuracy<wgs84::Altitude> altitude_accuracy;
51
 
    Accuracy<Velocity> velocity_accuracy;
52
 
    Accuracy<Heading> heading_accuracy;
 
36
    /**
 
37
     * @brief satisfies checks whether this instance also satisfies another criteria instance.
 
38
     * @param rhs The other criteria instance
 
39
     * @return true iff this instance also satisfies the other instance, else false.
 
40
     */
 
41
    bool satisfies(const Criteria& rhs) const;
 
42
 
 
43
    struct Requires
 
44
    {
 
45
        bool position = true; ///< The client needs position measurements.
 
46
        bool altitude = false; ///< The client needs altitude measurements.
 
47
        bool velocity = false; ///< The client needs velocity measurments.
 
48
        bool heading = false; ///< The client needs heading measurements.
 
49
    } requires = Requires{};
 
50
 
 
51
    struct Accuracy
 
52
    {
 
53
        units::Quantity<units::Length> horizontal = 3000 * units::Meters; ///< The client requires measurements of at least this horizontal accuracy.
 
54
        Optional<units::Quantity<units::Length>> vertical; ///< The client requires measurements of at least this vertical accuracy.
 
55
        Optional<units::Quantity<units::Velocity>> velocity; ///< The client requires measurements of at least this velocity accuracy.
 
56
        Optional<units::Quantity<units::PlaneAngle>> heading; ///< The client requires measurements of at least this heading accuracy.
 
57
    } accuracy = Accuracy{};
53
58
};
 
59
 
 
60
/**
 
61
 * @brief operator + merges lhs and rhs such that satisfying the new criteria satisfies lhs and rhs.
 
62
 */
 
63
Criteria operator+(const Criteria& lhs, const Criteria& rhs);
54
64
}
55
65
}
56
66
}