Skip to content

Commit ee550d3

Browse files
committed
[enum] Add TxStartStopPointType and helper for string conversion
Signed-off-by: Thomas BRUNEL <thomas.brunel@madic.com>
1 parent fa1f7fd commit ee550d3

File tree

3 files changed

+134
-2
lines changed

3 files changed

+134
-2
lines changed

src/ocpp20/chargepoint/ChargePoint20.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -899,12 +899,16 @@ class ChargePoint20
899899
if (m_msg_sender && !m_stop_in_progress)
900900
{
901901
ocpp::messages::CallResult res = m_msg_sender->call(action, request, response, error, message);
902-
if (res != ocpp::messages::CallResult::Ok)
902+
if (res == ocpp::messages::CallResult::Delayed)
903+
{
904+
LOG_INFO << "[" << identifier << "] - " << action << " => Delayed";
905+
}
906+
else if (res != ocpp::messages::CallResult::Ok)
903907
{
904908
LOG_ERROR << "[" << identifier << "] - " << action << " => "
905909
<< (res == ocpp::messages::CallResult::Failed ? "Timeout" : "Error");
906910
}
907-
else
911+
if (res != ocpp::messages::CallResult::Failed && res != ocpp::messages::CallResult::Delayed)
908912
{
909913
ret = true;
910914
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
Copyright (c) 2020 Cedric Jimenez
3+
This file is part of OpenOCPP.
4+
5+
OpenOCPP is free software: you can redistribute it and/or modify
6+
it under the terms of the GNU Lesser General Public License as published by
7+
the Free Software Foundation, either version 2.1 of the License, or
8+
(at your option) any later version.
9+
10+
OpenOCPP is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public License
16+
along with OpenOCPP. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
19+
#include "TxStartStopPointType20.h"
20+
21+
namespace ocpp
22+
{
23+
namespace types
24+
{
25+
namespace ocpp20
26+
{
27+
28+
/** @brief Helper to convert a TxStartStopPointType enum to string */
29+
const EnumToStringFromString<TxStartStopPointType> TxStartStopPointTypeHelper = {
30+
{TxStartStopPointType::ParkingBayOccupancy, "ParkingBayOccupancy"},
31+
{TxStartStopPointType::EVConnected, "EVConnected"},
32+
{TxStartStopPointType::Authorized, "Authorized"},
33+
{TxStartStopPointType::PowerPathClosed, "PowerPathClosed"},
34+
{TxStartStopPointType::EnergyTransfer, "EnergyTransfer"},
35+
{TxStartStopPointType::DataSigned, "DataSigned"},
36+
};
37+
38+
} // namespace ocpp20
39+
} // namespace types
40+
} // namespace ocpp
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
/*
2+
Copyright (c) 2020 Cedric Jimenez
3+
This file is part of OpenOCPP.
4+
5+
OpenOCPP is free software: you can redistribute it and/or modify
6+
it under the terms of the GNU Lesser General Public License as published by
7+
the Free Software Foundation, either version 2.1 of the License, or
8+
(at your option) any later version.
9+
10+
OpenOCPP is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public License
16+
along with OpenOCPP. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
19+
#ifndef OPENOCPP_OCPP20_TXSTARTSTOPTYPE_H
20+
#define OPENOCPP_OCPP20_TXSTARTSTOPTYPE_H
21+
22+
#include "EnumToStringFromString.h"
23+
24+
namespace ocpp
25+
{
26+
namespace types
27+
{
28+
namespace ocpp20
29+
{
30+
31+
/** @brief Points used to marks the start of a transaction */
32+
enum class TxStartStopPointType
33+
{
34+
/** @brief An object (probably an EV) is detected in the parking/charging bay. */
35+
ParkingBayOccupancy,
36+
/**
37+
* @brief Both ends of the Charging Cable have been connected
38+
* (if this can be detected, else detection of a cable being plugged into
39+
* the socket), or for wireless charging:
40+
* initial communication between EVSE and EV is established.
41+
*/
42+
EVConnected,
43+
/**
44+
* @brief Driver or EV has been authorized, this can also be some form of
45+
* anonymous authorization like a start button.
46+
*/
47+
Authorized,
48+
/**
49+
* @brief All preconditions for charging have been met, power can flow. This
50+
* event is the logical AND of EVConnected and Authorized and
51+
* should be used if a transaction is supposed to start when EV is
52+
* connected and authorized. Despite its name, this event is not
53+
* related to the state of the power relay.
54+
*
55+
* @note There may be situations where PowerPathClosed does not
56+
* imply that charging starts at that moment, e.g. because of delayed
57+
* charging or a battery that is too hot.
58+
*/
59+
PowerPathClosed,
60+
/**
61+
* @brief Energy is being transferred between EV and EVSE.
62+
* @note Energy is not being transferred between EV and EVSE.
63+
* This is not recommended to use as a TxStopPoint, because it
64+
* will stop the transaction as soon as EV or EVSE (temporarily)
65+
* suspend the charging.
66+
*/
67+
EnergyTransfer,
68+
/**
69+
* @brief The moment when the signed meter value is received from the
70+
* fiscal meter, that is used in the TransactionEventRequest with
71+
* context = Transaction.Begin and triggerReason = SignedDataReceived.
72+
* This TxStartPoint might be applicable when legislation exists that only
73+
* allows a billable transaction to start when the first signed meter value
74+
* has been received.
75+
* @note This condition has no meaning as a TxStopPoint and should not
76+
* be used as such.
77+
*/
78+
DataSigned
79+
};
80+
81+
/** @brief Helper to convert a TxStartPointType enum to string */
82+
extern const EnumToStringFromString<TxStartStopPointType> TxStartStopPointTypeHelper;
83+
84+
} // namespace ocpp20
85+
} // namespace types
86+
} // namespace ocpp
87+
88+
#endif // OPENOCPP_OCPP20_TXSTARTSTOPTYPE_H

0 commit comments

Comments
 (0)