Function upload

Source
pub async fn upload(
    station_uinq_id: &str,
    pin: u32,
    sample: SampleUpload,
    contact: &str,
) -> Result<(), FetchError>
Expand description

Upload sensor readings from a measurement station.

  • station_uniq_id: StationUniqID sometimes called ChipID or Sensor UID e.g. raspi-12345
  • pin: Sensor type identification e.g. 1 for SDS011
  • sample: SampleUpload
  • contact: Contact point e.g. email address
let su = SampleUpload {
    software_version: "rust-sensor-community-0.0.0".to_string(),
    sensordatavalues: vec![SensorDataValue {
        id: None,
        value_type: "P2".to_string(),
        value: serde_json::Value::String("3.22".to_string()),
    }],
};
println!("sending data: {}", serde_json::to_string(&su).unwrap());
let r = sensor_community::upload("raspi-12345", 1, su, "foo@example.com").await;
println!("{:?}", r);