v0.1 and onward Interface discussion #10
Replies: 7 comments 12 replies
-
Couple quick thoughts:
|
Beta Was this translation helpful? Give feedback.
-
Thank you for taking a look and for the feedback @mccormick-wooden! The intent behind As our requirements currently stand we did not include the notion of receiving data in version 0.1. One of our larger design goals for the crate is to provide meaningful and usable functionality in each release and so I think there could be an argument for providing the ability to receive data. Our thoughts were that sending data (without receiving) still provides usefulness while keeping the v0.1 scope small. Open to thoughts on that. |
Beta Was this translation helpful? Give feedback.
-
Got it! I think I misunderstood the intent, thanks for clarifying.
I don't have a strong opinion (as just a casual observer for now) and am a little out of my depth wrt embedded. That said, TCP is inherently a bi-directional protocol and I'm curious about what issues might happen if it's participating in a TCP connection but not handling the read buffer (even in an extremely basic way). In Linux when the read buffer is full the kernel just doesn't ack additional packets but I'm not sure about FreeRTOS (which I think is the kernel for your target here). It's probably the same or similar behavior, but not sure. |
Beta Was this translation helpful? Give feedback.
-
This is a great initial proposal @calebbourg, thank you for this! Here are some of my initial thoughts in continuing to brainstorm our 0.1 API: WifiWould we ever want more than one instance of ClientFor the
ErrorsFor all API functions we also need to define the return and error types that we'll need for v0.1. Again, I want to reiterate how strong a start this is and I look forward to iterating towards a strong first interface definition together! |
Beta Was this translation helpful? Give feedback.
-
In regards to how we want to abstract the transport concept, I agree with @mccormick-wooden that it may be something that reveals itself over time. It's definitely valuable to start thinking about it now and to continue to do so. Depending on our testing strategy it may make sense to provide traits for this early on in order to be able to better stub and mock parts of the system. |
Beta Was this translation helpful? Give feedback.
-
In terms of Error strategy, I'd like to propose starting with the following steps:
|
Beta Was this translation helpful? Give feedback.
-
I've been thinking a bit after our conversation today. What do you think about adding a We could then define a lower level SPI interface that handles the actual SPI bus communication and our It would provide a way to decouple invoking NINA commands from the underlying data bus protocol since they are separate concerns. So in theory Top level interfaces like So the layers of abstraction would be something like:
|
Beta Was this translation helpful? Give feedback.
-
Here is a brainstormed first pass at what a public API might look like for the 0.1 version (and onward) of the crate. It will continue to evolve and can radically change until we reach our first stable 1.0 release.
All input and suggestions are welcomed and encouraged.
Copied over from this Google doc
Some notes on API best practice guidelines:
firmware_version
) prefer 3 words or less where possible.Proposed Public Functions/Methods
These are some ideas on what our public API could look like. I’ve added some thoughts on underlying implementations where I had some questions but for the most part attempted to keep things at a high level. Likely some of our other Proposed Rust Crate Structs not mentioned here will turn up behind the scenes.
The intent here is to satisfy the following v0.1 requirements:
Structs
Wifi
- handles interaction with a Wifi network.Responsibilities:
Methods and Parameters:
init
- returns a Wifi struct instance which is configured according to the given arguments. Joins network.join
- joins a WIFI networkssid
passphrase
leave
- leaves currently joined WiFi network. TransitionsWifi
struct to disabled. Returns()
.resolve
- resolves hostname to IPfirmware_version
- returns current NINA firmware version.Client
(orTcpClient
)Responsibilities:
Methods and Parameters:
init
- returns instance of struct. V0.1 Assumption: We will only handle one client connection at a time.Wifi
instance - should indicate somehow that a network has been joinedconnect
- connect to a TCP server with IP/Portconnect_with_hostname
- connect to a TCP server with a hostname. Will useWifi.resolve
internally to resolve hostnamedisconnect
- terminate current connection with TCP serversend_data
- send data to a connected TCP serverreceive_data
- receive data from a connected TCP serverconnected
- determines whether the client is connected or notProposed Private Functions/Methods
Bus
possiblyNINABus
Responsibilities:
Methods and Parameters:
call_function(funct, parameters)
Beta Was this translation helpful? Give feedback.
All reactions