+void WindowManager::sendHandshake()
+{
+ struct timespec ts;
+
+ HMI_DEBUG("Check End Init");
+
+ if (this->subscribed && this->wmcon.getEndInit())
+ {
+ HMI_DEBUG("End Inited");
+ api_handshake();
+ }
+ else
+ {
+ HMI_DEBUG("Not End Init");
+ if (clock_gettime(CLOCK_BOOTTIME, &ts) != 0)
+ {
+ HMI_ERROR("Could't set time (clock_gettime() returns with error");
+ return;
+ }
+
+ uint64_t sleep = this->wmcon.getSleepTime();
+ uint64_t usec = (ts.tv_sec * 1000000000ULL) + ts.tv_nsec + (sleep * 1000000);
+
+ if (usec > 0)
+ {
+ usec /= 1000;
+ }
+
+ if (g_timer_endInit_src == nullptr)
+ {
+ int ret = sd_event_add_time(afb_daemon_get_event_loop(), &g_timer_endInit_src,
+ CLOCK_BOOTTIME, usec, 1, endInitTimerHandler, this);
+ }
+ else
+ {
+ sd_event_source_set_time(g_timer_endInit_src, usec);
+ sd_event_source_set_enabled(g_timer_endInit_src, SD_EVENT_ONESHOT);
+ }
+ }
+}
+
+void WindowManager::setSubscribed(bool flg)
+{
+ usleep(this->wmcon.getSleepTime() * 1000);
+
+ this->subscribed = flg;
+}
+