@@ -124,8 +124,7 @@ bool AuthentLocalList::handleMessage(const ocpp::messages::SendLocalListReq& req
124124 // Check local list activation
125125 if (m_ocpp_config.localAuthListEnabled ())
126126 {
127- // Check local list version
128- if (request.listVersion > m_local_list_version)
127+ if (request.listVersion > 0 )
129128 {
130129 // Check update list size
131130 if (request.localAuthorizationList .size () <= m_ocpp_config.sendLocalListMaxLength ())
@@ -135,25 +134,48 @@ bool AuthentLocalList::handleMessage(const ocpp::messages::SendLocalListReq& req
135134 if (request.updateType == UpdateType::Full)
136135 {
137136 success = performFullUpdate (request.localAuthorizationList );
138- }
139- else
140- {
141- success = performPartialUpdate (request.localAuthorizationList );
142- }
143- if (success)
144- {
145- response.status = UpdateStatus::Accepted;
137+ if (success)
138+ {
139+ response.status = UpdateStatus::Accepted;
146140
147- // Update local list version
148- m_local_list_version = request.listVersion ;
149- if (!m_internal_config.setKey (LOCAL_LIST_VERSION_KEY, std::to_string (m_local_list_version)))
141+ // Update local list version
142+ m_local_list_version = request.listVersion ;
143+ if (!m_internal_config.setKey (LOCAL_LIST_VERSION_KEY, std::to_string (m_local_list_version)))
144+ {
145+ LOG_ERROR << " Unable to save authent local list version" ;
146+ }
147+ }
148+ else
150149 {
151- LOG_ERROR << " Unable to save authent local list version " ;
150+ response. status = UpdateStatus::Failed ;
152151 }
153152 }
154153 else
155154 {
156- response.status = UpdateStatus::Failed;
155+ // Check local list version
156+ if (request.listVersion > m_local_list_version)
157+ {
158+ success = performPartialUpdate (request.localAuthorizationList );
159+ if (success)
160+ {
161+ response.status = UpdateStatus::Accepted;
162+
163+ // Update local list version
164+ m_local_list_version = request.listVersion ;
165+ if (!m_internal_config.setKey (LOCAL_LIST_VERSION_KEY, std::to_string (m_local_list_version)))
166+ {
167+ LOG_ERROR << " Unable to save authent local list version" ;
168+ }
169+ }
170+ else
171+ {
172+ response.status = UpdateStatus::Failed;
173+ }
174+ }
175+ else
176+ {
177+ response.status = UpdateStatus::VersionMismatch;
178+ }
157179 }
158180 }
159181 else
@@ -163,7 +185,7 @@ bool AuthentLocalList::handleMessage(const ocpp::messages::SendLocalListReq& req
163185 }
164186 else
165187 {
166- response.status = UpdateStatus::VersionMismatch ;
188+ response.status = UpdateStatus::Failed ;
167189 }
168190 }
169191 else
0 commit comments