Skip to content

Commit

Permalink
Fix some codacy issues, add documentation.
Browse files Browse the repository at this point in the history
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
  • Loading branch information
maaikez committed Dec 10, 2024
1 parent 5b53056 commit 54182dc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
13 changes: 11 additions & 2 deletions modules/Auth/include/ReservationHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,18 @@ class ReservationHandler {
///
void store_reservations();

///
/// \brief Get new reserved / available status for evse's and store it.
/// \param currently_available_evses Current available evse's.
/// \param reserved_evses Current reserved evse's.
/// \return A struct with changed reservation statuses compared with the last time this function was called.
///
/// When an evse is reserved and it was available before, it will be added to the set in the struct (return value).
/// But when an evse is reserved and last time it was already reserved, it is not added.
///
ReservationEvseStatus
get_evse_global_reserved_status_and_set_new_status(const std::set<int32_t> currently_available_evses,
const std::set<int32_t> reserved_evses);
get_evse_global_reserved_status_and_set_new_status(const std::set<int32_t>& currently_available_evses,
const std::set<int32_t>& reserved_evses);

///
/// \brief Helper function to print information about reservations and evses, to find out why a reservation has
Expand Down
2 changes: 1 addition & 1 deletion modules/Auth/lib/ReservationHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ void ReservationHandler::store_reservations() {
}

ReservationEvseStatus ReservationHandler::get_evse_global_reserved_status_and_set_new_status(
const std::set<int32_t> currently_available_evses, const std::set<int32_t> reserved_evses) {
const std::set<int32_t>& currently_available_evses, const std::set<int32_t>& reserved_evses) {
ReservationEvseStatus evse_status_to_send;
std::set<int32_t> new_reserved_evses;

Expand Down
3 changes: 1 addition & 2 deletions modules/EvseManager/EvseManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1278,8 +1278,7 @@ bool EvseManager::reserve(int32_t id, const bool signal_reservation_event) {
}

// When overwriting the reservation, don't signal.
if ((not overwrite_reservation || (overwrite_reservation && this->reservation_id == -1)) &&
signal_reservation_event) {
if ((not overwrite_reservation || this->reservation_id == -1) && signal_reservation_event) {
// publish event to other modules
types::evse_manager::SessionEvent se;
se.event = types::evse_manager::SessionEventEnum::ReservationStart;
Expand Down
8 changes: 2 additions & 6 deletions tests/ocpp_tests/test_sets/ocpp201/reservations.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import pytest_asyncio
import pytest
import logging
from unittest.mock import ANY
Expand All @@ -12,14 +11,11 @@

from ocpp.v201.enums import (IdTokenType as IdTokenTypeEnum, ReserveNowStatusType, ConnectorStatusType,
OperationalStatusType, CancelReservationStatusType, SetVariableStatusType,
RequestStartStopStatusType, AttributeType)
RequestStartStopStatusType)
from ocpp.v201.datatypes import *
from ocpp.v201 import call as call_201
from ocpp.v201 import call_result as call_result201
from validations import (validate_standard_start_transaction,
validate_standard_stop_transaction,
validate_remote_start_stop_transaction,
validate_status_notification_201)
from validations import validate_remote_start_stop_transaction
from ocpp.routing import on, create_route_map


Expand Down

0 comments on commit 54182dc

Please sign in to comment.