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

Connectivity manager refactoring #874

Merged
merged 15 commits into from
Nov 26, 2024
Merged

Conversation

marcemmers
Copy link
Contributor

Describe your changes

We refactored the connectivity manager a bit. We tried to make the interface simpler by just having connect() and disconnect() calls to control the manager instead of having 4.

This way we also are able to have slightly more control over how libocpp starts (with start_connecting) and be able to trigger a connection using a specific network profile.

Issue ticket number and link

Checklist before requesting a review

@marcemmers marcemmers force-pushed the connectivity-manager-refactoring branch from d40d83a to 14036b3 Compare November 20, 2024 12:53
Base automatically changed from me-libwebsockets-improvements to main November 20, 2024 13:42
@marcemmers marcemmers force-pushed the connectivity-manager-refactoring branch from 14036b3 to 94123cd Compare November 21, 2024 07:57
Signed-off-by: Marc Emmers <[email protected]>
Signed-off-by: Marc Emmers <[email protected]>
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.

Looks good and more clean 👍

Just a couple of remarks where id like to see some changes.

/// \param configuration_slot Slot in which the configuration is stored
/// \return true if the switch is possible.
bool on_try_switch_network_connection_profile(const int32_t configuration_slot);
void on_reconfiguration_of_security_parameters();
Copy link
Contributor

Choose a reason for hiding this comment

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

According to the documentation a better name could be on_charging_station_certificate_changed

Comment on lines 188 to 189
if (std::optional<std::string> interface_address =
get_network_configuration_interface(configuration_slot_to_set, network_connection_profile.value());
Copy link
Contributor

Choose a reason for hiding this comment

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

This confused me a little bit.

get_network_configuration_interface makes use of the configure_network_connection_profile_callback but get_network_configuration_interface does not return the response of configure_network_connection_profile_callback though, it just returns an interface_address. So if configure_network_connection_profile_callback returns {"sucess": true, interface_string: "std::nullopt"} no connection attempt will be made although that should probably happen, just without specifying the iface.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is a fair point. Renamed the function a little bit and allowed it to be used with nullopt as interface.

get_network_configuration_interface(configuration_slot_to_set, network_connection_profile.value());
interface_address.has_value()) {
connection_options->iface = interface_address;
} else {
can_use_connection_profile = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Id prefer to add a log that mentions that the profile for this slot can not be used.

@marcemmers marcemmers requested a review from Pietfried November 25, 2024 11:39
@marcemmers marcemmers merged commit 9836ac4 into main Nov 26, 2024
7 of 8 checks passed
@marcemmers marcemmers deleted the connectivity-manager-refactoring branch November 26, 2024 09:55
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