-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy pathswitch.proto
61 lines (48 loc) · 1.81 KB
/
switch.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
syntax = "proto3";
package viam.component.switch.v1;
import "common/v1/common.proto";
import "google/api/annotations.proto";
import "google/protobuf/struct.proto";
option go_package = "go.viam.com/api/component/switch/v1";
option java_package = "com.viam.component.switch.v1";
// A SwitchService services switches associated with a machine.
// Switches can have multiple discrete positions - e.g. a simple
// switch has 2 positions, but a knob could have 10 positions.
service SwitchService {
// Set the position of the switch
rpc SetPosition(SetPositionRequest) returns (SetPositionResponse) {
option (google.api.http) = {put: "/viam/api/v1/component/switch/{name}/set_position"};
}
// Get the position of the switch
rpc GetPosition(GetPositionRequest) returns (GetPositionResponse) {
option (google.api.http) = {put: "/viam/api/v1/component/switch/{name}/get_position"};
}
// Get the number of positions that the switch supports
rpc GetNumberOfPositions(GetNumberOfPositionsRequest) returns (GetNumberOfPositionsResponse) {
option (google.api.http) = {put: "/viam/api/v1/component/switch/{name}/get_number_of_positions"};
}
// DoCommand sends/receives arbitrary commands
rpc DoCommand(common.v1.DoCommandRequest) returns (common.v1.DoCommandResponse) {
option (google.api.http) = {post: "/viam/api/v1/component/switch/{name}/do_command"};
}
}
message SetPositionRequest {
string name = 1;
uint32 position = 2;
google.protobuf.Struct extra = 99;
}
message SetPositionResponse {}
message GetPositionRequest {
string name = 1;
google.protobuf.Struct extra = 99;
}
message GetPositionResponse {
uint32 position = 1;
}
message GetNumberOfPositionsRequest {
string name = 1;
google.protobuf.Struct extra = 99;
}
message GetNumberOfPositionsResponse {
uint32 number_of_positions = 1;
}