Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Serial.print reason #8

Answered by khoih-prog
pprakash asked this question in Q&A
Aug 18, 2022 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

You are doing great. Just missing some ; and you just have to use uint8_t cast from AsyncMqttClientDisconnectReason reason, such as

String dbgMqttDiscReason;

void onMqttDisconnect(AsyncMqttClientDisconnectReason reason)
{ 
  switch ((uint8_t) reason)
  {
    case 0:   //TCP_DISCONNECTED:
      AMQTT_LOGDEBUG(F("TCP_DISCONNECTED"));
      dbgMqttDiscReason = "TCP_DISCONNECTED";
      break;

    case 1:   //MQTT_UNACCEPTABLE_PROTOCOL_VERSION:
      AMQTT_LOGDEBUG(F("MQTT_UNACCEPTABLE_PROTOCOL_VERSION"));
      dbgMqttDiscReason = "MQTT_UNACCEPTABLE_PROTOCOL_VERSION";
      break;

    case 2:   //MQTT_IDENTIFIER_REJECTED:
      AMQTT_LOGDEBUG(F("MQTT_IDENTIFIER_REJECTED"));
      dbgMqttD…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@pprakash
Comment options

Comment options

You must be logged in to vote
1 reply
@pprakash
Comment options

Answer selected by pprakash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants