ocpp 0.24.1
A C++ implementation of the Open Charge Point Protocol
transaction.hpp
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2020 - 2023 Pionix GmbH and Contributors to EVerest
3#ifndef OCPP_V2_TRANSACTION_HANDLER_HPP
4#define OCPP_V2_TRANSACTION_HANDLER_HPP
5
6#include <ocpp/common/aligned_timer.hpp>
7#include <ocpp/v2/ocpp_types.hpp>
8
9namespace ocpp {
10
11namespace v2 {
12
13class DatabaseHandler;
14
17 explicit EnhancedTransaction(DatabaseHandler& database_handler, bool database_enabled) :
18 database_handler{database_handler}, database_enabled{database_enabled} {
19 }
20
21 bool id_token_sent = false;
22 int32_t connector_id = 0;
23 int32_t seq_no = 0;
24 std::optional<float> active_energy_import_start_value;
25 DateTime start_time;
26 bool check_max_active_import_energy = false;
27
28 ClockAlignedTimer sampled_tx_updated_meter_values_timer;
29 ClockAlignedTimer sampled_tx_ended_meter_values_timer;
30 ClockAlignedTimer aligned_tx_updated_meter_values_timer;
31 ClockAlignedTimer aligned_tx_ended_meter_values_timer;
32
36 int32_t get_seq_no();
37 Transaction get_transaction();
38
42 void update_charging_state(const ChargingStateEnum charging_state);
43
44 void set_id_token_sent();
45
46private:
47 DatabaseHandler& database_handler;
48 bool database_enabled;
49};
50} // namespace v2
51
52} // namespace ocpp
53
54#endif // OCPP_V2_TRANSACTION_HANDLER_HPP
Definition: aligned_timer.hpp:12
Contains a DateTime implementation that can parse and create RFC 3339 compatible strings.
Definition: types.hpp:109
Definition: database_handler.hpp:204
Struct that enhances the OCPP Transaction by some meta data and functionality.
Definition: transaction.hpp:16
int32_t get_seq_no()
Get the current sequence number of the transaction message.
Definition: transaction.cpp:19
void update_charging_state(const ChargingStateEnum charging_state)
Update the charging state of the transaction.
Definition: transaction.cpp:31
Definition: ocpp_types.hpp:933