diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/AglShellGrpcClient.cpp | 4 | ||||
-rw-r--r-- | app/main.cpp | 24 |
2 files changed, 7 insertions, 21 deletions
diff --git a/app/AglShellGrpcClient.cpp b/app/AglShellGrpcClient.cpp index 8577f16..3c7471b 100644 --- a/app/AglShellGrpcClient.cpp +++ b/app/AglShellGrpcClient.cpp @@ -41,11 +41,11 @@ GrpcClient::WaitForConnected(int wait_time_ms, int tries_timeout) clock_gettime(CLOCK_MONOTONIC, &ts); ts.tv_sec = 0; - ts.tv_nsec = 500 * 1000 * 1000; // 500ms + ts.tv_nsec = wait_time_ms * 1000 * 1000; while (((state = m_channel->GetState(true)) != GRPC_CHANNEL_READY) && try_++ < tries_timeout) { - fprintf(stderr, "waiting for channel state to be ready, current state %d", state); + fprintf(stderr, "waiting for channel state to be ready, current state %d\n", state); nanosleep(&ts, NULL); } diff --git a/app/main.cpp b/app/main.cpp index 41773f0..d5f756a 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -15,34 +15,19 @@ #include "qcheapruler.hpp" #include "file_operation.h" +#include <cstdlib> #include "AglShellGrpcClient.h" std::string read_config_and_get_output(void) { - GKeyFile *conf_file; - gchar *value; - GError *err = NULL; + char *ret; - bool ret; - int n; - unsigned width, height, x, y; - - // Load settings from configuration file if it exists - conf_file = g_key_file_new(); - - ret = g_key_file_load_from_dirs(conf_file, "AGL.conf", - (const gchar**) g_get_system_config_dirs(), - NULL, G_KEY_FILE_KEEP_COMMENTS, NULL); + ret = getenv("OUTPUT_NAME"); if (!ret) return std::string(""); - value = g_key_file_get_string(conf_file, "tbtnavi", "output", &err); - if (!value) { - return std::string(""); - } - - return std::string(value); + return std::string(ret); } int main(int argc, char *argv[]) @@ -63,6 +48,7 @@ int main(int argc, char *argv[]) std::string output = read_config_and_get_output(); GrpcClient *client = new GrpcClient(); + client->WaitForConnected(500, 10); if (!output.empty()) client->SetAppOnOutput(our_name, output); else |