6 #define ADDRESS "tcp://localhost:1883" 7 #define CLIENTID "ExampleClientSub" 8 #define TOPIC "MQTT Examples" 9 #define PAYLOAD "Hello World!" 11 #define TIMEOUT 10000L 17 printf(
"Message with token value %d delivery confirmed\n", dt);
25 printf(
"Message arrived\n");
26 printf(
" topic: %s\n", topicName);
31 putchar(*payloadptr++);
41 printf(
"\nConnection lost\n");
42 printf(
" cause: %s\n", cause);
45 int main(
int argc,
char *argv[])
47 printf(
"\nCreating MQTTClient\n");
56 printf(
"\nExiting\n");
void delivered(void *context, MQTTClient_deliveryToken dt)
int msgarrvd(void *context, char *topicName, int topicLen, MQTTClient_message *message)
MQTTAsync_connectOptions conn_opts
int MQTTClient_setCallbacks(MQTTClient handle, void *context, MQTTClient_connectionLost *cl, MQTTClient_messageArrived *ma, MQTTClient_deliveryComplete *dc)
volatile MQTTClient_deliveryToken deliveredtoken
void MQTTClient_freeMessage(MQTTClient_message **message)
void MQTTClient_destroy(MQTTClient *handle)
void connlost(void *context, char *cause)
void MQTTClient_free(void *memory)
#define MQTTCLIENT_PERSISTENCE_NONE
#define MQTTClient_connectOptions_initializer
int MQTTClient_deliveryToken
int main(int argc, char *argv[])
int MQTTClient_create(MQTTClient *handle, const char *serverURI, const char *clientId, int persistence_type, void *persistence_context)