diff --git a/backend.proto b/backend.proto new file mode 100644 index 0000000..eca3158 --- /dev/null +++ b/backend.proto @@ -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 options = 10; +} + +message BackendSetAll { + int32 value = 1; +} + +message BackendSetLocalDirect { + int32 channel = 1; + int32 value = 2; +} + +message BackendLEDOptions { + map options = 1; +} + +message BackendSetChannel { + map 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; + } +} diff --git a/client.proto b/client.proto index 8a48cbb..791fd29 100644 --- a/client.proto +++ b/client.proto @@ -2,28 +2,56 @@ syntax = "proto3"; package ledd; +import "hcl.proto"; +import "led.proto"; + message Client { - int32 max_led = 3; - string name = 4; - string platform = 5; - string version = 6; - int32 resolution = 7; - int32 port = 8; - - map options = 10; + string type = 1; } -message ClientSetPercentageAll { - float percentage = 1; - repeated int32 client_id = 2; +message AddLED { + string name = 1; + string backend = 2; + repeated int32 channel = 3; } -message ClientSetLocalDirect { - int32 local_id = 1; - float percentage = 2; +message RemoveLED { + string name = 1; } -message ClientLEDOptions { - map options = 1; +message SetLED { + 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; + } +} diff --git a/hcl.proto b/hcl.proto new file mode 100644 index 0000000..05817a1 --- /dev/null +++ b/hcl.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package ledd; + +message HCL { + double hue = 1; + double chroma = 2; + double light = 3; +} \ No newline at end of file diff --git a/hsv.proto b/hsv.proto deleted file mode 100644 index 75201a7..0000000 --- a/hsv.proto +++ /dev/null @@ -1,9 +0,0 @@ -syntax = "proto3"; - -package ledd; - -message HSV { - float hue = 1; - float sat = 2; - float val = 3; -} \ No newline at end of file diff --git a/led.proto b/led.proto index 9a6a5f8..29b7d90 100644 --- a/led.proto +++ b/led.proto @@ -2,29 +2,9 @@ syntax = "proto3"; package ledd; -import "hsv.proto"; +import "hcl.proto"; message LED { string name = 1; - int32 id = 2; - int32 remote_id = 3; - int32 client_unique = 4; - HSV color = 5; - - map 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; + HCL color = 2; } \ No newline at end of file diff --git a/ledd.proto b/ledd.proto deleted file mode 100644 index bada61f..0000000 --- a/ledd.proto +++ /dev/null @@ -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; -}