From 53e05e1985b597c1de9ef27669d7b2a4709c9fbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E9=92=A6?= Date: Mon, 17 Jul 2023 11:18:38 +0800 Subject: [PATCH 1/3] Fix the hidden bug which may cause many inexplicable exceptions. For example, after changing the AuthorizationKey, RpcBase::start will be called, but m_results_queue is not set to true. As a result, many inexplicable issues will occur for all subsequent requests. --- src/rpc/RpcBase.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rpc/RpcBase.cpp b/src/rpc/RpcBase.cpp index 65afaa16..dcfd978a 100644 --- a/src/rpc/RpcBase.cpp +++ b/src/rpc/RpcBase.cpp @@ -231,6 +231,7 @@ void RpcBase::start() { // Start reception thread m_requests_queue.setEnable(true); + m_results_queue.setEnable(true); m_rx_thread = new std::thread(std::bind(&RpcBase::rxThread, this)); } } From 70ac05986ca87634c8f9a23cba76439aaa73e58b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E9=92=A6?= Date: Mon, 17 Jul 2023 11:28:16 +0800 Subject: [PATCH 2/3] Fix the problem of invalid judgment in the command ChangeConfigurationConf. Here, value.find should be used to obtain the issued data. --- examples/common/config/OcppConfig.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/common/config/OcppConfig.cpp b/examples/common/config/OcppConfig.cpp index 3c53f5a9..6c4db9be 100644 --- a/examples/common/config/OcppConfig.cpp +++ b/examples/common/config/OcppConfig.cpp @@ -200,8 +200,8 @@ ocpp::types::ConfigurationStatus OcppConfig::setConfiguration(const std::string& std::size_t key_is_interval = key.find("Interval"); if (key_is_interval != std::string::npos) { - std::size_t value_is_negative = key.find("-"); - if (value_is_negative) + std::size_t value_is_negative = value.find("-"); + if (value_is_negative != std::string::npos) { ret = ConfigurationStatus::Rejected; } From b13a07d3d3450c3e5665029a5b5666192872e9b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E9=92=A6?= Date: Mon, 17 Jul 2023 13:32:20 +0800 Subject: [PATCH 3/3] Fix the precision loss issue in DateTime.h. I think your test was conducted in the UTC timezone, so it was difficult for you to discover this issue. If you are in another timezone, you will notice that the hour, minute, and second data will be lost. For example, in the time judgment of intelligent charging. --- src/types/DateTime.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/types/DateTime.h b/src/types/DateTime.h index 1ba8f79f..13a67006 100644 --- a/src/types/DateTime.h +++ b/src/types/DateTime.h @@ -84,7 +84,6 @@ class DateTime m_datetime = _mkgmtime(&t); #else // _MSC_VER m_datetime = std::mktime(&t); - m_datetime += t.tm_gmtoff; m_datetime -= (t.tm_isdst * 3600); #endif // _MSC_VER ret = true; @@ -179,7 +178,7 @@ class DateTime #ifdef _MSC_VER gmtime_s(&t, &m_datetime); #else // _MSC_VER - gmtime_r(&m_datetime, &t); + localtime_r(&m_datetime, &t); #endif // _MSC_VER ss << std::put_time(&t, "%Y-%m-%dT%TZ"); return ss.str();