From 0cf6be4cd144b01f91049891388c3cd063f43c9f Mon Sep 17 00:00:00 2001 From: kutayboz Date: Mon, 12 Jun 2023 23:34:37 +0300 Subject: Added stdout information --- src/bg96.c | 4 ++-- src/main.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/bg96.c b/src/bg96.c index 5defe35..1645c54 100644 --- a/src/bg96.c +++ b/src/bg96.c @@ -434,10 +434,10 @@ int mqttPubNetData(char *pathToPort, networkData nD) { msgID = rand() % 65536; cmdStrLen = strlen("AT+QMTPUB=0") + (int)ceil(log10(msgID)) + 1 + 1 + - strlen("kboz/feeds/textInfo") + (int)ceil(log10(msgSize)) + 8; + strlen("kboz/feeds/textinfo") + (int)ceil(log10(msgSize)) + 8; command = realloc(command, sizeof(char) * (cmdStrLen + 1)); snprintf(command, cmdStrLen + 1, "AT+QMTPUB=0,%d,1,0,\"%s\",%d", msgID, - "kboz/feeds/textInfo", msgSize); + "kboz/feeds/textinfo", msgSize); if (0 != querySerialPort(&response, serialPort, command, 15, (char *)-1)) { printf("Error querying publish command: %s\n", command); goto mqttPubError1; diff --git a/src/main.c b/src/main.c index caaf2f3..3dd2f56 100644 --- a/src/main.c +++ b/src/main.c @@ -73,6 +73,7 @@ int main(int argc, char **argv) { initNetworkData(nD); gatherData(nD, PATH_TO_SERIAL_PORT); + printf("Connecting to the MQTT broker\n"); if (0 != mqttConn(PATH_TO_SERIAL_PORT, "io.adafruit.com", 8883, "kboz", "aio_lvhz87FJ0rIlidH8g30V5mQ7FK7s")) { printf("Error connecting MQTT\n"); @@ -86,16 +87,19 @@ int main(int argc, char **argv) { return 1; } */ + printf("Publishing network information\n"); if (0 != mqttPubNetData(PATH_TO_SERIAL_PORT, *nD)) { printf("Error publishing to MQTT server\n"); return 1; } + printf("Disconnecting from the MQTT broker\n"); if (0 != mqttDisc(PATH_TO_SERIAL_PORT)) { printf("Could not disconnect MQTT\n"); return 1; } + printf("Done\n"); freeNetworkData(nD); free(nD); return 0; -- cgit v1.3