syntax = "proto3";

message CombinedData {
  uint32 abs_timestamp = 1;
  repeated Device devices = 2;
  repeated GatewayPoint gateway_points = 3;
  repeated PositionPoint position_points = 4;
  repeated WindPoint wind_points = 5;
}

message Device {
  optional uint32 type = 1;  // 0 = P2, ....
  uint32 serial_number = 2;
  repeated DevicePoint device_points = 3;
}

message DevicePoint {
  optional uint32 timestamp = 1;
  optional uint32 device_status = 2;
  uint32 ldsa = 3;
  uint32 average_particle_diameter = 4;
  uint32 particle_number_concentration = 5;
  int32 temperature = 6;
  uint32 relative_humidity = 7;
  uint32 battery_voltage = 8;
  uint32 particle_mass = 9;
  uint32 corona_voltage = 10;
  uint32 diffusion_current = 11;
  uint32 deposition_voltage = 12;
  uint32 flow = 13;
  uint32 ambient_pressure = 14;
  uint32 electrometer_offset = 15;
  uint32 electrometer_2_offset = 16;
  uint32 electrometer_gain = 17;
  uint32 electrometer_2_gain = 18;
  uint32 diffusion_current_offset = 19;
  uint32 particle_number_10nm = 20;
  uint32 particle_number_16nm = 21;
  uint32 particle_number_26nm = 22;
  uint32 particle_number_43nm = 23;
  uint32 particle_number_70nm = 24;
  uint32 particle_number_114nm = 25;
  uint32 particle_number_185nm = 26;
  uint32 particle_number_300nm = 27;
  uint32 surface = 28;            // um^2 / cm^3 -> * 100
  uint32 sigma_size_dist = 29;    // * 100
  uint32 steps_inversion = 30;    // * 1
  uint32 current_dist_0 = 31;     // * 100'000
  uint32 current_dist_1 = 32;     // * 100'000
  uint32 current_dist_2 = 33;     // * 100'000
  uint32 current_dist_3 = 34;     // * 100'000
  uint32 current_dist_4 = 35;     // * 100'000
  uint32 pump_current = 36;       // * 100
  uint32 pump_pwm = 37;           // * 1
  optional int32 cs_status = 38;  // 0=off, 1=on
}

message GatewayPoint {
  optional uint32 timestamp = 1;
  uint32 serial_number = 2;
  uint32 firmware_version = 3;
  uint32 free_memory = 4;
  uint32 free_heap = 5;
  uint32 largest_free_block_heap = 6;
  int32 cellular_signal = 7;
  uint32 battery_int_soc = 8;
  uint32 battery_ext_soc = 9;
  uint32 battery_ext_voltage = 10;
  uint32 charging_ext_voltage = 11;  // solar charging
}

message PositionPoint {
  optional uint32 timestamp = 1;
  float latitude = 2;
  float longitude = 3;
  // maybe use geohash to save space???
}

message WindPoint {
  optional uint32 timestamp = 1;
  optional uint32 wind_speed = 2;
  optional uint32 wind_angle = 3;
}