Skip to content
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

Refactor receiver module #2350

Closed
MattHag opened this issue Mar 1, 2024 · 1 comment · Fixed by #2367
Closed

Refactor receiver module #2350

MattHag opened this issue Mar 1, 2024 · 1 comment · Fixed by #2367

Comments

@MattHag
Copy link
Collaborator

MattHag commented Mar 1, 2024

Information

  • Solaar version: 1.1.11

Describe the solution you'd like
The Receiver class contains many branches based on the receiver_kind. There's the opportunity to split that with subclasses, which implement specific devices like BoltReceiver, UnifyingReceiver etc. and use the factory pattern to instantiate a proper device.

@pfps
Copy link
Collaborator

pfps commented Mar 1, 2024

This is a good idea, but the code is fragile and access to some of the hardware is not possible. A testing methodology will be needed before this is done, with test paths derived from the current code. For example, the current code will have to be examined to see what assumptions it makes about 27MHz receivers and a test devised to ensure that the expected responses produce the same result in the changed code.

MattHag added a commit to MattHag/Solaar that referenced this issue Mar 2, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 2, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 2, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 2, 2024
pfps pushed a commit that referenced this issue Mar 3, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
Provide default implementation and Bolt overrides it. This removes the
need for if else of receiver_kind.

Related pwr-Solaar#2350
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
Provide default implementation and Bolt overrides it. This removes the
need for if else of receiver_kind.

Related pwr-Solaar#2350
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
Introduce Protocol and pass instance of Hidpp10 at instantiation of a
Receiver. This simplifies testing and helps to decouple device from
hidpp10.

Related pwr-Solaar#2350
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
Introduce Protocol and pass instance of Hidpp10 at instantiation of a
Receiver. This simplifies testing and helps to decouple device from
hidpp10.

Related pwr-Solaar#2350
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
Provide default implementation and Bolt overrides it. This removes the
need for if else of receiver_kind.

Related pwr-Solaar#2350
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
MattHag added a commit to MattHag/Solaar that referenced this issue Mar 3, 2024
Introduce Protocol and pass instance of Hidpp10 at instantiation of a
Receiver. This simplifies testing and helps to decouple device from
hidpp10.

Related pwr-Solaar#2350
pfps pushed a commit to pfps/Solaar that referenced this issue Mar 5, 2024
@pfps pfps linked a pull request Mar 6, 2024 that will close this issue
pfps pushed a commit to pfps/Solaar that referenced this issue Mar 8, 2024
@pfps pfps closed this as completed in #2367 Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants