Skip to content

Conversation

john-michaelburke
Copy link
Collaborator

@john-michaelburke john-michaelburke commented Apr 17, 2021

Backend

  • Merged TCP connection, File connection, (soon) serial connection, pause, and disconnect into a generic "ConnectRequest" capnproto.
  • Moved TCP/File/(soon) Serial requests to a ServerState struct with associated functions for easier handling of the threads they run on.
  • Attempted to clean up the footprint of client_send clones by pushing it through the MainTab struct which passes it down to all subtabs. (My implementation has way too many statics so if someone could recommend a better approach please share.)
  • Added unittests for connect_to_file/pause(simulating the mechanism) / disconnect (simulating the mechanism) / no unittest for TCP connection seemed it would take some time for me I created a ticket to track this https://swift-nav.atlassian.net/browse/CPP-111

Frontend

  • Connect button is now checkable, if you are connected and uncheck it will kill the connection to allow for a new one.
  • Pause button will pause the current running connection, unchecking will resume (does not process messages during this pause)
  • Bottom Nav Bar has a dropdown for TCP/Serial/File. Serial is not implemented yet and all the fields are placeholders for what will be there. TCP and (absolute) Filepaths do work. For quickly connecting to the "test" piksi if the tcp Host/Port fields are blank you can just click connect and it will still connect (until we deem this unnecessary).
  • Added a Constants.qml file which we can reference for nested constants, still haven't quite worked out how to pass it down to subfolders/tabs as it is intended to be a single object.

Still need to include delays for files, serial connections, and the refresh rate toggle but I figured itd be better to get this in first.

@john-michaelburke john-michaelburke changed the title [CPP-102][CPP-78][CPP-79]Navbar + TCP / Serial / File comms, disconnect, pause, refresh rate, [CPP-78][CPP-79]Navbar + TCP / File comms, disconnect, pause Apr 20, 2021
@john-michaelburke john-michaelburke force-pushed the john-michaelburke/tcp_serial branch from 6cc5226 to 7ec30a2 Compare April 20, 2021 19:00
@john-michaelburke john-michaelburke force-pushed the john-michaelburke/tcp_serial branch from 7ec30a2 to a29b1d6 Compare April 20, 2021 19:01
@john-michaelburke john-michaelburke requested review from a team, jayvdb and silverjam April 20, 2021 19:10
@john-michaelburke john-michaelburke marked this pull request as ready for review April 20, 2021 19:51
pub struct SolutionTab {
pub age_corrections: Option<f64>,
pub available_units: [&'static str; 2],
pub client_sender: Box<dyn MessageSender>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless there is some use case for swapping different sender types at runtime I think just making the struct generic is better -

pub struct SolutionTab<S: MessageSender> {
    pub client_sender: S,
    ...
}

I think this might solve the 'static issue as well

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Worked beautifully!!

@john-michaelburke john-michaelburke force-pushed the john-michaelburke/tcp_serial branch from e31a1f3 to b7a87ce Compare April 20, 2021 22:53

#[derive(Clone)]
use std::fmt::Debug;
impl Debug for dyn MessageSender {
Copy link
Contributor

@notoriaga notoriaga Apr 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you have Debug and Clone be supertraits of MessageSender like

trait MessageSender: Debug + Clone {
  ...
}

you can avoid this impl and the + Clone (in one of the tab constructors). Assuming it makes sense to require the sender to be both of those, which seems reasonable

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}
if shared_state.is_paused() {
loop {
if !shared_state.is_paused() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a busy loop?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it was. I added a 100 ms sleep.

@john-michaelburke john-michaelburke force-pushed the john-michaelburke/tcp_serial branch from 8db7e68 to cbd8a20 Compare April 21, 2021 05:07
@john-michaelburke john-michaelburke merged commit 16b0e39 into main Apr 21, 2021
@john-michaelburke john-michaelburke deleted the john-michaelburke/tcp_serial branch April 21, 2021 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants