Skip to content

Commit

Permalink
clean up custom allocator changes
Browse files Browse the repository at this point in the history
  • Loading branch information
matth-x committed Aug 13, 2024
1 parent 926a197 commit 79eb16e
Show file tree
Hide file tree
Showing 36 changed files with 20 additions and 51 deletions.
1 change: 0 additions & 1 deletion src/MicroOcpp/Core/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <MicroOcpp/Debug.h>

#include <string.h>
#include <vector>
#include <algorithm>
#include <ArduinoJson.h>

Expand Down
2 changes: 1 addition & 1 deletion src/MicroOcpp/Core/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#include <MicroOcpp/Core/ConfigurationKeyValue.h>
#include <MicroOcpp/Core/ConfigurationContainer.h>
#include <MicroOcpp/Core/FilesystemAdapter.h>
#include <MicroOcpp/Core/Memory.h>

#include <memory>
#include <vector>

#define CONFIGURATION_FN (MO_FILENAME_PREFIX "ocpp-config.jsn")
#define CONFIGURATION_VOLATILE "/volatile"
Expand Down
1 change: 0 additions & 1 deletion src/MicroOcpp/Core/ConfigurationContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#ifndef MO_CONFIGURATIONCONTAINER_H
#define MO_CONFIGURATIONCONTAINER_H

#include <vector>
#include <memory>

#include <MicroOcpp/Core/ConfigurationKeyValue.h>
Expand Down
2 changes: 0 additions & 2 deletions src/MicroOcpp/Core/FilesystemAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@

#if MO_ENABLE_FILE_INDEX

#include <vector>
#include <algorithm>
#include <string>

