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 OCPP calling logic #1669

Merged
merged 6 commits into from
Jan 8, 2025
Merged

Refactor OCPP calling logic #1669

merged 6 commits into from
Jan 8, 2025

Conversation

goekay
Copy link
Member

@goekay goekay commented Jan 5, 2025

motivation: remove some technical debt, unnecessary code ceremony etc. to have a simpler entry point to make calls at stations.

  • refactor ChargePointSelect to use OcppProtocol: this DTO should include the protocol which contains transport and version info. this would enable to unify some logic wrt. Invoker and Client classes.
  • unify version-specific Client and Invoker classes: removing some code ceremony in order to create one interface that can handle all kinds of Ocpp messages to send to stations. ChargePointServiceClient is this new entry point. it hides
    • SOAP or JSON decision,
    • decisions wrt. the 1.2, 1.5 and 1.6 versions
  • add support for callback registration in ChargePointServiceClient
  • make CommunicationTask OcppVersion-agnostic: CommunicationTasks are not tied to a OcppVersion anymore. this opens up some flexibility when creating and using tasks. reason: since ChargePointSelect carries the transport and version info, we can derive the version info from ChargePointSelect.getOcppProtocol().getVersion(). therefore, if wanted, CommunicationTasks can be used for mixed OcppVersions now. keep in mind that the UI elements still use them for one version.
  • improve exception handling during calls:
    • bugfix: ChargePointServiceJsonInvoker should call failed(..) instead of defaultCallback().failed(..)
      because failed(..) iterates over all registered callbacks, whereas defaultCallback only the default one.
      this was letting other callbacks hang.
    • ChargePointServiceSoapInvoker should not throw Exception if one mismatched "station X operation"
      combination is not fitting. instead, we create the dedicated failure msg and trigger the callbacks for this
      combination and continue with other stations.

goekay added 6 commits January 5, 2025 16:06
this DTO should include the protocol which contains transport and version info.
this would enable to unify some logic wrt. Invoker and Client classes.
reason: removing some code ceremony in order to create one interface that can handle all kinds of
Ocpp messages to send to stations. ChargePointServiceClient is this new entry point. it hides
- SOAP or JSON decision,
- decisions wrt. the 1.2, 1.5 and 1.6 versions
CommunicationTasks are not tied to a OcppVersion anymore. this opens up
some flexibility when creating and using tasks.

reason: since ChargePointSelect carries the transport and version info,
we can derive the version info from ChargePointSelect.getOcppProtocol().getVersion().
therefore, if wanted, CommunicationTasks can be used for mixed OcppVersions now.
keep in mind that the UI elements still use them for one version.
* bugfix: ChargePointServiceJsonInvoker should call failed(..) instead of defaultCallback().failed(..)
because failed(..) iterates over all registered callbacks, whereas defaultCallback only the default one.
this was letting other callbacks hang.

* ChargePointServiceSoapInvoker should not throw Exception if one mismatched "station X operation"
combination is not fitting. instead, we create the dedicated failure msg and trigger the callbacks for this
combination and continue with other stations.
@goekay goekay merged commit a7697fd into master Jan 8, 2025
45 checks passed
@goekay goekay deleted the refactor_ocpp_calling_logic branch January 8, 2025 22:49
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.

1 participant