36 lines
860 B
C
36 lines
860 B
C
#include <mqttTest.h>
|
|
#include <logger.h>
|
|
|
|
#include <pubsubc.h>
|
|
#include <platformAdaption.h>
|
|
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
extern const uint8_t MQTT_SOCK;
|
|
|
|
client_t client;
|
|
mqttClient_t mqttClient;
|
|
|
|
|
|
// typedef void (*callback_t)(char*, uint8_t*, uint16_t);
|
|
static void mqttCallback(char *topic, uint8_t *payload, uint16_t payloadLength) {
|
|
logMsg("mcb");
|
|
}
|
|
|
|
void mqttTestInit() {
|
|
logMsg("mti: initializing mqtt client");
|
|
client.sockNum = MQTT_SOCK;
|
|
mqttClientInit(&mqttClient, &client, mqttCallback);
|
|
logMsg("mti: mqtt client initialized");
|
|
|
|
logMsg("mti: connecting to broker");
|
|
uint8_t brokerAddress[] = { 172, 16, 2, 16 };
|
|
bool res = mqttConnect(&mqttClient, brokerAddress, 1883, "mbv3gw-client", NULL, NULL, NULL, 0, false, NULL, false);
|
|
logMsg("mti: mqttConnect returns %d", res);
|
|
}
|
|
|