syntax = "proto2";

package jaiabot.protobuf;

enum ArduinoStatusCode
{
    STARTUP = 0;
    ACK = 1;
    TIMEOUT = 2;
    PREFIX_READ_ERROR = 3;
    MAGIC_WRONG = 4;
    MESSAGE_TOO_BIG = 5;
    MESSAGE_WRONG_SIZE = 6;
    MESSAGE_DECODE_ERROR = 7;
    CRC_ERROR = 8;
    SETTINGS = 9;
}

message ArduinoSettings
{
    required sint32 forward_start = 1;
    required sint32 reverse_start = 2;
}

message ArduinoActuators
{
    // Values to control the motor, surfaces, etc.
    required sint32 motor = 1;
    required sint32 port_elevator = 2;
    required sint32 stbd_elevator = 3;
    required sint32 rudder = 4;
    required sint32 timeout = 5;
    required bool led_switch_on = 6;
}

message ArduinoCommand
{
    optional ArduinoSettings settings = 1;
    optional ArduinoActuators actuators = 2;
}

message ArduinoResponse
{
    required ArduinoStatusCode status_code = 1;
    optional float thermocouple_temperature_C = 2;
    optional float vccvoltage = 3;
    optional float vcccurrent = 4;
    optional float vvcurrent = 5;
    optional int32 motor = 6;
    optional float thermistor_voltage = 7;
    optional float generic_gpio_voltage = 8;

    optional uint32 crc = 50;
    optional uint32 calculated_crc = 51;
    required uint32 version = 52 [default = 0];
}

message ArduinoDebug
{
    optional bool arduino_restarted = 1 [default = false];
    optional bool arduino_not_responding = 2 [default = false];
}
