Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCPP 2.0.1 Fixes after functionality tests #371

Merged
merged 19 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
add AuthorizeRemoteStart
  • Loading branch information
matth-x committed Sep 21, 2024
commit ca54084a01eebb0f5e8a4e027c374fa72b773f71
6 changes: 5 additions & 1 deletion src/MicroOcpp/Model/RemoteControl/RemoteControlService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <MicroOcpp/Model/RemoteControl/RemoteControlService.h>
#include <MicroOcpp/Core/Context.h>
#include <MicroOcpp/Debug.h>
#include <MicroOcpp/Model/Variables/VariableService.h>
#include <MicroOcpp/Model/Transactions/TransactionService.h>
#include <MicroOcpp/Operations/RequestStartTransaction.h>
#include <MicroOcpp/Operations/RequestStopTransaction.h>
Expand Down Expand Up @@ -66,6 +67,9 @@ RemoteControlService::RemoteControlService(Context& context, size_t numEvses) :
evses[i] = new RemoteControlServiceEvse(context, (unsigned int)i);
}

auto varService = context.getModel().getVariableService();
authorizeRemoteStart = varService->declareVariable<bool>("AuthCtrlr", "AuthorizeRemoteStart", false);

context.getOperationRegistry().registerOperation("RequestStartTransaction", [this] () -> Operation* {
if (!this->context.getModel().getTransactionService()) {
return nullptr; //-> NotSupported
Expand Down Expand Up @@ -114,7 +118,7 @@ RequestStartStopStatus RemoteControlService::requestStartTransaction(unsigned in

transactionOut = evse->getTransaction();

if (!evse->beginAuthorization(idToken, false)) {
if (!evse->beginAuthorization(idToken, authorizeRemoteStart->getBool())) {
MO_DBG_INFO("EVSE still occupied with pending tx");
return RequestStartStopStatus_Rejected;
}
Expand Down
4 changes: 3 additions & 1 deletion src/MicroOcpp/Model/RemoteControl/RemoteControlService.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
namespace MicroOcpp {

class Context;
class Variable;

class RemoteControlServiceEvse : public MemoryManaged {
private:
Expand All @@ -42,9 +43,10 @@ class RemoteControlServiceEvse : public MemoryManaged {
class RemoteControlService : public MemoryManaged {
private:
Context& context;

RemoteControlServiceEvse* evses [MO_NUM_EVSE] = {nullptr};

Variable *authorizeRemoteStart = nullptr;

public:
RemoteControlService(Context& context, size_t numEvses);
~RemoteControlService();
Expand Down