Skip to content

Commit 06b89e5

Browse files
committed
Formatting.
Signed-off-by: Maaike Zijderveld, iolar <git.mail@iolar.nl>
1 parent 2b71a68 commit 06b89e5

File tree

7 files changed

+34
-25
lines changed

7 files changed

+34
-25
lines changed

include/ocpp/v201/functional_blocks/availability.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ class Availability : public AvailabilityInterface {
8686
Everest::SteadyTimer heartbeat_timer;
8787

8888
public:
89-
Availability(const BlockContext& block_context,
90-
std::optional<TimeSyncCallback> time_sync_callback,
89+
Availability(const BlockContext& block_context, std::optional<TimeSyncCallback> time_sync_callback,
9190
std::optional<AllConnectorsUnavailableCallback> all_connectors_unavailable_callback);
9291
~Availability();
9392
void handle_message(const ocpp::EnhancedMessage<MessageType>& message) override;

include/ocpp/v201/functional_blocks/reservation.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ typedef std::function<ocpp::ReservationCheckStatus(const int32_t evse_id, const
2020

2121
class ReservationInterface : public MessageHandlerInterface {
2222
public:
23-
virtual ~ReservationInterface() {};
23+
virtual ~ReservationInterface() = default;
2424
virtual void on_reservation_status(const int32_t reservation_id, const ReservationUpdateStatusEnum status) = 0;
2525
virtual ocpp::ReservationCheckStatus
2626
is_evse_reserved_for_other(const EvseInterface& evse, const IdToken& id_token,

include/ocpp/v201/functional_blocks/tariff_and_cost.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class TariffAndCostInterface : public MessageHandlerInterface {
3434

3535
class TariffAndCost : public TariffAndCostInterface {
3636
public:
37-
TariffAndCost(const BlockContext& block_context, MeterValuesInterface &meter_values,
37+
TariffAndCost(const BlockContext& block_context, MeterValuesInterface& meter_values,
3838
std::optional<SetDisplayMessageCallback>& set_display_message_callback,
3939
std::optional<SetRunningCostCallback>& set_running_cost_callback,
4040
boost::asio::io_service& io_service);

lib/ocpp/v201/functional_blocks/diagnostics.cpp

+8-7
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33

44
#include <ocpp/v201/functional_blocks/diagnostics.hpp>
55

6-
#include <ocpp/v201/functional_blocks/block_context.hpp>
76
#include <ocpp/common/constants.hpp>
87
#include <ocpp/v201/connectivity_manager.hpp>
98
#include <ocpp/v201/ctrlr_component_variables.hpp>
109
#include <ocpp/v201/database_handler.hpp>
1110
#include <ocpp/v201/device_model.hpp>
1211
#include <ocpp/v201/functional_blocks/authorization.hpp>
12+
#include <ocpp/v201/functional_blocks/block_context.hpp>
1313
#include <ocpp/v201/utils.hpp>
1414

1515
#include <ocpp/v201/messages/ClearVariableMonitoring.hpp>
@@ -27,7 +27,7 @@ const auto DEFAULT_MAX_CUSTOMER_INFORMATION_DATA_LENGTH = 51200;
2727

2828
namespace ocpp::v201 {
2929

30-
Diagnostics::Diagnostics(const BlockContext &context, AuthorizationInterface& authorization,
30+
Diagnostics::Diagnostics(const BlockContext& context, AuthorizationInterface& authorization,
3131
GetLogRequestCallback get_log_request_callback,
3232
std::optional<GetCustomerInformationCallback> get_customer_information_callback,
3333
std::optional<ClearCustomerInformationCallback> clear_customer_information_callback) :
@@ -196,7 +196,8 @@ void Diagnostics::handle_customer_information_req(Call<CustomerInformationReques
196196
}
197197

198198
const auto max_customer_information_data_length =
199-
this->context.device_model.get_optional_value<int>(ControllerComponentVariables::MaxCustomerInformationDataLength)
199+
this->context.device_model
200+
.get_optional_value<int>(ControllerComponentVariables::MaxCustomerInformationDataLength)
200201
.value_or(DEFAULT_MAX_CUSTOMER_INFORMATION_DATA_LENGTH);
201202
if (data.length() > max_customer_information_data_length) {
202203
EVLOG_warning << "NotifyCustomerInformation.req data field is too large. Cropping it down to: "
@@ -246,10 +247,10 @@ void Diagnostics::handle_set_monitoring_level_req(Call<SetMonitoringLevelRequest
246247
if (msg.severity < MonitoringLevelSeverity::MIN or msg.severity > MonitoringLevelSeverity::MAX) {
247248
response.status = GenericStatusEnum::Rejected;
248249
} else {
249-
auto result = this->context.device_model.set_value(ControllerComponentVariables::ActiveMonitoringLevel.component,
250-
ControllerComponentVariables::ActiveMonitoringLevel.variable.value(),
251-
AttributeEnum::Actual, std::to_string(msg.severity),
252-
VARIABLE_ATTRIBUTE_VALUE_SOURCE_CSMS, true);
250+
auto result = this->context.device_model.set_value(
251+
ControllerComponentVariables::ActiveMonitoringLevel.component,
252+
ControllerComponentVariables::ActiveMonitoringLevel.variable.value(), AttributeEnum::Actual,
253+
std::to_string(msg.severity), VARIABLE_ATTRIBUTE_VALUE_SOURCE_CSMS, true);
253254

254255
if (result != SetVariableStatusEnum::Accepted) {
255256
EVLOG_warning << "Could not persist in device model new monitoring level: " << msg.severity;

lib/ocpp/v201/functional_blocks/security.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
#include <ocpp/v201/functional_blocks/security.hpp>
55

6-
#include <ocpp/v201/connectivity_manager.hpp>
76
#include <ocpp/common/constants.hpp>
87
#include <ocpp/common/ocpp_logging.hpp>
8+
#include <ocpp/v201/connectivity_manager.hpp>
99
#include <ocpp/v201/ctrlr_component_variables.hpp>
1010
#include <ocpp/v201/device_model.hpp>
1111
#include <ocpp/v201/functional_blocks/block_context.hpp>

lib/ocpp/v201/functional_blocks/tariff_and_cost.cpp

+16-9
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33

44
#include <ocpp/v201/functional_blocks/tariff_and_cost.hpp>
55

6-
#include <ocpp/v201/functional_blocks/block_context.hpp>
76
#include <ocpp/v201/ctrlr_component_variables.hpp>
87
#include <ocpp/v201/device_model.hpp>
98
#include <ocpp/v201/evse_manager.hpp>
9+
#include <ocpp/v201/functional_blocks/block_context.hpp>
1010
#include <ocpp/v201/functional_blocks/meter_values.hpp>
1111

1212
#include <ocpp/v201/messages/CostUpdated.hpp>
1313

1414
const auto DEFAULT_PRICE_NUMBER_OF_DECIMALS = 3;
1515

1616
namespace ocpp::v201 {
17-
TariffAndCost::TariffAndCost(const BlockContext &block_context, MeterValuesInterface& meter_values,
17+
TariffAndCost::TariffAndCost(const BlockContext& block_context, MeterValuesInterface& meter_values,
1818
std::optional<SetDisplayMessageCallback>& set_display_message_callback,
1919
std::optional<SetRunningCostCallback>& set_running_cost_callback,
2020
boost::asio::io_service& io_service) :
@@ -111,7 +111,8 @@ void TariffAndCost::handle_cost_and_tariff(const TransactionEventResponse& respo
111111
if (/*custom_data.contains("vendorId") and
112112
(custom_data.at("vendorId").get<std::string>() == "org.openchargealliance.org.qrcode") and */
113113
custom_data.contains("qrCodeText") and
114-
this->context.device_model.get_optional_value<bool>(ControllerComponentVariables::DisplayMessageQRCodeDisplayCapable)
114+
this->context.device_model
115+
.get_optional_value<bool>(ControllerComponentVariables::DisplayMessageQRCodeDisplayCapable)
115116
.value_or(false)) {
116117
running_cost.qr_code_text = custom_data.at("qrCodeText");
117118
}
@@ -166,7 +167,8 @@ void TariffAndCost::handle_cost_and_tariff(const TransactionEventResponse& respo
166167
}
167168

168169
const int number_of_decimals =
169-
this->context.device_model.get_optional_value<int>(ControllerComponentVariables::NumberOfDecimalsForCostValues)
170+
this->context.device_model
171+
.get_optional_value<int>(ControllerComponentVariables::NumberOfDecimalsForCostValues)
170172
.value_or(DEFAULT_PRICE_NUMBER_OF_DECIMALS);
171173
uint32_t decimals =
172174
(number_of_decimals < 0 ? DEFAULT_PRICE_NUMBER_OF_DECIMALS : static_cast<uint32_t>(number_of_decimals));
@@ -209,7 +211,8 @@ void TariffAndCost::handle_costupdated_req(const Call<CostUpdatedRequest> call)
209211
running_cost.cost = static_cast<double>(call.msg.totalCost);
210212
running_cost.transaction_id = call.msg.transactionId;
211213

212-
std::optional<int32_t> transaction_evse_id = this->context.evse_manager.get_transaction_evseid(running_cost.transaction_id);
214+
std::optional<int32_t> transaction_evse_id =
215+
this->context.evse_manager.get_transaction_evseid(running_cost.transaction_id);
213216
if (!transaction_evse_id.has_value()) {
214217
// We just put an error in the log as the spec does not define what to do here. It is not possible to return
215218
// a 'Rejected' or something in that manner.
@@ -232,7 +235,8 @@ void TariffAndCost::handle_costupdated_req(const Call<CostUpdatedRequest> call)
232235
return;
233236
}
234237

235-
const std::optional<int32_t> evse_id_opt = this->context.evse_manager.get_transaction_evseid(running_cost.transaction_id);
238+
const std::optional<int32_t> evse_id_opt =
239+
this->context.evse_manager.get_transaction_evseid(running_cost.transaction_id);
236240
if (!evse_id_opt.has_value()) {
237241
EVLOG_warning << "Can not set running cost triggers as there is no evse id found with the transaction id from "
238242
"the incoming CostUpdatedRequest";
@@ -256,14 +260,17 @@ bool TariffAndCost::is_multilanguage_enabled() const {
256260
}
257261

258262
bool TariffAndCost::is_tariff_enabled() const {
259-
return this->context.device_model.get_optional_value<bool>(ControllerComponentVariables::TariffCostCtrlrAvailableTariff)
263+
return this->context.device_model
264+
.get_optional_value<bool>(ControllerComponentVariables::TariffCostCtrlrAvailableTariff)
260265
.value_or(false) and
261-
this->context.device_model.get_optional_value<bool>(ControllerComponentVariables::TariffCostCtrlrEnabledTariff)
266+
this->context.device_model
267+
.get_optional_value<bool>(ControllerComponentVariables::TariffCostCtrlrEnabledTariff)
262268
.value_or(false);
263269
}
264270

265271
bool TariffAndCost::is_cost_enabled() const {
266-
return this->context.device_model.get_optional_value<bool>(ControllerComponentVariables::TariffCostCtrlrAvailableCost)
272+
return this->context.device_model
273+
.get_optional_value<bool>(ControllerComponentVariables::TariffCostCtrlrAvailableCost)
267274
.value_or(false) and
268275
this->context.device_model.get_optional_value<bool>(ControllerComponentVariables::TariffCostCtrlrEnabledCost)
269276
.value_or(false);

tests/lib/ocpp/v201/test_composite_schedule.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,17 @@ class CompositeScheduleTestFixtureV201 : public DatabaseTestingUtils {
193193
this->database_handler =
194194
std::make_unique<DatabaseHandlerFake>(std::move(database_connection), MIGRATION_FILES_LOCATION_V201);
195195
database_handler->open_connection();
196-
this->block_context = std::make_unique<BlockContext>(this->mock_dispatcher, *this->device_model, this->connectivity_manager, *this->evse_manager,
197-
*this->database_handler, this->evse_security, this->component_state_manager);
196+
this->block_context = std::make_unique<BlockContext>(
197+
this->mock_dispatcher, *this->device_model, this->connectivity_manager, *this->evse_manager,
198+
*this->database_handler, this->evse_security, this->component_state_manager);
198199
return std::make_unique<TestSmartCharging>(*block_context, set_charging_profiles_callback_mock.AsStdFunction());
199200
}
200201

201202
void reconfigure_for_nr_of_evses(int32_t nr_of_evses) {
202203
this->evse_manager = std::make_unique<EvseManagerFake>(nr_of_evses);
203-
this->block_context = std::make_unique<BlockContext>(this->mock_dispatcher, *this->device_model, this->connectivity_manager, *this->evse_manager,
204-
*this->database_handler, this->evse_security, this->component_state_manager);
204+
this->block_context = std::make_unique<BlockContext>(
205+
this->mock_dispatcher, *this->device_model, this->connectivity_manager, *this->evse_manager,
206+
*this->database_handler, this->evse_security, this->component_state_manager);
205207
this->handler =
206208
std::make_unique<TestSmartCharging>(*block_context, set_charging_profiles_callback_mock.AsStdFunction());
207209
}

0 commit comments

Comments
 (0)