Skip to content

Commit

Permalink
Add packet_id to the publish log message in examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
dgarske committed Nov 27, 2023
1 parent 0336347 commit 8a0cafe
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 28 deletions.
9 changes: 5 additions & 4 deletions examples/aws/awsiot.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,8 +617,9 @@ int awsiot_test(MQTTCtx *mqttCtx)
if (rc == MQTT_CODE_CONTINUE) {
return rc;
}
PRINTF("MQTT Publish: Topic %s, %s (%d)",
mqttCtx->publish.topic_name, MqttClient_ReturnCodeToString(rc), rc);
PRINTF("MQTT Publish: Topic %s, ID %d, %s (%d)",
mqttCtx->publish.topic_name, mqttCtx->publish.packet_id,
MqttClient_ReturnCodeToString(rc), rc);
if (rc != MQTT_CODE_SUCCESS) {
goto disconn;
}
Expand Down Expand Up @@ -676,8 +677,8 @@ int awsiot_test(MQTTCtx *mqttCtx)
mqttCtx->publish.buffer = (byte*)mqttCtx->app_ctx;
mqttCtx->publish.total_len = (word32)XSTRLEN((char*)mqttCtx->app_ctx);
rc = MqttClient_Publish(&mqttCtx->client, &mqttCtx->publish);
PRINTF("MQTT Publish: Topic %s, %s (%d)",
mqttCtx->publish.topic_name,
PRINTF("MQTT Publish: Topic %s, ID %d, %s (%d)",
mqttCtx->publish.topic_name, mqttCtx->publish.packet_id,
MqttClient_ReturnCodeToString(rc), rc);
}
}
Expand Down
9 changes: 5 additions & 4 deletions examples/azure/azureiothub.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,9 @@ int azureiothub_test(MQTTCtx *mqttCtx)
if (rc == MQTT_CODE_CONTINUE) {
return rc;
}
PRINTF("MQTT Publish: Topic %s, %s (%d)",
mqttCtx->publish.topic_name, MqttClient_ReturnCodeToString(rc), rc);
PRINTF("MQTT Publish: Topic %s, ID %d, %s (%d)",
mqttCtx->publish.topic_name, mqttCtx->publish.packet_id,
MqttClient_ReturnCodeToString(rc), rc);
if (rc != MQTT_CODE_SUCCESS) {
goto disconn;
}
Expand Down Expand Up @@ -496,8 +497,8 @@ int azureiothub_test(MQTTCtx *mqttCtx)
mqttCtx->publish.total_len = (word16)rc;

rc = MqttClient_Publish(&mqttCtx->client, &mqttCtx->publish);
PRINTF("MQTT Publish: Topic %s, %s (%d)",
mqttCtx->publish.topic_name,
PRINTF("MQTT Publish: Topic %s, ID %d, %s (%d)",
mqttCtx->publish.topic_name, mqttCtx->publish.packet_id,
MqttClient_ReturnCodeToString(rc), rc);
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/firmware/fwpush.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,8 @@ int fwpush_test(MQTTCtx *mqttCtx)
return rc;
}

PRINTF("MQTT Publish: Topic %s, %s (%d)",
mqttCtx->publish.topic_name,
PRINTF("MQTT Publish: Topic %s, ID %d, %s (%d)",
mqttCtx->publish.topic_name, mqttCtx->publish.packet_id,
MqttClient_ReturnCodeToString(rc), rc);
if (rc != MQTT_CODE_SUCCESS) {
goto disconn;
Expand Down
8 changes: 4 additions & 4 deletions examples/mqttclient/mqttclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,8 @@ int mqttclient_test(MQTTCtx *mqttCtx)
mqttCtx->pub_file = NULL; /* don't try and send file again */
}

PRINTF("MQTT Publish: Topic %s, %s (%d)",
mqttCtx->publish.topic_name,
PRINTF("MQTT Publish: Topic %s, ID %d, %s (%d)",
mqttCtx->publish.topic_name, mqttCtx->publish.packet_id,
MqttClient_ReturnCodeToString(rc), rc);
#ifdef WOLFMQTT_V5
if (mqttCtx->qos > 0) {
Expand Down Expand Up @@ -576,8 +576,8 @@ int mqttclient_test(MQTTCtx *mqttCtx)
mqttCtx->publish.total_len = (word16)rc;
rc = MqttClient_Publish(&mqttCtx->client,
&mqttCtx->publish);
PRINTF("MQTT Publish: Topic %s, %s (%d)",
mqttCtx->publish.topic_name,
PRINTF("MQTT Publish: Topic %s, ID %d, %s (%d)",
mqttCtx->publish.topic_name, mqttCtx->publish.packet_id,
MqttClient_ReturnCodeToString(rc), rc);
}
}
Expand Down
5 changes: 3 additions & 2 deletions examples/mqttsimple/mqttsimple.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,9 @@ int mqttsimple_test(void)
if (rc != MQTT_CODE_SUCCESS) {
goto exit;
}
PRINTF("MQTT Publish: Topic %s, Qos %d, Message %s",
mqttObj.publish.topic_name, mqttObj.publish.qos, mqttObj.publish.buffer);
PRINTF("MQTT Publish: Topic %s, ID %d, Qos %d, Message %s",
mqttObj.publish.topic_name, mqttObj.publish.packet_id,
mqttObj.publish.qos, mqttObj.publish.buffer);

/* Wait for messages */
while (1) {
Expand Down
8 changes: 4 additions & 4 deletions examples/multithread/multithread.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,8 @@ static void *waitMessage_task(void *param)
MqttClient_CancelMessage(&mqttCtx->client,
(MqttObject*)&mqttCtx->publish);
}
PRINTF("MQTT Publish: Topic %s, %s (%d)",
mqttCtx->publish.topic_name,
PRINTF("MQTT Publish: Topic %s, ID %d, %s (%d)",
mqttCtx->publish.topic_name, mqttCtx->publish.packet_id,
MqttClient_ReturnCodeToString(rc), rc);
}
}
Expand Down Expand Up @@ -637,8 +637,8 @@ static void *publish_task(void *param)
MqttClient_CancelMessage(&mqttCtx->client, (MqttObject*)&publish[i]);
}

