Skip to content

Commit

Permalink
feat: Integrating features from existing backend into rust, started w…
Browse files Browse the repository at this point in the history
…ith stub functions for get_gps. JIRA: GNS-33
  • Loading branch information
robbie-seymour committed Jul 18, 2023
1 parent 8de15ea commit 7547781
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 2 additions & 0 deletions orch-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ json-patch = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tokio = { version = "1.27", features = ["full"] }
serial = "0.4.0"
serialport = "4.2.1"
13 changes: 13 additions & 0 deletions orch-rs/src/groundstation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub trait GroundStation {
// fn subsribers(&mut self)
// fn subscribe(&mut self, subsriber: &dyn Fn(GroundSationStatus));
// whatever else might be needed for this?
fn get_gps(&mut self);
}

// this stuff will probably get moved out to some sorta test module later
Expand Down Expand Up @@ -47,6 +48,9 @@ impl GroundStation for MockGroundStation {
self.orientation.1 += 0.1;
self.orientation.1 %= 360.0;
}
fn get_gps(&mut self) {
todo!()
}
}

pub struct MobileGroundStation {}
Expand All @@ -59,6 +63,10 @@ impl GroundStation for MobileGroundStation {
fn update(&mut self) {
todo!()
}

fn get_gps(&mut self) {
todo!()
}
}

pub struct PhysicsGroundStation {}
Expand All @@ -71,4 +79,9 @@ impl GroundStation for PhysicsGroundStation {
fn update(&mut self) {
todo!()
}

fn get_gps(&mut self) {
todo!()
}

}
6 changes: 4 additions & 2 deletions orch-rs/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ async fn main() {

// TODO: setup logging

let ws_state = Arc::new(WsState::new());
let ws_state: Arc<WsState> = Arc::new(WsState::new());

// it should probably generate groundstations from a config file
tokio::spawn({
let ws_state = ws_state.clone();
let ws_state: Arc<WsState> = ws_state.clone();
async {
let gs = MockGroundStation::new("test".into(), "nowhere".into(), (0., 0.));
groundstation_handler(gs, ws_state).await;
Expand All @@ -44,6 +44,8 @@ async fn main() {
.serve(app.into_make_service())
.await
.unwrap();


}

async fn ws_handler(
Expand Down

0 comments on commit 7547781

Please sign in to comment.