Skip to content

Commit

Permalink
Moved the check for network priorities into the cache function
Browse files Browse the repository at this point in the history
Signed-off-by: Soumya Subramanya <[email protected]>
  • Loading branch information
SNSubramanya committed Sep 12, 2024
1 parent f8342cb commit 623250e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/ocpp/v201/connectivity_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,6 @@ void ConnectivityManager::init_websocket() {
// cache the network profiles on initialization
cache_network_connection_profiles();

if (this->network_connection_priorities.empty()) {
EVLOG_AND_THROW(std::runtime_error("NetworkConfigurationPriority must not be empty"));
}

const auto configuration_slot = this->network_connection_priorities.at(this->network_configuration_priority);
const auto connection_options = this->get_ws_connection_options(std::stoi(configuration_slot));

Expand Down Expand Up @@ -267,12 +263,17 @@ void ConnectivityManager::cache_network_connection_profiles() {
return;
}


// get all the network connection profiles from the device model and cache them
this->network_connection_profiles =
json::parse(this->device_model.get_value<std::string>(ControllerComponentVariables::NetworkConnectionProfiles));

this->network_connection_priorities = ocpp::get_vector_from_csv(
this->device_model.get_value<std::string>(ControllerComponentVariables::NetworkConfigurationPriority));

if (this->network_connection_priorities.empty()) {
EVLOG_AND_THROW(std::runtime_error("NetworkConfigurationPriority must not be empty"));
}
}
} // namespace v201
} // namespace ocpp

0 comments on commit 623250e

Please sign in to comment.