Skip to content

Commit 260bcec

Browse files
authored
Add forward declarations and move includes to cpp files (#987)
Signed-off-by: Maaike Zijderveld, iolar <git.mail@iolar.nl>
1 parent b7131c6 commit 260bcec

27 files changed

+143
-84
lines changed

include/ocpp/v201/charge_point.hpp

+23-40
Original file line numberDiff line numberDiff line change
@@ -8,64 +8,47 @@
88
#include <set>
99

1010
#include <ocpp/common/message_dispatcher.hpp>
11-
#include <ocpp/v201/functional_blocks/authorization.hpp>
12-
#include <ocpp/v201/functional_blocks/availability.hpp>
13-
#include <ocpp/v201/functional_blocks/data_transfer.hpp>
14-
#include <ocpp/v201/functional_blocks/diagnostics.hpp>
15-
#include <ocpp/v201/functional_blocks/display_message.hpp>
16-
#include <ocpp/v201/functional_blocks/firmware_update.hpp>
17-
#include <ocpp/v201/functional_blocks/meter_values.hpp>
18-
#include <ocpp/v201/functional_blocks/provisioning.hpp>
19-
#include <ocpp/v201/functional_blocks/remote_transaction_control.hpp>
20-
#include <ocpp/v201/functional_blocks/reservation.hpp>
21-
#include <ocpp/v201/functional_blocks/security.hpp>
22-
#include <ocpp/v201/functional_blocks/smart_charging.hpp>
23-
#include <ocpp/v201/functional_blocks/tariff_and_cost.hpp>
24-
#include <ocpp/v201/functional_blocks/transaction.hpp>
2511

2612
#include <ocpp/common/charging_station_base.hpp>
2713

2814
#include <ocpp/v201/average_meter_values.hpp>
2915
#include <ocpp/v201/charge_point_callbacks.hpp>
30-
#include <ocpp/v201/ctrlr_component_variables.hpp>
31-
#include <ocpp/v201/database_handler.hpp>
32-
#include <ocpp/v201/device_model.hpp>
33-
#include <ocpp/v201/device_model_storage_interface.hpp>
34-
#include <ocpp/v201/evse_manager.hpp>
35-
#include <ocpp/v201/monitoring_updater.hpp>
3616
#include <ocpp/v201/ocpp_enums.hpp>
3717
#include <ocpp/v201/ocpp_types.hpp>
3818
#include <ocpp/v201/ocsp_updater.hpp>
3919
#include <ocpp/v201/types.hpp>
4020
#include <ocpp/v201/utils.hpp>
4121

4222
#include <ocpp/v201/messages/Authorize.hpp>
43-
#include <ocpp/v201/messages/BootNotification.hpp>
44-
#include <ocpp/v201/messages/ClearVariableMonitoring.hpp>
45-
#include <ocpp/v201/messages/CustomerInformation.hpp>
4623
#include <ocpp/v201/messages/DataTransfer.hpp>
4724
#include <ocpp/v201/messages/Get15118EVCertificate.hpp>
48-
#include <ocpp/v201/messages/GetBaseReport.hpp>
49-
#include <ocpp/v201/messages/GetLog.hpp>
50-
#include <ocpp/v201/messages/GetMonitoringReport.hpp>
51-
#include <ocpp/v201/messages/GetReport.hpp>
52-
#include <ocpp/v201/messages/GetVariables.hpp>
53-
#include <ocpp/v201/messages/NotifyCustomerInformation.hpp>
54-
#include <ocpp/v201/messages/NotifyEvent.hpp>
55-
#include <ocpp/v201/messages/NotifyMonitoringReport.hpp>
56-
#include <ocpp/v201/messages/NotifyReport.hpp>
57-
#include <ocpp/v201/messages/Reset.hpp>
58-
#include <ocpp/v201/messages/SetMonitoringBase.hpp>
59-
#include <ocpp/v201/messages/SetMonitoringLevel.hpp>
60-
#include <ocpp/v201/messages/SetNetworkProfile.hpp>
61-
#include <ocpp/v201/messages/SetVariableMonitoring.hpp>
62-
#include <ocpp/v201/messages/SetVariables.hpp>
25+
#include <ocpp/v201/messages/GetCompositeSchedule.hpp>
6326

6427
#include "component_state_manager.hpp"
6528

6629
namespace ocpp {
6730
namespace v201 {
6831

32+
class AuthorizationInterface;
33+
class AvailabilityInterface;
34+
class DataTransferInterface;
35+
class DiagnosticsInterface;
36+
class DisplayMessageInterface;
37+
class FirmwareUpdateInterface;
38+
class MeterValuesInterface;
39+
class ProvisioningInterface;
40+
class RemoteTransactionControlInterface;
41+
class ReservationInterface;
42+
class SecurityInterface;
43+
class SmartChargingInterface;
44+
class TariffAndCostInterface;
45+
class TransactionInterface;
46+
47+
class DatabaseHandler;
48+
class DeviceModel;
49+
class DeviceModelStorageInterface;
50+
class EvseManager;
51+
6952
class UnexpectedMessageTypeFromCSMS : public std::runtime_error {
7053
using std::runtime_error::runtime_error;
7154
};
@@ -358,11 +341,11 @@ class ChargePoint : public ChargePointInterface, private ocpp::ChargingStationBa
358341
std::unique_ptr<DisplayMessageInterface> display_message;
359342
std::unique_ptr<FirmwareUpdateInterface> firmware_update;
360343
std::unique_ptr<MeterValuesInterface> meter_values;
361-
std::unique_ptr<SmartCharging> smart_charging;
344+
std::unique_ptr<SmartChargingInterface> smart_charging;
362345
std::unique_ptr<TariffAndCostInterface> tariff_and_cost;
363346
std::unique_ptr<TransactionInterface> transaction;
364347
std::unique_ptr<ProvisioningInterface> provisioning;
365-
std::unique_ptr<RemoteTransactionControl> remote_transaction_control;
348+
std::unique_ptr<RemoteTransactionControlInterface> remote_transaction_control;
366349

367350
// utility
368351
std::shared_ptr<MessageQueue<v201::MessageType>> message_queue;

include/ocpp/v201/functional_blocks/authorization.hpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@
33

44
#pragma once
55

6-
#include <ocpp/v201/messages/Authorize.hpp>
7-
#include <ocpp/v201/messages/ClearCache.hpp>
8-
#include <ocpp/v201/messages/GetLocalListVersion.hpp>
9-
#include <ocpp/v201/messages/SendLocalList.hpp>
10-
116
#include <ocpp/v201/database_handler.hpp>
127
#include <ocpp/v201/message_dispatcher.hpp>
138
#include <ocpp/v201/message_handler.hpp>
149

1510
namespace ocpp::v201 {
11+
struct AuthorizationCacheEntry;
12+
struct AuthorizeResponse;
13+
struct ClearCacheRequest;
14+
struct SendLocalListRequest;
15+
struct GetLocalListVersionRequest;
16+
1617
class AuthorizationInterface : public MessageHandlerInterface {
1718
public:
1819
virtual ~AuthorizationInterface() {
@@ -45,7 +46,7 @@ class Authorization : public AuthorizationInterface {
4546
MessageDispatcherInterface<MessageType>& message_dispatcher;
4647
DeviceModel& device_model;
4748
ConnectivityManagerInterface& connectivity_manager;
48-
ocpp::v201::DatabaseHandlerInterface& database_handler;
49+
DatabaseHandlerInterface& database_handler;
4950
EvseSecurity& evse_security;
5051

5152
// threads and synchronization

include/ocpp/v201/functional_blocks/availability.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
#include <ocpp/v201/message_handler.hpp>
88

99
#include <ocpp/v201/messages/ChangeAvailability.hpp>
10-
#include <ocpp/v201/messages/Heartbeat.hpp>
1110

1211
namespace ocpp::v201 {
13-
1412
class DeviceModel;
1513
class EvseManagerInterface;
1614
class ComponentStateManagerInterface;
1715

16+
struct HeartbeatResponse;
17+
1818
/// \brief Combines ChangeAvailabilityRequest with persist flag for scheduled Availability changes
1919
struct AvailabilityChange {
2020
ChangeAvailabilityRequest request;

include/ocpp/v201/functional_blocks/data_transfer.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55

66
#include <ocpp/v201/message_dispatcher.hpp>
77
#include <ocpp/v201/message_handler.hpp>
8-
#include <ocpp/v201/messages/DataTransfer.hpp>
98

109
namespace ocpp {
1110
namespace v201 {
11+
struct DataTransferRequest;
12+
struct DataTransferResponse;
1213

1314
class DataTransferInterface : public MessageHandlerInterface {
1415

include/ocpp/v201/functional_blocks/display_message.hpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33

44
#pragma once
55

6-
#include <ocpp/v201/evse_manager.hpp>
76
#include <ocpp/v201/message_dispatcher.hpp>
87
#include <ocpp/v201/message_handler.hpp>
9-
#include <ocpp/v201/messages/ClearDisplayMessage.hpp>
10-
#include <ocpp/v201/messages/GetDisplayMessages.hpp>
8+
119
#include <ocpp/v201/messages/SetDisplayMessage.hpp>
1210

1311
namespace ocpp::v201 {
12+
class EvseManagerInterface;
13+
struct GetDisplayMessagesRequest;
14+
struct ClearDisplayMessageResponse;
15+
struct ClearDisplayMessageRequest;
1416

1517
///
1618
/// \brief Convert message content from OCPP spec to DisplayMessageContent.
@@ -66,4 +68,4 @@ class DisplayMessageBlock : public DisplayMessageInterface {
6668
void handle_clear_display_message(Call<ClearDisplayMessageRequest> call);
6769
};
6870

69-
} // namespace ocpp::v201
71+
} // namespace ocpp::v201

include/ocpp/v201/functional_blocks/firmware_update.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55

66
#include <ocpp/common/message_dispatcher.hpp>
77
#include <ocpp/v201/message_handler.hpp>
8-
#include <ocpp/v201/messages/UpdateFirmware.hpp>
98

109
namespace ocpp {
11-
1210
// Forward declarations.
1311
class EvseSecurity;
1412

@@ -20,14 +18,16 @@ class EvseManagerInterface;
2018
class AvailabilityInterface;
2119
class SecurityInterface;
2220

21+
struct UpdateFirmwareRequest;
22+
struct UpdateFirmwareResponse;
23+
2324
// Typedef
2425
typedef std::function<UpdateFirmwareResponse(const UpdateFirmwareRequest& request)> UpdateFirmwareRequestCallback;
2526
typedef std::function<void()> AllConnectorsUnavailableCallback;
2627

2728
class FirmwareUpdateInterface : public MessageHandlerInterface {
2829
public:
29-
virtual ~FirmwareUpdateInterface() {
30-
}
30+
virtual ~FirmwareUpdateInterface() = default;
3131

3232
virtual void on_firmware_update_status_notification(int32_t request_id,
3333
const FirmwareStatusEnum& firmware_update_status) = 0;

include/ocpp/v201/functional_blocks/reservation.hpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@
33

44
#include <ocpp/v201/message_dispatcher.hpp>
55
#include <ocpp/v201/message_handler.hpp>
6-
#include <ocpp/v201/messages/CancelReservation.hpp>
7-
#include <ocpp/v201/messages/ReservationStatusUpdate.hpp>
8-
#include <ocpp/v201/messages/ReserveNow.hpp>
96

107
#pragma once
118

129
namespace ocpp::v201 {
13-
1410
class EvseInterface;
1511
class EvseManagerInterface;
1612

13+
struct ReserveNowRequest;
14+
struct CancelReservationRequest;
15+
1716
typedef std::function<ReserveNowStatusEnum(const ReserveNowRequest& request)> ReserveNowCallback;
1817
typedef std::function<bool(const int32_t reservationId)> CancelReservationCallback;
1918
typedef std::function<ocpp::ReservationCheckStatus(const int32_t evse_id, const CiString<36> idToken,

include/ocpp/v201/functional_blocks/security.hpp

+9-7
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@
99
#include <ocpp/v201/message_handler.hpp>
1010
#include <ocpp/v201/ocsp_updater.hpp>
1111

12-
#include <ocpp/v201/messages/CertificateSigned.hpp>
13-
#include <ocpp/v201/messages/DeleteCertificate.hpp>
14-
#include <ocpp/v201/messages/Get15118EVCertificate.hpp>
15-
#include <ocpp/v201/messages/GetInstalledCertificateIds.hpp>
16-
#include <ocpp/v201/messages/InstallCertificate.hpp>
17-
#include <ocpp/v201/messages/SignCertificate.hpp>
18-
1912
namespace ocpp::v201 {
13+
struct CertificateSignedRequest;
14+
struct CertificateSignedResponse;
15+
struct GetInstalledCertificateIdsRequest;
16+
struct Get15118EVCertificateRequest;
17+
struct Get15118EVCertificateResponse;
18+
struct InstallCertificateRequest;
19+
struct DeleteCertificateRequest;
20+
struct SignCertificateResponse;
21+
2022
typedef std::function<void(const CiString<50>& event_type, const std::optional<CiString<255>>& tech_info)>
2123
SecurityEventCallback;
2224

include/ocpp/v201/functional_blocks/smart_charging.hpp

+9-7
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,22 @@
99
#include <ocpp/v201/evse.hpp>
1010
#include <ocpp/v201/message_dispatcher.hpp>
1111

12-
#include <ocpp/v201/messages/ClearChargingProfile.hpp>
13-
#include <ocpp/v201/messages/GetChargingProfiles.hpp>
14-
#include <ocpp/v201/messages/GetCompositeSchedule.hpp>
15-
#include <ocpp/v201/messages/ReportChargingProfiles.hpp>
16-
#include <ocpp/v201/messages/SetChargingProfile.hpp>
17-
1812
namespace ocpp::v201 {
19-
2013
class DeviceModel;
2114
class EvseManagerInterface;
2215
class ConnectivityManagerInterface;
2316
class SmartChargingHandlerInterface;
2417
class EvseInterface;
2518

19+
struct GetChargingProfilesRequest;
20+
struct SetChargingProfileRequest;
21+
struct SetChargingProfileResponse;
22+
struct GetCompositeScheduleResponse;
23+
struct GetCompositeScheduleRequest;
24+
struct ClearChargingProfileResponse;
25+
struct ClearChargingProfileRequest;
26+
struct ReportChargingProfilesRequest;
27+
2628
enum class ProfileValidationResultEnum {
2729
Valid,
2830
EvseDoesNotExist,

include/ocpp/v201/functional_blocks/tariff_and_cost.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
#include <ocpp/common/message_dispatcher.hpp>
99
#include <ocpp/v201/functional_blocks/display_message.hpp>
1010

11-
#include <ocpp/v201/messages/CostUpdated.hpp>
12-
1311
namespace ocpp::v201 {
1412
class DeviceModel;
1513
class EvseManagerInterface;
1614
class MeterValuesInterface;
1715

16+
struct CostUpdatedRequest;
17+
1818
typedef std::function<void(const RunningCost& running_cost, const uint32_t number_of_decimals,
1919
std::optional<std::string> currency_code)>
2020
SetRunningCostCallback;

lib/ocpp/v201/charge_point.cpp

+22-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,35 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// Copyright Pionix GmbH and Contributors to EVerest
33

4+
#include <ocpp/v201/charge_point.hpp>
5+
46
#include <ocpp/common/constants.hpp>
57
#include <ocpp/common/types.hpp>
6-
#include <ocpp/v201/charge_point.hpp>
78
#include <ocpp/v201/ctrlr_component_variables.hpp>
9+
#include <ocpp/v201/database_handler.hpp>
10+
#include <ocpp/v201/device_model.hpp>
11+
#include <ocpp/v201/device_model_storage_interface.hpp>
812
#include <ocpp/v201/device_model_storage_sqlite.hpp>
13+
#include <ocpp/v201/evse_manager.hpp>
914
#include <ocpp/v201/message_dispatcher.hpp>
10-
#include <ocpp/v201/messages/LogStatusNotification.hpp>
1115
#include <ocpp/v201/notify_report_requests_splitter.hpp>
1216

17+
#include <ocpp/v201/functional_blocks/authorization.hpp>
18+
#include <ocpp/v201/functional_blocks/availability.hpp>
19+
#include <ocpp/v201/functional_blocks/data_transfer.hpp>
20+
#include <ocpp/v201/functional_blocks/diagnostics.hpp>
21+
#include <ocpp/v201/functional_blocks/display_message.hpp>
22+
#include <ocpp/v201/functional_blocks/firmware_update.hpp>
23+
#include <ocpp/v201/functional_blocks/meter_values.hpp>
24+
#include <ocpp/v201/functional_blocks/provisioning.hpp>
25+
#include <ocpp/v201/functional_blocks/remote_transaction_control.hpp>
26+
#include <ocpp/v201/functional_blocks/reservation.hpp>
27+
#include <ocpp/v201/functional_blocks/security.hpp>
28+
#include <ocpp/v201/functional_blocks/smart_charging.hpp>
29+
#include <ocpp/v201/functional_blocks/tariff_and_cost.hpp>
30+
#include <ocpp/v201/functional_blocks/transaction.hpp>
31+
32+
#include <ocpp/v201/messages/LogStatusNotification.hpp>
1333
#include <ocpp/v201/messages/RequestStopTransaction.hpp>
1434
#include <ocpp/v201/messages/TriggerMessage.hpp>
1535

lib/ocpp/v201/functional_blocks/authorization.cpp

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

44
#include <ocpp/common/constants.hpp>
55
#include <ocpp/v201/ctrlr_component_variables.hpp>
6+
#include <ocpp/v201/database_handler.hpp>
67
#include <ocpp/v201/functional_blocks/authorization.hpp>
78
#include <ocpp/v201/utils.hpp>
89

10+
#include <ocpp/v201/messages/Authorize.hpp>
11+
#include <ocpp/v201/messages/ClearCache.hpp>
12+
#include <ocpp/v201/messages/GetLocalListVersion.hpp>
13+
#include <ocpp/v201/messages/SendLocalList.hpp>
14+
915
///
1016
/// \brief Check if vector of authorization data has a duplicate id token.
1117
/// \param list List to check.

lib/ocpp/v201/functional_blocks/availability.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <ocpp/v201/device_model.hpp>
88
#include <ocpp/v201/evse_manager.hpp>
99

10+
#include <ocpp/v201/messages/Heartbeat.hpp>
1011
#include <ocpp/v201/messages/StatusNotification.hpp>
1112

1213
namespace ocpp::v201 {

lib/ocpp/v201/functional_blocks/data_transfer.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// Copyright Pionix GmbH and Contributors to EVerest
33

4-
#include <ocpp/common/constants.hpp>
54
#include <ocpp/v201/functional_blocks/data_transfer.hpp>
65

6+
#include <ocpp/common/constants.hpp>
7+
#include <ocpp/v201/messages/DataTransfer.hpp>
8+
79
namespace ocpp {
810
namespace v201 {
911

1012
void DataTransfer::handle_message(const EnhancedMessage<MessageType>& message) {
11-
1213
if (message.messageType != MessageType::DataTransfer) {
1314
throw MessageTypeNotImplementedException(message.messageType);
1415
}

0 commit comments

Comments
 (0)