2023-01-02 12:42:57 +01:00
|
|
|
#include <cstdlib>
|
2023-12-23 13:59:58 +01:00
|
|
|
#include <mosquitto/libmosquittopp.h>
|
2022-11-30 19:52:38 +01:00
|
|
|
|
|
|
|
|
#define QOS 2
|
|
|
|
|
|
2025-09-17 12:19:46 +02:00
|
|
|
|
2022-11-30 19:52:38 +01:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
|
{
|
|
|
|
|
int port;
|
|
|
|
|
struct mosquitto_message *messages;
|
|
|
|
|
|
|
|
|
|
if(argc < 2){
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
port = atoi(argv[1]);
|
|
|
|
|
|
2023-01-02 12:42:57 +01:00
|
|
|
mosqpp::lib_init();
|
2022-11-30 19:52:38 +01:00
|
|
|
|
2023-01-02 12:42:57 +01:00
|
|
|
mosqpp::subscribe_simple(&messages, 1,
|
2022-11-30 19:52:38 +01:00
|
|
|
true, "qos2/test", QOS, "localhost", port,
|
|
|
|
|
"subscribe-qos2-test", 60, true, NULL, NULL, NULL, NULL);
|
|
|
|
|
|
2023-01-02 12:42:57 +01:00
|
|
|
/* FIXME - this should be in the wrapper */
|
2022-11-30 19:52:38 +01:00
|
|
|
mosquitto_message_free(&messages);
|
|
|
|
|
|
2023-01-02 12:42:57 +01:00
|
|
|
mosqpp::lib_cleanup();
|
2022-11-30 19:52:38 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|