Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- Config `Cst_TxStartOnPowerPathClosed` to put back TxStartPoint
- Function `bool isConnected()` in `Connection` interface ([#282](https://github.com/matth-x/MicroOcpp/pull/282))
- Build flags for customizing memory limits of SmartCharging
- SConscript ([#287](https://github.com/matth-x/MicroOcpp/pull/287))
- Operation GetInstalledCertificateIds, UC M03 ([#262](https://github.com/matth-x/MicroOcpp/pull/262))
- Operation DeleteCertificate, UC M04 ([#262](https://github.com/matth-x/MicroOcpp/pull/262))
- Operation InstallCertificate, UC M05 ([#262](https://github.com/matth-x/MicroOcpp/pull/262))
Expand All @@ -33,7 +34,7 @@
- Ignore UnlockConnector when handler not set
- Reject ChargingProfile if unit not supported
- Fix building with debug level warn and error
- Fix transaction freeze in offline mode ([#279](https://github.com/matth-x/MicroOcpp/pull/279))
- Fix transaction freeze in offline mode ([#279](https://github.com/matth-x/MicroOcpp/pull/279), [#287](https://github.com/matth-x/MicroOcpp/pull/287))
- Fix compilation error caused by `PRId32` ([#279](https://github.com/matth-x/MicroOcpp/pull/279))
- Don't load FW-mngt. module when no handlers set

Expand Down
50 changes: 50 additions & 0 deletions SConscript.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# matth-x/MicroOcpp
# Copyright Matthias Akstaller 2019 - 2024
# MIT License

# NOTE: This SConscript is still WIP. It has thankfully been contributed from a project using SCons,
# not necessarily considering full reusability in other projects though.
# Use this file as a starting point for writing your own SCons integration. And as always, any
# contributions are highly welcome!

Import("env", "ARDUINOJSON_DIR")

import os, pathlib

def getAllDirs(root_dir):
dir_list = []
for root, subfolders, files in os.walk(root_dir.abspath):
dir_list.append(Dir(root))
return dir_list

SOURCE_DIR = Dir(".").srcnode()

source_dirs = getAllDirs(SOURCE_DIR.Dir("src"))
source_dirs += getAllDirs(ARDUINOJSON_DIR.Dir("src"))

source_files = []

for folder in source_dirs:
source_files += folder.glob("*.cpp")
env["CPPPATH"].append(folder)

compiled_objects = []
for source_file in source_files:
obj = env.Object(
target = pathlib.Path(source_file.path).stem
+ ".o",
source=source_file,
)
compiled_objects.append(obj)

libmicroocpp = env.StaticLibrary(
target='libmicroocpp',
source=sorted(compiled_objects)
)

exports = {
'library': libmicroocpp,
'CPPPATH': source_dirs.copy()
}

Return("exports")
4 changes: 2 additions & 2 deletions src/MicroOcpp/Core/RequestQueueStorageStrategy.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// matth-x/MicroOcpp
// Copyright Matthias Akstaller 2019 - 2023
// Copyright Matthias Akstaller 2019 - 2024
// MIT License

#include <MicroOcpp/Core/RequestQueueStorageStrategy.h>
Expand Down Expand Up @@ -104,12 +104,12 @@ Request *PersistentRequestQueue::front() {
tailCache.pop_front();
} else {
//cache miss -> case B) or A) -> try to fetch operation from flash (check for case B)) or take first cached element as front
auto storageHandler = opStore.makeOpHandler();

std::unique_ptr<Request> fetched;

unsigned int range = (opStore.getOpEnd() + MO_MAX_OPNR - nextOpNr) % MO_MAX_OPNR;
for (size_t i = 0; i < range; i++) {
auto storageHandler = opStore.makeOpHandler();
bool exists = storageHandler->restore(nextOpNr);
if (exists) {
//case B) -> load operation from flash and take it as front element
Expand Down
2 changes: 1 addition & 1 deletion src/MicroOcpp/Model/Diagnostics/DiagnosticsService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void DiagnosticsService::loop() {
if (uploadIssued) {
if (uploadStatusInput != nullptr && uploadStatusInput() == UploadStatus::Uploaded) {
//success!
MO_DBG_DEBUG("end upload routine (by status)")
MO_DBG_DEBUG("end upload routine (by status)");
uploadIssued = false;
retries = 0;
}
Expand Down
6 changes: 5 additions & 1 deletion src/MicroOcpp/Model/Transactions/Transaction.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// matth-x/MicroOcpp
// Copyright Matthias Akstaller 2019 - 2023
// Copyright Matthias Akstaller 2019 - 2024
// MIT License

#include <MicroOcpp/Model/Transactions/Transaction.h>
Expand Down Expand Up @@ -73,6 +73,10 @@ int32_t ocpp_tx_getMeterStop(OCPP_Transaction *tx) {
return reinterpret_cast<MicroOcpp::Transaction*>(tx)->getMeterStop();
}

void ocpp_tx_setMeterStop(OCPP_Transaction* tx, int32_t meter) {
return reinterpret_cast<MicroOcpp::Transaction*>(tx)->setMeterStop(meter);
}

bool ocpp_tx_getStopTimestamp(OCPP_Transaction *tx, char *buf, size_t len) {
return reinterpret_cast<MicroOcpp::Transaction*>(tx)->getStopTimestamp().toJsonString(buf, len);
}
Expand Down
1 change: 1 addition & 0 deletions src/MicroOcpp/Model/Transactions/Transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ bool ocpp_tx_getStartTimestamp(OCPP_Transaction *tx, char *buf, size_t len);
const char *ocpp_tx_getStopIdTag(OCPP_Transaction *tx);

int32_t ocpp_tx_getMeterStop(OCPP_Transaction *tx);
void ocpp_tx_setMeterStop(OCPP_Transaction* tx, int32_t meter);

bool ocpp_tx_getStopTimestamp(OCPP_Transaction *tx, char *buf, size_t len);

Expand Down
4 changes: 2 additions & 2 deletions src/MicroOcpp/Model/Transactions/TransactionDeserialize.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// matth-x/MicroOcpp
// Copyright Matthias Akstaller 2019 - 2023
// Copyright Matthias Akstaller 2019 - 2024
// MIT License

#include <limits>
Expand Down Expand Up @@ -234,7 +234,7 @@ bool deserializeTransaction(Transaction& tx, JsonObject state) {
tx.setSilent();
}

MO_DBG_DEBUG("DUMP TX");
MO_DBG_DEBUG("DUMP TX (%s)", tx.getIdTag() ? tx.getIdTag() : "idTag missing");
MO_DBG_DEBUG("Session | idTag %s, active: %i, authorized: %i, deauthorized: %i", tx.getIdTag(), tx.isActive(), tx.isAuthorized(), tx.isIdTagDeauthorized());
MO_DBG_DEBUG("Start RPC | req: %i, conf: %i", tx.getStartSync().isRequested(), tx.getStartSync().isConfirmed());
MO_DBG_DEBUG("Stop RPC | req: %i, conf: %i", tx.getStopSync().isRequested(), tx.getStopSync().isConfirmed());
Expand Down
4 changes: 2 additions & 2 deletions src/MicroOcpp/Operations/GetConfiguration.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// matth-x/MicroOcpp
// Copyright Matthias Akstaller 2019 - 2023
// Copyright Matthias Akstaller 2019 - 2024
// MIT License

#include <MicroOcpp/Operations/GetConfiguration.h>
Expand Down Expand Up @@ -135,7 +135,7 @@ std::unique_ptr<DynamicJsonDocument> GetConfiguration::createConf(){
if (!unknownKeys.empty()) {
JsonArray jsonUnknownKey = payload.createNestedArray("unknownKey");
for (auto key : unknownKeys) {
MO_DBG_DEBUG("Unknown key: %s", key)
MO_DBG_DEBUG("Unknown key: %s", key);
jsonUnknownKey.add(key);
}
}
Expand Down
Loading