Index: blimp/common/proto/geolocation.proto |
diff --git a/blimp/common/proto/geolocation.proto b/blimp/common/proto/geolocation.proto |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3eca41a4eafb0eba8e886ee8fbd1afe43c6b95d9 |
--- /dev/null |
+++ b/blimp/common/proto/geolocation.proto |
@@ -0,0 +1,70 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+// |
+// Message definitions for geolocation messages. |
+ |
+syntax = "proto2"; |
+ |
+option optimize_for = LITE_RUNTIME; |
+ |
+import "common.proto"; |
+ |
+package blimp; |
+ |
+message ErrorMessage { |
+ // These values follow the W3C geolocation specification and can be returned |
+ // to JavaScript without the need for a conversion. |
+ // https://dev.w3.org/geo/api/spec-source.html - 5.5 PositionError interface |
+ enum ErrorCode { |
+ option allow_alias = true; |
+ ERROR_CODE_NONE = 0; |
+ ERROR_CODE_PERMISSION_DENIED = 1; |
+ ERROR_CODE_POSITION_UNAVAILABLE = 2; |
+ ERROR_CODE_TIMEOUT = 3; |
+ ERROR_CODE_LAST = 3; |
Kevin M
2016/06/29 17:52:55
No need to define this - the pb compiler defines a
CJ
2016/07/11 23:21:06
Removed them. Can you explain more about the valid
|
+ } |
+ |
+ optional ErrorCode error_code = 1; |
+ optional string error_message = 2; |
+} |
+ |
+message LocationMessage { |
+ // Refer to content/public/common/geoposition.h for explanation of |
+ // these fields and associated units. |
+ optional double latitude = 1; |
+ optional double longitude = 2; |
+ optional double altitude = 3; |
+ optional double accuracy = 4; |
+ optional double altitude_accuracy = 5; |
+ optional double heading = 6; |
+ optional double speed = 7; |
+ optional int64 timestamp_millis = 8; |
+} |
+ |
+message UpdateListenStateMessage { |
+ // These values represent the various listening states the server can have. |
+ // A ListenState containing an accuracy level indicates that the server is |
+ // waiting for either high or low accuracy position updates from the client. |
+ // If a STOPPED listen state is sent, the server is no longer listening for |
+ // updates. |
+ enum ListenState { |
+ ACCURACY_HIGH = 0; |
+ ACCURACY_LOW = 1; |
+ STOPPED = 2; |
+ } |
+ |
+ optional ListenState listen_state = 1; |
+} |
+ |
+message GeolocationMessage { |
+ oneof type { |
+ // Server => Client types. |
+ UpdateListenStateMessage update_listen_state = 1; |
+ EmptyMessage request_refresh = 2; |
+ |
+ // Client => Server types. |
+ LocationMessage location = 3; |
+ ErrorMessage error = 4; |
+ } |
+} |