+void
+GrpcClient::WaitForConnected(int wait_time_ms, int tries_timeout)
+{
+ struct timespec ts;
+ grpc_connectivity_state state;
+ int try_ = 0;
+
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+ ts.tv_sec = 0;
+ ts.tv_nsec = 500 * 1000 * 1000; // 500ms
+
+ while (((state = m_channel->GetState(true)) != GRPC_CHANNEL_READY) &&
+ try_++ < tries_timeout) {
+ HMI_DEBUG("HomesScreen", "waiting for channel state to be ready, current state %d", state);
+ nanosleep(&ts, NULL);
+ }
+
+}
+