This commit is contained in:
Wolfgang Hottgenroth 2020-11-10 16:06:23 +01:00
parent 662a440179
commit 00cedd5e6a
2 changed files with 12 additions and 11 deletions

View File

@ -214,7 +214,7 @@ void SYSTICK_Callback() {
schUpdate(); schUpdate();
// MQTT Interface // MQTT Interface
MilliTimer_Handler() MilliTimer_Handler();
} }
void HAL_GPIO_EXTI_Callback(uint16_t pin) { void HAL_GPIO_EXTI_Callback(uint16_t pin) {

View File

@ -4,6 +4,7 @@
#include <wizHelper.h> #include <wizHelper.h>
#include <stdint.h> #include <stdint.h>
#include <string.h>
#include <mqtt_interface.h> #include <mqtt_interface.h>
#include <MQTTClient.h> #include <MQTTClient.h>
@ -31,10 +32,10 @@ struct opts_struct
enum QoS qos; enum QoS qos;
char* username; char* username;
char* password; char* password;
char* host; uint8_t *host;
int port; uint16_t port;
int showtopics; int showtopics;
} opts ={ (char*)"stdout-subscriber", 0, (char*)"\n", QOS0, NULL, NULL, targetIP, targetPort, 0 }; } opts ={ (char*)"stdout-subscriber", 0, (char*)"\n", QOS0, NULL, NULL, NULL, 0, 0 };
MQTTPacket_connectData data = MQTTPacket_connectData_initializer; MQTTPacket_connectData data = MQTTPacket_connectData_initializer;
@ -86,14 +87,14 @@ void mqttCommInit(void *handle) {
data.cleansession = 1; data.cleansession = 1;
int rc = MQTTConnect(&mqttClient, &data); int rc = MQTTConnect(&mqttClient, &data);
printf("Connected %d\r\n", rc); logMsg("Connected %d\r\n", rc);
opts.showtopics = 1; // opts.showtopics = 1;
printf("Subscribing to %s\r\n", "hello/wiznet"); // logMsg("Subscribing to %s\r\n", "hello/wiznet");
rc = MQTTSubscribe(&mqttClient, "hello/wiznet", opts.qos, messageArrived); // rc = MQTTSubscribe(&mqttClient, "hello/wiznet", opts.qos, messageArrived);
printf("Subscribed %d\r\n", rc); // logMsg("Subscribed %d\r\n", rc);
schAdd(mqttHandler, NULL, 0, 10); // schAdd(mqttHandler, NULL, 0, 10);
} }
} }