Fix area and role
authorfukubayashi.akio <fukubayashi.akio@genetec.co.jp>
Thu, 20 Jun 2019 01:33:15 +0000 (10:33 +0900)
committerfukubayashi.akio <fukubayashi.akio@genetec.co.jp>
Thu, 20 Jun 2019 01:33:15 +0000 (10:33 +0900)
Signed-off-by: fukubayashi.akio <fukubayashi.akio@genetec.co.jp>
layers.json
policy_manager/config/roles.json.zipc.split
src/main.cpp
src/window_manager.cpp
src/wm_layer_control.cpp
src/wm_layer_control.hpp

index 622ab16..2b157ee 100644 (file)
@@ -24,7 +24,7 @@
         },
         {
             "name": "NearApps",
-            "role": "receiver2",
+            "role": "receiver2|upleftreceiver",
             "id_range_begin": 2600,
             "id_range_end": 2999,
             "comment": "NearApps is the part of Apps. The z order of this layer is higher than Apps"
index 2a87de8..eee2156 100644 (file)
@@ -63,7 +63,7 @@
                 },
                 {
                     "category": "receiver",
-                    "role": "receiver",
+                    "role": "receiver | ssubreceiver",
                     "area": "split.sub | normal.full",
                     "layer": "apps",
                 }
             "roles":[
                 {
                     "category": "receiver",
-                    "role": "receiver",
+                    "role": "receiver | fullreceiver",
                     "area": "normal.full",
                     "layer": "apps",
                 },
                 {
                     "category": "receiver2",
-                    "role": "receiver2",
+                    "role": "receiver2 | upleftreceiver",
                     "area": "upper.left",
                     "layer": "near_apps",
                 },
                 {
                     "category": "general",
-                    "role": "video | music | sdl_bt | webbrowser | eb | poi | browser | mixer | radio | hvac | debug | phone | settings | hvac | dashboard",
+                    "role": "video | music | sdl_bt | webbrowser | eb | poi | browser | mixer | radio | hvac | debug | phone | settings | hvac | hudtbt | tbtnavi | tbtnavi2 | dashboard",
                     "area": "hud.normal.full",
                     "layer": "remote_hud",
                 },
                 {
                     "category": "speed",
-                    "role": "tachometer",
+                    "role": "tachometer | speed | hudspeed",
                     "area": "hud.upper.left",
                     "layer": "remote_hud_upper_left",
                 }
index 022834b..2584da0 100644 (file)
@@ -1,4 +1,4 @@
-/*
+/*;
  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -49,6 +49,8 @@ struct afb_instance
     ~afb_instance() = default;
 
     int init();
+
+    bool testFlg;
 };
 
 struct afb_instance *g_afb_instance;
@@ -71,6 +73,8 @@ int _binding_init()
         goto error;
     }
 
+    g_afb_instance->testFlg = false;
+
     atexit([] { delete g_afb_instance; });
 
     return 0;
@@ -307,6 +311,22 @@ void windowmanager_activatewindow(afb_req req) noexcept
                 afb_req_success(req, NULL, "success");
             };
 
+            HMI_DEBUG("activateWindow role:%s area:%s", appid, a_drawing_area);
+
+#if 0
+            std::string appidString = appid;
+            HMI_DEBUG("flg: %d", g_afb_instance->testFlg);
+            if ((appidString == "dashboard" && g_afb_instance->testFlg) || appidString == "hudspeed")
+            { 
+                HMI_DEBUG("%s is remote transfer", appid);
+                g_afb_instance->wmgr.api_activate_surface_to_master(
+                    appid, a_drawing_name, "hud.upper.left", reply);
+
+                g_afb_instance->testFlg = false;
+                return;
+            }
+
+#endif
             if (!g_afb_instance->wmgr.wmcon.isRemoteArea(a_drawing_area))
             {
                 g_afb_instance->wmgr.api_activate_window(
@@ -331,6 +351,12 @@ void windowmanager_activatewindow(afb_req req) noexcept
                         appid, a_drawing_name, a_drawing_area, reply);
                 }
             }
+#if 0
+            if (appidString == "dashboard")
+            {
+                g_afb_instance->testFlg = true;
+            }
+#endif
             free(appid);
         }
     }
@@ -720,7 +746,11 @@ void windowmanager_wm_subscribe(afb_req req) noexcept
         }
         afb_req_success(req, NULL, "success");
 
-        g_afb_instance->wmgr.setSubscribed(true);
+        if (event_id == 7)
+        {
+            //g_afb_instance->wmgr.api_handshake();
+            g_afb_instance->wmgr.setSubscribed(true);
+        }
     }
     catch (std::exception &e)
     {
index f121709..52a7144 100644 (file)
@@ -84,6 +84,7 @@ static sd_event_source *g_timer_ev_src = nullptr;
 static sd_event_source *g_timer_endInit_src = nullptr;
 static AppList g_app_list;
 static WindowManager *g_context;
+static bool testFlg = false;
 static vector<string> white_list_area_size_change = {
     "homescreen"
 };
index 887fc58..3e3d0d5 100644 (file)
@@ -861,18 +861,7 @@ bool LayerControl::moveForeGround(const shared_ptr<WMClient> client)
 bool LayerControl::moveRemote(unsigned layer, const std::string& area)
 {
     bool ret = false;
-    std::string remote_layer;
-    std::string ecu_name = area;
-
-    if (area.find('.') != std::string::npos)
-    {
-        std::vector<std::string> elements;
-        elements = parseString(area, '.');
-        ecu_name = elements[0];
-    }
-
-    remote_layer = this->areaToRemoteLayer(ecu_name);
-
+    std::string remote_layer = this->areaToRemoteLayer(area);
     auto remote = this->getWMLayer(remote_layer);
     
     if(remote != nullptr)
@@ -944,13 +933,46 @@ std::string LayerControl::hasRemoteLayer(unsigned layer)
     return "";
 }
 
-std::string LayerControl::areaToRemoteLayer(std::string area)
+std::string LayerControl::areaToRemoteLayer(const std::string& area)
 {
+    std::vector<std::string> elements;
+
+    if (area.find('.') != std::string::npos)
+    {
+        elements = parseString(area, '.');
+    }
+    else
+    {
+        elements.push_back(area);
+    }
+
     for (auto itr = wm_remoteLayerName.begin(); itr != wm_remoteLayerName.end(); ++itr)
     {
-        if (std::regex_search(*itr, std::regex(area, std::regex::icase)))
+        unsigned int idx = 0;
+        for (auto itr_elem = elements.begin(); itr_elem != elements.end(); ++itr_elem)
         {
-            return *itr;
+            if (std::regex_search(*itr, std::regex(*itr_elem, std::regex::icase)))
+            {
+                if (++idx == elements.size())
+               {
+                    return *itr;
+               }
+            }
+           else
+           {
+                // TODO: workaround, skip normal case
+                if ((itr_elem->compare("normal") == 0) || (itr_elem->compare("full") == 0))
+                {
+                    if (++idx == elements.size())
+                    {
+                        return *itr;
+                    }
+                }
+                else
+                {
+                    break;
+                }
+           }
         }
     }
 
index 102896d..7c19e97 100644 (file)
@@ -102,8 +102,7 @@ class LayerControl
     void dispatchLayerPropChangeEvent(unsigned id, struct ilmLayerProperties*, t_ilm_notification_mask);
 
     std::string hasRemoteLayer(unsigned layer);
-    std::string areaToRemoteLayer(std::string area);
-
+    std::string areaToRemoteLayer(const std::string& area);
   private:
     WMError makeVisible(const std::shared_ptr<WMClient> client);
     WMError makeInvisible(const std::shared_ptr<WMClient> client);