Skip to content
Open
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
6 changes: 6 additions & 0 deletions src/MicroOcpp/Model/ConnectorBase/Connector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,12 @@ std::shared_ptr<Transaction> Connector::beginTransaction(const char *idTag) {
transaction->setAuthorized();

updateTxNotification(TxNotification_Authorized);

//TC_008_1_CS & TC_008_2_CS / The Charge Point does NOT send a Authorize.req
if (localAuthorizeOfflineBool && localAuthorizeOfflineBool->getBool()) {
transaction->commit();
return transaction;
}
}

transaction->commit();
Expand Down
38 changes: 38 additions & 0 deletions tests/LocalAuthList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,44 @@ TEST_CASE( "LocalAuth" ) {
REQUIRE( checkListVerion == localListVersion );
}

SECTION("Id in Local Authorization List should not send Authorize.req (TC_008_1_CS & TC_008_2_CS)") {

localAuthorizeOffline->setBool(true);
localPreAuthorize->setBool(true);

//set local list
StaticJsonDocument<256> localAuthList;
localAuthList[0]["idTag"] = "mIdTag";
localAuthList[0]["idTagInfo"]["status"] = "Accepted";
authService->updateLocalList(localAuthList.as<JsonArray>(), 1, false);

//patch Authorize so we can check if it is called
bool checkAuthorize = false;
getOcppContext()->getOperationRegistry().registerOperation("Authorize", [&checkAuthorize] () {
return new Ocpp16::CustomOperation("Authorize",
[&checkAuthorize] (JsonObject) {
checkAuthorize = true;
},
[] () {
return createEmptyDocument();
});});

//begin transaction
//Authorize should be skipped because of LocalPreAuthorize & LocalAuthorizeOffline
loopback.setOnline(true);

REQUIRE( connector->getStatus() == ChargePointStatus_Available );

beginTransaction("mIdTag");
loop();

REQUIRE( !checkAuthorize ); // Ensure Authorize.req was NOT sent
REQUIRE( connector->getStatus() == ChargePointStatus_Charging );

endTransaction();
loop();
}

mocpp_deinitialize();
}

Expand Down
Loading