Fix left overs after models refactor (#3)

Co-authored-by: Felipe Diniello <felipediniello@pm.me>
Reviewed-on: #3
This commit was merged in pull request #3.
This commit is contained in:
2023-06-19 18:37:49 +02:00
parent 962b90e1b8
commit 990e8955e4
11 changed files with 33 additions and 24 deletions

View File

@@ -5,17 +5,31 @@
pub mod influx;
pub mod helper;
// random functions for mqtt
pub mod mqtt;
pub mod unit_conversion;
// Commonly used types across the services
mod types {
pub mod mac;
pub mod mac; // deprecated for the time being.
pub mod point;
}
pub type Point = types::point::Point;
pub type MAC = types::mac::MAC;
mod models;
mod models {
pub mod antenna;
pub mod beacon_measure;
pub mod dynamic_device_status;
pub mod known_position;
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct DeviceReport {
pub data: Vec<crate::models::beacon_measure::BeaconMeasure>,
}
}
pub type Antenna = models::antenna::Antenna;
pub type DeviceReport = models::DeviceReport;
pub type KnownPosition = models::known_position::KnownPosition;

View File

@@ -6,8 +6,10 @@ use crate::{unit_conversion::UnitsConversion, Point};
pub struct Antenna {
pub id: String,
pub tssi: f64,
pub coord: Point,
pub comment: Option<String>,
pos_x: f64,
pos_y: f64,
pos_z: f64,
}
impl Antenna {
@@ -19,11 +21,17 @@ impl Antenna {
Antenna {
id: id.into(),
comment: None,
coord,
pos_x: coord.x,
pos_y: coord.y,
pos_z: 0.0,
tssi,
}
}
pub fn coord(&self) -> Point {
Point::new(self.pos_x, self.pos_y)
}
pub fn get_rssi(&self, distance: f64) -> f64 {
#[allow(non_snake_case)]
// Free Space Path Loss

View File

@@ -1,9 +0,0 @@
pub mod antenna;
pub mod beacon_measure;
pub mod dynamic_device_status;
pub mod known_position;
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct DeviceReport {
pub data: Vec<crate::models::beacon_measure::BeaconMeasure>,
}