From 995da924bd2f859cc365404ab1d00d51ea4dc1ca Mon Sep 17 00:00:00 2001 From: MarzellT Date: Thu, 16 Jan 2025 16:15:47 +0100 Subject: [PATCH 1/6] removes unused function calls from tools Signed-off-by: MarzellT --- modules/EvseV2G/tools.cpp | 169 -------------------------------------- modules/EvseV2G/tools.hpp | 68 --------------- 2 files changed, 237 deletions(-) diff --git a/modules/EvseV2G/tools.cpp b/modules/EvseV2G/tools.cpp index 62a35c000f..66cd2a3fb7 100644 --- a/modules/EvseV2G/tools.cpp +++ b/modules/EvseV2G/tools.cpp @@ -55,15 +55,6 @@ int generate_random_data(void* dest, size_t dest_len) { return 0; } -unsigned int generate_srand_seed(void) { - unsigned int s; - - if (generate_random_data(&s, sizeof(s)) == -1) - return 42; /* just to _not_ use 1 which is the default value when srand is not used at all */ - - return s; -} - const char* choose_first_ipv6_interface() { struct ifaddrs *ifaddr, *ifa; char buffer[INET6_ADDRSTRLEN]; @@ -174,40 +165,10 @@ void timespec_add_ms(struct timespec* ts, long long msec) { set_normalized_timespec(ts, ts->tv_sec + sec, ts->tv_nsec + (msec - sec * 1000) * 1000 * 1000); } -/* - * lhs < rhs: return < 0 - * lhs == rhs: return 0 - * lhs > rhs: return > 0 - */ -int timespec_compare(const struct timespec* lhs, const struct timespec* rhs) { - if (lhs->tv_sec < rhs->tv_sec) - return -1; - if (lhs->tv_sec > rhs->tv_sec) - return 1; - return lhs->tv_nsec - rhs->tv_nsec; -} - long long timespec_to_ms(struct timespec ts) { return ((long long)ts.tv_sec * 1000) + (ts.tv_nsec / 1000000); } -long long timespec_to_us(struct timespec ts) { - return ((long long)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); -} - -int msleep(int ms) { - struct timespec req, rem; - - req.tv_sec = ms / 1000; - req.tv_nsec = (ms % 1000) * (1000 * 1000); /* x ms */ - - while ((nanosleep(&req, &rem) == (-1)) && (errno == EINTR)) { - req = rem; - } - - return 0; -} - long long int getmonotonictime() { struct timespec time; clock_gettime(CLOCK_MONOTONIC, &time); @@ -218,136 +179,6 @@ double calc_physical_value(const int16_t& value, const int8_t& multiplier) { return static_cast(value * pow(10.0, multiplier)); } -bool range_check_int32(int32_t min, int32_t max, int32_t value) { - return ((value < min) || (value > max)) ? false : true; -} - -bool range_check_int64(int64_t min, int64_t max, int64_t value) { - return ((value < min) || (value > max)) ? false : true; -} - -void round_down(const char* buffer, size_t len) { - char* p; - - p = (char*)strchr(buffer, '.'); - - if (!p) - return; - - if (p - buffer > len - 2) - return; - - if (*(p + 1) == '\0') - return; - - *(p + 2) = '\0'; -} - -bool get_dir_filename(char* file_name, uint8_t file_name_len, const char* path, const char* file_name_identifier) { - - file_name[0] = '\0'; - - if (path == NULL) { - dlog(DLOG_LEVEL_ERROR, "Invalid file path"); - return false; - } - DIR* d = opendir(path); // open the path - - if (d == NULL) { - dlog(DLOG_LEVEL_ERROR, "Unable to open file path %s", path); - return false; - } - struct dirent* dir; // for the directory entries - uint8_t file_name_identifier_len = std::string(file_name_identifier).size(); - while ((dir = readdir(d)) != NULL) { - if (dir->d_type != DT_DIR) { - /* if the type is not directory*/ - if ((std::string(dir->d_name).size() > (file_name_identifier_len)) && /* Plus one for the numbering */ - (strncmp(file_name_identifier, dir->d_name, file_name_identifier_len) == 0) && - (file_name_len > std::string(dir->d_name).size())) { - strncpy(file_name, dir->d_name, std::string(dir->d_name).size() + 1); - break; - } - } - } - - closedir(d); - - return (file_name[0] != '\0'); -} - -uint8_t get_dir_numbered_file_names(char file_names[MAX_PKI_CA_LENGTH][MAX_FILE_NAME_LENGTH], const char* path, - const char* prefix, const char* suffix, const uint8_t offset, - const uint8_t max_idx) { - if (path == NULL) { - dlog(DLOG_LEVEL_ERROR, "Invalid file path"); - return 0; - } - - DIR* d = opendir(path); // open the path - - if (d == NULL) { - dlog(DLOG_LEVEL_ERROR, "Unable to open file path %s", path); - return 0; - } - struct dirent* dir; // for the directory entries - uint8_t num_of_files = 0; - uint8_t prefix_len = std::string(prefix).size(); - uint8_t suffix_len = std::string(suffix).size(); - uint8_t min_idx = max_idx; // helper value to re-sort array - - while (((dir = readdir(d)) != NULL) && (num_of_files != (max_idx - offset))) { - if (dir->d_type != DT_DIR) { - /* if the type is not directory*/ - if ((std::string(dir->d_name).size() > (prefix_len + suffix_len + 1)) && /* Plus one for the numbering */ - (0 == strncmp(prefix, dir->d_name, prefix_len))) { - for (uint8_t idx = offset; idx < max_idx; idx++) { - /* Iterated over the number prefix */ - if ((dir->d_name[prefix_len] == ('0' + idx)) && - (strncmp(suffix, &dir->d_name[prefix_len + 1], suffix_len) == 0)) { - if (MAX_FILE_NAME_LENGTH >= std::string(dir->d_name).size()) { - strcpy(file_names[idx], dir->d_name); - // dlog(DLOG_LEVEL_ERROR,"Cert-file found: %s", &AFileNames[idx]); - num_of_files++; - min_idx = std::min(min_idx, idx); - } else { - dlog(DLOG_LEVEL_ERROR, "Max. file-name size exceeded. Only %i characters supported", - MAX_FILE_NAME_LENGTH); - num_of_files = 0; - goto exit; - } - } - } - } - } else if (dir->d_type == DT_DIR && strcmp(dir->d_name, ".") != 0 && strcmp(dir->d_name, "..") != 0) { - /*if it is a directory*/ - } - } - /* Re-sort array. This part fills gaps in the array. For example if there is only one file with - * number _4_, the following code will cpy the file name of index 3 of the AFileNames array to - * index 0 (In case AOffset is set to 0) */ - if (min_idx != offset) { - for (uint8_t idx = offset; (idx - offset) < num_of_files; idx++) { - strcpy(file_names[idx], file_names[min_idx + idx - offset]); - } - } - -exit: - closedir(d); - - return num_of_files + offset; -} - -std::string convert_to_hex_str(const uint8_t* data, int len) { - std::stringstream string_stream; - string_stream << std::hex; - - for (int idx = 0; idx < len; ++idx) - string_stream << std::setw(2) << std::setfill('0') << (int)data[idx]; - - return string_stream.str(); -} - types::iso15118::HashAlgorithm convert_to_hash_algorithm(const types::evse_security::HashAlgorithm hash_algorithm) { switch (hash_algorithm) { case types::evse_security::HashAlgorithm::SHA256: diff --git a/modules/EvseV2G/tools.hpp b/modules/EvseV2G/tools.hpp index 2b55dd4bdd..9a329d31e4 100644 --- a/modules/EvseV2G/tools.hpp +++ b/modules/EvseV2G/tools.hpp @@ -19,10 +19,6 @@ #define MAX_FILE_NAME_LENGTH 100 #define MAX_PKI_CA_LENGTH 4 /* leaf up to root certificate */ -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -#endif - #ifndef ROUND_UP #define ROUND_UP(N, S) ((((N) + (S)-1) / (S)) * (S)) #endif @@ -32,7 +28,6 @@ #endif int generate_random_data(void* dest, size_t dest_len); -unsigned int generate_srand_seed(void); enum Addr6Type { ADDR6_TYPE_UNPSEC = -1, @@ -44,13 +39,10 @@ const char* choose_first_ipv6_interface(); int get_interface_ipv6_address(const char* if_name, enum Addr6Type type, struct sockaddr_in6* addr); void set_normalized_timespec(struct timespec* ts, time_t sec, int64_t nsec); -int timespec_compare(const struct timespec* lhs, const struct timespec* rhs); struct timespec timespec_sub(struct timespec lhs, struct timespec rhs); struct timespec timespec_add(struct timespec lhs, struct timespec rhs); void timespec_add_ms(struct timespec* ts, long long msec); long long timespec_to_ms(struct timespec ts); -long long timespec_to_us(struct timespec ts); -int msleep(int ms); long long int getmonotonictime(void); /*! @@ -61,65 +53,6 @@ long long int getmonotonictime(void); */ double calc_physical_value(const int16_t& value, const int8_t& multiplier); -/*! - * \brief range_check_int32 This function checks if an int32 value is within the given range. - * \param min is the min value. - * \param max is the max value. - * \param value which must be checked. - * \return Returns \c true if it is within range, otherwise \c false. - */ -bool range_check_int32(int32_t min, int32_t max, int32_t value); - -/*! - * \brief range_check_int64 This function checks if an int64 value is within the given range. - * \param min is the min value. - * \param max is the max value. - * \param value which must be checked. - * \return Returns \c true if it is within range, otherwise \c false. - */ -bool range_check_int64(int64_t min, int64_t max, int64_t value); - -/*! - * \brief round_down "round" a string representation of a float down to 1 decimal places - * \param buffer is the float string - * \param len is the length of the buffer - */ -void round_down(const char* buffer, size_t len); - -/*! - * \brief get_dir_filename This function searches for a specific name (AFileNameIdentifier) in a file path and stores - * the complete name with file ending in \c AFileName - * \param file_name is the buffer to write the file name. - * \param file_name_len is the length of the buffer. - * \param path is the file path which will be used to search for the specific file. - * \param file_name_identifier is the identifier of the file (file without file ending). - * \return Returns \c true if the file could be found, otherwise \c false. - */ -bool get_dir_filename(char* file_name, uint8_t file_name_len, const char* path, const char* file_name_identifier); - -/*! - * \brief get_dir_numbered_file_names This helper-function searches for numbered files in the given file path and stores - * the file names in given char array - * \param file_names is the char array for the findings. - * \param path is the path where the numbered files are stored. - * \param prefix is the prefix of the numbered file. - * \param suffix is the suffix of the numbered file. - * \param offset defines the starting number of the file name. - * \param max_idx is the max index of a file (Between 0-9). - * \return Returns the number of files which where found in the file path. - */ -uint8_t get_dir_numbered_file_names(char file_names[MAX_PKI_CA_LENGTH][MAX_FILE_NAME_LENGTH], const char* path, - const char* prefix, const char* suffix, const uint8_t offset, - const uint8_t max_idx); - -/*! - * \brief convert_to_hex_str This function converts a array of binary data to hex string. - * \param data is the array of binary data. - * \param len is length of the array. - * \return Returns the converted string. - */ -std::string convert_to_hex_str(const uint8_t* data, int len); - /** * \brief convert the given \p hash_algorithm to type types::iso15118::HashAlgorithm * \param hash_algorithm @@ -134,5 +67,4 @@ types::iso15118::HashAlgorithm convert_to_hash_algorithm(const types::evse_secur */ std::vector convert_to_certificate_hash_data_info_vector(const types::evse_security::OCSPRequestDataList& ocsp_request_data_list); - #endif /* TOOLS_H */ From 7bfcd4d205db13d831412a064ab5e7ae5fa5e8f8 Mon Sep 17 00:00:00 2001 From: Anton Kadelbach Date: Thu, 16 Jan 2025 16:34:51 +0100 Subject: [PATCH 2/6] remove unused stop_timer function Signed-off-by: Anton Kadelbach --- modules/EvseV2G/connection/connection.cpp | 6 +----- modules/EvseV2G/din_server.cpp | 4 ---- modules/EvseV2G/iso_server.cpp | 2 -- modules/EvseV2G/v2g.hpp | 2 -- modules/EvseV2G/v2g_ctx.cpp | 19 ------------------- modules/EvseV2G/v2g_ctx.hpp | 8 -------- 6 files changed, 1 insertion(+), 40 deletions(-) diff --git a/modules/EvseV2G/connection/connection.cpp b/modules/EvseV2G/connection/connection.cpp index e7b068718f..546b5da858 100644 --- a/modules/EvseV2G/connection/connection.cpp +++ b/modules/EvseV2G/connection/connection.cpp @@ -497,9 +497,6 @@ void connection_teardown(struct v2g_connection* conn) { /* init charging session */ v2g_ctx_init_charging_session(conn->ctx, true); - /* stop timer */ - stop_timer(&conn->ctx->com_setup_timeout, nullptr, conn->ctx); - /* print dlink status */ switch (conn->dlink_action) { case MQTT_DLINK_ACTION_ERROR: @@ -861,8 +858,7 @@ static void* connection_handle_tls(void* data) { if (rv != 0) { if (((rv != MBEDTLS_ERR_SSL_WANT_READ) && (rv != MBEDTLS_ERR_SSL_WANT_WRITE) && - (rv != MBEDTLS_ERR_SSL_TIMEOUT)) || - (NULL == conn->ctx->com_setup_timeout)) { + (rv != MBEDTLS_ERR_SSL_TIMEOUT)) { dlog(DLOG_LEVEL_ERROR, "mbedtls_ssl_handshake returned -0x%04x", -rv); goto thread_exit; } diff --git a/modules/EvseV2G/din_server.cpp b/modules/EvseV2G/din_server.cpp index 694b5fdab6..124ea2896f 100644 --- a/modules/EvseV2G/din_server.cpp +++ b/modules/EvseV2G/din_server.cpp @@ -313,10 +313,6 @@ enum v2g_event handle_din_session_setup(struct v2g_connection* conn) { 1]; /* format: (%02x:) * n - 1x ':' + 1x NUL */ int idx; - /* un-arm a potentially communication setup timeout */ - /* dis-arm our communication setup timeout, for this we must hold the MQTT lock */ - stop_timer(&conn->ctx->com_setup_timeout, "session_setup: V2G_COMMUNICATION_SETUP_TIMER", conn->ctx); - /* format EVCC ID */ for (idx = 0; idx < req->EVCCID.bytesLen; idx++) { sprintf(&buffer[idx * 3], "%02" PRIX8 ":", req->EVCCID.bytes[idx]); diff --git a/modules/EvseV2G/iso_server.cpp b/modules/EvseV2G/iso_server.cpp index fb3110b8f7..274aab61f5 100644 --- a/modules/EvseV2G/iso_server.cpp +++ b/modules/EvseV2G/iso_server.cpp @@ -578,8 +578,6 @@ static enum v2g_event handle_iso_session_setup(struct v2g_connection* conn) { dlog(DLOG_LEVEL_INFO, "SessionSetupReq.EVCCID: %s", std::string(buffer).size() ? buffer : "(zero length provided)"); - /* un-arm a potentially communication setup timeout */ - stop_timer(&conn->ctx->com_setup_timeout, "session_setup: V2G_COMMUNICATION_SETUP_TIMER", conn->ctx); /* [V2G2-756]: If the SECC receives a SessionSetupReq including a SessionID value which is not * equal to zero (0) and not equal to the SessionID value stored from the preceding V2G diff --git a/modules/EvseV2G/v2g.hpp b/modules/EvseV2G/v2g.hpp index d01ae40c66..d4afa2be54 100644 --- a/modules/EvseV2G/v2g.hpp +++ b/modules/EvseV2G/v2g.hpp @@ -194,8 +194,6 @@ struct v2g_context { struct event_base* event_base; pthread_t event_thread; - struct event* com_setup_timeout; - const char* if_name; struct sockaddr_in6* local_tcp_addr; struct sockaddr_in6* local_tls_addr; diff --git a/modules/EvseV2G/v2g_ctx.cpp b/modules/EvseV2G/v2g_ctx.cpp index 65862999f8..597ce336cc 100644 --- a/modules/EvseV2G/v2g_ctx.cpp +++ b/modules/EvseV2G/v2g_ctx.cpp @@ -133,11 +133,6 @@ void v2g_ctx_init_charging_state(struct v2g_context* const ctx, bool is_connecti ctx->session.renegotiation_required = false; ctx->session.is_charging = false; - /* Reset timer */ - if (ctx->com_setup_timeout != NULL) { - event_free(ctx->com_setup_timeout); - ctx->com_setup_timeout = NULL; - } } void v2g_ctx_init_charging_values(struct v2g_context* const ctx) { @@ -349,8 +344,6 @@ struct v2g_context* v2g_ctx_create(ISO15118_chargerImplBase* p_chargerImplBase, if (v2g_ctx_start_events(ctx) != 0) goto free_out; - ctx->com_setup_timeout = NULL; - ctx->hlc_pause_active = false; return ctx; @@ -408,18 +401,6 @@ void v2g_ctx_free(struct v2g_context* ctx) { free(ctx); } -void stop_timer(struct event** event_timer, char const* const timer_name, struct v2g_context* ctx) { - pthread_mutex_lock(&ctx->mqtt_lock); - if (NULL != *event_timer) { - event_free(*event_timer); - *event_timer = NULL; // Reset timer pointer - if (NULL != timer_name) { - dlog(DLOG_LEVEL_TRACE, "%s stopped", (timer_name == NULL) ? "Timer" : timer_name); - } - } - pthread_mutex_unlock(&ctx->mqtt_lock); -} - void publish_dc_ev_maximum_limits(struct v2g_context* ctx, const float& v2g_dc_ev_max_current_limit, const unsigned int& v2g_dc_ev_max_current_limit_is_used, const float& v2g_dc_ev_max_power_limit, diff --git a/modules/EvseV2G/v2g_ctx.hpp b/modules/EvseV2G/v2g_ctx.hpp index 8bb0b92d99..e98cd27f82 100644 --- a/modules/EvseV2G/v2g_ctx.hpp +++ b/modules/EvseV2G/v2g_ctx.hpp @@ -86,14 +86,6 @@ void v2g_ctx_init_charging_values(struct v2g_context* const ctx); */ void v2g_ctx_free(struct v2g_context* ctx); -/*! - * \brief stop_timer This function stops a event timer. Note: mqtt_lock mutex must be unclocked before - * calling of this function. - * \param event_timer is the event timer. - * \param timer_name is the name of the event timer. - */ -void stop_timer(struct event** event_timer, char const* const timer_name, struct v2g_context* ctx); - /*! * \brief publish_dc_ev_maximum_limits This function publishes the dc_ev_maximum_limits * \param ctx is a pointer of type \c v2g_context From 08fc1b1531f9f2a074a559cdaae13fe8efd5b7bb Mon Sep 17 00:00:00 2001 From: Anton Kadelbach Date: Thu, 16 Jan 2025 16:46:35 +0100 Subject: [PATCH 3/6] reformate code Signed-off-by: Anton Kadelbach --- modules/EvseV2G/v2g_ctx.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/EvseV2G/v2g_ctx.cpp b/modules/EvseV2G/v2g_ctx.cpp index 597ce336cc..47348b6c9e 100644 --- a/modules/EvseV2G/v2g_ctx.cpp +++ b/modules/EvseV2G/v2g_ctx.cpp @@ -132,7 +132,6 @@ void v2g_ctx_init_charging_state(struct v2g_context* const ctx, bool is_connecti ctx->selected_protocol = V2G_UNKNOWN_PROTOCOL; ctx->session.renegotiation_required = false; ctx->session.is_charging = false; - } void v2g_ctx_init_charging_values(struct v2g_context* const ctx) { From 736dbe0d0a4b0af8503e975ef29226ae37eb6e88 Mon Sep 17 00:00:00 2001 From: MarzellT Date: Thu, 16 Jan 2025 16:54:24 +0100 Subject: [PATCH 4/6] removes unused function calls from v2g_ctx Signed-off-by: MarzellT --- modules/EvseV2G/iso_server.cpp | 1 - modules/EvseV2G/v2g_ctx.cpp | 14 -------------- modules/EvseV2G/v2g_ctx.hpp | 10 ---------- 3 files changed, 25 deletions(-) diff --git a/modules/EvseV2G/iso_server.cpp b/modules/EvseV2G/iso_server.cpp index 274aab61f5..f7175c6fb1 100644 --- a/modules/EvseV2G/iso_server.cpp +++ b/modules/EvseV2G/iso_server.cpp @@ -578,7 +578,6 @@ static enum v2g_event handle_iso_session_setup(struct v2g_connection* conn) { dlog(DLOG_LEVEL_INFO, "SessionSetupReq.EVCCID: %s", std::string(buffer).size() ? buffer : "(zero length provided)"); - /* [V2G2-756]: If the SECC receives a SessionSetupReq including a SessionID value which is not * equal to zero (0) and not equal to the SessionID value stored from the preceding V2G * Communication Session, it shall send a SessionID value in the SessionSetupRes message that is diff --git a/modules/EvseV2G/v2g_ctx.cpp b/modules/EvseV2G/v2g_ctx.cpp index 47348b6c9e..979a436141 100644 --- a/modules/EvseV2G/v2g_ctx.cpp +++ b/modules/EvseV2G/v2g_ctx.cpp @@ -67,20 +67,6 @@ void populate_physical_value_float(struct iso2_PhysicalValueType* pv, float valu pv->Value = value; } -void setMinPhysicalValue(struct iso2_PhysicalValueType* ADstPhyValue, const struct iso2_PhysicalValueType* ASrcPhyValue, - unsigned int* AIsUsed) { - - if (((NULL != AIsUsed) && (0 == *AIsUsed)) || ((pow(10, ASrcPhyValue->Multiplier) * ASrcPhyValue->Value) < - (pow(10, ADstPhyValue->Multiplier) * ADstPhyValue->Value))) { - ADstPhyValue->Multiplier = ASrcPhyValue->Multiplier; - ADstPhyValue->Value = ASrcPhyValue->Value; - - if (NULL != AIsUsed) { - *AIsUsed = 1; - } - } -} - static void* v2g_ctx_eventloop(void* data) { struct v2g_context* ctx = static_cast(data); diff --git a/modules/EvseV2G/v2g_ctx.hpp b/modules/EvseV2G/v2g_ctx.hpp index e98cd27f82..35c9639c51 100644 --- a/modules/EvseV2G/v2g_ctx.hpp +++ b/modules/EvseV2G/v2g_ctx.hpp @@ -55,16 +55,6 @@ bool populate_physical_value(struct iso2_PhysicalValueType* pv, long long int va void populate_physical_value_float(struct iso2_PhysicalValueType* pv, float value, uint8_t decimal_places, iso2_unitSymbolType unit); -/*! - * \brief setMinPhysicalValue This function sets the minimum value of ASrcPhyValue and ADstPhyValue in ADstPhyValue. - * \param ADstPhyValue is the destination value, where the minimum value will be stored. - * \param ASrcPhyValue is the source value, which will be compared with the ADstPhyValue value. - * \param AIsUsed If AIsUsed is \c 0 ASrcPhyValue will be used to initialize ADstPhyValue and AIsUsed will be set to - * \c 1. Can be set to \c NULL - */ -void setMinPhysicalValue(struct iso2_PhysicalValueType* ADstPhyValue, const struct iso2_PhysicalValueType* ASrcPhyValue, - unsigned int* AIsUsed); - /*! * \brief v2g_ctx_init_charging_state This function inits the charging state. This should be called afer a terminated * charging session. From eb617323b6ce031490c431b24206a61454860840 Mon Sep 17 00:00:00 2001 From: MarzellT Date: Tue, 11 Feb 2025 08:48:07 +0100 Subject: [PATCH 5/6] fixes tests Signed-off-by: MarzellT --- modules/EvseV2G/tests/din_server_test.cpp | 7 ------- modules/EvseV2G/tests/v2g_ctx_test.cpp | 4 ---- 2 files changed, 11 deletions(-) diff --git a/modules/EvseV2G/tests/din_server_test.cpp b/modules/EvseV2G/tests/din_server_test.cpp index 8aee602870..a2702b164a 100644 --- a/modules/EvseV2G/tests/din_server_test.cpp +++ b/modules/EvseV2G/tests/din_server_test.cpp @@ -98,7 +98,6 @@ TEST_F(DinServerTest, session_setup_generating_new_session_id) { // Setting up conn ctx->current_v2g_msg = V2G_SESSION_SETUP_MSG; - ctx->com_setup_timeout = nullptr; ctx->evse_v2g_data.session_id = 0; ctx->evse_v2g_data.date_time_now_is_used = 0; @@ -137,7 +136,6 @@ TEST_F(DinServerTest, session_setup_old_session_id) { // Setting up conn ctx->current_v2g_msg = V2G_SESSION_SETUP_MSG; - ctx->com_setup_timeout = nullptr; ctx->evse_v2g_data.session_id = 4158610156; ctx->evse_v2g_data.date_time_now_is_used = 0; @@ -176,7 +174,6 @@ TEST_F(DinServerTest, session_setup_datetime_is_used) { // Setting up conn ctx->current_v2g_msg = V2G_SESSION_SETUP_MSG; - ctx->com_setup_timeout = nullptr; ctx->evse_v2g_data.session_id = 0; ctx->evse_v2g_data.date_time_now_is_used = true; @@ -219,8 +216,6 @@ TEST_F(DinServerTest, din_service_discovery_good_case) { TEST_F(DinServerTest, handle_din_contract_authentication_check_evse_processing_finished) { - ctx->com_setup_timeout = nullptr; - // TODO: set a prober session id ctx->evse_v2g_data.session_id = 0; ctx->evse_v2g_data.date_time_now_is_used = 0; @@ -242,8 +237,6 @@ TEST_F(DinServerTest, handle_din_contract_authentication_check_evse_processing_f TEST_F(DinServerTest, handle_din_contract_authentication_check_evse_processing_ongoing) { - ctx->com_setup_timeout = nullptr; - // TODO: set a prober session id ctx->evse_v2g_data.session_id = 0; ctx->evse_v2g_data.date_time_now_is_used = 0; diff --git a/modules/EvseV2G/tests/v2g_ctx_test.cpp b/modules/EvseV2G/tests/v2g_ctx_test.cpp index e64e5b407e..0e978aeb4c 100644 --- a/modules/EvseV2G/tests/v2g_ctx_test.cpp +++ b/modules/EvseV2G/tests/v2g_ctx_test.cpp @@ -34,8 +34,6 @@ class V2gCtxTest : public testing::Test { void v2g_ctx_init_charging_state_cleared() { // checks try to match the order is v2g.hpp - EXPECT_EQ(ctx->com_setup_timeout, nullptr); - EXPECT_EQ(ctx->last_v2g_msg, V2G_UNKNOWN_MSG); EXPECT_EQ(ctx->current_v2g_msg, V2G_UNKNOWN_MSG); EXPECT_EQ(ctx->state, 0); @@ -96,7 +94,6 @@ TEST(RunFirst, v2g_ctx_init_charging_values) { TEST_F(V2gCtxTest, v2g_ctx_init_charging_stateTrue) { // called on session start in v2g_handle_connection() - ctx->com_setup_timeout = nullptr; // does not appear to ever be set ctx->last_v2g_msg = V2G_CABLE_CHECK_MSG; ctx->current_v2g_msg = V2G_CHARGE_PARAMETER_DISCOVERY_MSG; ctx->state = 10; @@ -115,7 +112,6 @@ TEST_F(V2gCtxTest, v2g_ctx_init_charging_stateTrue) { TEST_F(V2gCtxTest, v2g_ctx_init_charging_stateFalse) { // called on session end in v2g_handle_connection() - ctx->com_setup_timeout = nullptr; // does not appear to ever be set ctx->last_v2g_msg = V2G_CABLE_CHECK_MSG; ctx->current_v2g_msg = V2G_CHARGE_PARAMETER_DISCOVERY_MSG; ctx->state = 10; From 7840e9fd22e03c89b7a1cf014c1a14f0caacb423 Mon Sep 17 00:00:00 2001 From: MarzellT Date: Thu, 13 Mar 2025 10:27:30 +0100 Subject: [PATCH 6/6] removes unused variable Signed-off-by: MarzellT --- modules/EvseV2G/charger/ISO15118_chargerImpl.cpp | 2 -- modules/EvseV2G/v2g.hpp | 1 - 2 files changed, 3 deletions(-) diff --git a/modules/EvseV2G/charger/ISO15118_chargerImpl.cpp b/modules/EvseV2G/charger/ISO15118_chargerImpl.cpp index 7ab41ff5cb..2f3cb87932 100644 --- a/modules/EvseV2G/charger/ISO15118_chargerImpl.cpp +++ b/modules/EvseV2G/charger/ISO15118_chargerImpl.cpp @@ -54,8 +54,6 @@ void ISO15118_chargerImpl::init() { v2g_ctx->network_read_timeout_tls = mod->config.tls_timeout; - v2g_ctx->certs_path = mod->info.paths.etc / CERTS_SUB_DIR; - /* Configure if the contract certificate chain should be verified locally */ v2g_ctx->session.verify_contract_cert_chain = mod->config.verify_contract_cert_chain; diff --git a/modules/EvseV2G/v2g.hpp b/modules/EvseV2G/v2g.hpp index d4afa2be54..e274d4df2a 100644 --- a/modules/EvseV2G/v2g.hpp +++ b/modules/EvseV2G/v2g.hpp @@ -198,7 +198,6 @@ struct v2g_context { struct sockaddr_in6* local_tcp_addr; struct sockaddr_in6* local_tls_addr; - std::string certs_path; std::string tls_key_logging_path; uint32_t network_read_timeout; /* in milli seconds */