Skip to content
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
8 changes: 6 additions & 2 deletions src/MicroOcpp/Model/Authorization/AuthorizationService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ bool AuthorizationService::loadLists() {
}

AuthorizationData *AuthorizationService::getLocalAuthorization(const char *idTag) {
if (!localAuthListEnabledBool->getBool()) {
if (!localAuthListEnabled()) {
return nullptr; //auth cache will follow
}

Expand All @@ -101,6 +101,10 @@ size_t AuthorizationService::getLocalListSize() {
return localAuthorizationList.size();
}

bool AuthorizationService::localAuthListEnabled() const {
return localAuthListEnabledBool && localAuthListEnabledBool->getBool();
}

bool AuthorizationService::updateLocalList(JsonArray localAuthorizationListJson, int listVersion, bool differential) {
bool success = localAuthorizationList.readJson(localAuthorizationListJson, listVersion, differential, false);

Expand All @@ -127,7 +131,7 @@ bool AuthorizationService::updateLocalList(JsonArray localAuthorizationListJson,
void AuthorizationService::notifyAuthorization(const char *idTag, JsonObject idTagInfo) {
//check local list conflicts. In future: also update authorization cache

if (!localAuthListEnabledBool->getBool()) {
if (!localAuthListEnabled()) {
return; //auth cache will follow
}

Expand Down
1 change: 1 addition & 0 deletions src/MicroOcpp/Model/Authorization/AuthorizationService.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class AuthorizationService : public MemoryManaged {
AuthorizationData *getLocalAuthorization(const char *idTag);

int getLocalListVersion();
bool localAuthListEnabled() const;
size_t getLocalListSize(); //number of entries in current localAuthList; used in unit tests

bool updateLocalList(JsonArray localAuthorizationListJson, int listVersion, bool differential);
Expand Down
2 changes: 1 addition & 1 deletion src/MicroOcpp/Model/Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ void Model::updateSupportedStandardProfiles() {
}

#if MO_ENABLE_LOCAL_AUTH
if (authorizationService) {
if (authorizationService && authorizationService->localAuthListEnabled()) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This affects the SupportedFeatureProfiles Configuration key. In my understanding, that key tells the server what the charger is in theory capable of. When the the server disables unused profiles, then the charger would still be able to support them, in theory.

Did this change come out of an OCTT test case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, when disabled, the OCTT expects it not to appear in the list anymore (as it is not supported). This avoids having another precompiled firmware just to pass those tests...

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@razvanphp razvanphp Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, pushed in 9a4f1da!

if (!strstr(supportedFeatureProfilesString->getString(), "LocalAuthListManagement")) {
if (!buf.empty()) buf += ',';
buf += "LocalAuthListManagement";
Expand Down
4 changes: 3 additions & 1 deletion src/MicroOcpp/Operations/GetLocalListVersion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ std::unique_ptr<JsonDoc> GetLocalListVersion::createConf(){
auto doc = makeJsonDoc(getMemoryTag(), JSON_OBJECT_SIZE(1));
JsonObject payload = doc->to<JsonObject>();

if (auto authService = model.getAuthorizationService()) {
auto authService = model.getAuthorizationService();
if (authService && authService->localAuthListEnabled()) {
payload["listVersion"] = authService->getLocalListVersion();
} else {
//TC_042_1_CS Get Local List Version (not supported)
payload["listVersion"] = -1;
}
return doc;
Expand Down
6 changes: 6 additions & 0 deletions src/MicroOcpp/Operations/SendLocalList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ const char* SendLocalList::getOperationType(){

void SendLocalList::processReq(JsonObject payload) {

//TC_043_1_CS Send Local Authorization List - NotSupported
if (!authService.localAuthListEnabled()) {
errorCode = "NotSupported";
return;
}

if (!payload.containsKey("listVersion") || !payload.containsKey("updateType")) {
errorCode = "FormationViolation";
return;
Expand Down