Added wearable profile routin 89/186489/2 accepted/tizen/unified/20180817.061855 submit/tizen/20180816.123502
authorhyunuktak <hyunuk.tak@samsung.com>
Fri, 10 Aug 2018 02:15:58 +0000 (11:15 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Tue, 14 Aug 2018 12:32:39 +0000 (21:32 +0900)
Change-Id: Ie4f56b3b35572e6396a63454d4205b3b3562ddd9
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
CMakeLists.txt
include/net-popup-w.h [new file with mode: 0755]
include/net-popup.h
packaging/net.netpopup.spec
src/net-popup-w.c [new file with mode: 0755]
src/net-popup.c

index 18c50ee..9b6e678 100755 (executable)
@@ -3,6 +3,7 @@ PROJECT(net-popup C)
 
 SET(SRCS
        ${CMAKE_SOURCE_DIR}/src/net-popup.c
+       ${CMAKE_SOURCE_DIR}/src/net-popup-w.c
        ${CMAKE_SOURCE_DIR}/src/net-popup-vpn.c)
 
 
@@ -35,7 +36,8 @@ pkg_check_modules(pkgs REQUIRED
        vconf
        efl-extension
        capi-vpnsvc
-       capi-network-stc)
+       capi-network-stc
+       capi-system-info)
 
 FOREACH(flag ${pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
diff --git a/include/net-popup-w.h b/include/net-popup-w.h
new file mode 100755 (executable)
index 0000000..5b3bde3
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+*  net-popup
+*
+* Copyright 2012  Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.1 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.tizenopensource.org/license
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+#ifndef __DEF_NET_POPUP_W_H__
+#define __DEF_NET_POPUP_W_H__
+
+#include <dlog.h>
+#include <app_control.h>
+
+#define PACKAGE       "net-popup"
+#define NET_POPUP_W   "NET_POPUP_W"
+#define LOCALEDIR     "/usr/share/locale"
+#define log_print(MID, format, args...) \
+       SLOG(LOG_INFO, MID, "\033[0m[%s:%d]\033[0m " format, __func__, __LINE__, ##args)
+
+bool net_popup_w_create(void *data);
+void net_popup_w_terminate(void *data);
+void net_popup_w_pause(void *data);
+void net_popup_w_resume(void *data);
+void net_popup_w_service_cb(app_control_h request, void *data);
+
+#endif /* __DEF_NET_POPUP_W_H__ */
index 0131d2a..2ea0a12 100755 (executable)
 #define secure_log_print(tag, format, args...) SECURE_SLOG(LOG_DEBUG, \
                        tag, "%s:%d "format, __func__, __LINE__, ##args)
 
+typedef enum {
+    TIZEN_PROFILE_UNKNOWN = 0,
+    TIZEN_PROFILE_MOBILE = 0x1,
+    TIZEN_PROFILE_WEARABLE = 0x2,
+    TIZEN_PROFILE_TV = 0x4,
+    TIZEN_PROFILE_IVI = 0x8,
+    TIZEN_PROFILE_COMMON = 0x10,
+} tizen_profile_t;
+
 #endif /* __DEF_NET_POPUP_H__ */
index c0d8251..b9b24df 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       net.netpopup
 Summary:    Network Notification Popup application
-Version:    0.2.89
+Version:    0.2.90
 Release:    1
 Group:      App/Network
 License:    Flora-1.1
@@ -25,6 +25,7 @@ BuildRequires: pkgconfig(efl-extension)
 BuildRequires: pkgconfig(libtzplatform-config)
 BuildRequires: pkgconfig(capi-vpnsvc)
 BuildRequires: pkgconfig(capi-network-stc)
+BuildRequires: pkgconfig(capi-system-info)
 BuildRequires: gettext
 BuildRequires: edje-tools
 
diff --git a/src/net-popup-w.c b/src/net-popup-w.c
new file mode 100755 (executable)
index 0000000..a9ac8fa
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+*  net-popup
+*
+* Copyright 2012  Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.1 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.tizenopensource.org/license
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+#include "net-popup-w.h"
+#include "net-popup-strings.h"
+
+bool net_popup_w_create(void *data)
+{
+       log_print(NET_POPUP_W, "net_popup_w_create()\n");
+
+       bindtextdomain(PACKAGE, LOCALEDIR);
+
+       return true;
+}
+
+void net_popup_w_terminate(void *data)
+{
+       log_print(NET_POPUP_W, "net_popup_w_terminate()\n");
+
+       return;
+}
+
+void net_popup_w_pause(void *data)
+{
+       log_print(NET_POPUP_W, "net_popup_w_pause()\n");
+
+       return;
+}
+
+void net_popup_w_resume(void *data)
+{
+       log_print(NET_POPUP_W, "net_popup_w_resume()\n");
+
+       return;
+}
+
+void net_popup_w_service_cb(app_control_h request, void *data)
+{
+       log_print(NET_POPUP_W, "net_popup_w_service_cb()\n");
+
+       return;
+}
index ff2f72f..9a0328f 100755 (executable)
 #include <vpn_service_internal.h>
 #include <stc.h>
 #include <stc_internal.h>
+#include <system_info.h>
 
 #include "net-popup.h"
+#include "net-popup-w.h"
 #include "net-popup-vpn.h"
 #include "net-popup-strings.h"
 
@@ -106,6 +108,8 @@ static Ecore_Event_Handler *ecore_event_evas_quick_panel_handler;
 long sizes[] = {1073741824, 1048576, 1024, 0};
 char *units[] = {"GB", "MB", "KB", "B"};
 
+static tizen_profile_t g_profile = TIZEN_PROFILE_UNKNOWN;
+
 static app_control_h g_req_handle = NULL;
 static char *resp_popup_mode = NULL;
 
@@ -139,6 +143,34 @@ static int __net_popup_show_network_error_popup(app_control_h request, void *dat
 static void __net_popup_add_ip_conflict_noti(app_control_h request);
 static void __net_popup_del_ip_conflict_noti(void);
 
+static void __net_popup_get_tizen_profile(void)
+{
+       char *profile_name;
+
+       system_info_get_platform_string("http://tizen.org/feature/profile", &profile_name);
+
+       switch (*profile_name) {
+       case 'm':
+       case 'M':
+               g_profile = TIZEN_PROFILE_MOBILE;
+               break;
+       case 'w':
+       case 'W':
+               g_profile = TIZEN_PROFILE_WEARABLE;
+               break;
+       case 't':
+       case 'T':
+               g_profile = TIZEN_PROFILE_TV;
+               break;
+       case 'i':
+       case 'I':
+               g_profile = TIZEN_PROFILE_IVI;
+               break;
+       default:
+               g_profile = TIZEN_PROFILE_COMMON;
+       }
+}
+
 GDBusProxy *__net_popup_init_dbus(void)
 {
        log_print(NET_POPUP, "__net_popup_init_dbus()\n");
@@ -2128,14 +2160,29 @@ EXPORT_API int main(int argc, char *argv[])
 {
        log_print(NET_POPUP, "main()\n");
 
-       ui_app_lifecycle_callback_s app_callback = {
-               .create = __net_popup_create,
-               .terminate = __net_popup_terminate,
-               .pause = __net_popup_pause,
-               .resume = __net_popup_resume,
-               .app_control = __net_popup_service_cb,
-       };
+       __net_popup_get_tizen_profile();
 
-       return ui_app_main(argc, argv, &app_callback, NULL);
-}
+       if (g_profile == TIZEN_PROFILE_MOBILE) {
+               ui_app_lifecycle_callback_s app_callback = {
+                       .create = __net_popup_create,
+                       .terminate = __net_popup_terminate,
+                       .pause = __net_popup_pause,
+                       .resume = __net_popup_resume,
+                       .app_control = __net_popup_service_cb,
+               };
 
+               return ui_app_main(argc, argv, &app_callback, NULL);
+       } else if (g_profile == TIZEN_PROFILE_WEARABLE) {
+               ui_app_lifecycle_callback_s app_callback = {
+                       .create = net_popup_w_create,
+                       .terminate = net_popup_w_terminate,
+                       .pause = net_popup_w_pause,
+                       .resume = net_popup_w_resume,
+                       .app_control = net_popup_w_service_cb,
+               };
+
+               return ui_app_main(argc, argv, &app_callback, NULL);
+       }
+
+       return 0;
+}