PRINTF("MQTT Publish: Topic %s, %s (%d)",
publish[i].topic_name,
PRINTF("MQTT Publish: Topic %s, ID %d, %s (%d)",
publish[i].topic_name, publish[i].packet_id,
MqttClient_ReturnCodeToString(rc[i]), rc[i]);

wm_SemLock(&mtLock);
Expand Down
4 changes: 2 additions & 2 deletions examples/nbclient/nbclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,8 @@ int mqttclient_test(MQTTCtx *mqttCtx)
mqttCtx->pub_file = NULL; /* don't try and send file again */
}

PRINTF("MQTT Publish: Topic %s, %s (%d)",
mqttCtx->publish.topic_name,
PRINTF("MQTT Publish: Topic %s, ID %d, %s (%d)",
mqttCtx->publish.topic_name, mqttCtx->publish.packet_id,
MqttClient_ReturnCodeToString(rc), rc);
if (rc != MQTT_CODE_SUCCESS) {
goto disconn;
Expand Down
4 changes: 2 additions & 2 deletions examples/pub-sub/mqtt-pub.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@ int pub_client(MQTTCtx *mqttCtx)
mqttCtx->pub_file = NULL; /* don't try and send file again */
}
if (mqttCtx->debug_on) {
PRINTF("MQTT Publish: Topic %s, %s (%d)",
mqttCtx->publish.topic_name,
PRINTF("MQTT Publish: Topic %s, ID %d, %s (%d)",
mqttCtx->publish.topic_name, mqttCtx->publish.packet_id,
MqttClient_ReturnCodeToString(rc), rc);
}
if (rc != MQTT_CODE_SUCCESS) {
Expand Down
9 changes: 5 additions & 4 deletions examples/wiot/wiot.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,9 @@ int wiot_test(MQTTCtx *mqttCtx)

rc = MqttClient_Publish(&mqttCtx->client, &mqttCtx->publish);

PRINTF("MQTT Publish: Topic %s, %s (%d)",
mqttCtx->publish.topic_name, MqttClient_ReturnCodeToString(rc), rc);
PRINTF("MQTT Publish: Topic %s, ID %d, %s (%d)",
mqttCtx->publish.topic_name, mqttCtx->publish.packet_id,
MqttClient_ReturnCodeToString(rc), rc);
if (rc != MQTT_CODE_SUCCESS) {
goto disconn;
}
Expand Down Expand Up @@ -316,8 +317,8 @@ int wiot_test(MQTTCtx *mqttCtx)
mqttCtx->publish.buffer = mqttCtx->rx_buf;
mqttCtx->publish.total_len = (word16)rc;
rc = MqttClient_Publish(&mqttCtx->client, &mqttCtx->publish);
PRINTF("MQTT Publish: Topic %s, %s (%d)",
mqttCtx->publish.topic_name,
PRINTF("MQTT Publish: Topic %s, ID %d, %s (%d)",
mqttCtx->publish.topic_name, mqttCtx->publish.packet_id,
MqttClient_ReturnCodeToString(rc), rc);
}
}
Expand Down

0 comments on commit 8a0cafe

Please sign in to comment.