Added protobuf service

This commit is contained in:
2017-04-14 20:19:18 +02:00
parent 239c659027
commit 3c1c420747
3 changed files with 30 additions and 64 deletions

View File

@@ -14,10 +14,6 @@ message Client {
map<string, string> options = 10;
}
message Clients {
repeated Client clients = 1;
}
message ClientSetPercentageAll {
float percentage = 1;
repeated int32 client_id = 2;

View File

@@ -7,8 +7,9 @@ import "hsv.proto";
message LED {
string name = 1;
int32 id = 2;
int32 local_id = 3;
int32 client_id = 4;
int32 remote_id = 3;
int32 client_unique = 4;
HSV color = 5;
map<string, string> options = 10;
}
@@ -23,29 +24,7 @@ message LEDGroup {
int32 id = 2;
GroupType type = 3;
int32 size = 4;
HSV color = 5;
repeated int32 led_ids = 10;
}
message LEDs {
repeated LED leds = 1;
}
message LEDGroups {
repeated LEDGroup led_groups = 1;
}
message LEDPercentage {
int32 led = 1;
float percentage = 2;
}
message LEDGroupColor {
int32 group = 1;
HSV color = 2;
}
message LEDGroupPercentage {
int32 group = 1;
float perc = 2;
}

View File

@@ -4,47 +4,38 @@ package ledd;
import "led.proto";
import "client.proto";
import "google/protobuf/any.proto";
import "google/protobuf/empty.proto";
service LedDService {
rpc getLED (LED) returns (RPCResponse) {}
rpc getLEDs (google.protobuf.Empty) returns (RPCResponse) {}
rpc addLED (LED) returns (RPCResponse) {}
rpc addLEDGroup (LEDGroup) returns (RPCResponse) {}
rpc addLEDGroups (google.protobuf.Empty) returns (RPCResponse) {}
rpc removeLED(LED) returns (RPCResponse) {}
rpc removeLEDGroup(LEDGroup) returns (RPCResponse) {}
rpc addClient(Client) returns (RPCResponse) {}
rpc removeClient(Client) returns (RPCResponse) {}
rpc init(Client) returns (LedD) {}
rpc updateClient(Client) returns (RPCResponse) {}
}
message LedD {
string hostname = 1;
string version = 2;
string unique = 3;
}
message WrapperMsg {
enum Type {
LED_GET_ALL = 0;
LED_ADD = 1;
CLIENT_ADD = 2;
CLIENT_SET_PERC_ALL = 3;
LED_PERC_SET = 4;
LED_PERC_GET = 5;
CLIENT_LED_SET = 6;
DISCOVER = 7;
CLIENT_GET = 8;
CLIENT_GET_LED_OPTIONS = 9;
CLIENT_SET_LOCAL_DIRECT = 10;
LEDGROUP_GET = 11;
LEDGROUP_GET_ALL = 12;
LEDGROUP_SET_COLOR = 13;
LEDGROUP_ADD = 14;
message RPCResponse {
enum ResponseType {
OK = 0;
ERROR = 1;
INVALID_REQUEST = 2;
}
// Identifies which field is filled in.
Type type = 1;
// One of the following will be filled in.
LED led = 2;
LEDs leds = 3;
LEDGroup led_group = 4;
LEDGroups led_groups = 5;
LEDPercentage led_perc = 6;
LEDGroupColor led_group_color = 7;
LedD ledd = 8;
Client client = 9;
Clients clients = 10;
ClientSetLocalDirect client_set_direct = 11;
ClientLEDOptions client_led_options = 12;
ClientSetPercentageAll client_set_perc_all = 13;
LEDGroupPercentage led_group_perc = 14;
ResponseType status = 1;
string msg = 2;
repeated google.protobuf.Any payload = 3;
}