add power to RadioData
This commit is contained in:
parent
566983283a
commit
64cf89b185
2 changed files with 5 additions and 8 deletions
|
@ -1,5 +1,4 @@
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use serde_json;
|
|
||||||
use reqwest::Client;
|
use reqwest::Client;
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
|
@ -8,13 +7,10 @@ pub struct RadioData {
|
||||||
pub radio: String,
|
pub radio: String,
|
||||||
pub frequency : String,
|
pub frequency : String,
|
||||||
pub mode: String,
|
pub mode: String,
|
||||||
|
pub power: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
pub async fn upload(url: &str, radio_data: &RadioData) {
|
pub async fn upload(url: &str, radio_data: &RadioData) {
|
||||||
let radio_data_json = serde_json::to_string(radio_data).unwrap();
|
let _res = Client::new().post(url).json(&radio_data).send().await.unwrap();
|
||||||
|
}
|
||||||
let res = Client::new().post(url).json(&radio_data_json).send().await.unwrap();
|
|
||||||
|
|
||||||
println!("{}", radio_data_json);
|
|
||||||
}
|
|
||||||
|
|
|
@ -10,8 +10,9 @@ fn main() {
|
||||||
let rd = RadioData {
|
let rd = RadioData {
|
||||||
key: settings.cloudlog.key,
|
key: settings.cloudlog.key,
|
||||||
radio: settings.cloudlog.identifier,
|
radio: settings.cloudlog.identifier,
|
||||||
frequency: String::from("2400170000"),
|
frequency: String::from("14017000"),
|
||||||
mode: String::from("CW"),
|
mode: String::from("CW"),
|
||||||
|
power: String::from("5"),
|
||||||
};
|
};
|
||||||
|
|
||||||
cloudlog::upload(&settings.cloudlog.url, &rd);
|
cloudlog::upload(&settings.cloudlog.url, &rd);
|
||||||
|
|
Loading…
Reference in a new issue