Skip to content

Commit

Permalink
APP-7497: Add Button and Switch APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanlookpotts committed Jan 23, 2025
1 parent e6bd6ba commit 2d0a61d
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
32 changes: 32 additions & 0 deletions proto/viam/component/button/v1/button.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
syntax = "proto3";

package viam.component.button.v1;

import "common/v1/common.proto";
import "google/api/annotations.proto";
import "google/protobuf/struct.proto";

option go_package = "go.viam.com/api/component/button/v1";
option java_package = "com.viam.component.button.v1";

// A ButtonService services buttons associated with a machine
service ButtonService {
// Pushes a button
rpc Push(PushRequest) returns (PushResponse) {
option (common.v1.safety_heartbeat_monitored) = true;
option (google.api.http) = {put: "/viam/api/v1/component/button/{name}/push"};
}

// DoCommand sends/receives arbitrary commands
rpc DoCommand(common.v1.DoCommandRequest) returns (common.v1.DoCommandResponse) {
option (google.api.http) = {post: "/viam/api/v1/component/gripper/{name}/do_command"};
}
}

message PushRequest {
string name = 1;
google.protobuf.Struct extra = 99;
}

message PushResponse {}

45 changes: 45 additions & 0 deletions proto/viam/component/switch/v1/switch.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
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
service SwitchService {
// Turns on the switch
rpc On(OnRequest) returns (OnResponse) {
option (common.v1.safety_heartbeat_monitored) = true;
option (google.api.http) = {put: "/viam/api/v1/component/switch/{name}/on"};
}

// Turns off the switch
rpc Off(OffRequest) returns (OffResponse) {
option (common.v1.safety_heartbeat_monitored) = true;
option (google.api.http) = {put: "/viam/api/v1/component/switch/{name}/off"};
}

// DoCommand sends/receives arbitrary commands
rpc DoCommand(common.v1.DoCommandRequest) returns (common.v1.DoCommandResponse) {
option (google.api.http) = {post: "/viam/api/v1/component/gripper/{name}/do_command"};
}
}

message OnRequest {
string name = 1;
google.protobuf.Struct extra = 99;
}

message OnResponse {}

message OffRequest {
string name = 1;
google.protobuf.Struct extra = 99;
}

message OffResponse {}

0 comments on commit 2d0a61d

Please sign in to comment.