@@ -95,8 +95,7 @@ void Evse::open_transaction(const std::string& transaction_id, const int32_t con
95
95
this ->transaction_meter_value_req (this ->get_meter_value (), this ->transaction ->get_transaction (),
96
96
transaction->get_seq_no (), this ->transaction ->reservation_id );
97
97
},
98
- sampled_data_tx_updated_interval,
99
- date::utc_clock::to_sys (timestamp.to_time_point ()));
98
+ sampled_data_tx_updated_interval, date::utc_clock::to_sys (timestamp.to_time_point ()));
100
99
}
101
100
102
101
if (sampled_data_tx_ended_interval > 0s) {
@@ -105,8 +104,7 @@ void Evse::open_transaction(const std::string& transaction_id, const int32_t con
105
104
this ->database_handler ->transaction_metervalues_insert (this ->transaction ->transactionId .get (),
106
105
this ->get_meter_value ());
107
106
},
108
- sampled_data_tx_ended_interval,
109
- date::utc_clock::to_sys (timestamp.to_time_point ()));
107
+ sampled_data_tx_ended_interval, date::utc_clock::to_sys (timestamp.to_time_point ()));
110
108
}
111
109
112
110
if (aligned_data_tx_updated_interval > 0s) {
@@ -141,25 +139,23 @@ void Evse::open_transaction(const std::string& transaction_id, const int32_t con
141
139
142
140
if (aligned_data_tx_ended_interval > 0s) {
143
141
auto store_aligned_metervalue = [this , aligned_data_tx_ended_interval] {
144
- auto meter_value = this ->aligned_data_tx_end .retrieve_processed_values ();
142
+ auto meter_value = this ->aligned_data_tx_end .retrieve_processed_values ();
145
143
146
- // If empty fallback on last updated metervalue
147
- if (meter_value.sampledValue .empty ()) {
148
- meter_value = get_meter_value ();
149
- }
144
+ // If empty fallback on last updated metervalue
145
+ if (meter_value.sampledValue .empty ()) {
146
+ meter_value = get_meter_value ();
147
+ }
150
148
151
- for (auto & item : meter_value.sampledValue ) {
152
- item.context = ReadingContextEnum::Sample_Clock;
153
- }
154
- if (this ->device_model
155
- .get_optional_value <bool >(ControllerComponentVariables::RoundClockAlignedTimestamps)
156
- .value_or (false )) {
157
- meter_value.timestamp = utils::align_timestamp (DateTime{}, aligned_data_tx_ended_interval);
158
- }
159
- this ->database_handler ->transaction_metervalues_insert (this ->transaction ->transactionId .get (),
160
- meter_value);
161
- this ->aligned_data_tx_end .clear_values ();
162
- };
149
+ for (auto & item : meter_value.sampledValue ) {
150
+ item.context = ReadingContextEnum::Sample_Clock;
151
+ }
152
+ if (this ->device_model .get_optional_value <bool >(ControllerComponentVariables::RoundClockAlignedTimestamps)
153
+ .value_or (false )) {
154
+ meter_value.timestamp = utils::align_timestamp (DateTime{}, aligned_data_tx_ended_interval);
155
+ }
156
+ this ->database_handler ->transaction_metervalues_insert (this ->transaction ->transactionId .get (), meter_value);
157
+ this ->aligned_data_tx_end .clear_values ();
158
+ };
163
159
164
160
auto next_interval = transaction->aligned_tx_ended_meter_values_timer .interval_starting_from (
165
161
store_aligned_metervalue, aligned_data_tx_ended_interval,
0 commit comments