-
Notifications
You must be signed in to change notification settings - Fork 62
Develop dadashi #99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Develop dadashi #99
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -363,20 +363,43 @@ bool StatusManager::handleMessage(const ocpp::messages::ChangeAvailabilityReq& r | |
unsigned int connector_id = request.connectorId; | ||
if (m_connectors.isValid(connector_id)) | ||
{ | ||
// Notify request | ||
response.status = m_events_handler.changeAvailabilityRequested(connector_id, request.type); | ||
if (response.status == AvailabilityStatus::Accepted) | ||
{ | ||
// Update status | ||
ChargePointStatus status = ChargePointStatus::Unavailable; | ||
if (request.type == AvailabilityType::Operative) | ||
//In the case the ChangeAvailability.req contains ConnectorId = 0, the status change applies to the Charge Point and all Connectors. | ||
if(connector_id == 0) | ||
{ | ||
for(unsigned int i=0;i <= m_connectors.getCount();i++) | ||
{ | ||
status = ChargePointStatus::Available; | ||
response.status = m_events_handler.changeAvailabilityRequested(i, request.type); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For connector 0, I would have done it differently : I would have notified the user application of a change availability request on connector 0 only. If the request has been accepted, I would have change the status of all the connectors. |
||
if (response.status == AvailabilityStatus::Accepted) | ||
{ | ||
// Update status | ||
ChargePointStatus status = ChargePointStatus::Unavailable; | ||
if (request.type == AvailabilityType::Operative) | ||
{ | ||
status = ChargePointStatus::Available; | ||
} | ||
m_worker_pool.run<void>([this, i, status] { updateConnectorStatus(i, status); }); | ||
} | ||
|
||
LOG_INFO << "Change availability " << AvailabilityStatusHelper.toString(response.status); | ||
} | ||
m_worker_pool.run<void>([this, connector_id, status] { updateConnectorStatus(connector_id, status); }); | ||
} | ||
else | ||
{ | ||
// Notify request | ||
response.status = m_events_handler.changeAvailabilityRequested(connector_id, request.type); | ||
if (response.status == AvailabilityStatus::Accepted) | ||
{ | ||
// Update status | ||
ChargePointStatus status = ChargePointStatus::Unavailable; | ||
if (request.type == AvailabilityType::Operative) | ||
{ | ||
status = ChargePointStatus::Available; | ||
} | ||
m_worker_pool.run<void>([this, connector_id, status] { updateConnectorStatus(connector_id, status); }); | ||
} | ||
|
||
LOG_INFO << "Change availability " << AvailabilityStatusHelper.toString(response.status); | ||
LOG_INFO << "Change availability " << AvailabilityStatusHelper.toString(response.status); | ||
} | ||
ret = true; | ||
} | ||
else | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I didn't handled this case.