ocpp 0.24.1
A C++ implementation of the Open Charge Point Protocol
Public Member Functions | List of all members
ocpp::v16::TransactionHandler Class Reference

Contains transactions for all available connectors and manages access to these transactions. More...

#include <transaction.hpp>

Public Member Functions

 TransactionHandler (int32_t number_of_connectors)
 Creates and manages transactions for the provided number_of_connectors.
 
int32_t get_negative_random_transaction_id ()
 Returns a negative random transaction_id.
 
void add_transaction (std::shared_ptr< Transaction > transaction)
 Adds the given transaction the vector of transactions.
 
void add_stopped_transaction (int32_t connector)
 Adds the transaction at the connector to the vector of stopped transactions.
 
bool remove_active_transaction (int32_t connector)
 Removes a transaction from the provided connector. More...
 
void erase_stopped_transaction (std::string stop_transaction_message_id)
 Erases a transaction with the provided stop_transaction_message_id.
 
std::shared_ptr< Transactionget_transaction (int32_t connector)
 Returns the transaction associated with the transaction at the provided connector. More...
 
std::shared_ptr< Transactionget_transaction (const std::string &start_transaction_message_id)
 Returns the transaction associated with the transaction with the provided start_transaction_message_id. More...
 
std::shared_ptr< Transactionget_transaction_from_id_tag (const std::string &id_tag)
 Returns the transaction associated with the given id tag. More...
 
int32_t get_connector_from_transaction_id (int32_t transaction_id)
 Provides the connector on which a transaction with the given transaction_id is running. More...
 
void add_meter_value (int32_t connector, const MeterValue &meter_value)
 Adds a clock aligned meter_value to the transaction on the provided connector.
 
void change_meter_values_sample_intervals (int32_t interval)
 Modifies the sample interval of the meter values sample timer on all connectors. The provided interval is expected to be given in seconds.
 
std::optional< CiString< 20 > > get_authorized_id_tag (const std::string &stop_transaction_message_id)
 
bool transaction_active (int32_t connector)
 Indicates if there is an active transaction at the proveded connector. More...
 

Detailed Description

Contains transactions for all available connectors and manages access to these transactions.

Member Function Documentation

◆ get_authorized_id_tag()

std::optional< CiString< 20 > > ocpp::v16::TransactionHandler::get_authorized_id_tag ( const std::string &  stop_transaction_message_id)

stop_transaction_message_id

Returns
the IdTag if it is available, std::nullopt otherwise

◆ get_connector_from_transaction_id()

int32_t ocpp::v16::TransactionHandler::get_connector_from_transaction_id ( int32_t  transaction_id)

Provides the connector on which a transaction with the given transaction_id is running.

Returns
The connector or -1 if the transaction_id is unknown

◆ get_transaction() [1/2]

std::shared_ptr< Transaction > ocpp::v16::TransactionHandler::get_transaction ( const std::string &  start_transaction_message_id)

Returns the transaction associated with the transaction with the provided start_transaction_message_id.

Returns
The associated transaction if available or nullptr if not

◆ get_transaction() [2/2]

std::shared_ptr< Transaction > ocpp::v16::TransactionHandler::get_transaction ( int32_t  connector)

Returns the transaction associated with the transaction at the provided connector.

Returns
The associated transaction if available or nullptr if not

◆ get_transaction_from_id_tag()

std::shared_ptr< Transaction > ocpp::v16::TransactionHandler::get_transaction_from_id_tag ( const std::string &  id_tag)

Returns the transaction associated with the given id tag.

Parameters
id_tagThe id tag.
Returns
The associated transaction if available.

◆ remove_active_transaction()

bool ocpp::v16::TransactionHandler::remove_active_transaction ( int32_t  connector)

Removes a transaction from the provided connector.

Returns
true if successful

◆ transaction_active()

bool ocpp::v16::TransactionHandler::transaction_active ( int32_t  connector)

Indicates if there is an active transaction at the proveded connector.

Returns
true if a transaction exists

The documentation for this class was generated from the following files: