Files
Vermix-Sense/proto/hardware.proto
T
2025-10-04 10:44:42 +02:00

79 lines
1.6 KiB
Protocol Buffer

syntax = "proto3";
package hardware;
// LED animation types
enum LedAnimation {
LED_ANIMATION_STATIC = 0;
LED_ANIMATION_PULSE = 1;
LED_ANIMATION_FADE = 2;
LED_ANIMATION_FLICKER = 3;
}
// Hardware configuration
message HardwareConfig {
uint32 hold_duration_ms = 1;
bool override = 2;
uint32 relay_pin = 3;
uint32 sensor_rx_pin = 4;
uint32 sensor_tx_pin = 5;
LedConfig on_open_led = 6;
LedConfig default_led = 7;
LedConfig on_invalid_led = 8;
bool enable_serial_sensor = 9;
// repeated char sensor_api_key = 10;
// bool enable_ws_sensor = 11;
}
// LED configuration
message LedConfig {
// General properties that apply to all animations
uint32 brightness = 1; // 0-255
uint32 duration_ms = 2; // 0 for indefinite
oneof animation_params {
StaticParams static_params = 3;
PulseParams pulse_params = 4;
FadeParams fade_params = 5;
FlickerParams flicker_params = 6;
}
}
// Define the specific parameters for each animation type
message StaticParams {
uint32 color = 1;
}
message PulseParams {
uint32 color = 1;
uint32 speed_ms = 2;
}
message FadeParams {
repeated uint32 colors = 1; // Fade between these colors
uint32 speed_ms = 2;
}
message FlickerParams {
uint32 color = 1;
uint32 intensity = 2; // e.g., 0-100
}
message RfidReading {
uint32 card_id = 1;
}
message SensorToControlMessage {
uint32 sensor_id = 1;
oneof payload {
RfidReading rfid_reading = 2;
// Add other sensor message types as needed
}
}
message ControlToSensorMessage {
uint32 control_id = 1;
oneof payload {
LedConfig led_config = 2;
// Add other control message types as needed
}
}