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:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>,
|
||||
}
|
||||
Reference in New Issue
Block a user