-
Notifications
You must be signed in to change notification settings - Fork 178
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
Discussion: refactoring/rearchitecting to separate concerns #579
Comments
I would suggest we consider creating/consolidating a set of lower-level primitives from the existing wireless driver code and look at embedding this tried-and-tested functionality in a brand new framework created to a more usable command-line environment, using cleaner internal data structures and (I suspect) greatly simplifying much of the logic. The first step will therefore be to define the radio API (my familiarity with the existing software isn't yet good enough for me to confidently say what parts currently exist) for the layers above to use. There's some milage in that discussion. |
So, several months later, but I think I have a bit of a clearer idea of what can happen here. Our most core/fundamental interaction with the radio is, of course, FromRadio and ToRadio packets. There's a couple user-facing APIs that are built up here, but so far only on the FromRadio side -- The other side of the user-facing APIs is mostly the This plus some functions those things call is probably the base layer of the API, with the inclusion of the several interface subclasses. There is however a lot more in The level above this is basically the CLI itself. Most of the response handlers fall within this (except for some things that should probably be updated automatically, like acknowledgments and updates of data structures), and certainly anything that prints to the console does. I think it's acceptable to have the level below this check for things at some known names (for example, using I don't doubt that there's a few things that fall slightly outside of this structure, but I think this three-tiered model might be a good place to start as far as this kind of separation. One issue with this is the possibility for a proliferation of subclasses, especially for the different connection types. I think we probably would not want to have Curious if the above makes any sense and what thoughts folks have on this structure. |
I wasn't aware of those ideas here and I ended up with something pretty similar what you are describing here (it is implemented in https://github.com/broglep/homeassistant-meshtastic/tree/dev/custom_components/meshtastic/aiomeshtastic) I kind of see the lowest level as the transport layer, where we implement specifics for serial, bluetooth, etc. One such example I stumbled upon was the NodeInfo, that you end up having in 3 different variations (full node info as part of initial connection, partial node info send via mesh as app payload, "aggregated" node info as dict inside In my home assistant integration, I even have one layer more where meshtasic world meets the home assistant world and translation between those two worlds happen. I would see a text based cli on that same level |
The current codebase has a lot of different things interleaved in often unpredictable ways; for example, stuff that controls how data is printed to the console being in the same basic areas of the code as sending and receiving data, and both of those together with code that controls things like managing client connections.
We should more clearly separate these things for a couple reasons:
I think this might get broken up a few different ways and I'm not sure exactly what I think should be done here, but I wanted to get the issue out here to discuss things.
Closely related to #569 since separating the concern of presentation from that of acquiring data is key to that.
Previously: #566
The text was updated successfully, but these errors were encountered: