static_cast<void *>(this), protocol);
// Wait a few seconds until the AITT client gets a server list (discover devices)
- DBG("Sleep %d secs", SLEEP_MS);
- sleep(SLEEP_MS);
+ DBG("Sleep %d ms", SLEEP_MS);
+ usleep(SLEEP_MS * 1000);
aitt.Publish("test/value1", dump_msg, 12, protocol);
aitt.Publish("test/value2", dump_msg, 1600, protocol);
static_cast<void *>(this), AITT_TYPE_TCP);
// Wait a few seconds until the AITT client gets a server list (discover devices)
- DBG("Sleep %d secs", SLEEP_MS);
- sleep(SLEEP_MS);
+ DBG("Sleep %d ms", SLEEP_MS);
+ usleep(SLEEP_MS * 1000);
aitt.Publish("test/step1/value1", dump_msg, 12, AITT_TYPE_TCP);
aitt.Publish("test/step2/value1", dump_msg, 1600, AITT_TYPE_TCP);
static_cast<void *>(this), protocol);
// Wait a few seconds until the AITT client gets a server list (discover devices)
- DBG("Sleep %d secs", SLEEP_MS);
- sleep(SLEEP_MS);
+ DBG("Sleep %d ms", SLEEP_MS);
+ usleep(SLEEP_MS * 1000);
DBG("Publish(%s) : %s(%zu)", testTopic.c_str(), test_msg, strlen(test_msg));
aitt.Publish(testTopic, test_msg, strlen(test_msg), protocol);
aitt1.Connect();
// Wait a few seconds to the AITT client gets server list (discover devices)
- sleep(SLEEP_MS);
+ usleep(SLEEP_MS * 1000);
for (int i = 0; i < 10; i++) {
INFO("size = %zu", sizeof(dump_msg));
static_cast<void *>(this), protocol);
// Wait a few seconds to the AITT client gets server list (discover devices)
- sleep(SLEEP_MS);
+ usleep(SLEEP_MS * 1000);
// NOTE:
// Select target peers and send the data through the specified protocol - TCP
static_cast<void *>(this), protocol);
// Wait a few seconds to the AITT client gets server list (discover devices)
- sleep(SLEEP_MS);
+ usleep(SLEEP_MS * 1000);
// NOTE:
// Publish a message with the retained flag
static_cast<void *>(this), AITT_TYPE_MQTT);
// Wait a few seconds to the AITT client gets server list (discover devices)
- DBG("Sleep %d secs", SLEEP_MS);
- sleep(SLEEP_MS);
+ DBG("Sleep %d ms", SLEEP_MS);
+ usleep(SLEEP_MS * 1000);
DBG("Publish message to %s (%s) / %zu", testTopic.c_str(), TEST_MSG, sizeof(TEST_MSG));
aitt.Publish(testTopic, TEST_MSG, sizeof(TEST_MSG),
#define TEST_MSG "This is aitt test message"
#define TEST_MSG2 "This message is going to be delivered through a specified AittProtocol"
-#define SLEEP_MS 1
+#define SLEEP_MS 100
class AittTests {
public:
g_timeout_add(10, AittTests::ReadyCheck, static_cast<AittTests *>(this));
IterateEventLoop();
+ aitt.Disconnect();
EXPECT_TRUE(sub_ok);
EXPECT_TRUE(reply_ok[0]);
EXPECT_TRUE(reply_ok[1]);
AITT aitt(clientId, LOCAL_IP, AittOption(true, false));
aitt.Connect();
+ usleep(SLEEP_MS * 1000);
using namespace std::placeholders;
auto replyCB = std::bind(&AITTRRTest::PublishSyncInCallback, GetHandle(), &aitt, &reply1_ok,
g_timeout_add(10, AittTests::ReadyCheck, static_cast<AittTests *>(this));
IterateEventLoop();
+ aitt.Disconnect();
+ sub_aitt.Disconnect();
EXPECT_TRUE(sub_ok);
EXPECT_TRUE(reply1_ok);
EXPECT_TRUE(reply2_ok);
reply_ok = true;
invalid++;
},
- nullptr, correlation, 500);
+ nullptr, correlation, 100);
EXPECT_TRUE(sub_ok == reply_ok);
EXPECT_EQ(ret, AITT_ERROR_TIMED_OUT);