Skip to content

Commit 07368e3

Browse files
committed
Add ocpp_transaction_id. Fix OCPP 1.6 session cost message conversion.
Signed-off-by: Maaike Zijderveld, iolar <git.mail@iolar.nl>
1 parent 49f3df9 commit 07368e3

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

include/ocpp/common/types.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ enum class IdentifierType {
372372
};
373373

374374
struct SessionCostMessage {
375+
std::optional<std::string> ocpp_transaction_id;
375376
std::optional<std::string> identifier_id;
376377
std::optional<IdentifierType> identifier_type;
377378
std::vector<DisplayMessageContent> message;

lib/ocpp/v16/charge_point_impl.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -3136,6 +3136,10 @@ DataTransferResponse ChargePointImpl::handle_set_user_price(const std::optional<
31363136
} else {
31373137
identifier_id = t->get_session_id();
31383138
identifier_type = IdentifierType::SessionId;
3139+
const std::optional<int32_t> transaction_id = t->get_transaction_id();
3140+
if (transaction_id != std::nullopt) {
3141+
session_cost_message.ocpp_transaction_id = std::to_string(transaction_id.value());
3142+
}
31393143
}
31403144

31413145
session_cost_message.identifier_id = identifier_id;
@@ -3153,7 +3157,7 @@ DataTransferResponse ChargePointImpl::handle_set_user_price(const std::optional<
31533157
data.at("priceTextExtra").is_array()) {
31543158
for (const json& j : data.at("priceTextExtra")) {
31553159
DisplayMessageContent message;
3156-
message.message = j;
3160+
message = j;
31573161

31583162
messages.push_back(message);
31593163
}

lib/ocpp/v2/functional_blocks/tariff_and_cost.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ void TariffAndCost::handle_cost_and_tariff(const TransactionEventResponse& respo
5555
this->session_cost_message_callback != nullptr) {
5656
SessionCostMessage session_cost_message;
5757
session_cost_message.message = cost_messages;
58+
session_cost_message.ocpp_transaction_id = original_message.transactionInfo.transactionId;
5859
session_cost_message.identifier_id = original_message.transactionInfo.transactionId;
5960
session_cost_message.identifier_type = IdentifierType::TransactionId;
6061
this->session_cost_message_callback.value()({session_cost_message});

0 commit comments

Comments
 (0)