forked from amkovkov/GranuSightSoftware2
Первый коммит
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Protobuf Include="..\lights.proto" GrpcServices="Client" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Google.Protobuf" Version="3.18.0" />
|
||||
<PackageReference Include="Grpc.Net.Client" Version="2.52.0" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.40.0">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,10 @@
|
||||
LED_COUNT=9
|
||||
LED_PIN=23
|
||||
|
||||
GAMMA=2.2
|
||||
TIMEOUT=5
|
||||
|
||||
IDLE_BRIGHTNESS=0.30
|
||||
IDLE_R=0
|
||||
IDLE_G=96
|
||||
IDLE_B=175
|
||||
@@ -0,0 +1 @@
|
||||
!.env
|
||||
@@ -0,0 +1,932 @@
|
||||
import os, time, threading, colorsys, math, random, datetime
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import List, Tuple
|
||||
from concurrent import futures
|
||||
from dotenv import load_dotenv
|
||||
import grpc
|
||||
import board
|
||||
import neopixel
|
||||
import psutil
|
||||
|
||||
import lights_pb2
|
||||
import lights_pb2_grpc
|
||||
|
||||
Color = Tuple[int, int , int]
|
||||
|
||||
load_dotenv()
|
||||
def get_env(name) -> str:
|
||||
value = os.getenv(name)
|
||||
if value is None:
|
||||
raise RuntimeError(f"Environment variable not found: {name}")
|
||||
return value
|
||||
def get_env_int(name) -> int:
|
||||
return int(get_env(name))
|
||||
def get_env_float(name) -> float:
|
||||
return float(get_env(name))
|
||||
def get_env_str(name) -> str:
|
||||
return get_env(name)
|
||||
|
||||
def hasattr_all(obj: object, names: List[str]) -> bool:
|
||||
return all([hasattr(obj, name) for name in names])
|
||||
|
||||
LED_COUNT = get_env_int("LED_COUNT")
|
||||
LED_PIN_NUM = get_env_int("LED_PIN")
|
||||
LED_PIN = getattr(board, f"D{LED_PIN_NUM}")
|
||||
|
||||
GAMMA = get_env_float("GAMMA")
|
||||
TIMEOUT = get_env_float("TIMEOUT")
|
||||
|
||||
IDLE_SPEED = get_env_float("IDLE_SPEED")
|
||||
IDLE_BRIGHTNESS = get_env_float("IDLE_BRIGHTNESS")
|
||||
IDLE_COLOR = (
|
||||
get_env_int("IDLE_R"),
|
||||
get_env_int("IDLE_G"),
|
||||
get_env_int("IDLE_B")
|
||||
)
|
||||
|
||||
class Animation(ABC):
|
||||
@abstractmethod
|
||||
def get_pixels(self, time: float, count: int) -> List[Color]:
|
||||
raise NotImplementedError()
|
||||
|
||||
class OffAnimation(Animation):
|
||||
def get_pixels(self, time: float, count: int) -> List[Color]:
|
||||
return [(0, 0, 0)] * count
|
||||
|
||||
class StaticColorAnimation(Animation):
|
||||
def __init__(self, color: Color):
|
||||
self._color = color
|
||||
|
||||
def get_pixels(self, time: float, count: int) -> List[Color]:
|
||||
return [self._color] * count
|
||||
|
||||
class StaticGradient2Animation(Animation):
|
||||
def __init__(self, left_color: Color, right_color: Color):
|
||||
self._left_color = left_color
|
||||
self._right_color = right_color
|
||||
|
||||
def get_pixels(self, time: float, count: int) -> List[Color]:
|
||||
if count <= 0:
|
||||
return []
|
||||
if count == 1:
|
||||
return [self._left_color]
|
||||
|
||||
out = []
|
||||
(r1, g1, b1) = self._left_color
|
||||
(r2, g2, b2) = self._right_color
|
||||
|
||||
for i in range(count):
|
||||
pos = i / (count - 1)
|
||||
r = int(r1 * (1 - pos) + r2 * pos)
|
||||
g = int(g1 * (1 - pos) + g2 * pos)
|
||||
b = int(b1 * (1 - pos) + b2 * pos)
|
||||
out.append((r, g, b))
|
||||
|
||||
return out
|
||||
|
||||
class StaticGradient3Animation(Animation):
|
||||
def __init__(self, left_color: Color, middle_color: Color, right_color: Color):
|
||||
self._left_color = left_color
|
||||
self._middle_color = middle_color
|
||||
self._right_color = right_color
|
||||
|
||||
def get_pixels(self, time: float, count: int) -> List[Color]:
|
||||
if count <= 0:
|
||||
return []
|
||||
if count == 1:
|
||||
return [self._left_color]
|
||||
|
||||
out = []
|
||||
(c1r, c1g, c1b) = self._left_color
|
||||
(c2r, c2g, c2b) = self._middle_color
|
||||
(c3r, c3g, c3b) = self._right_color
|
||||
|
||||
for i in range(count):
|
||||
pos = i / (count - 1)
|
||||
|
||||
if pos < 0.5:
|
||||
f = pos * 2
|
||||
r = int(c1r * (1 - f) + c2r * f)
|
||||
g = int(c1g * (1 - f) + c2g * f)
|
||||
b = int(c1b * (1 - f) + c2b * f)
|
||||
else:
|
||||
f = (pos - 0.5) * 2
|
||||
r = int(c2r * (1 - f) + c3r * f)
|
||||
g = int(c2g * (1 - f) + c3g * f)
|
||||
b = int(c2b * (1 - f) + c3b * f)
|
||||
|
||||
out.append((r, g, b))
|
||||
|
||||
return out
|
||||
|
||||
class StaticRainbowAnimation(Animation):
|
||||
def get_pixels(self, time: float, count: int) -> List[Color]:
|
||||
if count == 0:
|
||||
return []
|
||||
if count == 1:
|
||||
return [(255, 0, 0)]
|
||||
|
||||
out = []
|
||||
|
||||
for i in range(count):
|
||||
hue = i / count
|
||||
r, g, b = colorsys.hsv_to_rgb(hue, 1.0, 1.0)
|
||||
out.append((int(r * 255), int(g * 255), int(b * 255)))
|
||||
|
||||
return out
|
||||
|
||||
class BreathingColorAnimation(Animation):
|
||||
def __init__(self, speed: float, color: Color):
|
||||
self._speed = speed
|
||||
self._color = color
|
||||
|
||||
def get_pixels(self, time: float, count: int) -> List[Color]:
|
||||
if count <= 0:
|
||||
return []
|
||||
|
||||
intensity = (math.sin(time * self._speed) + 1) / 2
|
||||
|
||||
r = int(self._color[0] * intensity)
|
||||
g = int(self._color[1] * intensity)
|
||||
b = int(self._color[2] * intensity)
|
||||
|
||||
return [(r, g, b)] * count
|
||||
|
||||
class BreathingGradient2Animation(Animation):
|
||||
def __init__(self, speed: float, left_color: Color, right_color: Color):
|
||||
self._speed = speed
|
||||
self._left_color = left_color
|
||||
self._right_color = right_color
|
||||
|
||||
def get_pixels(self, time: float, count: int) -> List[Color]:
|
||||
intensity = (math.sin(time * self._speed) + 1) / 2
|
||||
|
||||
if count <= 0:
|
||||
return []
|
||||
if count == 1:
|
||||
return [(
|
||||
int(self._left_color[0] * intensity),
|
||||
int(self._left_color[1] * intensity),
|
||||
int(self._left_color[2] * intensity)
|
||||
)]
|
||||
|
||||
out = []
|
||||
(r1, g1, b1) = self._left_color
|
||||
(r2, g2, b2) = self._right_color
|
||||
|
||||
for i in range(count):
|
||||
pos = i / (count - 1)
|
||||
r = int((r1 * (1 - pos) + r2 * pos) * intensity)
|
||||
g = int((g1 * (1 - pos) + g2 * pos) * intensity)
|
||||
b = int((b1 * (1 - pos) + b2 * pos) * intensity)
|
||||
out.append((r, g, b))
|
||||
|
||||
return out
|
||||
|
||||
class BreathingGradient3Animation(Animation):
|
||||
def __init__(self, speed: float, left_color: Color, middle_color: Color, right_color: Color):
|
||||
self._speed = speed
|
||||
self._left_color = left_color
|
||||
self._middle_color = middle_color
|
||||
self._right_color = right_color
|
||||
|
||||
def get_pixels(self, time: float, count: int) -> List[Color]:
|
||||
intensity = (math.sin(time * self._speed) + 1) / 2
|
||||
|
||||
if count == 0:
|
||||
return []
|
||||
if count == 1:
|
||||
return [(
|
||||
int(self._left_color[0] * intensity),
|
||||
int(self._left_color[1] * intensity),
|
||||
int(self._left_color[2] * intensity)
|
||||
)]
|
||||
|
||||
out = []
|
||||
(c1r, c1g, c1b) = self._left_color
|
||||
(c2r, c2g, c2b) = self._middle_color
|
||||
(c3r, c3g, c3b) = self._right_color
|
||||
|
||||
for i in range(count):
|
||||
pos = i / (count - 1)
|
||||
|
||||
if pos < 0.5:
|
||||
f = pos * 2
|
||||
r = int((c1r * (1 - f) + c2r * f) * intensity)
|
||||
g = int((c1g * (1 - f) + c2g * f) * intensity)
|
||||
b = int((c1b * (1 - f) + c2b * f) * intensity)
|
||||
else:
|
||||
f = (pos - 0.5) * 2
|
||||
r = int((c2r * (1 - f) + c3r * f) * intensity)
|
||||
g = int((c2g * (1 - f) + c3g * f) * intensity)
|
||||
b = int((c2b * (1 - f) + c3b * f) * intensity)
|
||||
|
||||
out.append((r, g, b))
|
||||
|
||||
return out
|
||||
|
||||
class BreathingRainbowAnimation(Animation):
|
||||
def __init__(self, speed: float):
|
||||
self._speed = speed
|
||||
|
||||
def get_pixels(self, time: float, count: int) -> List[Color]:
|
||||
intensity = (math.sin(time * self._speed) + 1) / 2
|
||||
|
||||
if count == 0:
|
||||
return []
|
||||
if count <= 1:
|
||||
return [(255 * intensity, 0, 0)]
|
||||
|
||||
out = []
|
||||
|
||||
for i in range(count):
|
||||
hue = i / count
|
||||
r, g, b = colorsys.hsv_to_rgb(hue, 1.0, 1.0)
|
||||
out.append((int(r * 255 * intensity), int(g * 255 * intensity), int(b * 255 * intensity)))
|
||||
|
||||
return out
|
||||
|
||||
class RunningColorAnimation(Animation):
|
||||
def __init__(self, speed: float, length: int, fade: int, color: Color):
|
||||
self._speed = speed
|
||||
self._length = length
|
||||
self._fade = fade
|
||||
self._color = color
|
||||
|
||||
def get_pixels(self, time: float, count: int) -> List[Color]:
|
||||
if count <= 0:
|
||||
return []
|
||||
|
||||
out = []
|
||||
|
||||
center = (time * self._speed) % count
|
||||
|
||||
for i in range(count):
|
||||
raw_dist = abs(i - center)
|
||||
dist = min(raw_dist, count - raw_dist)
|
||||
|
||||
if dist <= self._length:
|
||||
intensity = 1.0
|
||||
elif dist <= self._length + self._fade:
|
||||
fade_pos = dist - self._length
|
||||
intensity = 1.0 - fade_pos / self._fade
|
||||
else:
|
||||
intensity = 0.0
|
||||
|
||||
r = int(self._color[0] * intensity)
|
||||
g = int(self._color[1] * intensity)
|
||||
b = int(self._color[2] * intensity)
|
||||
out.append((r, g, b))
|
||||
|
||||
return out
|
||||
|
||||
class RunningGradient2Animation(Animation):
|
||||
def __init__(self, speed: float, left_color: Color, right_color: Color):
|
||||
self._speed = speed
|
||||
self._left_color = left_color
|
||||
self._right_color = right_color
|
||||
|
||||
def get_pixels(self, time: float, count: int) -> List[Color]:
|
||||
if count <= 0:
|
||||
return []
|
||||
|
||||
(r1, g1, b1) = self._left_color
|
||||
(r2, g2, b2) = self._right_color
|
||||
|
||||
shift = (time * self._speed) / (count - 1)
|
||||
out = []
|
||||
|
||||
for i in range(count):
|
||||
pos = (i / (count - 1) + shift) % 1.0
|
||||
|
||||
r = int(r1 * (1 - pos) + r2 * pos)
|
||||
g = int(g1 * (1 - pos) + g2 * pos)
|
||||
b = int(b1 * (1 - pos) + b2 * pos)
|
||||
out.append((r, g, b))
|
||||
|
||||
return out
|
||||
|
||||
class RunningGradient3Animation(Animation):
|
||||
def __init__(self, speed: float, left_color: Color, middle_color: Color, right_color: Color):
|
||||
self._speed = speed
|
||||
self._left_color = left_color
|
||||
self._middle_color = middle_color
|
||||
self._right_color = right_color
|
||||
|
||||
def get_pixels(self, time: float, count: int) -> List[Color]:
|
||||
if count <= 0:
|
||||
return []
|
||||
|
||||
(c1r, c1g, c1b) = self._left_color
|
||||
(c2r, c2g, c2b) = self._middle_color
|
||||
(c3r, c3g, c3b) = self._right_color
|
||||
|
||||
shift = (time * self._speed) / (count - 1)
|
||||
out = []
|
||||
|
||||
for i in range(count):
|
||||
pos = (i / (count - 1) + shift) % 1.0
|
||||
|
||||
if pos < 0.5:
|
||||
f = pos * 2
|
||||
r = int(c1r * (1 - f) + c2r * f)
|
||||
g = int(c1g * (1 - f) + c2g * f)
|
||||
b = int(c1b * (1 - f) + c2b * f)
|
||||
else:
|
||||
f = (pos - 0.5) * 2
|
||||
r = int(c2r * (1 - f) + c3r * f)
|
||||
g = int(c2g * (1 - f) + c3g * f)
|
||||
b = int(c2b * (1 - f) + c3b * f)
|
||||
|
||||
out.append((r, g, b))
|
||||
|
||||
return out
|
||||
|
||||
class RunningRainbowAnimation(Animation):
|
||||
def __init__(self, speed: float):
|
||||
self._speed = speed
|
||||
|
||||
def get_pixels(self, time: float, count: int) -> List[Color]:
|
||||
if count <= 0:
|
||||
return []
|
||||
|
||||
shift = (time * self._speed)
|
||||
out = []
|
||||
|
||||
for i in range(count):
|
||||
hue = (i + shift) % 1.0
|
||||
r, g, b = colorsys.hsv_to_rgb(hue, 1.0, 1.0)
|
||||
out.append((int(r * 255), int(g * 255), int(b * 255)))
|
||||
|
||||
return out
|
||||
|
||||
class SnakeAnimation(Animation):
|
||||
def __init__(self, speed: float, head_length: int, tail_length: int, head_color: Color, tail_color: Color):
|
||||
self._speed = speed
|
||||
self._head_length = head_length
|
||||
self._tail_length = tail_length
|
||||
self._head_color = head_color
|
||||
self._tail_color = tail_color
|
||||
|
||||
def get_pixels(self, time: float, count: int) -> List[Color]:
|
||||
if count == 0:
|
||||
return []
|
||||
|
||||
out = [(0, 0, 0)] * count
|
||||
head_pos = (time * self._speed) % count
|
||||
|
||||
for i in range(count):
|
||||
dist = (i - head_pos) % count
|
||||
|
||||
if 0 <= dist < self._head_length:
|
||||
factor = 1.0
|
||||
elif self._head_length <= dist < self._head_length + self._tail_length:
|
||||
t = dist - self._head_length
|
||||
factor = max(0.0, 1.0 - t / self._tail_length)
|
||||
else:
|
||||
continue
|
||||
|
||||
(hr, hg, hb) = self._head_color
|
||||
(tr, tg, tb) = self._tail_color
|
||||
|
||||
r = int(hr * factor + tr * (1 - factor))
|
||||
g = int(hg * factor + tg * (1 - factor))
|
||||
b = int(hb * factor + tb * (1 - factor))
|
||||
out[i] = (r, g, b)
|
||||
|
||||
return out
|
||||
|
||||
class FireAnimation(Animation):
|
||||
def __init__(self, speed: float, color: Color):
|
||||
self._speed = speed
|
||||
self._color = color
|
||||
|
||||
def get_pixels(self, time: float, count: int) -> List[Color]:
|
||||
if count == 0:
|
||||
return []
|
||||
|
||||
(r0, g0, b0) = self._color
|
||||
out = []
|
||||
|
||||
for i in range(count):
|
||||
flicker = math.sin(i * 0.25 + time * self._speed)
|
||||
flicker = 0.5 + 0.5 * flicker # -> [0..1]
|
||||
|
||||
flicker *= 0.7 + 0.3 * random.random()
|
||||
|
||||
r = int(r0 * flicker)
|
||||
g = int(g0 * flicker)
|
||||
b = int(b0 * flicker)
|
||||
out.append((r, g, b))
|
||||
|
||||
return out
|
||||
|
||||
class SnowfallAnimation(Animation):
|
||||
def __init__(self, speed: float, color: Color):
|
||||
self._speed = speed
|
||||
self._color = color
|
||||
self._state = []
|
||||
|
||||
def get_pixels(self, time: float, count: int) -> List[Color]:
|
||||
if len(self._state) != count:
|
||||
self._state = [0.0] * count
|
||||
|
||||
(r0, g0, b0) = self._color
|
||||
out = []
|
||||
|
||||
for i in range(count):
|
||||
if self._state[i] <= 0 and random.random() < self._speed * 0.02:
|
||||
self._state[i] = 1.0
|
||||
|
||||
self._state[i] = max(0.0, self._state[i] - 0.02 * self._speed)
|
||||
|
||||
brightness = self._state[i]
|
||||
|
||||
r = int(r0 * brightness)
|
||||
g = int(g0 * brightness)
|
||||
b = int(b0 * brightness)
|
||||
out.append((r, g, b))
|
||||
|
||||
return out
|
||||
|
||||
class FlashAnimation(Animation):
|
||||
def __init__(self, speed: float, color: Color):
|
||||
self._speed = speed
|
||||
self._color = color
|
||||
self._start_time = None
|
||||
|
||||
def get_pixels(self, time: float, count: int) -> List[Color]:
|
||||
if count == 0:
|
||||
return []
|
||||
|
||||
if self._start_time == None:
|
||||
self._start_time = time
|
||||
|
||||
(r0, g0, b0) = self._color
|
||||
|
||||
brightness = math.exp(-(time - self._start_time) * self._speed)
|
||||
brightness = max(0.0, min(1.0, brightness))
|
||||
|
||||
r = int(r0 * brightness)
|
||||
g = int(g0 * brightness)
|
||||
b = int(b0 * brightness)
|
||||
|
||||
return [(r, g, b)] * count
|
||||
|
||||
class LoadAnimation(Animation):
|
||||
def __init__(self, speed: float, percent: float, last_percent: float, color: Color):
|
||||
self._speed = speed
|
||||
self._percent = max(0.0, min(100.0, percent))
|
||||
self._last_percent = max(0.0, min(100.0, last_percent))
|
||||
self._color = color
|
||||
self._last_time = None
|
||||
|
||||
def get_pixels(self, time: float, count: int) -> List[Color]:
|
||||
if count <= 0:
|
||||
return []
|
||||
|
||||
if self._last_time == None:
|
||||
self._last_time = time
|
||||
dt = time - self._last_time
|
||||
self._last_time = time
|
||||
|
||||
smoothed_percent = self._last_percent + (self._percent - self._last_percent) * min(1.0, self._speed * dt)
|
||||
|
||||
(r0, g0, b0) = self._color
|
||||
|
||||
filled_float = (smoothed_percent / 100.0) * count
|
||||
filled = int(filled_float)
|
||||
fractional = filled_float - filled
|
||||
|
||||
out = []
|
||||
|
||||
for i in range(count):
|
||||
if i < filled:
|
||||
out.append((r0, g0, b0))
|
||||
elif i == filled and fractional > 0:
|
||||
r = int(r0 * fractional)
|
||||
g = int(g0 * fractional)
|
||||
b = int(b0 * fractional)
|
||||
out.append((r, g, b))
|
||||
else:
|
||||
out.append((0, 0, 0))
|
||||
|
||||
# фиксируем новое сглаженное значение как last_percent
|
||||
self._last_percent = smoothed_percent
|
||||
|
||||
return out
|
||||
|
||||
class CpuLoadAnimation(LoadAnimation):
|
||||
def __init__(self, speed: float, color: Color):
|
||||
super().__init__(speed, 0.0, 0.0, color)
|
||||
|
||||
def get_pixels(self, time: float, count: int) -> List[Color]:
|
||||
self._percent = psutil.cpu_percent(interval=0.0)
|
||||
pixels = super().get_pixels(time, count)
|
||||
return pixels
|
||||
|
||||
class IdleAnimationUsual(RunningColorAnimation):
|
||||
def __init__(self):
|
||||
super().__init__(IDLE_SPEED, 1, 4, IDLE_COLOR)
|
||||
|
||||
def get_pixels(self, time: float, count: int) -> List[Color]:
|
||||
return super().get_pixels(time, count)
|
||||
|
||||
class IdleAnimationNewYear(RunningRainbowAnimation): # Новогодняя пасхалка
|
||||
def __init__(self):
|
||||
super().__init__(IDLE_SPEED / 10)
|
||||
|
||||
def get_pixels(self, time: float, count: int) -> List[Color]:
|
||||
return super().get_pixels(time, count)
|
||||
|
||||
today = datetime.datetime.now()
|
||||
if (today.month == 12 and today.day == 31) or (today.month == 1 and today.day == 1):
|
||||
IdleAnimation = IdleAnimationNewYear
|
||||
else:
|
||||
IdleAnimation = IdleAnimationUsual
|
||||
|
||||
class LightsDaemon(lights_pb2_grpc.LightsServicer):
|
||||
def __init__(self):
|
||||
self._running = True
|
||||
self._lock = threading.Lock()
|
||||
with self._lock:
|
||||
self._pixels = neopixel.NeoPixel(
|
||||
LED_PIN,
|
||||
LED_COUNT,
|
||||
brightness=IDLE_BRIGHTNESS,
|
||||
auto_write=False
|
||||
)
|
||||
|
||||
self._gamma = [int((i / 255) ** GAMMA * 255 + 0.5) for i in range(256)]
|
||||
self._color_clamp = lambda x: max(0, min(255, x))
|
||||
|
||||
self._control_mode = False
|
||||
self._last_ping = 0
|
||||
|
||||
self._animation = IdleAnimation()
|
||||
|
||||
self._worker = threading.Thread(target=self.loop, daemon=True)
|
||||
self._worker.start()
|
||||
|
||||
def stop(self):
|
||||
self._running = False
|
||||
self._worker.join()
|
||||
|
||||
for i in range(len(self._pixels)):
|
||||
self._pixels[i] = (0, 0, 0)
|
||||
self._pixels.show()
|
||||
|
||||
def loop(self):
|
||||
while self._running:
|
||||
with self._lock:
|
||||
if self._control_mode and time.time() - self._last_ping > TIMEOUT:
|
||||
self._control_mode = False
|
||||
self._pixels.brightness = IDLE_BRIGHTNESS
|
||||
self._animation = IdleAnimation()
|
||||
self._run_animation()
|
||||
time.sleep(0.02)
|
||||
|
||||
def _run_animation(self):
|
||||
new_colors = self._animation.get_pixels(time.time(), LED_COUNT)
|
||||
for i in range(LED_COUNT):
|
||||
self._pixels[i] = new_colors[i]
|
||||
self._pixels.show()
|
||||
|
||||
def _update_last_ping(self):
|
||||
with self._lock:
|
||||
self._control_mode = True
|
||||
self._last_ping = time.time()
|
||||
|
||||
def Ping(self, request, context):
|
||||
self._update_last_ping()
|
||||
return lights_pb2.Empty()
|
||||
|
||||
def SetOff(self, request, context):
|
||||
self._update_last_ping()
|
||||
with self._lock:
|
||||
self._control_mode = True
|
||||
self._animation = OffAnimation()
|
||||
return lights_pb2.Empty()
|
||||
|
||||
def SetStaticColor(self, request, context):
|
||||
self._update_last_ping()
|
||||
if not hasattr_all(request, ["brightness", "r", "g", "b"]):
|
||||
return lights_pb2.Empty()
|
||||
with self._lock:
|
||||
self._control_mode = True
|
||||
self._pixels.brightness = request.brightness
|
||||
color = (
|
||||
self._gamma[self._color_clamp(request.r)],
|
||||
self._gamma[self._color_clamp(request.g)],
|
||||
self._gamma[self._color_clamp(request.b)],
|
||||
)
|
||||
self._animation = StaticColorAnimation(color)
|
||||
return lights_pb2.Empty()
|
||||
|
||||
def SetStaticGradient2(self, request, context):
|
||||
self._update_last_ping()
|
||||
if not hasattr_all(request, ["brightness", "left_r", "left_g", "left_b", "right_r", "right_g", "right_b"]):
|
||||
return lights_pb2.Empty()
|
||||
with self._lock:
|
||||
self._control_mode = True
|
||||
self._pixels.brightness = request.brightness
|
||||
left_color = (
|
||||
self._gamma[self._color_clamp(request.left_r)],
|
||||
self._gamma[self._color_clamp(request.left_g)],
|
||||
self._gamma[self._color_clamp(request.left_b)],
|
||||
)
|
||||
right_color = (
|
||||
self._gamma[self._color_clamp(request.right_r)],
|
||||
self._gamma[self._color_clamp(request.right_g)],
|
||||
self._gamma[self._color_clamp(request.right_b)],
|
||||
)
|
||||
self._animation = StaticGradient2Animation(left_color, right_color)
|
||||
return lights_pb2.Empty()
|
||||
|
||||
def SetStaticGradient3(self, request, context):
|
||||
self._update_last_ping()
|
||||
if not hasattr_all(request, ["brightness", "left_r", "left_g", "left_b", "middle_r", "middle_g", "middle_b", "right_r", "right_g", "right_b"]):
|
||||
return lights_pb2.Empty()
|
||||
with self._lock:
|
||||
self._control_mode = True
|
||||
self._pixels.brightness = request.brightness
|
||||
left_color = (
|
||||
self._gamma[self._color_clamp(request.left_r)],
|
||||
self._gamma[self._color_clamp(request.left_g)],
|
||||
self._gamma[self._color_clamp(request.left_b)],
|
||||
)
|
||||
middle_color = (
|
||||
self._gamma[self._color_clamp(request.middle_r)],
|
||||
self._gamma[self._color_clamp(request.middle_g)],
|
||||
self._gamma[self._color_clamp(request.middle_b)],
|
||||
)
|
||||
right_color = (
|
||||
self._gamma[self._color_clamp(request.right_r)],
|
||||
self._gamma[self._color_clamp(request.right_g)],
|
||||
self._gamma[self._color_clamp(request.right_b)],
|
||||
)
|
||||
self._animation = StaticGradient3Animation(left_color, middle_color, right_color)
|
||||
return lights_pb2.Empty()
|
||||
|
||||
def SetStaticRainbow(self, request, context):
|
||||
self._update_last_ping()
|
||||
if not hasattr_all(request, ["brightness"]):
|
||||
return lights_pb2.Empty()
|
||||
with self._lock:
|
||||
self._control_mode = True
|
||||
self._pixels.brightness = request.brightness
|
||||
self._animation = StaticRainbowAnimation()
|
||||
return lights_pb2.Empty()
|
||||
|
||||
def SetBreathingColor(self, request, context):
|
||||
self._update_last_ping()
|
||||
if not hasattr_all(request, ["brightness", "speed", "r", "g", "b"]):
|
||||
return lights_pb2.Empty()
|
||||
with self._lock:
|
||||
self._control_mode = True
|
||||
self._pixels.brightness = request.brightness
|
||||
color = (
|
||||
self._gamma[self._color_clamp(request.r)],
|
||||
self._gamma[self._color_clamp(request.g)],
|
||||
self._gamma[self._color_clamp(request.b)],
|
||||
)
|
||||
self._animation = BreathingColorAnimation(request.speed, color)
|
||||
return lights_pb2.Empty()
|
||||
|
||||
def SetBreathingGradient2(self, request, context):
|
||||
self._update_last_ping()
|
||||
if not hasattr_all(request, ["brightness", "speed", "left_r", "left_g", "left_b", "right_r", "right_g", "right_b"]):
|
||||
return lights_pb2.Empty()
|
||||
with self._lock:
|
||||
self._control_mode = True
|
||||
self._pixels.brightness = request.brightness
|
||||
left_color = (
|
||||
self._gamma[self._color_clamp(request.left_r)],
|
||||
self._gamma[self._color_clamp(request.left_g)],
|
||||
self._gamma[self._color_clamp(request.left_b)],
|
||||
)
|
||||
right_color = (
|
||||
self._gamma[self._color_clamp(request.right_r)],
|
||||
self._gamma[self._color_clamp(request.right_g)],
|
||||
self._gamma[self._color_clamp(request.right_b)],
|
||||
)
|
||||
self._animation = BreathingGradient2Animation(request.speed, left_color, right_color)
|
||||
return lights_pb2.Empty()
|
||||
|
||||
def SetBreathingGradient3(self, request, context):
|
||||
self._update_last_ping()
|
||||
if not hasattr_all(request, ["brightness", "speed", "left_r", "left_g", "left_b", "middle_r", "middle_g", "middle_b", "right_r", "right_g", "right_b"]):
|
||||
return lights_pb2.Empty()
|
||||
with self._lock:
|
||||
self._control_mode = True
|
||||
self._pixels.brightness = request.brightness
|
||||
left_color = (
|
||||
self._gamma[self._color_clamp(request.left_r)],
|
||||
self._gamma[self._color_clamp(request.left_g)],
|
||||
self._gamma[self._color_clamp(request.left_b)],
|
||||
)
|
||||
middle_color = (
|
||||
self._gamma[self._color_clamp(request.middle_r)],
|
||||
self._gamma[self._color_clamp(request.middle_g)],
|
||||
self._gamma[self._color_clamp(request.middle_b)],
|
||||
)
|
||||
right_color = (
|
||||
self._gamma[self._color_clamp(request.right_r)],
|
||||
self._gamma[self._color_clamp(request.right_g)],
|
||||
self._gamma[self._color_clamp(request.right_b)],
|
||||
)
|
||||
self._animation = BreathingGradient3Animation(request.speed, left_color, middle_color, right_color)
|
||||
return lights_pb2.Empty()
|
||||
|
||||
def SetBreathingRainbow(self, request, context):
|
||||
self._update_last_ping()
|
||||
if not hasattr_all(request, ["brightness", "speed"]):
|
||||
return lights_pb2.Empty()
|
||||
with self._lock:
|
||||
self._control_mode = True
|
||||
self._pixels.brightness = request.brightness
|
||||
self._animation = BreathingRainbowAnimation(request.speed)
|
||||
return lights_pb2.Empty()
|
||||
|
||||
def SetRunningColor(self, request, context):
|
||||
self._update_last_ping()
|
||||
if not hasattr_all(request, ["brightness", "speed", "length", "fade", "r", "g", "b"]):
|
||||
return lights_pb2.Empty()
|
||||
with self._lock:
|
||||
self._control_mode = True
|
||||
self._pixels.brightness = request.brightness
|
||||
color = (
|
||||
self._gamma[self._color_clamp(request.r)],
|
||||
self._gamma[self._color_clamp(request.g)],
|
||||
self._gamma[self._color_clamp(request.b)],
|
||||
)
|
||||
self._animation = RunningColorAnimation(request.speed, request.length, request.fade, color)
|
||||
return lights_pb2.Empty()
|
||||
|
||||
def SetRunningGradient2(self, request, context):
|
||||
self._update_last_ping()
|
||||
if not hasattr_all(request, ["brightness", "speed", "left_r", "left_g", "left_b", "right_r", "right_g", "right_b"]):
|
||||
return lights_pb2.Empty()
|
||||
with self._lock:
|
||||
self._control_mode = True
|
||||
self._pixels.brightness = request.brightness
|
||||
left_color = (
|
||||
self._gamma[self._color_clamp(request.left_r)],
|
||||
self._gamma[self._color_clamp(request.left_g)],
|
||||
self._gamma[self._color_clamp(request.left_b)],
|
||||
)
|
||||
right_color = (
|
||||
self._gamma[self._color_clamp(request.right_r)],
|
||||
self._gamma[self._color_clamp(request.right_g)],
|
||||
self._gamma[self._color_clamp(request.right_b)],
|
||||
)
|
||||
self._animation = RunningGradient2Animation(request.speed, left_color, right_color)
|
||||
return lights_pb2.Empty()
|
||||
|
||||
def SetRunningGradient3(self, request, context):
|
||||
self._update_last_ping()
|
||||
if not hasattr_all(request, ["brightness", "speed", "left_r", "left_g", "left_b", "middle_r", "middle_g", "middle_b", "right_r", "right_g", "right_b"]):
|
||||
return lights_pb2.Empty()
|
||||
with self._lock:
|
||||
self._control_mode = True
|
||||
self._pixels.brightness = request.brightness
|
||||
left_color = (
|
||||
self._gamma[self._color_clamp(request.left_r)],
|
||||
self._gamma[self._color_clamp(request.left_g)],
|
||||
self._gamma[self._color_clamp(request.left_b)],
|
||||
)
|
||||
middle_color = (
|
||||
self._gamma[self._color_clamp(request.middle_r)],
|
||||
self._gamma[self._color_clamp(request.middle_g)],
|
||||
self._gamma[self._color_clamp(request.middle_b)],
|
||||
)
|
||||
right_color = (
|
||||
self._gamma[self._color_clamp(request.right_r)],
|
||||
self._gamma[self._color_clamp(request.right_g)],
|
||||
self._gamma[self._color_clamp(request.right_b)],
|
||||
)
|
||||
self._animation = RunningGradient3Animation(request.speed, left_color, middle_color, right_color)
|
||||
return lights_pb2.Empty()
|
||||
|
||||
def SetRunningRainbow(self, request, context):
|
||||
self._update_last_ping()
|
||||
if not hasattr_all(request, ["brightness", "speed"]):
|
||||
return lights_pb2.Empty()
|
||||
with self._lock:
|
||||
self._control_mode = True
|
||||
self._pixels.brightness = request.brightness
|
||||
self._animation = RunningRainbowAnimation(request.speed)
|
||||
return lights_pb2.Empty()
|
||||
|
||||
def SetSnake(self, request, context):
|
||||
self._update_last_ping()
|
||||
if not hasattr_all(request, ["brightness", "speed", "head_length", "tail_length", "head_r", "head_g", "head_b", "tail_r", "tail_g", "tail_b"]):
|
||||
return lights_pb2.Empty()
|
||||
with self._lock:
|
||||
self._control_mode = True
|
||||
self._pixels.brightness = request.brightness
|
||||
head_color = (
|
||||
self._gamma[self._color_clamp(request.head_r)],
|
||||
self._gamma[self._color_clamp(request.head_g)],
|
||||
self._gamma[self._color_clamp(request.head_b)],
|
||||
)
|
||||
tail_color = (
|
||||
self._gamma[self._color_clamp(request.tail_r)],
|
||||
self._gamma[self._color_clamp(request.tail_g)],
|
||||
self._gamma[self._color_clamp(request.tail_b)],
|
||||
)
|
||||
self._animation = SnakeAnimation(request.speed, request.head_length, request.tail_length, head_color, tail_color)
|
||||
return lights_pb2.Empty()
|
||||
|
||||
def SetFire(self, request, context):
|
||||
self._update_last_ping()
|
||||
if not hasattr_all(request, ["brightness", "speed", "r", "g", "b"]):
|
||||
return lights_pb2.Empty()
|
||||
with self._lock:
|
||||
self._control_mode = True
|
||||
self._pixels.brightness = request.brightness
|
||||
color = (
|
||||
self._gamma[self._color_clamp(request.r)],
|
||||
self._gamma[self._color_clamp(request.g)],
|
||||
self._gamma[self._color_clamp(request.b)],
|
||||
)
|
||||
self._animation = FireAnimation(request.speed, color)
|
||||
return lights_pb2.Empty()
|
||||
|
||||
def SetSnowfall(self, request, context):
|
||||
self._update_last_ping()
|
||||
if not hasattr_all(request, ["brightness", "speed", "r", "g", "b"]):
|
||||
return lights_pb2.Empty()
|
||||
with self._lock:
|
||||
self._control_mode = True
|
||||
self._pixels.brightness = request.brightness
|
||||
color = (
|
||||
self._gamma[self._color_clamp(request.r)],
|
||||
self._gamma[self._color_clamp(request.g)],
|
||||
self._gamma[self._color_clamp(request.b)],
|
||||
)
|
||||
self._animation = SnowfallAnimation(request.speed, color)
|
||||
return lights_pb2.Empty()
|
||||
|
||||
def SetFlash(self, request, context):
|
||||
self._update_last_ping()
|
||||
if not hasattr_all(request, ["brightness", "speed", "r", "g", "b"]):
|
||||
return lights_pb2.Empty()
|
||||
with self._lock:
|
||||
self._control_mode = True
|
||||
self._pixels.brightness = request.brightness
|
||||
color = (
|
||||
self._gamma[self._color_clamp(request.r)],
|
||||
self._gamma[self._color_clamp(request.g)],
|
||||
self._gamma[self._color_clamp(request.b)],
|
||||
)
|
||||
self._animation = FlashAnimation(request.speed, color)
|
||||
return lights_pb2.Empty()
|
||||
|
||||
def SetLoad(self, request, context):
|
||||
self._update_last_ping()
|
||||
if not hasattr_all(request, ["brightness", "speed", "percent", "last_percent", "r", "g", "b"]):
|
||||
return lights_pb2.Empty()
|
||||
with self._lock:
|
||||
self._control_mode = True
|
||||
self._pixels.brightness = request.brightness
|
||||
color = (
|
||||
self._gamma[self._color_clamp(request.r)],
|
||||
self._gamma[self._color_clamp(request.g)],
|
||||
self._gamma[self._color_clamp(request.b)],
|
||||
)
|
||||
self._animation = LoadAnimation(request.speed, request.percent, request.last_percent, color)
|
||||
return lights_pb2.Empty()
|
||||
|
||||
def SetCpuLoad(self, request, context):
|
||||
self._update_last_ping()
|
||||
if not hasattr_all(request, ["brightness", "speed", "r", "g", "b"]):
|
||||
return lights_pb2.Empty()
|
||||
with self._lock:
|
||||
self._control_mode = True
|
||||
self._pixels.brightness = request.brightness
|
||||
color = (
|
||||
self._gamma[self._color_clamp(request.r)],
|
||||
self._gamma[self._color_clamp(request.g)],
|
||||
self._gamma[self._color_clamp(request.b)],
|
||||
)
|
||||
self._animation = CpuLoadAnimation(request.speed, color)
|
||||
return lights_pb2.Empty()
|
||||
|
||||
def serve():
|
||||
daemon = LightsDaemon()
|
||||
server = grpc.server(futures.ThreadPoolExecutor(max_workers=1))
|
||||
lights_pb2_grpc.add_LightsServicer_to_server(daemon, server)
|
||||
server.add_insecure_port('localhost:50051')
|
||||
server.start()
|
||||
print("Lights daemon started on port 50051")
|
||||
try:
|
||||
server.wait_for_termination()
|
||||
except KeyboardInterrupt:
|
||||
print("Shutting down")
|
||||
server.stop(0)
|
||||
daemon.stop()
|
||||
print("Lights daemon stopped")
|
||||
|
||||
if __name__ == "__main__":
|
||||
serve()
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,914 @@
|
||||
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
||||
"""Client and server classes corresponding to protobuf-defined services."""
|
||||
import grpc
|
||||
import warnings
|
||||
|
||||
import lights_pb2 as lights__pb2
|
||||
|
||||
GRPC_GENERATED_VERSION = '1.76.0'
|
||||
GRPC_VERSION = grpc.__version__
|
||||
_version_not_supported = False
|
||||
|
||||
try:
|
||||
from grpc._utilities import first_version_is_lower
|
||||
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
||||
except ImportError:
|
||||
_version_not_supported = True
|
||||
|
||||
if _version_not_supported:
|
||||
raise RuntimeError(
|
||||
f'The grpc package installed is at version {GRPC_VERSION},'
|
||||
+ ' but the generated code in lights_pb2_grpc.py depends on'
|
||||
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
||||
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
||||
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
||||
)
|
||||
|
||||
|
||||
class LightsStub(object):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
|
||||
def __init__(self, channel):
|
||||
"""Constructor.
|
||||
|
||||
Args:
|
||||
channel: A grpc.Channel.
|
||||
"""
|
||||
self.Ping = channel.unary_unary(
|
||||
'/GSS2.LightsControl.Lights/Ping',
|
||||
request_serializer=lights__pb2.Empty.SerializeToString,
|
||||
response_deserializer=lights__pb2.Empty.FromString,
|
||||
_registered_method=True)
|
||||
self.SetOff = channel.unary_unary(
|
||||
'/GSS2.LightsControl.Lights/SetOff',
|
||||
request_serializer=lights__pb2.Empty.SerializeToString,
|
||||
response_deserializer=lights__pb2.Empty.FromString,
|
||||
_registered_method=True)
|
||||
self.SetStaticColor = channel.unary_unary(
|
||||
'/GSS2.LightsControl.Lights/SetStaticColor',
|
||||
request_serializer=lights__pb2.StaticColorRequest.SerializeToString,
|
||||
response_deserializer=lights__pb2.Empty.FromString,
|
||||
_registered_method=True)
|
||||
self.SetStaticGradient2 = channel.unary_unary(
|
||||
'/GSS2.LightsControl.Lights/SetStaticGradient2',
|
||||
request_serializer=lights__pb2.StaticGradient2Request.SerializeToString,
|
||||
response_deserializer=lights__pb2.Empty.FromString,
|
||||
_registered_method=True)
|
||||
self.SetStaticGradient3 = channel.unary_unary(
|
||||
'/GSS2.LightsControl.Lights/SetStaticGradient3',
|
||||
request_serializer=lights__pb2.StaticGradient3Request.SerializeToString,
|
||||
response_deserializer=lights__pb2.Empty.FromString,
|
||||
_registered_method=True)
|
||||
self.SetStaticRainbow = channel.unary_unary(
|
||||
'/GSS2.LightsControl.Lights/SetStaticRainbow',
|
||||
request_serializer=lights__pb2.StaticRainbowRequest.SerializeToString,
|
||||
response_deserializer=lights__pb2.Empty.FromString,
|
||||
_registered_method=True)
|
||||
self.SetBreathingColor = channel.unary_unary(
|
||||
'/GSS2.LightsControl.Lights/SetBreathingColor',
|
||||
request_serializer=lights__pb2.BreathingColorRequest.SerializeToString,
|
||||
response_deserializer=lights__pb2.Empty.FromString,
|
||||
_registered_method=True)
|
||||
self.SetBreathingGradient2 = channel.unary_unary(
|
||||
'/GSS2.LightsControl.Lights/SetBreathingGradient2',
|
||||
request_serializer=lights__pb2.BreathingGradient2Request.SerializeToString,
|
||||
response_deserializer=lights__pb2.Empty.FromString,
|
||||
_registered_method=True)
|
||||
self.SetBreathingGradient3 = channel.unary_unary(
|
||||
'/GSS2.LightsControl.Lights/SetBreathingGradient3',
|
||||
request_serializer=lights__pb2.BreathingGradient3Request.SerializeToString,
|
||||
response_deserializer=lights__pb2.Empty.FromString,
|
||||
_registered_method=True)
|
||||
self.SetBreathingRainbow = channel.unary_unary(
|
||||
'/GSS2.LightsControl.Lights/SetBreathingRainbow',
|
||||
request_serializer=lights__pb2.BreathingRainbowRequest.SerializeToString,
|
||||
response_deserializer=lights__pb2.Empty.FromString,
|
||||
_registered_method=True)
|
||||
self.SetRunningColor = channel.unary_unary(
|
||||
'/GSS2.LightsControl.Lights/SetRunningColor',
|
||||
request_serializer=lights__pb2.RunningColorRequest.SerializeToString,
|
||||
response_deserializer=lights__pb2.Empty.FromString,
|
||||
_registered_method=True)
|
||||
self.SetRunningGradient2 = channel.unary_unary(
|
||||
'/GSS2.LightsControl.Lights/SetRunningGradient2',
|
||||
request_serializer=lights__pb2.RunningGradient2Request.SerializeToString,
|
||||
response_deserializer=lights__pb2.Empty.FromString,
|
||||
_registered_method=True)
|
||||
self.SetRunningGradient3 = channel.unary_unary(
|
||||
'/GSS2.LightsControl.Lights/SetRunningGradient3',
|
||||
request_serializer=lights__pb2.RunningGradient3Request.SerializeToString,
|
||||
response_deserializer=lights__pb2.Empty.FromString,
|
||||
_registered_method=True)
|
||||
self.SetRunningRainbow = channel.unary_unary(
|
||||
'/GSS2.LightsControl.Lights/SetRunningRainbow',
|
||||
request_serializer=lights__pb2.RunningRainbowRequest.SerializeToString,
|
||||
response_deserializer=lights__pb2.Empty.FromString,
|
||||
_registered_method=True)
|
||||
self.SetSnake = channel.unary_unary(
|
||||
'/GSS2.LightsControl.Lights/SetSnake',
|
||||
request_serializer=lights__pb2.SnakeRequest.SerializeToString,
|
||||
response_deserializer=lights__pb2.Empty.FromString,
|
||||
_registered_method=True)
|
||||
self.SetFire = channel.unary_unary(
|
||||
'/GSS2.LightsControl.Lights/SetFire',
|
||||
request_serializer=lights__pb2.FireRequest.SerializeToString,
|
||||
response_deserializer=lights__pb2.Empty.FromString,
|
||||
_registered_method=True)
|
||||
self.SetSnowfall = channel.unary_unary(
|
||||
'/GSS2.LightsControl.Lights/SetSnowfall',
|
||||
request_serializer=lights__pb2.SnowfallRequest.SerializeToString,
|
||||
response_deserializer=lights__pb2.Empty.FromString,
|
||||
_registered_method=True)
|
||||
self.SetFlash = channel.unary_unary(
|
||||
'/GSS2.LightsControl.Lights/SetFlash',
|
||||
request_serializer=lights__pb2.FlashRequest.SerializeToString,
|
||||
response_deserializer=lights__pb2.Empty.FromString,
|
||||
_registered_method=True)
|
||||
self.SetLoad = channel.unary_unary(
|
||||
'/GSS2.LightsControl.Lights/SetLoad',
|
||||
request_serializer=lights__pb2.LoadRequest.SerializeToString,
|
||||
response_deserializer=lights__pb2.Empty.FromString,
|
||||
_registered_method=True)
|
||||
self.SetCpuLoad = channel.unary_unary(
|
||||
'/GSS2.LightsControl.Lights/SetCpuLoad',
|
||||
request_serializer=lights__pb2.CpuLoadRequest.SerializeToString,
|
||||
response_deserializer=lights__pb2.Empty.FromString,
|
||||
_registered_method=True)
|
||||
|
||||
|
||||
class LightsServicer(object):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
|
||||
def Ping(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SetOff(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SetStaticColor(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SetStaticGradient2(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SetStaticGradient3(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SetStaticRainbow(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SetBreathingColor(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SetBreathingGradient2(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SetBreathingGradient3(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SetBreathingRainbow(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SetRunningColor(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SetRunningGradient2(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SetRunningGradient3(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SetRunningRainbow(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SetSnake(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SetFire(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SetSnowfall(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SetFlash(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SetLoad(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SetCpuLoad(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
|
||||
def add_LightsServicer_to_server(servicer, server):
|
||||
rpc_method_handlers = {
|
||||
'Ping': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.Ping,
|
||||
request_deserializer=lights__pb2.Empty.FromString,
|
||||
response_serializer=lights__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'SetOff': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SetOff,
|
||||
request_deserializer=lights__pb2.Empty.FromString,
|
||||
response_serializer=lights__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'SetStaticColor': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SetStaticColor,
|
||||
request_deserializer=lights__pb2.StaticColorRequest.FromString,
|
||||
response_serializer=lights__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'SetStaticGradient2': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SetStaticGradient2,
|
||||
request_deserializer=lights__pb2.StaticGradient2Request.FromString,
|
||||
response_serializer=lights__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'SetStaticGradient3': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SetStaticGradient3,
|
||||
request_deserializer=lights__pb2.StaticGradient3Request.FromString,
|
||||
response_serializer=lights__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'SetStaticRainbow': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SetStaticRainbow,
|
||||
request_deserializer=lights__pb2.StaticRainbowRequest.FromString,
|
||||
response_serializer=lights__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'SetBreathingColor': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SetBreathingColor,
|
||||
request_deserializer=lights__pb2.BreathingColorRequest.FromString,
|
||||
response_serializer=lights__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'SetBreathingGradient2': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SetBreathingGradient2,
|
||||
request_deserializer=lights__pb2.BreathingGradient2Request.FromString,
|
||||
response_serializer=lights__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'SetBreathingGradient3': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SetBreathingGradient3,
|
||||
request_deserializer=lights__pb2.BreathingGradient3Request.FromString,
|
||||
response_serializer=lights__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'SetBreathingRainbow': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SetBreathingRainbow,
|
||||
request_deserializer=lights__pb2.BreathingRainbowRequest.FromString,
|
||||
response_serializer=lights__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'SetRunningColor': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SetRunningColor,
|
||||
request_deserializer=lights__pb2.RunningColorRequest.FromString,
|
||||
response_serializer=lights__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'SetRunningGradient2': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SetRunningGradient2,
|
||||
request_deserializer=lights__pb2.RunningGradient2Request.FromString,
|
||||
response_serializer=lights__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'SetRunningGradient3': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SetRunningGradient3,
|
||||
request_deserializer=lights__pb2.RunningGradient3Request.FromString,
|
||||
response_serializer=lights__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'SetRunningRainbow': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SetRunningRainbow,
|
||||
request_deserializer=lights__pb2.RunningRainbowRequest.FromString,
|
||||
response_serializer=lights__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'SetSnake': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SetSnake,
|
||||
request_deserializer=lights__pb2.SnakeRequest.FromString,
|
||||
response_serializer=lights__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'SetFire': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SetFire,
|
||||
request_deserializer=lights__pb2.FireRequest.FromString,
|
||||
response_serializer=lights__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'SetSnowfall': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SetSnowfall,
|
||||
request_deserializer=lights__pb2.SnowfallRequest.FromString,
|
||||
response_serializer=lights__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'SetFlash': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SetFlash,
|
||||
request_deserializer=lights__pb2.FlashRequest.FromString,
|
||||
response_serializer=lights__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'SetLoad': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SetLoad,
|
||||
request_deserializer=lights__pb2.LoadRequest.FromString,
|
||||
response_serializer=lights__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'SetCpuLoad': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SetCpuLoad,
|
||||
request_deserializer=lights__pb2.CpuLoadRequest.FromString,
|
||||
response_serializer=lights__pb2.Empty.SerializeToString,
|
||||
),
|
||||
}
|
||||
generic_handler = grpc.method_handlers_generic_handler(
|
||||
'GSS2.LightsControl.Lights', rpc_method_handlers)
|
||||
server.add_generic_rpc_handlers((generic_handler,))
|
||||
server.add_registered_method_handlers('GSS2.LightsControl.Lights', rpc_method_handlers)
|
||||
|
||||
|
||||
# This class is part of an EXPERIMENTAL API.
|
||||
class Lights(object):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
|
||||
@staticmethod
|
||||
def Ping(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/GSS2.LightsControl.Lights/Ping',
|
||||
lights__pb2.Empty.SerializeToString,
|
||||
lights__pb2.Empty.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def SetOff(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/GSS2.LightsControl.Lights/SetOff',
|
||||
lights__pb2.Empty.SerializeToString,
|
||||
lights__pb2.Empty.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def SetStaticColor(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/GSS2.LightsControl.Lights/SetStaticColor',
|
||||
lights__pb2.StaticColorRequest.SerializeToString,
|
||||
lights__pb2.Empty.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def SetStaticGradient2(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/GSS2.LightsControl.Lights/SetStaticGradient2',
|
||||
lights__pb2.StaticGradient2Request.SerializeToString,
|
||||
lights__pb2.Empty.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def SetStaticGradient3(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/GSS2.LightsControl.Lights/SetStaticGradient3',
|
||||
lights__pb2.StaticGradient3Request.SerializeToString,
|
||||
lights__pb2.Empty.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def SetStaticRainbow(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/GSS2.LightsControl.Lights/SetStaticRainbow',
|
||||
lights__pb2.StaticRainbowRequest.SerializeToString,
|
||||
lights__pb2.Empty.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def SetBreathingColor(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/GSS2.LightsControl.Lights/SetBreathingColor',
|
||||
lights__pb2.BreathingColorRequest.SerializeToString,
|
||||
lights__pb2.Empty.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def SetBreathingGradient2(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/GSS2.LightsControl.Lights/SetBreathingGradient2',
|
||||
lights__pb2.BreathingGradient2Request.SerializeToString,
|
||||
lights__pb2.Empty.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def SetBreathingGradient3(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/GSS2.LightsControl.Lights/SetBreathingGradient3',
|
||||
lights__pb2.BreathingGradient3Request.SerializeToString,
|
||||
lights__pb2.Empty.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def SetBreathingRainbow(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/GSS2.LightsControl.Lights/SetBreathingRainbow',
|
||||
lights__pb2.BreathingRainbowRequest.SerializeToString,
|
||||
lights__pb2.Empty.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def SetRunningColor(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/GSS2.LightsControl.Lights/SetRunningColor',
|
||||
lights__pb2.RunningColorRequest.SerializeToString,
|
||||
lights__pb2.Empty.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def SetRunningGradient2(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/GSS2.LightsControl.Lights/SetRunningGradient2',
|
||||
lights__pb2.RunningGradient2Request.SerializeToString,
|
||||
lights__pb2.Empty.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def SetRunningGradient3(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/GSS2.LightsControl.Lights/SetRunningGradient3',
|
||||
lights__pb2.RunningGradient3Request.SerializeToString,
|
||||
lights__pb2.Empty.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def SetRunningRainbow(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/GSS2.LightsControl.Lights/SetRunningRainbow',
|
||||
lights__pb2.RunningRainbowRequest.SerializeToString,
|
||||
lights__pb2.Empty.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def SetSnake(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/GSS2.LightsControl.Lights/SetSnake',
|
||||
lights__pb2.SnakeRequest.SerializeToString,
|
||||
lights__pb2.Empty.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def SetFire(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/GSS2.LightsControl.Lights/SetFire',
|
||||
lights__pb2.FireRequest.SerializeToString,
|
||||
lights__pb2.Empty.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def SetSnowfall(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/GSS2.LightsControl.Lights/SetSnowfall',
|
||||
lights__pb2.SnowfallRequest.SerializeToString,
|
||||
lights__pb2.Empty.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def SetFlash(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/GSS2.LightsControl.Lights/SetFlash',
|
||||
lights__pb2.FlashRequest.SerializeToString,
|
||||
lights__pb2.Empty.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def SetLoad(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/GSS2.LightsControl.Lights/SetLoad',
|
||||
lights__pb2.LoadRequest.SerializeToString,
|
||||
lights__pb2.Empty.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def SetCpuLoad(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/GSS2.LightsControl.Lights/SetCpuLoad',
|
||||
lights__pb2.CpuLoadRequest.SerializeToString,
|
||||
lights__pb2.Empty.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
Binary file not shown.
@@ -0,0 +1,287 @@
|
||||
import grpc, time
|
||||
import lights_pb2, lights_pb2_grpc
|
||||
|
||||
stub: lights_pb2_grpc.LightsStub = None
|
||||
|
||||
def connect():
|
||||
global stub
|
||||
channel = grpc.insecure_channel('localhost:50051')
|
||||
stub = lights_pb2_grpc.LightsStub(channel)
|
||||
stub.Ping(lights_pb2.Empty())
|
||||
print("Пинг отправлен")
|
||||
|
||||
def disconnect():
|
||||
global stub
|
||||
stub.SetOff(lights_pb2.Empty())
|
||||
print("Светодиоды выключены")
|
||||
|
||||
def StaticColor():
|
||||
print("StaticColor")
|
||||
global stub
|
||||
request = lights_pb2.StaticColorRequest(brightness=0.5, r=255, g=0, b=0)
|
||||
stub.SetStaticColor(request)
|
||||
print("Красный")
|
||||
time.sleep(1)
|
||||
request = lights_pb2.StaticColorRequest(brightness=0.5, r=0, g=0, b=255)
|
||||
stub.SetStaticColor(request)
|
||||
print("Синий")
|
||||
time.sleep(1)
|
||||
request = lights_pb2.StaticColorRequest(brightness=0.5, r=0, g=255, b=0)
|
||||
stub.SetStaticColor(request)
|
||||
print("Зелёный")
|
||||
time.sleep(1)
|
||||
|
||||
def StaticGradient2():
|
||||
print("StaticGradient2")
|
||||
global stub
|
||||
request = lights_pb2.StaticGradient2Request(brightness=0.5, left_r=255, left_g=0, left_b=0, right_r=0, right_g=0, right_b=255)
|
||||
stub.SetStaticGradient2(request)
|
||||
print("Красный-Синий")
|
||||
time.sleep(1)
|
||||
request = lights_pb2.StaticGradient2Request(brightness=0.5, left_r=0, left_g=0, left_b=255, right_r=0, right_g=255, right_b=0)
|
||||
stub.SetStaticGradient2(request)
|
||||
print("Синий-Зелёный")
|
||||
time.sleep(1)
|
||||
request = lights_pb2.StaticGradient2Request(brightness=0.5, left_r=0, left_g=255, left_b=0, right_r=255, right_g=0, right_b=0)
|
||||
stub.SetStaticGradient2(request)
|
||||
print("Зелёный-Красный")
|
||||
time.sleep(1)
|
||||
|
||||
def StaticGradient3():
|
||||
print("StaticGradient3")
|
||||
global stub
|
||||
request = lights_pb2.StaticGradient3Request(brightness=0.5, left_r=255, left_g=0, left_b=0, middle_r=0, middle_g=255, middle_b=0, right_r=0, right_g=0, right_b=255)
|
||||
stub.SetStaticGradient3(request)
|
||||
print("Красный-Зелёный-Синий")
|
||||
time.sleep(1)
|
||||
request = lights_pb2.StaticGradient3Request(brightness=0.5, left_r=0, left_g=255, left_b=0, middle_r=0, middle_g=0, middle_b=255, right_r=255, right_g=0, right_b=0)
|
||||
stub.SetStaticGradient3(request)
|
||||
print("Зелёный-Синий-Красный")
|
||||
time.sleep(1)
|
||||
request = lights_pb2.StaticGradient3Request(brightness=0.5, left_r=0, left_g=0, left_b=255, middle_r=255, middle_g=0, middle_b=0, right_r=0, right_g=255, right_b=0)
|
||||
stub.SetStaticGradient3(request)
|
||||
print("Синий-Красный-Зелёный")
|
||||
time.sleep(1)
|
||||
|
||||
def StaticRainbow():
|
||||
print("StaticRainbow")
|
||||
global stub
|
||||
request = lights_pb2.StaticRainbowRequest(brightness=0.5)
|
||||
stub.SetStaticRainbow(request)
|
||||
print("Радуга")
|
||||
time.sleep(2)
|
||||
|
||||
def BreathingColor():
|
||||
print("BreathingColor")
|
||||
global stub
|
||||
request = lights_pb2.BreathingColorRequest(brightness=0.5, speed=4, r=255, g=0, b=0)
|
||||
stub.SetBreathingColor(request)
|
||||
print("Красный")
|
||||
time.sleep(3)
|
||||
request = lights_pb2.BreathingColorRequest(brightness=0.5, speed=4, r=0, g=0, b=255)
|
||||
stub.SetBreathingColor(request)
|
||||
print("Синий")
|
||||
time.sleep(3)
|
||||
request = lights_pb2.BreathingColorRequest(brightness=0.5, speed=4, r=0, g=255, b=0)
|
||||
stub.SetBreathingColor(request)
|
||||
print("Зелёный")
|
||||
time.sleep(3)
|
||||
|
||||
def BreathingGradient2():
|
||||
print("BreathingGradient2")
|
||||
global stub
|
||||
request = lights_pb2.BreathingGradient2Request(brightness=0.5, speed=4, left_r=255, left_g=0, left_b=0, right_r=0, right_g=0, right_b=255)
|
||||
stub.SetBreathingGradient2(request)
|
||||
print("Красный-Синий")
|
||||
time.sleep(3)
|
||||
request = lights_pb2.BreathingGradient2Request(brightness=0.5, speed=4, left_r=0, left_g=0, left_b=255, right_r=0, right_g=255, right_b=0)
|
||||
stub.SetBreathingGradient2(request)
|
||||
print("Синий-Зелёный")
|
||||
time.sleep(3)
|
||||
request = lights_pb2.BreathingGradient2Request(brightness=0.5, speed=4, left_r=0, left_g=255, left_b=0, right_r=255, right_g=0, right_b=0)
|
||||
stub.SetBreathingGradient2(request)
|
||||
print("Зелёный-Красный")
|
||||
time.sleep(3)
|
||||
|
||||
def BreathingGradient3():
|
||||
print("BreathingGradient3")
|
||||
global stub
|
||||
request = lights_pb2.BreathingGradient3Request(brightness=0.5, speed=4, left_r=255, left_g=0, left_b=0, middle_r=0, middle_g=255, middle_b=0, right_r=0, right_g=0, right_b=255)
|
||||
stub.SetBreathingGradient3(request)
|
||||
print("Красный-Зелёный-Синий")
|
||||
time.sleep(3)
|
||||
request = lights_pb2.BreathingGradient3Request(brightness=0.5, speed=4, left_r=0, left_g=255, left_b=0, middle_r=0, middle_g=0, middle_b=255, right_r=255, right_g=0, right_b=0)
|
||||
stub.SetBreathingGradient3(request)
|
||||
print("Зелёный-Синий-Красный")
|
||||
time.sleep(3)
|
||||
request = lights_pb2.BreathingGradient3Request(brightness=0.5, speed=4, left_r=0, left_g=0, left_b=255, middle_r=255, middle_g=0, middle_b=0, right_r=0, right_g=255, right_b=0)
|
||||
stub.SetBreathingGradient3(request)
|
||||
print("Синий-Красный-Зелёный")
|
||||
time.sleep(3)
|
||||
|
||||
def BreathingRainbow():
|
||||
print("BreathingRainbow")
|
||||
global stub
|
||||
request = lights_pb2.BreathingRainbowRequest(brightness=0.5, speed=4)
|
||||
stub.SetBreathingRainbow(request)
|
||||
print("Радуга")
|
||||
time.sleep(2)
|
||||
|
||||
def RunningColor():
|
||||
print("RunningColor")
|
||||
global stub
|
||||
request = lights_pb2.RunningColorRequest(brightness=0.5, speed=4, length=1, fade=4, r=125, g=0, b=0)
|
||||
stub.SetRunningColor(request)
|
||||
print("Красный")
|
||||
time.sleep(3)
|
||||
request = lights_pb2.RunningColorRequest(brightness=0.5, speed=4, length=1, fade=4, r=0, g=0, b=125)
|
||||
stub.SetRunningColor(request)
|
||||
print("Синий")
|
||||
time.sleep(3)
|
||||
request = lights_pb2.RunningColorRequest(brightness=0.5, speed=4, length=1, fade=4, r=0, g=125, b=0)
|
||||
stub.SetRunningColor(request)
|
||||
print("Зелёный")
|
||||
time.sleep(3)
|
||||
|
||||
def RunningGradient2():
|
||||
print("RunningGradient2")
|
||||
global stub
|
||||
request = lights_pb2.RunningGradient2Request(brightness=0.5, speed=4, left_r=255, left_g=0, left_b=0, right_r=0, right_g=0, right_b=255)
|
||||
stub.SetRunningGradient2(request)
|
||||
print("Красный-Синий")
|
||||
time.sleep(3)
|
||||
request = lights_pb2.RunningGradient2Request(brightness=0.5, speed=4, left_r=0, left_g=0, left_b=255, right_r=0, right_g=255, right_b=0)
|
||||
stub.SetRunningGradient2(request)
|
||||
print("Синий-Зелёный")
|
||||
time.sleep(3)
|
||||
request = lights_pb2.RunningGradient2Request(brightness=0.5, speed=4, left_r=0, left_g=255, left_b=0, right_r=255, right_g=0, right_b=0)
|
||||
stub.SetRunningGradient2(request)
|
||||
print("Зелёный-Красный")
|
||||
time.sleep(3)
|
||||
|
||||
def RunningGradient3():
|
||||
print("RunningGradient3")
|
||||
global stub
|
||||
request = lights_pb2.RunningGradient3Request(brightness=0.5, speed=4, left_r=255, left_g=0, left_b=0, middle_r=0, middle_g=255, middle_b=0, right_r=0, right_g=0, right_b=255)
|
||||
stub.SetRunningGradient3(request)
|
||||
print("Красный-Зелёный-Синий")
|
||||
time.sleep(3)
|
||||
request = lights_pb2.RunningGradient3Request(brightness=0.5, speed=4, left_r=0, left_g=255, left_b=0, middle_r=0, middle_g=0, middle_b=255, right_r=255, right_g=0, right_b=0)
|
||||
stub.SetRunningGradient3(request)
|
||||
print("Зелёный-Синий-Красный")
|
||||
time.sleep(3)
|
||||
request = lights_pb2.RunningGradient3Request(brightness=0.5, speed=4, left_r=0, left_g=0, left_b=255, middle_r=255, middle_g=0, middle_b=0, right_r=0, right_g=255, right_b=0)
|
||||
stub.SetRunningGradient3(request)
|
||||
print("Синий-Красный-Зелёный")
|
||||
time.sleep(3)
|
||||
|
||||
def Snake():
|
||||
print("Snake")
|
||||
global stub
|
||||
request = lights_pb2.SnakeRequest(brightness=0.5, speed=2, head_length=1, tail_length=3, head_r=255, head_g=0, head_b=0, tail_r=0, tail_g=255, tail_b=0)
|
||||
stub.SetSnake(request)
|
||||
print("Красный-Зелёный")
|
||||
time.sleep(3)
|
||||
request = lights_pb2.SnakeRequest(brightness=0.5, speed=2, head_length=1, tail_length=3, head_r=0, head_g=0, head_b=255, tail_r=255, tail_g=0, tail_b=0)
|
||||
stub.SetSnake(request)
|
||||
print("Зелёный-Красный")
|
||||
time.sleep(3)
|
||||
request = lights_pb2.SnakeRequest(brightness=0.5, speed=2, head_length=1, tail_length=3, head_r=0, head_g=255, head_b=0, tail_r=0, tail_g=0, tail_b=255)
|
||||
stub.SetSnake(request)
|
||||
print("Зелёный-Синий")
|
||||
time.sleep(3)
|
||||
|
||||
def RunningRainbow():
|
||||
print("RunningRainbow")
|
||||
global stub
|
||||
request = lights_pb2.RunningRainbowRequest(brightness=0.5, speed=1)
|
||||
stub.SetRunningRainbow(request)
|
||||
print("Радуга")
|
||||
time.sleep(2)
|
||||
|
||||
def Fire():
|
||||
print("Fire")
|
||||
global stub
|
||||
request = lights_pb2.FireRequest(brightness=0.5, speed=4, r=255, g=0, b=0)
|
||||
stub.SetFire(request)
|
||||
print("Красный")
|
||||
time.sleep(3)
|
||||
request = lights_pb2.FireRequest(brightness=0.5, speed=4, r=0, g=0, b=255)
|
||||
stub.SetFire(request)
|
||||
print("Синий")
|
||||
time.sleep(3)
|
||||
request = lights_pb2.FireRequest(brightness=0.5, speed=4, r=0, g=255, b=0)
|
||||
stub.SetFire(request)
|
||||
print("Зелёный")
|
||||
time.sleep(3)
|
||||
|
||||
def Snowfall():
|
||||
print("Snowfall")
|
||||
global stub
|
||||
request = lights_pb2.SnowfallRequest(brightness=0.5, speed=1, r=255, g=0, b=0)
|
||||
stub.SetSnowfall(request)
|
||||
print("Красный")
|
||||
time.sleep(3)
|
||||
request = lights_pb2.SnowfallRequest(brightness=0.5, speed=1, r=0, g=0, b=255)
|
||||
stub.SetSnowfall(request)
|
||||
print("Синий")
|
||||
time.sleep(3)
|
||||
request = lights_pb2.SnowfallRequest(brightness=0.5, speed=1, r=0, g=255, b=0)
|
||||
stub.SetSnowfall(request)
|
||||
print("Зелёный")
|
||||
time.sleep(3)
|
||||
|
||||
def Flash():
|
||||
print("Flash")
|
||||
global stub
|
||||
request = lights_pb2.FlashRequest(brightness=0.5, speed=6, r=255, g=0, b=0)
|
||||
stub.SetFlash(request)
|
||||
print("Красный")
|
||||
time.sleep(3)
|
||||
request = lights_pb2.FlashRequest(brightness=0.5, speed=6, r=0, g=0, b=255)
|
||||
stub.SetFlash(request)
|
||||
print("Синий")
|
||||
time.sleep(3)
|
||||
request = lights_pb2.FlashRequest(brightness=0.5, speed=6, r=0, g=255, b=0)
|
||||
stub.SetFlash(request)
|
||||
print("Зелёный")
|
||||
time.sleep(3)
|
||||
|
||||
def Load():
|
||||
print("Load")
|
||||
global stub
|
||||
last_percent = 0
|
||||
for p in range(0, 20):
|
||||
request = lights_pb2.LoadRequest(brightness=0.5, speed=1, percent=float(p * 5), last_percent=last_percent, r=255, g=255, b=255)
|
||||
last_percent = float(p * 5)
|
||||
stub.SetLoad(request)
|
||||
time.sleep(0.2)
|
||||
|
||||
def CpuLoad():
|
||||
print("CpuLoad")
|
||||
global stub
|
||||
request = lights_pb2.CpuLoadRequest(brightness=0.5, speed=1, r=255, g=255, b=255)
|
||||
stub.SetCpuLoad(request)
|
||||
time.sleep(5)
|
||||
|
||||
if __name__ == "__main__":
|
||||
connect()
|
||||
# StaticColor()
|
||||
# StaticGradient2()
|
||||
# StaticGradient3()
|
||||
# StaticRainbow()
|
||||
# BreathingColor()
|
||||
# BreathingGradient2()
|
||||
# BreathingGradient3()
|
||||
# BreathingRainbow()
|
||||
# RunningColor()
|
||||
# RunningGradient2() #fix right
|
||||
# RunningGradient3() #fix right
|
||||
# RunningRainbow() #fix run not change
|
||||
# Snake()
|
||||
# Fire()
|
||||
# Snowfall()
|
||||
# Flash()
|
||||
# Load()
|
||||
# CpuLoad()
|
||||
disconnect()
|
||||
@@ -0,0 +1,189 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option csharp_namespace = "GSS2.LightsControl.CSharpClient";
|
||||
|
||||
package GSS2.LightsControl;
|
||||
|
||||
service Lights {
|
||||
rpc Ping (Empty) returns (Empty);
|
||||
|
||||
rpc SetOff (Empty) returns (Empty);
|
||||
|
||||
rpc SetStaticColor (StaticColorRequest) returns (Empty);
|
||||
rpc SetStaticGradient2 (StaticGradient2Request) returns (Empty);
|
||||
rpc SetStaticGradient3 (StaticGradient3Request) returns (Empty);
|
||||
rpc SetStaticRainbow (StaticRainbowRequest) returns (Empty);
|
||||
|
||||
rpc SetBreathingColor (BreathingColorRequest) returns (Empty);
|
||||
rpc SetBreathingGradient2 (BreathingGradient2Request) returns (Empty);
|
||||
rpc SetBreathingGradient3 (BreathingGradient3Request) returns (Empty);
|
||||
rpc SetBreathingRainbow (BreathingRainbowRequest) returns (Empty);
|
||||
|
||||
rpc SetRunningColor (RunningColorRequest) returns (Empty);
|
||||
rpc SetRunningGradient2 (RunningGradient2Request) returns (Empty);
|
||||
rpc SetRunningGradient3 (RunningGradient3Request) returns (Empty);
|
||||
rpc SetRunningRainbow (RunningRainbowRequest) returns (Empty);
|
||||
|
||||
rpc SetSnake (SnakeRequest) returns (Empty);
|
||||
rpc SetFire (FireRequest) returns (Empty);
|
||||
rpc SetSnowfall (SnowfallRequest) returns (Empty);
|
||||
|
||||
rpc SetFlash (FlashRequest) returns (Empty);
|
||||
rpc SetLoad (LoadRequest) returns (Empty);
|
||||
|
||||
rpc SetCpuLoad (CpuLoadRequest) returns (Empty);
|
||||
}
|
||||
|
||||
message Empty {}
|
||||
|
||||
message StaticColorRequest {
|
||||
double brightness = 1;
|
||||
int32 r = 2;
|
||||
int32 g = 3;
|
||||
int32 b = 4;
|
||||
}
|
||||
message StaticGradient2Request {
|
||||
double brightness = 1;
|
||||
int32 left_r = 2;
|
||||
int32 left_g = 3;
|
||||
int32 left_b = 4;
|
||||
int32 right_r = 5;
|
||||
int32 right_g = 6;
|
||||
int32 right_b = 7;
|
||||
}
|
||||
message StaticGradient3Request {
|
||||
double brightness = 1;
|
||||
int32 left_r = 2;
|
||||
int32 left_g = 3;
|
||||
int32 left_b = 4;
|
||||
int32 middle_r = 5;
|
||||
int32 middle_g = 6;
|
||||
int32 middle_b = 7;
|
||||
int32 right_r = 8;
|
||||
int32 right_g = 9;
|
||||
int32 right_b = 10;
|
||||
}
|
||||
message StaticRainbowRequest {
|
||||
double brightness = 1;
|
||||
}
|
||||
message BreathingColorRequest {
|
||||
double brightness = 1;
|
||||
double speed = 2;
|
||||
int32 r = 3;
|
||||
int32 g = 4;
|
||||
int32 b = 5;
|
||||
}
|
||||
message BreathingGradient2Request {
|
||||
double brightness = 1;
|
||||
double speed = 2;
|
||||
int32 left_r = 3;
|
||||
int32 left_g = 4;
|
||||
int32 left_b = 5;
|
||||
int32 right_r = 6;
|
||||
int32 right_g = 7;
|
||||
int32 right_b = 8;
|
||||
|
||||
}
|
||||
message BreathingGradient3Request {
|
||||
double brightness = 1;
|
||||
double speed = 2;
|
||||
int32 left_r = 3;
|
||||
int32 left_g = 4;
|
||||
int32 left_b = 5;
|
||||
int32 middle_r = 6;
|
||||
int32 middle_g = 7;
|
||||
int32 middle_b = 8;
|
||||
int32 right_r = 9;
|
||||
int32 right_g = 10;
|
||||
int32 right_b = 11;
|
||||
|
||||
}
|
||||
message BreathingRainbowRequest {
|
||||
double brightness = 1;
|
||||
double speed = 2;
|
||||
}
|
||||
message RunningColorRequest {
|
||||
double brightness = 1;
|
||||
double speed = 2;
|
||||
int32 length = 3;
|
||||
int32 fade = 4;
|
||||
int32 r = 5;
|
||||
int32 g = 6;
|
||||
int32 b = 7;
|
||||
}
|
||||
message RunningGradient2Request {
|
||||
double brightness = 1;
|
||||
double speed = 2;
|
||||
int32 left_r = 3;
|
||||
int32 left_g = 4;
|
||||
int32 left_b = 5;
|
||||
int32 right_r = 6;
|
||||
int32 right_g = 7;
|
||||
int32 right_b = 8;
|
||||
}
|
||||
message RunningGradient3Request {
|
||||
double brightness = 1;
|
||||
double speed = 2;
|
||||
int32 left_r = 3;
|
||||
int32 left_g = 4;
|
||||
int32 left_b = 5;
|
||||
int32 middle_r = 6;
|
||||
int32 middle_g = 7;
|
||||
int32 middle_b = 8;
|
||||
int32 right_r = 9;
|
||||
int32 right_g = 10;
|
||||
int32 right_b = 11;
|
||||
}
|
||||
message RunningRainbowRequest {
|
||||
double brightness = 1;
|
||||
double speed = 2;
|
||||
}
|
||||
message SnakeRequest {
|
||||
double brightness = 1;
|
||||
double speed = 2;
|
||||
int32 head_length = 3;
|
||||
int32 tail_length = 4;
|
||||
int32 head_r = 5;
|
||||
int32 head_g = 6;
|
||||
int32 head_b = 7;
|
||||
int32 tail_r = 8;
|
||||
int32 tail_g = 9;
|
||||
int32 tail_b = 10;
|
||||
}
|
||||
message FireRequest {
|
||||
double brightness = 1;
|
||||
double speed = 2;
|
||||
int32 r = 3;
|
||||
int32 g = 4;
|
||||
int32 b = 5;
|
||||
}
|
||||
message SnowfallRequest {
|
||||
double brightness = 1;
|
||||
double speed = 2;
|
||||
int32 r = 3;
|
||||
int32 g = 4;
|
||||
int32 b = 5;
|
||||
}
|
||||
message FlashRequest {
|
||||
double brightness = 1;
|
||||
double speed = 2;
|
||||
int32 r = 3;
|
||||
int32 g = 4;
|
||||
int32 b = 5;
|
||||
}
|
||||
message LoadRequest {
|
||||
double brightness = 1;
|
||||
double speed = 2;
|
||||
double percent = 3;
|
||||
double last_percent = 4;
|
||||
int32 r = 5;
|
||||
int32 g = 6;
|
||||
int32 b = 7;
|
||||
}
|
||||
message CpuLoadRequest {
|
||||
double brightness = 1;
|
||||
double speed = 2;
|
||||
int32 r = 3;
|
||||
int32 g = 4;
|
||||
int32 b = 5;
|
||||
}
|
||||
Reference in New Issue
Block a user