Reorganize profiling routines to support the common profile 56/56056/1 submit/tizen_common/20151229.154718
authorMu-Woong Lee <muwoong.lee@samsung.com>
Mon, 4 Jan 2016 03:33:08 +0000 (12:33 +0900)
committerMu-Woong Lee <muwoong.lee@samsung.com>
Mon, 4 Jan 2016 03:33:08 +0000 (12:33 +0900)
Change-Id: Iaada37db8bc9ec223e9a18a4a113a2c28e8233a5
Signed-off-by: Mu-Woong Lee <muwoong.lee@samsung.com>
CMakeLists.txt
packaging/device-context-provider.spec
src/device_context_provider.cpp

index bf440a4..dcaf67f 100644 (file)
@@ -12,11 +12,11 @@ FILE(GLOB SRCS src/*.cpp)
 
 # Dependencies (Base)
 SET(provider_deps "context-common vconf capi-system-info capi-system-device capi-system-runtime-info")
-SET(provider_deps "${provider_deps} capi-network-bluetooth capi-network-wifi")
 
 # Mobile profile
 IF("${PROFILE}" STREQUAL "mobile")
        ADD_DEFINITIONS("-D_MOBILE_")
+       SET(provider_deps "${provider_deps} capi-network-bluetooth capi-network-wifi")
        SET(provider_deps "${provider_deps} capi-telephony tapi msg-service capi-messaging-email motion")
        FILE(GLOB_RECURSE SRCS ${SRCS} src/activity/*.cpp)
        FILE(GLOB_RECURSE SRCS ${SRCS} src/device_status/*.cpp)
@@ -26,6 +26,7 @@ ENDIF("${PROFILE}" STREQUAL "mobile")
 # Wearable profile
 IF("${PROFILE}" STREQUAL "wearable")
        ADD_DEFINITIONS("-D_WEARABLE_")
+       SET(provider_deps "${provider_deps} capi-network-bluetooth capi-network-wifi")
        SET(provider_deps "${provider_deps} capi-telephony tapi msg-service motion")
        FILE(GLOB_RECURSE SRCS ${SRCS} src/activity/*.cpp)
        FILE(GLOB_RECURSE SRCS ${SRCS} src/device_status/*.cpp)
@@ -36,6 +37,7 @@ ENDIF("${PROFILE}" STREQUAL "wearable")
 # TV profile
 IF("${PROFILE}" STREQUAL "tv")
        ADD_DEFINITIONS("-D_TV_")
+       SET(provider_deps "${provider_deps} capi-network-bluetooth capi-network-wifi")
        SET(SRCS
                ${SRCS}
                src/device_status/headphone.cpp
index cbcf6eb..71a9669 100644 (file)
@@ -15,10 +15,9 @@ BuildRequires: pkgconfig(capi-system-info)
 BuildRequires: pkgconfig(capi-system-device)
 BuildRequires: pkgconfig(capi-system-runtime-info)
 
+%if "%{?BUILD_PROFILE}" == "mobile"
 BuildRequires: pkgconfig(capi-network-bluetooth)
 BuildRequires: pkgconfig(capi-network-wifi)
-
-%if "%{?BUILD_PROFILE}" == "mobile"
 BuildRequires: pkgconfig(capi-telephony)
 BuildRequires: pkgconfig(tapi)
 BuildRequires: pkgconfig(msg-service)
@@ -27,12 +26,19 @@ BuildRequires: pkgconfig(motion)
 %endif
 
 %if "%{?BUILD_PROFILE}" == "wearable"
+BuildRequires: pkgconfig(capi-network-bluetooth)
+BuildRequires: pkgconfig(capi-network-wifi)
 BuildRequires: pkgconfig(capi-telephony)
 BuildRequires: pkgconfig(tapi)
 BuildRequires: pkgconfig(msg-service)
 BuildRequires: pkgconfig(motion)
 %endif
 
+%if "%{?BUILD_PROFILE}" == "tv"
+BuildRequires: pkgconfig(capi-network-bluetooth)
+BuildRequires: pkgconfig(capi-network-wifi)
+%endif
+
 %description
 Device Context Provider
 
index 32c4903..fe18ad9 100644 (file)
 #include "social_status/social_status_types.h"
 #include "activity/activity_types.h"
 
-#include "device_status/wifi.h"
-#include "device_status/headphone.h"
-
 #ifdef _MOBILE_
 #include "device_status/runtime-info/charger.h"
 #include "device_status/runtime-info/gps.h"
 #include "device_status/runtime-info/usb.h"
+#include "device_status/wifi.h"
+#include "device_status/headphone.h"
 #include "device_status/battery.h"
 #include "device_status/psmode.h"
 #include "social_status/call.h"
@@ -42,6 +41,8 @@
 #include "device_status/runtime-info/charger.h"
 #include "device_status/runtime-info/gps.h"
 #include "device_status/runtime-info/usb.h"
+#include "device_status/wifi.h"
+#include "device_status/headphone.h"
 #include "device_status/battery.h"
 #include "device_status/psmode.h"
 #include "social_status/call.h"
 #include "activity/activity.h"
 #endif
 
+#ifdef _TV_
+#include "device_status/wifi.h"
+#include "device_status/headphone.h"
+#endif
+
 #define PRIV_NETWORK   "network.get"
 #define PRIV_TELEPHONY "telephony"
 #define PRIV_MESSAGE   "message.read"
@@ -66,10 +72,10 @@ void register_provider(const char *subject, const char *privilege)
 
 EXTAPI bool ctx::init_device_context_provider()
 {
+#ifdef _MOBILE_
        register_provider<device_status_wifi>(DEVICE_ST_SUBJ_WIFI, PRIV_NETWORK);
        register_provider<device_status_headphone>(DEVICE_ST_SUBJ_HEADPHONE, NULL);
 
-#ifdef _MOBILE_
        register_provider<device_status_charger>(DEVICE_ST_SUBJ_CHARGER, NULL);
        register_provider<device_status_gps>(DEVICE_ST_SUBJ_GPS, NULL);
        register_provider<device_status_usb>(DEVICE_ST_SUBJ_USB, NULL);
@@ -84,9 +90,16 @@ EXTAPI bool ctx::init_device_context_provider()
        register_provider<user_activity_walking>(USER_ACT_SUBJ_WALKING, NULL);
        register_provider<user_activity_running>(USER_ACT_SUBJ_RUNNING, NULL);
        register_provider<user_activity_in_vehicle>(USER_ACT_SUBJ_IN_VEHICLE, NULL);
+
+       /* Create context providers, which need to be initiated before being subscribed */
+       if (device_status_wifi::is_supported())
+               device_status_wifi::create(NULL);
 #endif
 
 #ifdef _WEARABLE_
+       register_provider<device_status_wifi>(DEVICE_ST_SUBJ_WIFI, PRIV_NETWORK);
+       register_provider<device_status_headphone>(DEVICE_ST_SUBJ_HEADPHONE, NULL);
+
        register_provider<device_status_charger>(DEVICE_ST_SUBJ_CHARGER, NULL);
        register_provider<device_status_gps>(DEVICE_ST_SUBJ_GPS, NULL);
        register_provider<device_status_usb>(DEVICE_ST_SUBJ_USB, NULL);
@@ -100,11 +113,20 @@ EXTAPI bool ctx::init_device_context_provider()
        register_provider<user_activity_walking>(USER_ACT_SUBJ_WALKING, NULL);
        register_provider<user_activity_running>(USER_ACT_SUBJ_RUNNING, NULL);
        register_provider<user_activity_in_vehicle>(USER_ACT_SUBJ_IN_VEHICLE, NULL);
+
+       /* Create context providers, which need to be initiated before being subscribed */
+       if (device_status_wifi::is_supported())
+               device_status_wifi::create(NULL);
 #endif
 
+#ifdef _TV_
+       register_provider<device_status_wifi>(DEVICE_ST_SUBJ_WIFI, PRIV_NETWORK);
+       register_provider<device_status_headphone>(DEVICE_ST_SUBJ_HEADPHONE, NULL);
+
        /* Create context providers, which need to be initiated before being subscribed */
        if (device_status_wifi::is_supported())
                device_status_wifi::create(NULL);
+#endif
 
        return true;
 }