namespace MicroOcpp {

Expand Down
2 changes: 1 addition & 1 deletion src/MicroOcpp/Core/FilesystemUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ std::unique_ptr<JsonDoc> FilesystemUtils::loadJson(std::shared_ptr<FilesystemAda
capacity = MO_MAX_JSON_CAPACITY;
}

auto doc = std::unique_ptr<JsonDoc>(nullptr);
std::unique_ptr<JsonDoc> doc;
DeserializationError err = DeserializationError::NoMemory;
ArduinoJsonFileAdapter fileReader {file.get()};

Expand Down
1 change: 0 additions & 1 deletion src/MicroOcpp/Core/FtpMbedTLS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#if MO_ENABLE_MBEDTLS

#include <string>
#include <string.h>
#include <functional>

Expand Down
4 changes: 2 additions & 2 deletions src/MicroOcpp/Core/Memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,10 @@ void mo_mem_print_stats() {
MO_CONSOLE_PRINTF("%s - %zu B (max. %zu B)\n", tag.first.c_str(), tag.second.current_size, tag.second.max_size);
}

MO_CONSOLE_PRINTF("Blocks: %zu\nTags: %zu\nCurrent usage: %zu B\nMaximum usage: %zu B\n", memBlocks.size(), memTags.size(), memTotal, memTotalMax);
MO_CONSOLE_PRINTF(" *** Summary ***\nBlocks: %zu\nTags: %zu\nCurrent usage: %zu B\nMaximum usage: %zu B\n", memBlocks.size(), memTags.size(), memTotal, memTotalMax);
#if MO_DBG_LEVEL >= MO_DL_DEBUG
{
MO_CONSOLE_PRINTF("Total blocks (control value 1): %zu B\nTags (control value): %zu\nTotal tagged (control value 2): %zu B\nTotal tagged (control value 3): %zu B\nUntagged: %zu\nTotal untagged: %zu B\n", size, tags.size(), size_control, size_control2, untagged, untagged_size);
MO_CONSOLE_PRINTF(" *** Debug information ***\nTotal blocks (control value 1): %zu B\nTags (control value): %zu\nTotal tagged (control value 2): %zu B\nTotal tagged (control value 3): %zu B\nUntagged: %zu\nTotal untagged: %zu B\n", size, tags.size(), size_control, size_control2, untagged, untagged_size);
}
#endif
}
Expand Down
4 changes: 2 additions & 2 deletions src/MicroOcpp/Core/OcppError.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace MicroOcpp {

class NotImplemented : public Operation, public MemoryManaged {
public:
NotImplemented() : MemoryManaged("v16.CallError.NotImplemented") { }
NotImplemented() : MemoryManaged("v16.CallError.", "NotImplemented") { }

const char *getErrorCode() override {
return "NotImplemented";
Expand All @@ -24,7 +24,7 @@ class MsgBufferExceeded : public Operation, public MemoryManaged {
size_t maxCapacity;
size_t msgLen;
public:
MsgBufferExceeded(size_t maxCapacity, size_t msgLen) : MemoryManaged("v16.CallError.MsgBufferExceeded"), maxCapacity(maxCapacity), msgLen(msgLen) { }
MsgBufferExceeded(size_t maxCapacity, size_t msgLen) : MemoryManaged("v16.CallError.", "GenericError"), maxCapacity(maxCapacity), msgLen(msgLen) { }
const char *getErrorCode() override {
return "GenericError";
}
Expand Down
1 change: 0 additions & 1 deletion src/MicroOcpp/Model/Authorization/AuthorizationList.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#include <MicroOcpp/Model/Authorization/AuthorizationData.h>
#include <MicroOcpp/Core/Memory.h>
#include <vector>

#ifndef MO_LocalAuthListMaxLength
#define MO_LocalAuthListMaxLength 48
Expand Down
1 change: 0 additions & 1 deletion src/MicroOcpp/Model/ConnectorBase/Connector.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <MicroOcpp/Core/Memory.h>
#include <MicroOcpp/Operations/CiStrings.h>

#include <vector>
#include <functional>
#include <memory>

Expand Down
2 changes: 0 additions & 2 deletions src/MicroOcpp/Model/ConnectorBase/ConnectorsCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Copyright Matthias Akstaller 2019 - 2024
// MIT License

#include <string>

#include <MicroOcpp/Model/ConnectorBase/ConnectorsCommon.h>
#include <MicroOcpp/Core/Context.h>
#include <MicroOcpp/Core/Configuration.h>
Expand Down
2 changes: 0 additions & 2 deletions src/MicroOcpp/Model/Diagnostics/DiagnosticsService.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

#include <functional>
#include <memory>
#include <string>
#include <deque>
#include <MicroOcpp/Core/Time.h>
#include <MicroOcpp/Core/Ftp.h>
#include <MicroOcpp/Core/Memory.h>
Expand Down
1 change: 0 additions & 1 deletion src/MicroOcpp/Model/Metering/MeterValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <MicroOcpp/Core/Memory.h>
#include <ArduinoJson.h>
#include <memory>
#include <vector>

namespace MicroOcpp {

Expand Down
1 change: 0 additions & 1 deletion src/MicroOcpp/Model/Metering/MeteringConnector.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#include <functional>
#include <memory>
#include <vector>

#include <MicroOcpp/Model/Metering/MeterValue.h>
#include <MicroOcpp/Model/Metering/MeterStore.h>
Expand Down
1 change: 0 additions & 1 deletion src/MicroOcpp/Model/Metering/MeteringService.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#define MO_METERINGSERVICE_H

#include <functional>
#include <vector>
#include <memory>

#include <MicroOcpp/Model/Metering/MeteringConnector.h>
Expand Down
2 changes: 0 additions & 2 deletions src/MicroOcpp/Model/Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

#include <MicroOcpp/Model/Model.h>

#include <string>

#include <MicroOcpp/Model/Transactions/TransactionStore.h>
#include <MicroOcpp/Model/SmartCharging/SmartChargingService.h>
#include <MicroOcpp/Model/ConnectorBase/ConnectorsCommon.h>
Expand Down
1 change: 0 additions & 1 deletion src/MicroOcpp/Model/Reset/ResetService.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#define MO_RESETSERVICE_H

#include <functional>
#include <vector>

#include <MicroOcpp/Version.h>
#include <MicroOcpp/Core/ConfigurationKeyValue.h>
Expand Down
1 change: 0 additions & 1 deletion src/MicroOcpp/Model/SmartCharging/SmartChargingModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#endif

#include <memory>
#include <vector>
#include <limits>

#include <ArduinoJson.h>
Expand Down
2 changes: 1 addition & 1 deletion src/MicroOcpp/Model/SmartCharging/SmartChargingService.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class SmartChargingConnector : public MemoryManaged {

public:
SmartChargingConnector(Model& model, std::shared_ptr<FilesystemAdapter> filesystem, unsigned int connectorId, ProfileStack& ChargePointMaxProfile, ProfileStack& ChargePointTxDefaultProfile);
SmartChargingConnector(SmartChargingConnector&& other) = default;
SmartChargingConnector(SmartChargingConnector&&) = default;
~SmartChargingConnector();

void loop();
Expand Down
1 change: 0 additions & 1 deletion src/MicroOcpp/Model/Variables/Variable.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#if MO_ENABLE_V201

#include <stdint.h>
#include <vector>
#include <memory>
#include <limits>

Expand Down
1 change: 0 additions & 1 deletion src/MicroOcpp/Model/Variables/VariableContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

#if MO_ENABLE_V201

#include <vector>
#include <memory>

#include <MicroOcpp/Model/Variables/Variable.h>
Expand Down
1 change: 0 additions & 1 deletion src/MicroOcpp/Model/Variables/VariableService.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#define MO_VARIABLESERVICE_H

#include <stdint.h>
#include <vector>
#include <memory>
#include <limits>
#include <functional>
Expand Down
3 changes: 1 addition & 2 deletions src/MicroOcpp/Operations/GetBaseReport.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@

#if MO_ENABLE_V201

#include <string>

#include <MicroOcpp/Core/Operation.h>
#include <MicroOcpp/Core/Memory.h>
#include <MicroOcpp/Model/Variables/Variable.h>

namespace MicroOcpp {
Expand Down
2 changes: 1 addition & 1 deletion src/MicroOcpp/Operations/GetConfiguration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void GetConfiguration::processReq(JsonObject payload) {

JsonArray requestedKeys = payload["key"];
for (size_t i = 0; i < requestedKeys.size(); i++) {
keys.emplace_back(makeString(getMemoryTag(), requestedKeys[i].as<const char*>()));
keys.push_back(makeString(getMemoryTag(), requestedKeys[i].as<const char*>()));
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/MicroOcpp/Operations/GetConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
#define MO_GETCONFIGURATION_H

#include <MicroOcpp/Core/Operation.h>

#include <vector>
#include <MicroOcpp/Core/Memory.h>

namespace MicroOcpp {
namespace Ocpp16 {
Expand Down
2 changes: 1 addition & 1 deletion src/MicroOcpp/Operations/GetInstalledCertificateIds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void GetInstalledCertificateIds::processReq(JsonObject payload) {
return;
}

Vector<GetCertificateIdType> certificateType = makeVector<GetCertificateIdType>(getMemoryTag());
auto certificateType = makeVector<GetCertificateIdType>(getMemoryTag());
for (const char *certificateTypeCstr : payload["certificateType"].as<JsonArray>()) {
if (!strcmp(certificateTypeCstr, "V2GRootCertificate")) {
certificateType.push_back(GetCertificateIdType_V2GRootCertificate);
Expand Down
4 changes: 1 addition & 3 deletions src/MicroOcpp/Operations/GetVariables.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@

#if MO_ENABLE_V201

#include <string>
#include <vector>

#include <MicroOcpp/Core/Operation.h>
#include <MicroOcpp/Core/Memory.h>
#include <MicroOcpp/Model/Variables/Variable.h>

namespace MicroOcpp {
Expand Down
3 changes: 1 addition & 2 deletions src/MicroOcpp/Operations/MeterValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
#define MO_METERVALUES_H

#include <MicroOcpp/Core/Operation.h>
#include <MicroOcpp/Core/Memory.h>
#include <MicroOcpp/Core/Time.h>

#include <vector>

namespace MicroOcpp {

class MeterValue;
Expand Down
2 changes: 0 additions & 2 deletions src/MicroOcpp/Operations/NotifyReport.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#include <MicroOcpp/Core/Time.h>
#include <MicroOcpp/Core/Memory.h>

#include <vector>

namespace MicroOcpp {

class Model;
Expand Down
2 changes: 1 addition & 1 deletion src/MicroOcpp/Operations/RequestStartTransaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

#if MO_ENABLE_V201

#include <string>
#include <MicroOcpp/Core/Operation.h>
#include <MicroOcpp/Core/Memory.h>
#include <MicroOcpp/Model/Transactions/TransactionDefs.h>

namespace MicroOcpp {
Expand Down
2 changes: 1 addition & 1 deletion src/MicroOcpp/Operations/RequestStopTransaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

#if MO_ENABLE_V201

#include <string>
#include <MicroOcpp/Core/Operation.h>
#include <MicroOcpp/Core/Memory.h>
#include <MicroOcpp/Model/Transactions/TransactionDefs.h>

namespace MicroOcpp {
Expand Down
4 changes: 1 addition & 3 deletions src/MicroOcpp/Operations/SetVariables.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@

#if MO_ENABLE_V201

#include <string>
#include <vector>

#include <MicroOcpp/Core/Operation.h>
#include <MicroOcpp/Core/Memory.h>
#include <MicroOcpp/Model/Variables/Variable.h>

namespace MicroOcpp {
Expand Down
2 changes: 1 addition & 1 deletion src/MicroOcpp/Operations/StopTransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ std::unique_ptr<JsonDoc> StopTransaction::createReq() {
txDataJson.emplace_back(std::move(mvJson));
}

JsonDoc txDataDoc = JsonDoc(JSON_ARRAY_SIZE(txDataJson.size()) + txDataJson_size);
auto txDataDoc = initJsonDoc(getMemoryTag(), JSON_ARRAY_SIZE(txDataJson.size()) + txDataJson_size);
for (auto mvJson = txDataJson.begin(); mvJson != txDataJson.end(); mvJson++) {
txDataDoc.add(**mvJson);
}
Expand Down
2 changes: 1 addition & 1 deletion src/MicroOcpp/Operations/StopTransaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#define MO_STOPTRANSACTION_H

#include <MicroOcpp/Core/Operation.h>
#include <MicroOcpp/Core/Memory.h>
#include <MicroOcpp/Core/Time.h>
#include <MicroOcpp/Operations/CiStrings.h>
#include <vector>

namespace MicroOcpp {

Expand Down
3 changes: 1 addition & 2 deletions src/MicroOcpp/Operations/TriggerMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
#define MO_TRIGGERMESSAGE_H

#include <MicroOcpp/Core/Operation.h>

#include <vector>
#include <MicroOcpp/Core/Memory.h>

namespace MicroOcpp {

Expand Down
2 changes: 1 addition & 1 deletion src/MicroOcpp_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ void ocpp_set_console_out_c(void (*console_out)(const char *msg)) {

void ocpp_authorize(const char *idTag, AuthorizeConfCallback onConfirmation, AuthorizeAbortCallback onAbort, AuthorizeTimeoutCallback onTimeout, AuthorizeErrorCallback onError, void *user_data) {

MicroOcpp::String idTag_capture = MicroOcpp::makeString("MicroOcpp_c.cpp", idTag);
auto idTag_capture = MicroOcpp::makeString("MicroOcpp_c.cpp", idTag);

authorize(idTag,
onConfirmation ? [onConfirmation, idTag_capture, user_data] (JsonObject payload) {
Expand Down

0 comments on commit 79eb16e

Please sign in to comment.