Refactor Mqtt Sync client (#5)
Co-authored-by: Felipe Diniello <felipediniello@pm.me> Reviewed-on: #5
This commit was merged in pull request #5.
This commit is contained in:
@@ -3,7 +3,7 @@ use std::{thread, time};
|
||||
|
||||
mod error_report;
|
||||
|
||||
use kairo_common::mqtt::for_sync::{get_mqtt_cli, mqtt_pub};
|
||||
use kairo_common::mqtt::for_sync::MqttClient;
|
||||
use kairo_common::{Antenna, BeaconMeasure, DeviceReport, Point};
|
||||
|
||||
#[derive(Clone)]
|
||||
@@ -29,7 +29,7 @@ async fn main() {
|
||||
// });
|
||||
// }
|
||||
|
||||
let client = get_mqtt_cli();
|
||||
let client = MqttClient::new(None);
|
||||
|
||||
let mut position = Point::new(config.radius, 0.0);
|
||||
|
||||
@@ -57,7 +57,9 @@ async fn main() {
|
||||
.push(BeaconMeasure::new(&config.id, &ant.id, rssi + noise));
|
||||
}
|
||||
let payload = serde_json::to_string(&report).unwrap_or_else(|_| "".to_string());
|
||||
mqtt_pub(&client, topic.as_str(), payload.as_str()).expect("Pub error");
|
||||
client
|
||||
.publish(topic.as_str(), Some(payload.as_str()))
|
||||
.expect("Pub error");
|
||||
|
||||
// if config.real {
|
||||
// let _r = KnownPosition::new(position).write_for("real").await;
|
||||
|
||||
Reference in New Issue
Block a user