Reworked protocol to fit new simplified approch (first rough concept)
This commit is contained in:
40
backend.proto
Normal file
40
backend.proto
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package ledd;
|
||||||
|
|
||||||
|
message Backend {
|
||||||
|
int32 channel = 3;
|
||||||
|
string name = 4;
|
||||||
|
string type = 5;
|
||||||
|
string version = 6;
|
||||||
|
int32 resolution = 7;
|
||||||
|
|
||||||
|
map<string, string> options = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BackendSetAll {
|
||||||
|
int32 value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BackendSetLocalDirect {
|
||||||
|
int32 channel = 1;
|
||||||
|
int32 value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BackendLEDOptions {
|
||||||
|
map<string, string> options = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BackendSetChannel {
|
||||||
|
map <int32, int32> new_channel_values = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BackendWrapperMessage {
|
||||||
|
oneof msg {
|
||||||
|
Backend m_backend = 2;
|
||||||
|
BackendSetAll m_set_all = 3;
|
||||||
|
BackendSetLocalDirect m_set_local_direct = 4;
|
||||||
|
BackendLEDOptions m_options = 5;
|
||||||
|
BackendSetChannel m_set_channel = 6;
|
||||||
|
}
|
||||||
|
}
|
60
client.proto
60
client.proto
@@ -2,28 +2,56 @@ syntax = "proto3";
|
|||||||
|
|
||||||
package ledd;
|
package ledd;
|
||||||
|
|
||||||
|
import "hcl.proto";
|
||||||
|
import "led.proto";
|
||||||
|
|
||||||
message Client {
|
message Client {
|
||||||
int32 max_led = 3;
|
string type = 1;
|
||||||
string name = 4;
|
|
||||||
string platform = 5;
|
|
||||||
string version = 6;
|
|
||||||
int32 resolution = 7;
|
|
||||||
int32 port = 8;
|
|
||||||
|
|
||||||
map<string, string> options = 10;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message ClientSetPercentageAll {
|
message AddLED {
|
||||||
float percentage = 1;
|
string name = 1;
|
||||||
repeated int32 client_id = 2;
|
string backend = 2;
|
||||||
|
repeated int32 channel = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ClientSetLocalDirect {
|
message RemoveLED {
|
||||||
int32 local_id = 1;
|
string name = 1;
|
||||||
float percentage = 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message ClientLEDOptions {
|
message SetLED {
|
||||||
map<string, string> options = 1;
|
string name = 1;
|
||||||
|
HCL colour = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message GetLED {
|
||||||
|
string name = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SetDirect {
|
||||||
|
string backend = 1;
|
||||||
|
int32 channel = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RPCResponse {
|
||||||
|
enum ResponseType {
|
||||||
|
OK = 0;
|
||||||
|
ERROR = 1;
|
||||||
|
INVALID_REQUEST = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
ResponseType status = 1;
|
||||||
|
string err_msg = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ClientWrapperMessage {
|
||||||
|
repeated LED leds = 1;
|
||||||
|
oneof msg {
|
||||||
|
Client m_client = 2;
|
||||||
|
AddLED m_add_led = 3;
|
||||||
|
RemoveLED m_remove_led = 4;
|
||||||
|
SetLED m_set_led = 5;
|
||||||
|
GetLED m_get_led = 6;
|
||||||
|
SetDirect m_set_direct = 7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
9
hcl.proto
Normal file
9
hcl.proto
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package ledd;
|
||||||
|
|
||||||
|
message HCL {
|
||||||
|
double hue = 1;
|
||||||
|
double chroma = 2;
|
||||||
|
double light = 3;
|
||||||
|
}
|
@@ -1,9 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package ledd;
|
|
||||||
|
|
||||||
message HSV {
|
|
||||||
float hue = 1;
|
|
||||||
float sat = 2;
|
|
||||||
float val = 3;
|
|
||||||
}
|
|
24
led.proto
24
led.proto
@@ -2,29 +2,9 @@ syntax = "proto3";
|
|||||||
|
|
||||||
package ledd;
|
package ledd;
|
||||||
|
|
||||||
import "hsv.proto";
|
import "hcl.proto";
|
||||||
|
|
||||||
message LED {
|
message LED {
|
||||||
string name = 1;
|
string name = 1;
|
||||||
int32 id = 2;
|
HCL color = 2;
|
||||||
int32 remote_id = 3;
|
|
||||||
int32 client_unique = 4;
|
|
||||||
HSV color = 5;
|
|
||||||
|
|
||||||
map<string, string> options = 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
message LEDGroup {
|
|
||||||
enum GroupType {
|
|
||||||
RGB = 0;
|
|
||||||
USER = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
string name = 1;
|
|
||||||
int32 id = 2;
|
|
||||||
GroupType type = 3;
|
|
||||||
int32 size = 4;
|
|
||||||
HSV color = 5;
|
|
||||||
|
|
||||||
repeated int32 led_ids = 10;
|
|
||||||
}
|
}
|
42
ledd.proto
42
ledd.proto
@@ -1,42 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package ledd;
|
|
||||||
|
|
||||||
import "led.proto";
|
|
||||||
import "client.proto";
|
|
||||||
import "google/protobuf/any.proto";
|
|
||||||
import "google/protobuf/empty.proto";
|
|
||||||
|
|
||||||
service LEDInterface {
|
|
||||||
rpc GetLED (LED) returns (RPCResponse) {}
|
|
||||||
rpc ListLED (google.protobuf.Empty) returns (stream LED) {}
|
|
||||||
rpc AddLED (LED) returns (RPCResponse) {}
|
|
||||||
rpc AddLEDGroup (LEDGroup) returns (RPCResponse) {}
|
|
||||||
rpc ListLEDGroup (google.protobuf.Empty) returns (stream LEDGroup) {}
|
|
||||||
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) {}
|
|
||||||
rpc UpdateLED(stream LED) returns (stream LED) {}
|
|
||||||
rpc UpdateLEDGroup(stream LEDGroup) returns (stream LEDGroup) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
message LedD {
|
|
||||||
string hostname = 1;
|
|
||||||
string version = 2;
|
|
||||||
string unique = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message RPCResponse {
|
|
||||||
enum ResponseType {
|
|
||||||
OK = 0;
|
|
||||||
ERROR = 1;
|
|
||||||
INVALID_REQUEST = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
ResponseType status = 1;
|
|
||||||
string msg = 2;
|
|
||||||
repeated google.protobuf.Any payload = 3;
|
|
||||||
}
|
|
Reference in New Issue
Block a user