-
Notifications
You must be signed in to change notification settings - Fork 57
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
fix error and update example #74
Conversation
Afronut
commented
Feb 25, 2023
- in database_handler.cpp the boost optional value expiryDate will not be initialized on idTag if experyDate is not provided or tag does not have such a date. However, in the chargepoint->validate_against_cache_entries, value() is called on the returned idtag (a boost optional ) from get_authorization_cache_entry. This will always throw.
- Update the chargepoint example because parameters of he function on_session_started and on_session_stopped has changed
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.
Thanks for the fixes to the build examples.
Please remove the changes to the database_handler.cpp and then we can merge.
lib/ocpp/common/database_handler.cpp
Outdated
@@ -323,6 +323,11 @@ boost::optional<v16::IdTagInfo> DatabaseHandler::get_authorization_cache_entry(c | |||
const auto expiry_date = DateTime(expiry_date_str); | |||
id_tag_info.expiryDate.emplace(expiry_date); | |||
} | |||
// if expiry date is not set, calling has_value() on the returned optional will return true, but calling 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.
Calling has_value() on an boost:optional will return false if the value of the optional is not set, so setting id_tag_info.expiryDate = boost::none is not necessary
I will remove it however the client crash when local whitelist is enabled and the server send tags with no expiration so store locally. I have tried with Steve server |
Ok, I tried to reproduce it but could not get the same result. Please create a ticket with further information of your general setup / config file etc. so that we can try to reproduce the error. |
I have removed the update to database handler |
Signed-off-by: Coovi Meha <[email protected]> Signed-off-by: pietfried <[email protected]>