Files
Vermix-Gate/proto/hardware.proto
T
2025-10-06 18:27:50 +02:00

104 lines
2.2 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;
LedConfig on_override_open_led = 12;
LedConfig on_interception_led = 13;
}
// 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;
SensorOTAEnableResponse ota_response = 3;
// Add other sensor message types as needed
}
}
message SensorOTAEnable {
string ssid = 1;
string password = 2;
uint32 timeout_seconds = 3;
bool as_station_mode = 4;
bool use_static_ip = 5;
string static_ip = 6;
string netmask = 7;
string gateway = 8;
}
message SensorRestart {
}
message SensorOTAEnableResponse {
bool success = 1;
string ip_address = 2;
string error_message = 3;
}
message ControlToSensorMessage {
uint32 control_id = 1;
oneof payload {
LedConfig led_config = 2;
SensorOTAEnable ota_enable = 3;
SensorRestart restart = 4;
// Add other control message types as needed
}
}