Add Fhub model feature 42/305542/1 tizen
authorWootak Jung <wootak.jung@samsung.com>
Fri, 26 Jan 2024 00:25:04 +0000 (09:25 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Mon, 5 Feb 2024 01:30:51 +0000 (10:30 +0900)
Change-Id: Ie7323d4db35488185025751ec7e1109a4b53512a
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
CMakeLists.txt
packaging/org.tizen.bt-syspopup.spec
src/bt-syspopup-m.c

index c278f69..7077c69 100644 (file)
@@ -77,7 +77,8 @@ pkg_check_modules(pkgs REQUIRED
        edbus
        vconf
        capi-ui-efl-util
-       ecore-wl2)
+       ecore-wl2
+       capi-system-info)
 ENDIF()
 
 FOREACH(flag ${pkgs_CFLAGS})
index 116293c..4da8216 100644 (file)
@@ -46,6 +46,7 @@ BuildRequires:  pkgconfig(capi-network-bluetooth)
 BuildRequires:  pkgconfig(vconf)
 BuildRequires:  pkgconfig(ecore-wl2)
 BuildRequires:  pkgconfig(capi-ui-efl-util)
+BuildRequires:  pkgconfig(capi-system-info)
 
 BuildRequires:  cmake
 BuildRequires:  gettext-devel
index 2dc547b..fa486b7 100644 (file)
@@ -44,6 +44,7 @@
 #include <gio/giotypes.h>
 #include <efl_util.h>
 #include <Ecore_Wl2.h>
+#include <system_info.h>
 
 #include "bt-syspopup-m.h"
 
@@ -76,6 +77,119 @@ static void __bluetooth_set_win_level(Evas_Object *parent);
 
 static void __popup_terminate(void);
 
+typedef enum {
+       _PROFILE_UNKNOWN = 0,
+       _PROFILE_MOBILE = 0x1,
+       _PROFILE_WEARABLE = 0x2,
+       _PROFILE_TV = 0x4,
+       _PROFILE_IVI = 0x8,
+       _PROFILE_IOT = 0x10,
+       _PROFILE_COMMON = 0x20,
+} tizen_profile_t;
+
+typedef enum {
+       _MODEL_UNKNOWN = 0,
+       _MODEL_COMMON = 0x1,
+       _MODEL_FHUB = 0x2,
+       _MODEL_DA = 0x4,
+} tizen_model_t;
+
+extern tizen_profile_t _get_tizen_profile();
+extern tizen_profile_t profile;
+
+extern tizen_model_t _get_tizen_model();
+extern tizen_model_t model;
+
+#define TIZEN_PROFILE_(x) (((__builtin_expect(profile != _PROFILE_UNKNOWN, 1)) ? \
+                                       (profile) : _get_tizen_profile()) \
+                               & (x))
+
+#define TIZEN_MODEL_(x) (((__builtin_expect(model != _MODEL_UNKNOWN, 1)) ? \
+                                       (model) : _get_tizen_model()) \
+                               & (x))
+
+#define TIZEN_FEATURE_FHUB_REFERENCE TIZEN_MODEL_(_MODEL_FHUB)
+
+tizen_profile_t profile = _PROFILE_UNKNOWN;
+tizen_profile_t _get_tizen_profile()
+{
+       char *profileName = NULL;
+
+       if (__builtin_expect(profile != _PROFILE_UNKNOWN, 1))
+               return profile;
+
+       system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
+       if (!profileName)
+               return _PROFILE_UNKNOWN;
+
+       switch (*profileName) {
+       case 'm':
+       case 'M':
+               profile = _PROFILE_MOBILE;
+               break;
+       case 'w':
+       case 'W':
+               profile = _PROFILE_WEARABLE;
+               break;
+       case 't':
+       case 'T':
+               profile = _PROFILE_TV;
+               break;
+       case 'i':
+       case 'I':
+               if (!strncasecmp(profileName, "ivi", 3))
+                       profile = _PROFILE_IVI;
+               else if (!strncasecmp(profileName, "iot", 3))
+                       profile = _PROFILE_IOT;
+               else
+                       profile = _PROFILE_COMMON;
+               break;
+       default: // common or unknown ==> ALL ARE COMMON.
+               profile = _PROFILE_COMMON;
+       }
+       free(profileName);
+
+       return profile;
+}
+
+tizen_model_t model = _MODEL_UNKNOWN;
+tizen_model_t _get_tizen_model(void)
+{
+       char *model_name = NULL;
+
+       if (__builtin_expect(model != _MODEL_UNKNOWN, 1))
+               return model;
+
+       system_info_get_platform_string("http://tizen.org/system/model_name", &model_name);
+
+       if (model_name == NULL) {
+               model = _MODEL_COMMON;
+               return model;
+       }
+
+       if (!strncasecmp(model_name, "Family Hub", 10))
+               model = _MODEL_FHUB;
+       else if (!strcasecmp(model_name, "Robot Vacuum Cleaner") ||
+                       !strcasecmp(model_name, "Smart Dryer") ||
+                       !strcasecmp(model_name, "Smart Washer") ||
+                       !strcasecmp(model_name, "DDMS") ||
+                       !strcasecmp(model_name, "Smart Cooktop") ||
+                       !strcasecmp(model_name, "Smart Range") ||
+                       !strcasecmp(model_name, "Refrigerator") ||
+                       !strcasecmp(model_name, "Echo Heating System Controller") ||
+                       !strcasecmp(model_name, "Bespoke Washer") ||
+                       !strcasecmp(model_name, "Bespoke Dryer") ||
+                       !strcasecmp(model_name, "Appliance Emulator") ||
+                       !strcasecmp(model_name, "AI Hub Smart EHS"))
+               model = _MODEL_DA;
+       else
+               model = _MODEL_COMMON;
+
+       free(model_name);
+
+       return model;
+}
+
 static char *format_string(const char *format, ...)
 {
        va_list arg;
@@ -1241,7 +1355,8 @@ static void __bluetooth_draw_popup(struct bt_popup_appdata *ad,
        BT_DBG("__bluetooth_draw_popup");
 
        ad->popup = elm_popup_add(ad->layout);
-       elm_popup_align_set(ad->popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+       if (!TIZEN_FEATURE_FHUB_REFERENCE)
+               elm_popup_align_set(ad->popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
 
        /*set window level to HIGH*/
        __bluetooth_set_win_level(ad->win_main);
@@ -2482,12 +2597,19 @@ static void __bluetooth_set_win_level(Evas_Object *parent)
        ret_if(!wl_win);
 
        ecore_wl2_window_type_set(wl_win, ECORE_WL2_WINDOW_TYPE_NOTIFICATION);
-       efl_util_set_notification_window_level(parent, EFL_UTIL_NOTIFICATION_LEVEL_HIGH);
+       if (TIZEN_FEATURE_FHUB_REFERENCE)
+               efl_util_set_notification_window_level(parent, EFL_UTIL_NOTIFICATION_LEVEL_TOP);
+       else
+               efl_util_set_notification_window_level(parent, EFL_UTIL_NOTIFICATION_LEVEL_HIGH);
 }
 
 static Evas_Object *__bluetooth_create_win(const char *name)
 {
        Evas_Object *eo;
+
+       if (TIZEN_FEATURE_FHUB_REFERENCE)
+               elm_config_accel_preference_set("gl");
+
        eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
        retv_if(!eo, NULL);