diff --git a/config.example.toml b/config.example.toml index 3a6f0f8c261b12f010adc4c04e239f8b5b8a537d..b514f200b8020ca7dd05cc206d97844de5a2fe67 100644 --- a/config.example.toml +++ b/config.example.toml @@ -11,4 +11,10 @@ max_hops = 3 latitude = 45.0 longitude = -66.0 altitude = 30 # meters -comment = "Check out my cool CATS beacon!" +comment = "Check out my cool CATS I-gate!" +# These settings DO NOT change anything about how +# the software/hardware work. It only changes data +# in the NodeInfo whisker +antenna_height = 10 # meters above ground +antenna_gain = 2 # dBi +tx_power = 30 # dBm diff --git a/src/config.rs b/src/config.rs index b9ecded3c145479716c64d2d8da616ac72988c98..d8c2f9418f9c7878261139facc4355bca1875548 100644 --- a/src/config.rs +++ b/src/config.rs @@ -20,6 +20,9 @@ pub struct BeaconConfig { pub longitude: Option<f64>, pub altitude: Option<f64>, pub comment: Option<String>, + pub antenna_height: Option<u8>, + pub antenna_gain: Option<f32>, + pub tx_power: Option<f32>, } #[derive(Deserialize, Clone)] diff --git a/src/gate.rs b/src/gate.rs index 4657576844e63f4a1d953095011ad7b7a7fe7552..68443e15f82b144d599bc88cf286f5525b67bee5 100644 --- a/src/gate.rs +++ b/src/gate.rs @@ -9,6 +9,7 @@ use anyhow::{anyhow, Context}; use async_stream::stream; use half::f16; use ham_cats::buffer::Buffer; +use ham_cats::whisker::NodeInfoBuilder; use ham_cats::{ packet::Packet, whisker::{Gps, Identification, Route}, @@ -19,6 +20,9 @@ use tokio_stream::StreamExt; use tonic::{transport::Channel, Request}; use uuid::Uuid; +const HARDWARE_ID: u16 = 0x7c85; +const SOFTWARE_ID: u8 = 0x00; + pub fn beacon_forever( c: &Config, modem_send: mpsc::Sender<Vec<u8>>, @@ -58,6 +62,26 @@ pub fn beacon_forever( .map_err(|e| anyhow!("Could not add gps to beacon packet: {e}"))?; } + let mut info_builder = NodeInfoBuilder::default() + .hardware_id(HARDWARE_ID) + .software_id(SOFTWARE_ID); + + if let Some(height) = c.beacon.antenna_height { + info_builder = info_builder.antenna_height(height); + } + + if let Some(gain) = c.beacon.antenna_gain { + info_builder = info_builder.antenna_gain(gain as f64); + } + + if let Some(power) = c.beacon.tx_power { + info_builder = info_builder.tx_power(power as f64); + } + + packet + .add_node_info(info_builder.build()) + .map_err(|e| anyhow!("Could not add info to beacon packet: {e}"))?; + let mut internet_buf = [0; MAX_PACKET_LEN]; let mut internet_packet = packet.clone_backing(&mut internet_buf); let mut rf_packet = packet;