Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Design Serial protocol #65

Closed
wants to merge 47 commits into from
Closed

Conversation

ed7coyne
Copy link
Collaborator

#35

@ed7coyne
Copy link
Collaborator Author

@proppy
Take a look at modem/design.md when you get a second. It is pretty high level but that is how I would like to organize the design of this.

Also I have been sticking with the term "modem" you used before. Now would be a good time to change it if we want something else :)

@proppy
Copy link
Contributor

proppy commented Feb 12, 2016

Take a look at modem/design.md when you get a second. It is pretty high level but that is how I would like to organize the design of this.

It looks simple, I made a few comments: but what do you think of first developing the modem as a flat .ino example w/o much architecture before iterating on the design?


![Design diagram](diagram.png)

We create a Transceiver object that will manage the serial connection. It will do command detection and hand off to the appropriate Command object to handle the interaction. The Command object will be subclassed for each type of command we will receive and will handle the processing of the command and generating the response.
Copy link
Contributor

Choose a reason for hiding this comment

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

How do you plan to dynamically dispatch the command to the right instance of Command object?

And what's the lifecycle of a Command object? Does it carry any state or is it purely a function wrapper?

Copy link
Contributor

Choose a reason for hiding this comment

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

what do you think of Protocol instead of transceiver, with the following instance
SerialProtocol
SPIProtocol
I2CProtocol.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I updated the document to include this. But since all of our commands can be uniquely identified by the first word (text before whitespace) it should be trivial. We could get fancy with a module registration system, (ala REGISTER_MAPPER for MRs), but the command list is small enough it will probably just end up being a if-then tree.

I think the commands should be short lived. I don't see any of them needing to persist state and keeping the objects alive uses extra memory we could use for data handling.

How about SerialTransciever to allow the other protocols in the future? Just as a object I prefer to name it after what it is doing.

@ed7coyne
Copy link
Collaborator Author

As for the simplified .ino, I would prefer to build a testing framework that wraps a command object and build the commands against that. It is quick to iterate and hopefully we can do it off-device. The flat .ino could work as an overall proof of concept but all of the manual testing work would be lost while the unit tests could live on to ensure we don't introduce regressions as we go.

@ed7coyne ed7coyne changed the title Implement modem Design modem Mar 11, 2016
@ed7coyne
Copy link
Collaborator Author

We seem in agreement here, what do you think about merging it in to the repo?

@ed7coyne ed7coyne changed the title Design modem Design Serial protocol Mar 25, 2016
Moving to modem-impl branch.
Moving to modem-impl branch.
@ed7coyne ed7coyne closed this Mar 25, 2016
@ed7coyne
Copy link
Collaborator Author

Merged the design into the impl PR.

@ed7coyne ed7coyne deleted the modem branch June 17, 2016 16:34
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.

2 participants