Skip to content

Conversation

@rafaellehmkuhl
Copy link
Member

@rafaellehmkuhl rafaellehmkuhl commented Apr 15, 2022

Fix #708

Image available.

@rafaellehmkuhl rafaellehmkuhl marked this pull request as ready for review April 15, 2022 19:35
@rafaellehmkuhl rafaellehmkuhl marked this pull request as draft April 15, 2022 19:37
@rafaellehmkuhl rafaellehmkuhl force-pushed the add-settings-to-nmea-injector branch from 8dbb729 to 168cbba Compare April 15, 2022 19:43
@rafaellehmkuhl rafaellehmkuhl marked this pull request as ready for review April 15, 2022 19:49
@rafaellehmkuhl rafaellehmkuhl marked this pull request as draft April 15, 2022 20:21
@rafaellehmkuhl rafaellehmkuhl force-pushed the add-settings-to-nmea-injector branch 4 times, most recently from 3b3af1d to 1fea99b Compare April 15, 2022 22:16
@rafaellehmkuhl rafaellehmkuhl marked this pull request as ready for review April 15, 2022 22:42

def __init__(self) -> None:
self._socks: Dict[NMEASocket, Union[asyncio.AbstractServer, asyncio.BaseTransport]] = {}
self._settings_manager = Manager("NmeaInjector", SettingsV1)
Copy link
Member

Choose a reason for hiding this comment

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

we are using lowercase for our settings name.

else:
raise UnsupportedSocketKind(f"Got {sock.kind}. Expected one of: {[kind.value for kind in SocketKind]}.")
self._socks[sock] = server_socket
settings_spec = NmeaInjectorSettingsSpecV1.from_spec(sock)
Copy link
Member

Choose a reason for hiding this comment

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

It would be better to have such method encapsulate over a free function or inside the NMEASocket class, the reason behind this is that each settings version will need to implement such function unnecessary, like V1, V2, v3, so every time that we update the settings such method will need to exist.
If we move it to a free function or inside the NMEASocket class, the function will only need to exist in a single place and be updated when the settings version change, over duplicating such method over and over for each settings.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree. Was following the same pattern as the Bridget implementation, but this seems better.

component_id = pykson.IntegerField()

@staticmethod
def from_spec(spec: "NmeaInjectorSpec") -> "NmeaInjectorSettingsSpecV1": # type: ignore
Copy link
Member

Choose a reason for hiding this comment

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

This should be NMEASocket when reading async def add_sock(self, sock: NMEASocket) -> None:

image

@rafaellehmkuhl rafaellehmkuhl force-pushed the add-settings-to-nmea-injector branch 2 times, most recently from 8812683 to a125f81 Compare April 18, 2022 13:30
@rafaellehmkuhl
Copy link
Member Author

@patrickelectric I'm waiting for the image build to test with the modifications.

@rafaellehmkuhl rafaellehmkuhl force-pushed the add-settings-to-nmea-injector branch from a125f81 to e259069 Compare April 18, 2022 14:10
@patrickelectric
Copy link
Member

@patrickelectric I'm waiting for the image build to test with the modifications.

I tested and eveything appears to be working.
Nice work!

@patrickelectric patrickelectric merged commit f6bbed4 into bluerobotics:master Apr 18, 2022
@rafaellehmkuhl rafaellehmkuhl deleted the add-settings-to-nmea-injector branch April 18, 2022 14:53
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.

core: NMEA-Injector does not save settings

2 participants