22 #define ADDRESS "tcp://mqtt.eclipse.org:1883" 23 #define CLIENTID "ExampleClientPub" 24 #define TOPIC "MQTT Examples" 25 #define PAYLOAD "Hello World!" 27 #define TIMEOUT 10000L 29 int main(
int argc,
char* argv[])
40 printf(
"Failed to create client, return code %d\n", rc);
48 printf(
"Failed to connect, return code %d\n", rc);
58 printf(
"Failed to publish message, return code %d\n", rc);
62 printf(
"Waiting for up to %d seconds for publication of %s\n" 63 "on topic %s for client with ClientID: %s\n",
66 printf(
"Message with delivery token %d delivered\n", token);
69 printf(
"Failed to disconnect, return code %d\n", rc);
int main(int argc, char *argv[])
int MQTTClient_waitForCompletion(MQTTClient handle, MQTTClient_deliveryToken mdt, unsigned long timeout)
#define MQTTCLIENT_SUCCESS
int MQTTClient_connect(MQTTClient handle, MQTTClient_connectOptions *options)
int MQTTClient_disconnect(MQTTClient handle, int timeout)
#define MQTTClient_message_initializer
MQTTAsync_connectOptions conn_opts
int MQTTClient_publishMessage(MQTTClient handle, const char *topicName, MQTTClient_message *message, MQTTClient_deliveryToken *deliveryToken)
void MQTTClient_destroy(MQTTClient *handle)
#define MQTTCLIENT_PERSISTENCE_NONE
#define MQTTClient_connectOptions_initializer
int MQTTClient_deliveryToken
int MQTTClient_create(MQTTClient *handle, const char *serverURI, const char *clientId, int persistence_type, void *persistence_context)