e_test_event: Added get_aux_hint method 57/257557/1
authorJunseok, Kim <juns.kim@samsung.com>
Tue, 27 Apr 2021 11:19:09 +0000 (20:19 +0900)
committerJunseok, Kim <juns.kim@samsung.com>
Tue, 27 Apr 2021 11:19:09 +0000 (20:19 +0900)
Added method to get current aux hint data from server.

Change-Id: Ia90c1cbd2dec71f99066c75442d1fa3fd8b575ca

src/e_test_event.cpp
src/e_test_event.h

index e8ad844..b86eb77 100644 (file)
@@ -75,6 +75,7 @@ static void _cb_method_window_effect(void *data, const Eldbus_Message *msg, Eldb
 static void _cb_method_set_tc_start_end(void *data, const Eldbus_Message *msg, Eldbus_Pending *p);
 static void _cb_method_set_tc_timeout(void *data, const Eldbus_Message *msg, Eldbus_Pending *p);
 static void _cb_method_transient_for_below(void *data, const Eldbus_Message *msg, Eldbus_Pending *p);
+static void _cb_method_aux_hint_get(void *data, const Eldbus_Message *msg, Eldbus_Pending *p);
 
 /* callbacks - signal */
 static void _cb_signal_vis_changed(void *data, const Eldbus_Message *msg);
@@ -1270,6 +1271,34 @@ etRunner::delSupportedAuxHint(const char *hint)
    return EINA_TRUE;
 }
 
+std::shared_ptr<auxHintEventItem>
+etRunner::getAuxHint(etWin *tw, const char *hint_key)
+{
+   Eldbus_Pending *p = NULL;
+   auxHintEventItem *hint = NULL;
+
+   p = eldbus_proxy_call(dbus.ds_proxy,
+                         "GetAuxHint",
+                         _cb_method_aux_hint_get,
+                         &hint,
+                         -1,
+                         "us",
+                         tw->native_win,
+                         hint_key);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(p, nullptr);
+
+   work();
+
+   if (hint)
+     {
+        std::shared_ptr<auxHintEventItem> shared_hint = std::make_shared<auxHintEventItem>(tw->native_win, E_TC_EVENT_TYPE_AUX_HINT_CHANGED, hint->getID(), hint->getHint().c_str(), hint->getVal().c_str());
+        delete hint;
+        return shared_hint;
+     }
+
+   return NULL;
+}
+
 std::shared_ptr<eventItem>
 etRunner::waitEvent(etWin *win, E_TC_Event_Type ev_type)
 {
@@ -1971,6 +2000,34 @@ finish:
    etRunner::get().finishWork();
 }
 
+static void
+_cb_method_aux_hint_get(void *data,
+                        const Eldbus_Message *msg,
+                        Eldbus_Pending *p)
+{
+   auxHintEventItem **hint = (auxHintEventItem **) data;
+   const char *name = NULL, *text = NULL;
+   Eina_Bool res = EINA_FALSE;
+   int id;
+   const char *hint_key, *hint_val;
+
+   res = eldbus_message_error_get(msg, &name, &text);
+   EINA_SAFETY_ON_TRUE_GOTO(res, finish);
+
+   res = eldbus_message_arguments_get(msg, "iss", &id, &hint_key, &hint_val);
+   EINA_SAFETY_ON_FALSE_GOTO(res, finish);
+
+   *hint = new auxHintEventItem(0, E_TC_EVENT_TYPE_AUX_HINT_CHANGED, id, hint_key, hint_val);
+
+finish:
+   if ((name) || (text))
+     {
+        ERR("errname: %s errmsg: %s\n", name, text);
+     }
+
+   etRunner::get().finishWork();
+}
+
 /* callbacks - signal */
 static void
 _cb_signal_vis_changed(void *data,
index 9f46f36..834e2bc 100644 (file)
@@ -233,6 +233,7 @@ public:
    Eina_Bool     thawEvent();
    Eina_Bool     addSupportedAuxHint(const char *hint);
    Eina_Bool     delSupportedAuxHint(const char *hint);
+   std::shared_ptr<auxHintEventItem> getAuxHint(etWin *tw, const char *hint);
    std::shared_ptr<eventItem> waitEvent(etWin *win, E_TC_Event_Type ev_type);
    Eina_Bool     requestKillWinByName(const char *name);