google_anymote 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +17 -0
- data/.rvmrc +1 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +66 -0
- data/Rakefile +18 -0
- data/bin/pair +29 -0
- data/google_anymote.gemspec +21 -0
- data/lib/google_anymote/exceptions.rb +7 -0
- data/lib/google_anymote/pair.rb +150 -0
- data/lib/google_anymote/tv.rb +96 -0
- data/lib/google_anymote/version.rb +4 -0
- data/lib/google_anymote.rb +7 -0
- data/lib/proto/keycodes.pb.rb +359 -0
- data/lib/proto/keycodes.proto +190 -0
- data/lib/proto/polo.pb.rb +211 -0
- data/lib/proto/polo.proto +124 -0
- data/lib/proto/remote.pb.rb +200 -0
- data/lib/proto/remote.proto +128 -0
- metadata +115 -0
@@ -0,0 +1,211 @@
|
|
1
|
+
### Generated by rprotoc. DO NOT EDIT!
|
2
|
+
### <proto file: polo.proto>
|
3
|
+
# // Copyright 2009 Google Inc. All Rights Reserved.
|
4
|
+
#
|
5
|
+
# option java_outer_classname = "PoloProto";
|
6
|
+
# option java_package = "com.google.polo.wire.protobuf";
|
7
|
+
#
|
8
|
+
# // OuterMessage - base outer message type used in the protocol.
|
9
|
+
#
|
10
|
+
# message OuterMessage {
|
11
|
+
#
|
12
|
+
# // MessageType indicates the type of the enclosed message (serialized in the
|
13
|
+
# // `payload` field)
|
14
|
+
# enum MessageType {
|
15
|
+
# // Initialization phase
|
16
|
+
# MESSAGE_TYPE_PAIRING_REQUEST = 10;
|
17
|
+
# MESSAGE_TYPE_PAIRING_REQUEST_ACK = 11;
|
18
|
+
#
|
19
|
+
# // Configuration phase
|
20
|
+
# MESSAGE_TYPE_OPTIONS = 20;
|
21
|
+
# MESSAGE_TYPE_CONFIGURATION = 30;
|
22
|
+
# MESSAGE_TYPE_CONFIGURATION_ACK = 31;
|
23
|
+
#
|
24
|
+
# // Pairing phase
|
25
|
+
# MESSAGE_TYPE_SECRET = 40;
|
26
|
+
# MESSAGE_TYPE_SECRET_ACK = 41;
|
27
|
+
# }
|
28
|
+
#
|
29
|
+
# // Protocol status states.
|
30
|
+
# enum Status {
|
31
|
+
# STATUS_OK = 200;
|
32
|
+
# STATUS_ERROR = 400;
|
33
|
+
# STATUS_BAD_CONFIGURATION = 401;
|
34
|
+
# STATUS_BAD_SECRET = 402;
|
35
|
+
# }
|
36
|
+
#
|
37
|
+
# required uint32 protocol_version = 1 [default = 1];
|
38
|
+
#
|
39
|
+
# // Protocol status. Any status other than STATUS_OK implies a fault.
|
40
|
+
# required Status status = 2;
|
41
|
+
#
|
42
|
+
# // Encapsulated message. These fields are required if status is STATUS_OK.
|
43
|
+
# optional MessageType type = 3;
|
44
|
+
# optional bytes payload = 4;
|
45
|
+
#
|
46
|
+
# }
|
47
|
+
#
|
48
|
+
#
|
49
|
+
# //
|
50
|
+
# // Initialization messages
|
51
|
+
# //
|
52
|
+
#
|
53
|
+
# message PairingRequest {
|
54
|
+
# // String name of the service to pair with. The name used should be an
|
55
|
+
# // established convention of the application protocol.
|
56
|
+
# required string service_name = 1;
|
57
|
+
#
|
58
|
+
# // Descriptive name of the client.
|
59
|
+
# optional string client_name = 2;
|
60
|
+
# }
|
61
|
+
#
|
62
|
+
# message PairingRequestAck {
|
63
|
+
# // Descriptive name of the server.
|
64
|
+
# optional string server_name = 1;
|
65
|
+
# }
|
66
|
+
#
|
67
|
+
#
|
68
|
+
# //
|
69
|
+
# // Configuration messages
|
70
|
+
# //
|
71
|
+
#
|
72
|
+
# message Options {
|
73
|
+
# message Encoding {
|
74
|
+
# enum EncodingType {
|
75
|
+
# ENCODING_TYPE_UNKNOWN = 0;
|
76
|
+
# ENCODING_TYPE_ALPHANUMERIC = 1;
|
77
|
+
# ENCODING_TYPE_NUMERIC = 2;
|
78
|
+
# ENCODING_TYPE_HEXADECIMAL = 3;
|
79
|
+
# ENCODING_TYPE_QRCODE = 4;
|
80
|
+
# }
|
81
|
+
#
|
82
|
+
# required EncodingType type = 1;
|
83
|
+
# required uint32 symbol_length = 2;
|
84
|
+
# }
|
85
|
+
#
|
86
|
+
# enum RoleType {
|
87
|
+
# ROLE_TYPE_UNKNOWN = 0;
|
88
|
+
# ROLE_TYPE_INPUT = 1;
|
89
|
+
# ROLE_TYPE_OUTPUT = 2;
|
90
|
+
# }
|
91
|
+
#
|
92
|
+
# // List of encodings this endpoint accepts when serving as an input device.
|
93
|
+
# repeated Encoding input_encodings = 1;
|
94
|
+
#
|
95
|
+
# // List of encodings this endpoint can generate as an output device.
|
96
|
+
# repeated Encoding output_encodings = 2;
|
97
|
+
#
|
98
|
+
# // Preferred role, if any.
|
99
|
+
# optional RoleType preferred_role = 3;
|
100
|
+
# }
|
101
|
+
#
|
102
|
+
# message Configuration {
|
103
|
+
# // The encoding to be used in this session.
|
104
|
+
# required Options.Encoding encoding = 1;
|
105
|
+
#
|
106
|
+
# // The role of the client (ie, the one initiating pairing). This implies the
|
107
|
+
# // peer (server) acts as the complementary role.
|
108
|
+
# required Options.RoleType client_role = 2;
|
109
|
+
# }
|
110
|
+
#
|
111
|
+
# message ConfigurationAck {
|
112
|
+
# }
|
113
|
+
#
|
114
|
+
#
|
115
|
+
# //
|
116
|
+
# // Pairing messages
|
117
|
+
# //
|
118
|
+
#
|
119
|
+
# message Secret {
|
120
|
+
# required bytes secret = 1;
|
121
|
+
# }
|
122
|
+
#
|
123
|
+
# message SecretAck {
|
124
|
+
# required bytes secret = 1;
|
125
|
+
# }
|
126
|
+
#
|
127
|
+
|
128
|
+
require 'protobuf/message/message'
|
129
|
+
require 'protobuf/message/enum'
|
130
|
+
require 'protobuf/message/service'
|
131
|
+
require 'protobuf/message/extend'
|
132
|
+
|
133
|
+
::Protobuf::OPTIONS[:"java_outer_classname"] = "PoloProto"
|
134
|
+
::Protobuf::OPTIONS[:"java_package"] = "com.google.polo.wire.protobuf"
|
135
|
+
class OuterMessage < ::Protobuf::Message
|
136
|
+
defined_in __FILE__
|
137
|
+
class MessageType < ::Protobuf::Enum
|
138
|
+
defined_in __FILE__
|
139
|
+
MESSAGE_TYPE_PAIRING_REQUEST = value(:MESSAGE_TYPE_PAIRING_REQUEST, 10)
|
140
|
+
MESSAGE_TYPE_PAIRING_REQUEST_ACK = value(:MESSAGE_TYPE_PAIRING_REQUEST_ACK, 11)
|
141
|
+
MESSAGE_TYPE_OPTIONS = value(:MESSAGE_TYPE_OPTIONS, 20)
|
142
|
+
MESSAGE_TYPE_CONFIGURATION = value(:MESSAGE_TYPE_CONFIGURATION, 30)
|
143
|
+
MESSAGE_TYPE_CONFIGURATION_ACK = value(:MESSAGE_TYPE_CONFIGURATION_ACK, 31)
|
144
|
+
MESSAGE_TYPE_SECRET = value(:MESSAGE_TYPE_SECRET, 40)
|
145
|
+
MESSAGE_TYPE_SECRET_ACK = value(:MESSAGE_TYPE_SECRET_ACK, 41)
|
146
|
+
end
|
147
|
+
class Status < ::Protobuf::Enum
|
148
|
+
defined_in __FILE__
|
149
|
+
STATUS_OK = value(:STATUS_OK, 200)
|
150
|
+
STATUS_ERROR = value(:STATUS_ERROR, 400)
|
151
|
+
STATUS_BAD_CONFIGURATION = value(:STATUS_BAD_CONFIGURATION, 401)
|
152
|
+
STATUS_BAD_SECRET = value(:STATUS_BAD_SECRET, 402)
|
153
|
+
end
|
154
|
+
required :uint32, :protocol_version, 1, :default => 1
|
155
|
+
required :Status, :status, 2
|
156
|
+
optional :MessageType, :type, 3
|
157
|
+
optional :bytes, :payload, 4
|
158
|
+
end
|
159
|
+
|
160
|
+
class PairingRequest < ::Protobuf::Message
|
161
|
+
defined_in __FILE__
|
162
|
+
required :string, :service_name, 1
|
163
|
+
optional :string, :client_name, 2
|
164
|
+
end
|
165
|
+
|
166
|
+
class PairingRequestAck < ::Protobuf::Message
|
167
|
+
defined_in __FILE__
|
168
|
+
optional :string, :server_name, 1
|
169
|
+
end
|
170
|
+
|
171
|
+
class Options < ::Protobuf::Message
|
172
|
+
defined_in __FILE__
|
173
|
+
class Encoding < ::Protobuf::Message
|
174
|
+
defined_in __FILE__
|
175
|
+
class EncodingType < ::Protobuf::Enum
|
176
|
+
defined_in __FILE__
|
177
|
+
ENCODING_TYPE_UNKNOWN = value(:ENCODING_TYPE_UNKNOWN, 0)
|
178
|
+
ENCODING_TYPE_ALPHANUMERIC = value(:ENCODING_TYPE_ALPHANUMERIC, 1)
|
179
|
+
ENCODING_TYPE_NUMERIC = value(:ENCODING_TYPE_NUMERIC, 2)
|
180
|
+
ENCODING_TYPE_HEXADECIMAL = value(:ENCODING_TYPE_HEXADECIMAL, 3)
|
181
|
+
ENCODING_TYPE_QRCODE = value(:ENCODING_TYPE_QRCODE, 4)
|
182
|
+
end
|
183
|
+
required :EncodingType, :type, 1
|
184
|
+
required :uint32, :symbol_length, 2
|
185
|
+
end
|
186
|
+
class RoleType < ::Protobuf::Enum
|
187
|
+
defined_in __FILE__
|
188
|
+
ROLE_TYPE_UNKNOWN = value(:ROLE_TYPE_UNKNOWN, 0)
|
189
|
+
ROLE_TYPE_INPUT = value(:ROLE_TYPE_INPUT, 1)
|
190
|
+
ROLE_TYPE_OUTPUT = value(:ROLE_TYPE_OUTPUT, 2)
|
191
|
+
end
|
192
|
+
repeated :Encoding, :input_encodings, 1
|
193
|
+
repeated :Encoding, :output_encodings, 2
|
194
|
+
optional :RoleType, :preferred_role, 3
|
195
|
+
end
|
196
|
+
class Configuration < ::Protobuf::Message
|
197
|
+
defined_in __FILE__
|
198
|
+
required :'Options::Encoding', :encoding, 1
|
199
|
+
required :'Options::RoleType', :client_role, 2
|
200
|
+
end
|
201
|
+
class ConfigurationAck < ::Protobuf::Message
|
202
|
+
defined_in __FILE__
|
203
|
+
end
|
204
|
+
class Secret < ::Protobuf::Message
|
205
|
+
defined_in __FILE__
|
206
|
+
required :bytes, :secret, 1
|
207
|
+
end
|
208
|
+
class SecretAck < ::Protobuf::Message
|
209
|
+
defined_in __FILE__
|
210
|
+
required :bytes, :secret, 1
|
211
|
+
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
// Copyright 2009 Google Inc. All Rights Reserved.
|
2
|
+
|
3
|
+
option java_outer_classname = "PoloProto";
|
4
|
+
option java_package = "com.google.polo.wire.protobuf";
|
5
|
+
|
6
|
+
// OuterMessage - base outer message type used in the protocol.
|
7
|
+
|
8
|
+
message OuterMessage {
|
9
|
+
|
10
|
+
// MessageType indicates the type of the enclosed message (serialized in the
|
11
|
+
// `payload` field)
|
12
|
+
enum MessageType {
|
13
|
+
// Initialization phase
|
14
|
+
MESSAGE_TYPE_PAIRING_REQUEST = 10;
|
15
|
+
MESSAGE_TYPE_PAIRING_REQUEST_ACK = 11;
|
16
|
+
|
17
|
+
// Configuration phase
|
18
|
+
MESSAGE_TYPE_OPTIONS = 20;
|
19
|
+
MESSAGE_TYPE_CONFIGURATION = 30;
|
20
|
+
MESSAGE_TYPE_CONFIGURATION_ACK = 31;
|
21
|
+
|
22
|
+
// Pairing phase
|
23
|
+
MESSAGE_TYPE_SECRET = 40;
|
24
|
+
MESSAGE_TYPE_SECRET_ACK = 41;
|
25
|
+
}
|
26
|
+
|
27
|
+
// Protocol status states.
|
28
|
+
enum Status {
|
29
|
+
STATUS_OK = 200;
|
30
|
+
STATUS_ERROR = 400;
|
31
|
+
STATUS_BAD_CONFIGURATION = 401;
|
32
|
+
STATUS_BAD_SECRET = 402;
|
33
|
+
}
|
34
|
+
|
35
|
+
required uint32 protocol_version = 1 [default = 1];
|
36
|
+
|
37
|
+
// Protocol status. Any status other than STATUS_OK implies a fault.
|
38
|
+
required Status status = 2;
|
39
|
+
|
40
|
+
// Encapsulated message. These fields are required if status is STATUS_OK.
|
41
|
+
optional MessageType type = 3;
|
42
|
+
optional bytes payload = 4;
|
43
|
+
|
44
|
+
}
|
45
|
+
|
46
|
+
|
47
|
+
//
|
48
|
+
// Initialization messages
|
49
|
+
//
|
50
|
+
|
51
|
+
message PairingRequest {
|
52
|
+
// String name of the service to pair with. The name used should be an
|
53
|
+
// established convention of the application protocol.
|
54
|
+
required string service_name = 1;
|
55
|
+
|
56
|
+
// Descriptive name of the client.
|
57
|
+
optional string client_name = 2;
|
58
|
+
}
|
59
|
+
|
60
|
+
message PairingRequestAck {
|
61
|
+
// Descriptive name of the server.
|
62
|
+
optional string server_name = 1;
|
63
|
+
}
|
64
|
+
|
65
|
+
|
66
|
+
//
|
67
|
+
// Configuration messages
|
68
|
+
//
|
69
|
+
|
70
|
+
message Options {
|
71
|
+
message Encoding {
|
72
|
+
enum EncodingType {
|
73
|
+
ENCODING_TYPE_UNKNOWN = 0;
|
74
|
+
ENCODING_TYPE_ALPHANUMERIC = 1;
|
75
|
+
ENCODING_TYPE_NUMERIC = 2;
|
76
|
+
ENCODING_TYPE_HEXADECIMAL = 3;
|
77
|
+
ENCODING_TYPE_QRCODE = 4;
|
78
|
+
}
|
79
|
+
|
80
|
+
required EncodingType type = 1;
|
81
|
+
required uint32 symbol_length = 2;
|
82
|
+
}
|
83
|
+
|
84
|
+
enum RoleType {
|
85
|
+
ROLE_TYPE_UNKNOWN = 0;
|
86
|
+
ROLE_TYPE_INPUT = 1;
|
87
|
+
ROLE_TYPE_OUTPUT = 2;
|
88
|
+
}
|
89
|
+
|
90
|
+
// List of encodings this endpoint accepts when serving as an input device.
|
91
|
+
repeated Encoding input_encodings = 1;
|
92
|
+
|
93
|
+
// List of encodings this endpoint can generate as an output device.
|
94
|
+
repeated Encoding output_encodings = 2;
|
95
|
+
|
96
|
+
// Preferred role, if any.
|
97
|
+
optional RoleType preferred_role = 3;
|
98
|
+
}
|
99
|
+
|
100
|
+
message Configuration {
|
101
|
+
// The encoding to be used in this session.
|
102
|
+
required Options.Encoding encoding = 1;
|
103
|
+
|
104
|
+
// The role of the client (ie, the one initiating pairing). This implies the
|
105
|
+
// peer (server) acts as the complementary role.
|
106
|
+
required Options.RoleType client_role = 2;
|
107
|
+
}
|
108
|
+
|
109
|
+
message ConfigurationAck {
|
110
|
+
}
|
111
|
+
|
112
|
+
|
113
|
+
//
|
114
|
+
// Pairing messages
|
115
|
+
//
|
116
|
+
|
117
|
+
message Secret {
|
118
|
+
required bytes secret = 1;
|
119
|
+
}
|
120
|
+
|
121
|
+
message SecretAck {
|
122
|
+
required bytes secret = 1;
|
123
|
+
}
|
124
|
+
|
@@ -0,0 +1,200 @@
|
|
1
|
+
### Generated by rprotoc. DO NOT EDIT!
|
2
|
+
### <proto file: remote.proto>
|
3
|
+
# /*
|
4
|
+
# * Copyright (C) 2009 Google Inc. All rights reserved.
|
5
|
+
# *
|
6
|
+
# * Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# * you may not use this file except in compliance with the License.
|
8
|
+
# * You may obtain a copy of the License at
|
9
|
+
# *
|
10
|
+
# * http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
# *
|
12
|
+
# * Unless required by applicable law or agreed to in writing, software
|
13
|
+
# * distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# * See the License for the specific language governing permissions and
|
16
|
+
# * limitations under the License.
|
17
|
+
# */
|
18
|
+
#
|
19
|
+
# // Definition of the remote protocol messages.
|
20
|
+
#
|
21
|
+
# syntax = "proto2";
|
22
|
+
#
|
23
|
+
# option java_outer_classname = "Messages";
|
24
|
+
# option java_package = "com.google.anymote";
|
25
|
+
# option optimize_for = LITE_RUNTIME;
|
26
|
+
#
|
27
|
+
# //
|
28
|
+
# // HIGH LEVEL MESSAGE CONTAINERS
|
29
|
+
# //
|
30
|
+
#
|
31
|
+
# import "keycodes.proto";
|
32
|
+
#
|
33
|
+
# message RemoteMessage {
|
34
|
+
# // Optional sequence number. If present in the message with request_message
|
35
|
+
# // present, the other end will reply with response_message with the same
|
36
|
+
# // sequence_number
|
37
|
+
# optional uint32 sequence_number = 1;
|
38
|
+
# // Message for a request
|
39
|
+
# optional RequestMessage request_message = 2;
|
40
|
+
# // Message for a response
|
41
|
+
# optional ResponseMessage response_message = 3;
|
42
|
+
# }
|
43
|
+
#
|
44
|
+
# message RequestMessage {
|
45
|
+
# // Message for a key event
|
46
|
+
# optional KeyEvent key_event_message = 1;
|
47
|
+
# // Message for a mouse movement
|
48
|
+
# optional MouseEvent mouse_event_message = 2;
|
49
|
+
# // Message for a mouse wheel event
|
50
|
+
# optional MouseWheel mouse_wheel_message = 3;
|
51
|
+
# // Message containing data
|
52
|
+
# optional Data data_message = 4;
|
53
|
+
# // Message send upon connection
|
54
|
+
# optional Connect connect_message = 5;
|
55
|
+
# // Fling message
|
56
|
+
# optional Fling fling_message = 6;
|
57
|
+
# }
|
58
|
+
#
|
59
|
+
# message ResponseMessage {
|
60
|
+
# // Data message
|
61
|
+
# optional Data data_message = 1;
|
62
|
+
# // Fling result
|
63
|
+
# optional FlingResult fling_result_message = 3;
|
64
|
+
# }
|
65
|
+
#
|
66
|
+
# //
|
67
|
+
# // REQUEST MESSAGES
|
68
|
+
# //
|
69
|
+
#
|
70
|
+
# // Sends a key event to the server
|
71
|
+
# message KeyEvent {
|
72
|
+
# // Key code
|
73
|
+
# required Code keycode = 1;
|
74
|
+
# // Action (Up/Down)
|
75
|
+
# required Action action = 2;
|
76
|
+
# }
|
77
|
+
#
|
78
|
+
# // Sends a mouse event to the server
|
79
|
+
# message MouseEvent {
|
80
|
+
# // Relative movement of the cursor on the xAxis
|
81
|
+
# required int32 x_delta = 1;
|
82
|
+
# // Relative movement of the cursor on the yAxis
|
83
|
+
# required int32 y_delta = 2;
|
84
|
+
# }
|
85
|
+
#
|
86
|
+
# // Sends a mouse wheel to the server
|
87
|
+
# message MouseWheel {
|
88
|
+
# // Scrolling along the x-axis
|
89
|
+
# required int32 x_scroll = 1;
|
90
|
+
# // Scrolling along the y-axis
|
91
|
+
# required int32 y_scroll = 2;
|
92
|
+
# }
|
93
|
+
#
|
94
|
+
# message Connect {
|
95
|
+
# // Remote device name
|
96
|
+
# required string device_name = 1;
|
97
|
+
# // Version number for a given device software
|
98
|
+
# optional int32 version = 2;
|
99
|
+
# }
|
100
|
+
#
|
101
|
+
# message Fling {
|
102
|
+
# // Flinged URI
|
103
|
+
# required string uri = 1;
|
104
|
+
# }
|
105
|
+
#
|
106
|
+
# //
|
107
|
+
# // RESPONSE MESSAGES
|
108
|
+
# //
|
109
|
+
#
|
110
|
+
# //
|
111
|
+
# // TWO-WAY MESSAGES
|
112
|
+
# //
|
113
|
+
#
|
114
|
+
# // Sends a string and a type to interpret this string
|
115
|
+
# message Data {
|
116
|
+
# // The type of data sent to the box
|
117
|
+
# required string type = 1;
|
118
|
+
# // The data sent to the box
|
119
|
+
# required string data = 2;
|
120
|
+
# }
|
121
|
+
#
|
122
|
+
# // Result of the fling request execution:
|
123
|
+
# message FlingResult {
|
124
|
+
# enum Result {
|
125
|
+
# SUCCESS = 0;
|
126
|
+
# FAILURE = 1;
|
127
|
+
# }
|
128
|
+
# // Status
|
129
|
+
# required Result result = 1;
|
130
|
+
# }
|
131
|
+
|
132
|
+
require 'protobuf/message/message'
|
133
|
+
require 'protobuf/message/enum'
|
134
|
+
require 'protobuf/message/service'
|
135
|
+
require 'protobuf/message/extend'
|
136
|
+
|
137
|
+
::Protobuf::OPTIONS[:"java_outer_classname"] = "Messages"
|
138
|
+
::Protobuf::OPTIONS[:"java_package"] = "com.google.anymote"
|
139
|
+
::Protobuf::OPTIONS[:"optimize_for"] = :LITE_RUNTIME
|
140
|
+
|
141
|
+
require 'proto/keycodes.pb'
|
142
|
+
|
143
|
+
class RemoteMessage < ::Protobuf::Message
|
144
|
+
defined_in __FILE__
|
145
|
+
optional :uint32, :sequence_number, 1
|
146
|
+
optional :RequestMessage, :request_message, 2
|
147
|
+
optional :ResponseMessage, :response_message, 3
|
148
|
+
end
|
149
|
+
class RequestMessage < ::Protobuf::Message
|
150
|
+
defined_in __FILE__
|
151
|
+
optional :KeyEvent, :key_event_message, 1
|
152
|
+
optional :MouseEvent, :mouse_event_message, 2
|
153
|
+
optional :MouseWheel, :mouse_wheel_message, 3
|
154
|
+
optional :Data1, :data_message, 4
|
155
|
+
optional :Connect, :connect_message, 5
|
156
|
+
optional :Fling, :fling_message, 6
|
157
|
+
end
|
158
|
+
class ResponseMessage < ::Protobuf::Message
|
159
|
+
defined_in __FILE__
|
160
|
+
optional :Data1, :data_message, 1
|
161
|
+
optional :FlingResult, :fling_result_message, 3
|
162
|
+
end
|
163
|
+
class KeyEvent < ::Protobuf::Message
|
164
|
+
defined_in __FILE__
|
165
|
+
required :Code, :keycode, 1
|
166
|
+
required :Action, :action, 2
|
167
|
+
end
|
168
|
+
class MouseEvent < ::Protobuf::Message
|
169
|
+
defined_in __FILE__
|
170
|
+
required :int32, :x_delta, 1
|
171
|
+
required :int32, :y_delta, 2
|
172
|
+
end
|
173
|
+
class MouseWheel < ::Protobuf::Message
|
174
|
+
defined_in __FILE__
|
175
|
+
required :int32, :x_scroll, 1
|
176
|
+
required :int32, :y_scroll, 2
|
177
|
+
end
|
178
|
+
class Connect < ::Protobuf::Message
|
179
|
+
defined_in __FILE__
|
180
|
+
required :string, :device_name, 1
|
181
|
+
optional :int32, :version, 2
|
182
|
+
end
|
183
|
+
class Fling < ::Protobuf::Message
|
184
|
+
defined_in __FILE__
|
185
|
+
required :string, :uri, 1
|
186
|
+
end
|
187
|
+
class Data1 < ::Protobuf::Message
|
188
|
+
defined_in __FILE__
|
189
|
+
required :string, :type, 1
|
190
|
+
required :string, :data, 2
|
191
|
+
end
|
192
|
+
class FlingResult < ::Protobuf::Message
|
193
|
+
defined_in __FILE__
|
194
|
+
class Result < ::Protobuf::Enum
|
195
|
+
defined_in __FILE__
|
196
|
+
SUCCESS = value(:SUCCESS, 0)
|
197
|
+
FAILURE = value(:FAILURE, 1)
|
198
|
+
end
|
199
|
+
required :Result, :result, 1
|
200
|
+
end
|
@@ -0,0 +1,128 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) 2009 Google Inc. All rights reserved.
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
// Definition of the remote protocol messages.
|
18
|
+
|
19
|
+
syntax = "proto2";
|
20
|
+
|
21
|
+
option java_outer_classname = "Messages";
|
22
|
+
option java_package = "com.google.anymote";
|
23
|
+
option optimize_for = LITE_RUNTIME;
|
24
|
+
|
25
|
+
//
|
26
|
+
// HIGH LEVEL MESSAGE CONTAINERS
|
27
|
+
//
|
28
|
+
|
29
|
+
import "keycodes.proto";
|
30
|
+
|
31
|
+
message RemoteMessage {
|
32
|
+
// Optional sequence number. If present in the message with request_message
|
33
|
+
// present, the other end will reply with response_message with the same
|
34
|
+
// sequence_number
|
35
|
+
optional uint32 sequence_number = 1;
|
36
|
+
// Message for a request
|
37
|
+
optional RequestMessage request_message = 2;
|
38
|
+
// Message for a response
|
39
|
+
optional ResponseMessage response_message = 3;
|
40
|
+
}
|
41
|
+
|
42
|
+
message RequestMessage {
|
43
|
+
// Message for a key event
|
44
|
+
optional KeyEvent key_event_message = 1;
|
45
|
+
// Message for a mouse movement
|
46
|
+
optional MouseEvent mouse_event_message = 2;
|
47
|
+
// Message for a mouse wheel event
|
48
|
+
optional MouseWheel mouse_wheel_message = 3;
|
49
|
+
// Message containing data
|
50
|
+
optional Data data_message = 4;
|
51
|
+
// Message send upon connection
|
52
|
+
optional Connect connect_message = 5;
|
53
|
+
// Fling message
|
54
|
+
optional Fling fling_message = 6;
|
55
|
+
}
|
56
|
+
|
57
|
+
message ResponseMessage {
|
58
|
+
// Data message
|
59
|
+
optional Data data_message = 1;
|
60
|
+
// Fling result
|
61
|
+
optional FlingResult fling_result_message = 3;
|
62
|
+
}
|
63
|
+
|
64
|
+
//
|
65
|
+
// REQUEST MESSAGES
|
66
|
+
//
|
67
|
+
|
68
|
+
// Sends a key event to the server
|
69
|
+
message KeyEvent {
|
70
|
+
// Key code
|
71
|
+
required Code keycode = 1;
|
72
|
+
// Action (Up/Down)
|
73
|
+
required Action action = 2;
|
74
|
+
}
|
75
|
+
|
76
|
+
// Sends a mouse event to the server
|
77
|
+
message MouseEvent {
|
78
|
+
// Relative movement of the cursor on the xAxis
|
79
|
+
required int32 x_delta = 1;
|
80
|
+
// Relative movement of the cursor on the yAxis
|
81
|
+
required int32 y_delta = 2;
|
82
|
+
}
|
83
|
+
|
84
|
+
// Sends a mouse wheel to the server
|
85
|
+
message MouseWheel {
|
86
|
+
// Scrolling along the x-axis
|
87
|
+
required int32 x_scroll = 1;
|
88
|
+
// Scrolling along the y-axis
|
89
|
+
required int32 y_scroll = 2;
|
90
|
+
}
|
91
|
+
|
92
|
+
message Connect {
|
93
|
+
// Remote device name
|
94
|
+
required string device_name = 1;
|
95
|
+
// Version number for a given device software
|
96
|
+
optional int32 version = 2;
|
97
|
+
}
|
98
|
+
|
99
|
+
message Fling {
|
100
|
+
// Flinged URI
|
101
|
+
required string uri = 1;
|
102
|
+
}
|
103
|
+
|
104
|
+
//
|
105
|
+
// RESPONSE MESSAGES
|
106
|
+
//
|
107
|
+
|
108
|
+
//
|
109
|
+
// TWO-WAY MESSAGES
|
110
|
+
//
|
111
|
+
|
112
|
+
// Sends a string and a type to interpret this string
|
113
|
+
message Data {
|
114
|
+
// The type of data sent to the box
|
115
|
+
required string type = 1;
|
116
|
+
// The data sent to the box
|
117
|
+
required string data = 2;
|
118
|
+
}
|
119
|
+
|
120
|
+
// Result of the fling request execution:
|
121
|
+
message FlingResult {
|
122
|
+
enum Result {
|
123
|
+
SUCCESS = 0;
|
124
|
+
FAILURE = 1;
|
125
|
+
}
|
126
|
+
// Status
|
127
|
+
required Result result = 1;
|
128
|
+
}
|