Skip to content

Commit e17af28

Browse files
author
LUCAS DREZET
committed
add logs when receive MQTT message
1 parent 930b6e1 commit e17af28

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/chargepoint/mqtt/MqttManager.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ void MqttManager::mqttMessageReceived(const char* topic, const std::string& mess
5858
(void)qos;
5959
(void)retained;
6060

61+
std::cout << "MQTT message received!" << std::endl;
62+
6163
// Decode message
6264
bool valid = false;
6365
rapidjson::Document payload;
@@ -75,6 +77,7 @@ void MqttManager::mqttMessageReceived(const char* topic, const std::string& mess
7577
}
7678
else
7779
{
80+
std::cout << "topic: " << topic << "\npayload: " << message << std::endl;
7881
// Split topic name
7982
std::filesystem::path topic_path(topic);
8083

@@ -185,10 +188,10 @@ void MqttManager::start(unsigned int nb_phases, unsigned int max_charge_point_cu
185188
std::cout << "Connecting to the broker (" << m_config.mqttConfig().brokerUrl() << ")..." << std::endl;
186189
if (m_mqtt->connect(m_config.mqttConfig().brokerUrl()))
187190
{
188-
std::cout << "Subscribing to charge point's command topic..." << std::endl;
191+
std::cout << "Subscribing to charge point's command topic: " << chargepoint_cmd_topic << std::endl;
189192
if (m_mqtt->subscribe(chargepoint_cmd_topic))
190193
{
191-
std::cout << "Subscribing to charge point's connector topics..." << std::endl;
194+
std::cout << "Subscribing to charge point's connector topics: " << chargepoint_car_topics << " and " << chargepoint_tag_topics << std::endl;
192195
if (m_mqtt->subscribe(chargepoint_car_topics) && m_mqtt->subscribe(chargepoint_tag_topics))
193196
{
194197
// Wait for disconnection or end of application

0 commit comments

Comments
 (0)