Skip to content

[OCPP] Add support for OCPP 2.1 Q11 and Q12#1852

Open
JB-CompleoCS wants to merge 9 commits intomainfrom
feature/add-support-for-ocpp21-Q11-Q12
Open

[OCPP] Add support for OCPP 2.1 Q11 and Q12#1852
JB-CompleoCS wants to merge 9 commits intomainfrom
feature/add-support-for-ocpp21-Q11-Q12

Conversation

@JB-CompleoCS
Copy link

@JB-CompleoCS JB-CompleoCS commented Feb 20, 2026

Describe your changes

Adds support for OCPP 2.1 use cases Q11 and Q12 to libocpp.

Issue ticket number and link

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have made corresponding changes to the documentation
  • I read the contribution documentation and made sure that my changes meet its requirements

std::optional<std::int32_t> get_priority_from_configuration_slot(const int configuration_slot) const override;
const std::vector<int>& get_network_connection_slots() const override;
bool is_websocket_connected() override;
std::optional<std::chrono::time_point<std::chrono::steady_clock>> get_time_disconnected() const;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why make this optional? It was not before so I don't think it should be. I think this also affects the construction of the time disconnected time point

Copy link
Author

Choose a reason for hiding this comment

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

Before this change a value of 0s was used for 'time disconnected not set'. To me this is a use case for an optional where std::nullopt means 'time disconnected not set'. But if you like it more the way it was before, I can revert that change

Copy link
Contributor

Choose a reason for hiding this comment

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

You are right. However, as it is implemented now this "feature" is not used anymore as we always set the disconnected time.
I think a good way to move forward would be to move this "not set" feature to where the old uses of time_disconnected were done and always update time_disconnected since it is now always needed by the new invalid offline profile functionality.

Copy link
Author

Choose a reason for hiding this comment

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

The idea was that get_time_disconnected returns std::nullopt, if we are not disconnected at all. And if we are disconnected, it returns the corresponding time point. The same way time_disconnected had time_since_epoch() == 0s before when we were not disconnected.
The new invalid offline profile functionality treats it exactly this way.

Copy link
Contributor

@Pietfried Pietfried left a comment

Choose a reason for hiding this comment

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

…tivity manager

Signed-off-by: Jan Bruchhaus <Jan.Bruchhaus@compleo-cs.com>
Signed-off-by: Jan Bruchhaus <Jan.Bruchhaus@compleo-cs.com>
Signed-off-by: Jan Bruchhaus <Jan.Bruchhaus@compleo-cs.com>
Signed-off-by: Jan Bruchhaus <Jan.Bruchhaus@compleo-cs.com>
Signed-off-by: Jan Bruchhaus <Jan.Bruchhaus@compleo-cs.com>
…ionals

Signed-off-by: Jan Bruchhaus <Jan.Bruchhaus@compleo-cs.com>
Signed-off-by: Jan Bruchhaus <Jan.Bruchhaus@compleo-cs.com>
…ing the connected callback

Signed-off-by: Jan Bruchhaus <Jan.Bruchhaus@compleo-cs.com>
@DR-CompleoCS DR-CompleoCS force-pushed the feature/add-support-for-ocpp21-Q11-Q12 branch from 1b3d211 to ae63fda Compare February 26, 2026 14:32
@Pietfried Pietfried requested review from Pietfried and mlitre March 2, 2026 10:01
Pietfried
Pietfried previously approved these changes Mar 2, 2026
Copy link
Contributor

@Pietfried Pietfried left a comment

Choose a reason for hiding this comment

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

lgtm

…1 and Q12

Co-authored-by: Piet Gömpel <37657534+Pietfried@users.noreply.github.com>
Signed-off-by: JB-CompleoCS <Jan.Bruchhaus@compleo-cs.com>
std::optional<std::int32_t> get_priority_from_configuration_slot(const int configuration_slot) const override;
const std::vector<int>& get_network_connection_slots() const override;
bool is_websocket_connected() override;
std::optional<std::chrono::time_point<std::chrono::steady_clock>> get_time_disconnected() const override;
Copy link
Contributor

Choose a reason for hiding this comment

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

We should wrap this in a monitor as it can now be used from multiple threads

Comment on lines -1132 to -1135
if (this->device_model->get_value<int>(ControllerComponentVariables::OfflineThreshold) != 0) {
// Get the current time point using steady_clock
this->time_disconnected = std::chrono::steady_clock::now();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a regression on this functionality as we now always set the time disconnected. We should most likely remove the optional from time_disconnected and a check on this variable when we do the reconnection check. See other comment

this->connectivity_manager->confirm_successful_connection();

if (this->time_disconnected.time_since_epoch() != 0s) {
if (const auto time_disconnected = this->connectivity_manager->get_time_disconnected();
Copy link
Contributor

Choose a reason for hiding this comment

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

We should use the check on the variable here since we always set time disconnected

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.

3 participants