Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NMEA support improvements #1939

Merged
merged 36 commits into from Feb 15, 2023
Merged

NMEA support improvements #1939

merged 36 commits into from Feb 15, 2023

Conversation

pgrawehr
Copy link
Contributor

@pgrawehr pgrawehr commented Oct 1, 2022

  • Add AIS parser, including AIS target manager
  • Add messages for engine surveillance
  • Improve performance of Geoid calculations
  • Add NMEA Udp server
  • Add NMEA TCP client
  • Fix bugs
  • Improve simulation
Microsoft Reviewers: Open in CodeFlow

pgrawehr and others added 3 commits October 6, 2022 15:58
- Add AIS parser, including AIS target manager
- Add messages for engine surveillance
- Improve performance of Geoid calculations
- Add NMEA Udp server
- Add NMEA TCP client
- Fix bugs
- Improve simulation
@pgrawehr pgrawehr marked this pull request as ready for review October 6, 2022 15:23
@krwq krwq assigned krwq and joperezr Oct 6, 2022
pgrawehr and others added 3 commits October 7, 2022 09:14
@pgrawehr
Copy link
Contributor Author

pgrawehr commented Oct 8, 2022

/azp run dotnet.iot

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@pgrawehr
Copy link
Contributor Author

pgrawehr commented Oct 9, 2022

/azp run dotnet.iot

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

/// <returns>True if a valid position is returned</returns>
public bool TryGetCurrentPosition(out GeographicPosition? position, bool extrapolate, out Angle track, out Speed sog, out Angle? heading)
public bool TryGetCurrentPosition(
Copy link
Member

Choose a reason for hiding this comment

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

I might be missing something but why is this function in the SentenceCache? I'd expect this code to only do caching without any extra logic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, I separated these methods to a separate class. To much logic in the same class is poor design.

/// <summary>
/// A helper DTO to transfer engine data in one blob
/// </summary>
[Serializable]
Copy link
Member

Choose a reason for hiding this comment

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

why do we need the attribute?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because DTOs should generally have this attribute.

/// This class helps finding a free network port for a test.
/// Could be moved to the real library, but with what name?
/// </summary>
internal class NetworkPortScanner
Copy link
Member

Choose a reason for hiding this comment

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

I'd really prefer we did not have to use TCP or UDP anywhere in the product and not have to test it this way

Copy link
Member

Choose a reason for hiding this comment

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

(these kind of stuff tends to be flaky and networking code is always a bit fragile and prone to errors)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know, but this is the best possibility to really do an integration test on several parts at once. And it did help me find compatibility bugs on different platforms (e.g. macOS has several weird bugs in the UDP code).

Copy link
Member

@krwq krwq left a comment

Choose a reason for hiding this comment

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

Sorry this took so long but it was really large PR 😄

Generally speaking looks good to me, there is only one blocking item left before we merge:

  • ensure to add comment with attribution to original code if needed also in tests (if not needed then ignore this)

As a follow up I'd recommend to clean up this code and remove as much code as possible without losing much functionality:

  • remove networking utilities - while they're useful it's better to focus on core abstraction and provide something more general purpose separately
  • try to cleanup the code, generalize repeating code etc

@pgrawehr
Copy link
Contributor Author

Generally speaking looks good to me, there is only one blocking item left before we merge:

* ensure to add comment with attribution to original code if needed also in tests (if not needed then ignore this)

Done.

As a follow up I'd recommend to clean up this code and remove as much code as possible without losing much functionality:

* remove networking utilities - while they're useful it's better to focus on core abstraction and provide something more general purpose separately

I kind of agree. It would be good if we could separate such utilities for general use. We'll have to see how to best achieve that.

* try to cleanup the code, generalize repeating code etc

That could be more difficult. There's indeed a lot of boilerplate code here, but since the messages don't follow a general scheme but instead are individually defined, I don't see much potential there. I'm somewhat trying to achieve that with the high-level interfaces, so that (for instance) one can call TryGetCurrentPosition and the system automatically combines the data from several input messages.

@pgrawehr pgrawehr merged commit 03192fa into dotnet:main Feb 15, 2023
@pgrawehr pgrawehr deleted the AisPR branch February 15, 2023 20:35
@github-actions github-actions bot locked and limited conversation to collaborators Dec 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants