@@ -113,7 +113,7 @@ void StatusManager::updateConnectionStatus(bool is_connected)
113
113
}
114
114
115
115
// Restart heartbeat process
116
- m_heartbeat_timer.start (m_heartbeat_timer. getInterval ());
116
+ m_heartbeat_timer.start (m_ocpp_config. heartbeatInterval ());
117
117
}
118
118
}
119
119
else
@@ -144,24 +144,22 @@ bool StatusManager::updateConnectorStatus(unsigned int conn
144
144
Connector* connector = m_connectors.getConnector (connector_id);
145
145
if (connector)
146
146
{
147
+ std::lock_guard<std::mutex> lock (connector->mutex );
148
+
147
149
// Check if status has changed
148
150
if (connector->status != status)
149
151
{
150
- {
151
- std::lock_guard<std::mutex> lock (connector->mutex );
152
-
153
- // Save new status
154
- connector->status = status;
155
- connector->status_timestamp = DateTime::now ();
156
- connector->error_code = error_code;
157
- connector->info = info;
158
- connector->vendor_id = vendor_id;
159
- connector->vendor_error = vendor_error;
160
- m_connectors.saveConnector (connector->id );
161
- }
162
-
163
152
LOG_INFO << " Connector " << connector_id << " : " << ChargePointStatusHelper.toString (status);
164
153
154
+ // Save new status
155
+ connector->status = status;
156
+ connector->status_timestamp = DateTime::now ();
157
+ connector->error_code = error_code;
158
+ connector->info = info;
159
+ connector->vendor_id = vendor_id;
160
+ connector->vendor_error = vendor_error;
161
+ m_connectors.saveConnector (connector->id );
162
+
165
163
// Check registration status
166
164
if (m_registration_status == RegistrationStatus::Accepted)
167
165
{
@@ -170,7 +168,7 @@ bool StatusManager::updateConnectorStatus(unsigned int conn
170
168
if (duration == std::chrono::seconds (0 ))
171
169
{
172
170
// Notify now
173
- statusNotificationProcess ( connector_id);
171
+ m_worker_pool. run < void >( std::bind (&StatusManager::statusNotificationProcess, this , connector_id) );
174
172
}
175
173
else
176
174
{
@@ -197,7 +195,7 @@ void StatusManager::resetHeartBeatTimer()
197
195
{
198
196
if (m_heartbeat_timer.isStarted ())
199
197
{
200
- m_heartbeat_timer.restart (m_heartbeat_timer. getInterval ());
198
+ m_heartbeat_timer.restart (m_ocpp_config. heartbeatInterval ());
201
199
}
202
200
}
203
201
0 commit comments