Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion lib/everest/ocpp/include/ocpp/common/message_queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,6 @@ template <typename M> class MessageQueue {
}

if (!this->send_callback(this->in_flight->message)) {
this->paused = true;
EVLOG_error << "Could not send message, this is most likely because the charge point is offline.";
if (this->in_flight && is_transaction_message(*this->in_flight)) {
EVLOG_info << "The message in flight is transaction related and will be sent again once the "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ struct WebsocketConnectionOptions {
Uri csms_uri; // the URI of the CSMS
int security_profile; // FIXME: change type to `SecurityProfile`
std::optional<std::string> authorization_key;
std::chrono::milliseconds message_timeout;
int retry_backoff_random_range_s;
int retry_backoff_repeat_times;
int retry_backoff_wait_minimum_s;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ enum class EConnectionState {
/// \brief Message to return in the callback to close the socket connection
static constexpr int LWS_CLOSE_SOCKET_RESPONSE_MESSAGE = -1;

/// \brief How much we wait for a message to be sent in seconds
static constexpr int MESSAGE_SEND_TIMEOUT_S = 1;

/// \brief Current connection data, sets the internal state of the
struct ConnectionData {
explicit ConnectionData(WebsocketLibwebsockets* owner) :
Expand Down Expand Up @@ -1153,7 +1150,7 @@ void WebsocketLibwebsockets::poll_message(const std::shared_ptr<WebsocketMessage
request_write();

message_queue.wait_on_custom_event([&] { return (true == msg->message_sent); },
std::chrono::seconds(MESSAGE_SEND_TIMEOUT_S));
this->connection_options.message_timeout);

if (msg->message_sent) {
EVLOG_debug << "Successfully sent last message!";
Expand Down
1 change: 1 addition & 0 deletions lib/everest/ocpp/lib/ocpp/v16/charge_point_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ WebsocketConnectionOptions ChargePointImpl::get_ws_connection_options() {
uri,
security_profile,
this->configuration->getAuthorizationKey(),
std::chrono::seconds(10),
this->configuration->getRetryBackoffRandomRange(),
this->configuration->getRetryBackoffRepeatTimes(),
this->configuration->getRetryBackoffWaitMinimum(),
Expand Down
1 change: 1 addition & 0 deletions lib/everest/ocpp/lib/ocpp/v2/charge_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,7 @@ std::optional<DataTransferResponse> ChargePoint::data_transfer_req(const DataTra
void ChargePoint::websocket_connected_callback(const int configuration_slot,
const NetworkConnectionProfile& network_connection_profile,
const OcppProtocolVersion ocpp_version) {
this->message_queue->update_message_timeout(network_connection_profile.messageTimeout);
this->message_queue->resume(this->message_queue_resume_delay);
this->ocpp_version = ocpp_version;
if (this->registration_status == RegistrationStatusEnum::Accepted) {
Expand Down
6 changes: 3 additions & 3 deletions lib/everest/ocpp/lib/ocpp/v2/connectivity_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,10 @@ ConnectivityManager::get_ws_connection_options(const std::int32_t configuration_
this->device_model.get_value<std::string>(ControllerComponentVariables::SupportedOcppVersions));

WebsocketConnectionOptions connection_options{
ocpp_versions,
uri,
network_connection_profile.securityProfile,
ocpp_versions, uri, network_connection_profile.securityProfile,
this->device_model.get_optional_value<std::string>(ControllerComponentVariables::BasicAuthPassword),
// Always use a minimum of 1 second otherwise each message would timeout immediately
std::chrono::seconds(std::max(network_connection_profile.messageTimeout, 1)),
this->device_model.get_value<int>(ControllerComponentVariables::RetryBackOffRandomRange),
this->device_model.get_value<int>(ControllerComponentVariables::RetryBackOffRepeatTimes),
this->device_model.get_value<int>(ControllerComponentVariables::RetryBackOffWaitMinimum),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,13 +585,6 @@ void Provisioning::handle_variable_changed(const SetVariableData& set_variable_d
}
}

if (component_variable == ControllerComponentVariables::MessageTimeout) {
if (component_variable.variable.has_value()) {
this->message_queue.update_message_timeout(
this->context.device_model.get_value<int>(ControllerComponentVariables::MessageTimeout));
}
}

// TODO(piet): other special handling of changed variables can be added here...
}

Expand Down
Loading