chore: Refactor some of the internal channel details used by the device. #424
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refactor some of the internal channel details used by the device by separating V1 API connection logic from encoding logic
This creates an "RPC Channel" to separate the logic for establishing connections from doing the "RPC" payload request encoding and response parsing for sending
RoborockCommandcommands. The existingsend_commandon the channel has been renamed tosend_messageto be more clear since it is sending aRoborockMessage. The fallback logic is now behind the RPC interface.The motivation for this is because we will likely try to push much of the device connection logic into the background. I'm working on a separate PR that adding A01 protocol and it seems like separating the connection logic from the RPC sending is helpful since when interacting with the devices you only care about sending RPCs.