[go: nahoru, domu]

blob: f1d5e99d9110474fbc6aea8c45db1f8af5682903 [file] [log] [blame]
alemate@chromium.org9e844cf2014-04-19 02:36:011// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
satoruxde6a5dc2014-12-12 22:30:375#ifndef CHROMEOS_GEOLOCATION_GEOPOSITION_H_
6#define CHROMEOS_GEOLOCATION_GEOPOSITION_H_
alemate@chromium.org9e844cf2014-04-19 02:36:017
8#include <string>
9
10#include "base/time/time.h"
satoruxde6a5dc2014-12-12 22:30:3711#include "chromeos/chromeos_export.h"
alemate@chromium.org9e844cf2014-04-19 02:36:0112
13namespace chromeos {
14
15// This structure represents Google Maps Geolocation response.
mcasas4e216e72016-07-28 21:28:3816// Based on device/geolocation/geoposition.h .
satoruxde6a5dc2014-12-12 22:30:3717struct CHROMEOS_EXPORT Geoposition {
alemate@chromium.org9e844cf2014-04-19 02:36:0118 // Geolocation API client status.
19 // (Server status is reported in "error_code" field.)
20 enum Status {
21 STATUS_NONE,
22 STATUS_OK, // Response successful.
23 STATUS_SERVER_ERROR, // Received error object.
24 STATUS_NETWORK_ERROR, // Received bad or no response.
25 STATUS_TIMEOUT, // Request stopped because of timeout.
26 STATUS_LAST = STATUS_TIMEOUT
27 };
28
29 // All fields are initialized to sentinel values marking them as invalid. The
30 // status is set to STATUS_NONE.
31 Geoposition();
32
33 // A valid fix has a valid latitude, longitude, accuracy and timestamp.
34 bool Valid() const;
35
36 // Serialize to string.
37 std::string ToString() const;
38
39 // Latitude in decimal degrees north.
40 double latitude;
41
42 // Longitude in decimal degrees west.
43 double longitude;
44
45 // Accuracy of horizontal position in meters.
46 double accuracy;
47
48 // Error object data:
49 // Value of "error.code".
50 int error_code;
51
52 // Human-readable error message.
53 std::string error_message;
54
55 // Absolute time, when this position was acquired. This is
56 // taken from the host computer's system clock (i.e. from Time::Now(), not the
57 // source device's clock).
58 base::Time timestamp;
59
60 // See enum above.
61 Status status;
62};
63
64} // namespace chromeos
65
satoruxde6a5dc2014-12-12 22:30:3766#endif // CHROMEOS_GEOLOCATION_GEOPOSITION_H_