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 bluetooth reading #24

Closed
wants to merge 41 commits into from
Closed

Refactor bluetooth reading #24

wants to merge 41 commits into from

Conversation

DSIW
Copy link
Collaborator

@DSIW DSIW commented May 5, 2024

  • Extract ScooterReader
  • Extract BatteryReader
  • Extract CharacteristicRepository
  • Remove unused CBB capacity reading

QA checklist

  • Read state (state & power state)
  • Read primary battery SOC
  • Read primary battery cycles
  • Read secondary battery SOC
  • Read secondary battery cycles
  • Read seat closed
  • Read handlebar
  • Read AUX SOC
  • Read CBB SOC
  • Read CBB charging state
  • Update ping
  • SOCs are cached (after app restart)
  • Commands can be sent (locking & hibernation)

@DSIW DSIW force-pushed the battery-reader branch from c0cf231 to 7e0bd46 Compare May 5, 2024 14:46
@DSIW DSIW marked this pull request as ready for review May 5, 2024 16:23
@DSIW DSIW mentioned this pull request May 10, 2024
@TheFreal
Copy link
Collaborator

TheFreal commented May 11, 2024

Gerade mal ein bisschen durch geguckt...ich weiß, clean code und so, aber fühlt sich für mich persönlich irgendwie etwas arg verschachtelt an? Brauchen sowas wie CacheManager oder StateOfChargeReader wirklich eigene Klassen und Dateien?

@DSIW
Copy link
Collaborator Author

DSIW commented May 11, 2024

Kein Problem, ich schaue mir die Abstraktionen nochmals kritisch an und werde es hoffentlich noch weiter vereinfachen können.

Grundsätzlich bin ich ein Freund von eher kleineren Klassen, um sie leichter testen zu können.

Den CacheManager hatte ich hinzugefügt, um das Schreiben und Auslesen an einer Stelle zu haben.

Den StateOfChargeReader finde ich gerade sinnvoll, weil er den Ping und das Caching beinhaltet. Ggf. brauchen wir den extra CycleReader nicht und kann es in einen allgemeineren BatteryReader umfunktionieren.

DSIW added 10 commits May 13, 2024 08:47
* battery-reader-test:
  Reduce duplication in tests
  Add more tests
  Add tests for BatteryReader
  Align battery reading
  Inline CacheManager and StateOfChargeReader
  Inline CycleReader
  Add tests for CycleReader
  Add tests for CacheManager
  Add tests for CycleReader
  Add test for StringReader
  Reformat
@DSIW
Copy link
Collaborator Author

DSIW commented May 14, 2024

Ich habe nun einige Komponenten zu dem BatteryReader hinzugefügt inkl. Unit-Tests.

@TheFreal
Copy link
Collaborator

Might make sense to rebase your branch first to make sure all changes make it over

@DSIW DSIW closed this Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants