-
Notifications
You must be signed in to change notification settings - Fork 65
Added configuration key MeterPublicKey for OCPP1.6 #1161
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
Conversation
…dded public function to set the public key of the powermeter per connector Signed-off-by: Piet Gömpel <pietgoempel@gmail.com>
848068b to
9b3d70d
Compare
james-ctc
left a comment
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.
General
especially for header files basic types as function arguments shouldn't be const.
e.g. std::uint32_t connector_id rather than const std::uint32_t connector_id
(it does have a meaning for the function implementation)
| } | ||
|
|
||
| namespace { | ||
| template <typename T> std::optional<T> parse_meter_public_key_index(const std::string& input) { |
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.
is there any situation where parse_meter_public_key_index will be called where T != uint32?
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.
Removed the template
| const std::string& s = key.get(); | ||
| const auto connector_id_opt = parse_meter_public_key_index<uint32_t>(s); | ||
|
|
||
| if (connector_id_opt.has_value() == false) { |
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.
in other places if (!…) is used, which is preferable, rather than if (… == false)
| return std::nullopt; | ||
| } | ||
|
|
||
| const uint32_t connector_id = connector_id_opt.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.
safer to be const auto especially since connector_id_opt is auto.
Signed-off-by: Piet Gömpel <pietgoempel@gmail.com>
Describe your changes
The implementation for this configuration key follows the requirements of the OCA Eichrecht Whitepaper
The format the new configuration keys are reported is:
MeterPublicKey[n] where n is the id of the respective connector
Issue ticket number and link
Companion PR: EVerest/everest-core#1599
Checklist before requesting a review