Skip to content

Commit

Permalink
Change comparison order in handle get variables
Browse files Browse the repository at this point in the history
Signed-off-by: Soumya Subramanya <[email protected]>
  • Loading branch information
SNSubramanya committed Oct 24, 2023
1 parent b650dd7 commit 5a2d222
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions config/v201/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@
"BytesPerMessageGetVariables": {
"variable_name": "BytesPerMessage",
"attributes": {
"Actual": 42
"Actual": 250
},
"instance": "GetVariables"
},
Expand All @@ -538,7 +538,7 @@
"ItemsPerMessageGetVariables": {
"variable_name": "ItemsPerMessage",
"attributes": {
"Actual": 42
"Actual": 2
},
"instance": "GetVariables"
},
Expand Down
12 changes: 6 additions & 6 deletions lib/ocpp/v201/charge_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1414,18 +1414,18 @@ void ChargePoint::handle_get_variables_req(const EnhancedMessage<v201::MessageTy
const auto max_bytes_per_message =
this->device_model->get_value<int>(ControllerComponentVariables::BytesPerMessageGetVariables);

// B06.FR.17
if (message.message_size > max_bytes_per_message) {
// B06.FR.16
if (msg.getVariableData.size() > max_variables_per_message) {
// send a CALLERROR
const auto call_error = CallError(call.uniqueId, "FormatViolation", "", json({}));
const auto call_error = CallError(call.uniqueId, "OccurenceConstraintViolation", "", json({}));
this->send(call_error);
return;
}

// B06.FR.16
if (msg.getVariableData.size() > max_variables_per_message) {
// B06.FR.17
if (message.message_size > max_bytes_per_message) {
// send a CALLERROR
const auto call_error = CallError(call.uniqueId, "OccurenceConstraintViolation", "", json({}));
const auto call_error = CallError(call.uniqueId, "FormatViolation", "", json({}));
this->send(call_error);
return;
}
Expand Down

0 comments on commit 5a2d222

Please sign in to comment.