-
Notifications
You must be signed in to change notification settings - Fork 69
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
Multiplexer module for ISO communication #776
base: main
Are you sure you want to change the base?
Conversation
e4803a2
to
02ea455
Compare
What's missing: D20 module needs support for ::1 TCP connections via option, both modules need to allow PnC via option on TCP connection. Config files to be updated to actually use D20 module once it is merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stopping reviewing here as most of the code base is copied from the EvseV2G module (and therefore this would be more like a review for that code base). Nice to see that the proxying can be implemented that easy via the connection_proxy
functions.
I would recommend for the next time, when copying source files, that they are checked in with their initial/original content in a first commit - so it would be possible to track changes.
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright (C) 2022-2023 chargebyte GmbH | ||
// Copyright (C) 2022-2023 Contributors to EVerest | ||
#include "IsoMux.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line after main header file
|
||
void IsoMux::init() { | ||
/* create v2g context */ | ||
v2g_ctx = v2g_ctx_create(&(*r_security)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r_security.get()
) | ||
target_sources(${MODULE_NAME} | ||
PRIVATE | ||
"connection/tls_connection.cpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to upper target_sources
find_package(PkgConfig REQUIRED) | ||
|
||
target_include_directories(${MODULE_NAME} PRIVATE | ||
crypto |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- where is this
crypto
directory? - wouldn't include
connection
here,#include "connection/connection.hpp"
should be more explicit
connection | ||
) | ||
|
||
target_link_libraries(${MODULE_NAME} PUBLIC -lpthread) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would prefer cmakes Threads::Threads
if its enough
mod->r_iso2->subscribe_Require_Auth_EIM([this]() { | ||
if (not mod->selected_iso20()) { | ||
publish_Require_Auth_EIM(nullptr); | ||
} | ||
}); | ||
mod->r_iso20->subscribe_Require_Auth_EIM([this]() { | ||
if (mod->selected_iso20()) { | ||
publish_Require_Auth_EIM(nullptr); | ||
} | ||
}); | ||
|
||
mod->r_iso2->subscribe_Require_Auth_PnC([this](const auto value) { | ||
if (not mod->selected_iso20()) { | ||
publish_Require_Auth_PnC(value); | ||
} | ||
}); | ||
mod->r_iso20->subscribe_Require_Auth_PnC([this](const auto value) { | ||
if (mod->selected_iso20()) { | ||
publish_Require_Auth_PnC(value); | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would sort all these subscriptions by mod->selected_iso20()
and not mod->selected_iso20()
for better overview. Furthermore, currently as the subscribers don't do anything else it would be probably enough to have one if mod->selected_iso2()
block within which you do the subscriptions and the same for the other case
} | ||
}); | ||
|
||
mod->r_iso2->subscribe_Require_Auth_PnC([this](const auto value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably const auto& value
void ISO15118_chargerImpl::handle_set_charging_parameters( | ||
types::iso15118_charger::SetupPhysicalValues& physical_values) { | ||
mod->r_iso20->call_set_charging_parameters(physical_values); | ||
mod->r_iso2->call_set_charging_parameters(physical_values); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not easy to reason here, when information needs to be forwarded to both modules and when not.
For the cases where only one module gets informed, it might be easier to have a pointer like active_iso_module
which points either to r_iso2
or r_iso20
instead of checking selected_iso20
all the time and making this variable probably obsolete
namespace { | ||
|
||
void process_connection_thread(std::shared_ptr<tls::ServerConnection> con, struct v2g_context* ctx) { | ||
assert(con != nullptr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be question of style, but asserting pointers can also be done simply by assert(con)
proto_ns, app_proto->VersionNumberMajor, app_proto->VersionNumberMinor, app_proto->SchemaID, | ||
app_proto->Priority); | ||
|
||
free(proto_ns); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be done after strncmp
.
Thanks for your review, I'm not sure if it makes sense to fix the issues that are copy past from the EvseV2G module as it will make it harder to merge fixes done to EvseV2G into this module. This module is also just an intermediate solution until the D20 module supports DIN and ISO-2 as well. |
This module starts and SDP server and waits for incoming V2G connections (TCP, and optionally TLS). Upon connection, it reads the SupportedAppProtocol.req message to determine if the EV supports ISO-20 or not. If ISO-20 is supported, it transparently bridges the connection to the ISO-20 module (using TLS->TCP). If the EV does not support ISO-20, it bridges to the ISO-2 module instead. Both the required iso-2 and iso-20 modules only need TCP enabled, but they require to accept e.g. PnC on TCP sessions (as the actual communication to the EV may be TLS). Also the need to listen on localhost (::1) instead of the actual PLC device. Signed-off-by: Cornelius Claussen <[email protected]>
02ea455
to
5af54a7
Compare
This module starts and SDP server and waits
for incoming V2G connections (TCP, and optionally TLS). Upon connection, it reads the SupportedAppProtocol.req message to determine if the EV supports ISO-20 or not.
If ISO-20 is supported, it transparently bridges the connection to the ISO-20 module (using TLS->TCP).
If the EV does not support ISO-20, it bridges to the ISO-2 module instead.
Both the required iso-2 and iso-20 modules only need TCP enabled, but they require to accept e.g. PnC on TCP sessions (as the actual communication to the EV may be TLS).
Also the need to listen on localhost (::1) instead of the actual PLC device.
Describe your changes
Issue ticket number and link
Checklist before requesting a review