File tree Expand file tree Collapse file tree
src/MicroOcpp/Model/ConnectorBase Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -782,6 +782,12 @@ std::shared_ptr<Transaction> Connector::beginTransaction(const char *idTag) {
782782 transaction->setAuthorized ();
783783
784784 updateTxNotification (TxNotification_Authorized);
785+
786+ // TC_008_1_CS & TC_008_2_CS / The Charge Point does NOT send a Authorize.req
787+ if (localAuthorizeOfflineBool && localAuthorizeOfflineBool->getBool ()) {
788+ transaction->commit ();
789+ return transaction;
790+ }
785791 }
786792
787793 transaction->commit ();
Original file line number Diff line number Diff line change @@ -923,6 +923,44 @@ TEST_CASE( "LocalAuth" ) {
923923 REQUIRE ( checkListVerion == localListVersion );
924924 }
925925
926+ SECTION (" Id in Local Authorization List should not send Authorize.req (TC_008_1_CS & TC_008_2_CS)" ) {
927+
928+ localAuthorizeOffline->setBool (true );
929+ localPreAuthorize->setBool (true );
930+
931+ // set local list
932+ StaticJsonDocument<256 > localAuthList;
933+ localAuthList[0 ][" idTag" ] = " mIdTag" ;
934+ localAuthList[0 ][" idTagInfo" ][" status" ] = " Accepted" ;
935+ authService->updateLocalList (localAuthList.as <JsonArray>(), 1 , false );
936+
937+ // patch Authorize so we can check if it is called
938+ bool checkAuthorize = false ;
939+ getOcppContext ()->getOperationRegistry ().registerOperation (" Authorize" , [&checkAuthorize] () {
940+ return new Ocpp16::CustomOperation (" Authorize" ,
941+ [&checkAuthorize] (JsonObject) {
942+ checkAuthorize = true ;
943+ },
944+ [] () {
945+ return createEmptyDocument ();
946+ });});
947+
948+ // begin transaction
949+ // Authorize should be skipped because of LocalPreAuthorize & LocalAuthorizeOffline
950+ loopback.setOnline (true );
951+
952+ REQUIRE ( connector->getStatus () == ChargePointStatus_Available );
953+
954+ beginTransaction (" mIdTag" );
955+ loop ();
956+
957+ REQUIRE ( !checkAuthorize ); // Ensure Authorize.req was NOT sent
958+ REQUIRE ( connector->getStatus () == ChargePointStatus_Charging );
959+
960+ endTransaction ();
961+ loop ();
962+ }
963+
926964 mocpp_deinitialize ();
927965}
928966
You can’t perform that action at this time.
0 commit comments