- This is for Tizen 4.0.
: Tizen 4.0 Configurability and Build Blocks require
to remove all profile-depending build options in spec files.
(No More profile macros!)
: Note that _WEARABLE and _MOBILE were completely useless because
no code was using it.
: _TV was used only once at daemon/ServiceManager.cpp, which
is replaced by runtime profile probing.
: INTERNAL_ACL has been always 1 in Tizen.org Public and INTERNAL_ACL
has been 0 only in Tizen-TV Product. So, I've changed the condition
more clearly.
: daemon/discovery_provider/WifiDirectDiscoveryProvider.cpp has
a ifdef condition that is always FALSE in public.
- Merge conflicts resolved.
Change-Id: I4ce56ef62d81e542067abc2847c674a4bdd61f7f
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
FILE(GLOB DAEMON_SRCS ${DAEMON_SRCS} ../msf_tizen_client/src/*.cpp)
SET(provider_deps "glib-2.0 dlog json-glib-1.0 jsoncpp iotcon capi-appfw-app-manager vconf capi-network-bluetooth capi-appfw-application bundle capi-network-connection cynara-creds-gdbus cynara-client cynara-session capi-appfw-package-manager sqlite3 syspopup-caller")
-SET(provider_deps "${provider_deps} openssl libwebsockets libcurl nsd-dns-sd")
-#SET(provider_deps "${provider_deps} capi-network-wifi-direct")
-
-# Wearable profile
-IF("${PROFILE}" STREQUAL "wearable")
- ADD_DEFINITIONS("-D_WEARABLE_")
-ENDIF("${PROFILE}" STREQUAL "wearable")
-
-# Mobile profile
-IF("${PROFILE}" STREQUAL "mobile")
- ADD_DEFINITIONS("-D_MOBILE_")
-ENDIF("${PROFILE}" STREQUAL "mobile")
-
-# TV profile
-IF("${PROFILE}" STREQUAL "tv")
- ADD_DEFINITIONS("-D_TV_")
- IF(${D2D_INTERNAL_ACL} EQUAL 0)
- SET(provider_deps "${provider_deps} capi-register-device")
- ENDIF(${D2D_INTERNAL_ACL} EQUAL 0)
-ENDIF("${PROFILE}" STREQUAL "tv")
+SET(provider_deps "${provider_deps} openssl libwebsockets libcurl nsd-dns-sd capi-system-info")
+
+IF(${D2D_INTERNAL_ACL} EQUAL 0)
+ SET(provider_deps "${provider_deps} capi-register-device")
+ENDIF(${D2D_INTERNAL_ACL} EQUAL 0)
IF(${D2D_INTERNAL_ACL} EQUAL 1)
ADD_DEFINITIONS("-D_D2D_INTERNAL_ACL_")
_D("device name : %s", deviceName);
iotcon_attributes_add_str(attributes, CONV_JSON_DEVICE_ID, deviceId);
iotcon_attributes_add_str(attributes, CONV_JSON_DEVICE_NAME, deviceName);
-#if defined(_TV_)
- _D("device type : TV");
- string deviceTypeStr(CONV_DEVICE_TYPE_TV);
-#elif defined(_MOBILE_)
- _D("device type : MOBILE");
- string deviceTypeStr(CONV_DEVICE_TYPE_MOBILE);
-#elif defined(_WEARABLE_)
- _D("device type : WEARABLE");
- string deviceTypeStr(CONV_DEVICE_TYPE_WEARABLE);
-#else
- _D("device type : UNKNOWN");
- string deviceTypeStr(CONV_DEVICE_TYPE_UNKNOWN);
-#endif
+
+ string deviceTypeStr;
+ if (conv::util::getTizenProfile() == conv::util::TIZEN_PROFILE_TV) {
+ _D("device type : TV");
+ deviceTypeStr = string(CONV_DEVICE_TYPE_TV);
+ } else if (conv::util::getTizenProfile() == conv::util::TIZEN_PROFILE_MOBILE) {
+ _D("device type : MOBILE");
+ deviceTypeStr = string(CONV_DEVICE_TYPE_MOBILE);
+ } else if (conv::util::getTizenProfile() == conv::util::TIZEN_PROFILE_WEARABLE) {
+ _D("device type : WEARABLE");
+ deviceTypeStr = string(CONV_DEVICE_TYPE_WEARABLE);
+ } else {
+ _D("device type : UNKNOWN");
+ deviceTypeStr = string(CONV_DEVICE_TYPE_UNKNOWN);
+ }
char* deviceType = new char[deviceTypeStr.size() + 1];
memset(deviceType, 0, deviceTypeStr.size() + 1);
#include <glib.h>
#include <pthread.h>
#include "Service.h"
+#include <system_info.h>
#define FRONT_PROTOCOL_SIZE 7 // coap://
using namespace std;
+conv::util::tizen_profile_t conv::util::getTizenProfile()
+{
+ static conv::util::tizen_profile_t profile = conv::util::TIZEN_PROFILE_UNKNOWN;
+ if (__builtin_expect(profile != conv::util::TIZEN_PROFILE_UNKNOWN, 1))
+ return profile;
+
+ char *profileName;
+ system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
+ switch (*profileName) {
+ case 'm':
+ case 'M':
+ profile = conv::util::TIZEN_PROFILE_MOBILE;
+ break;
+ case 'w':
+ case 'W':
+ profile = conv::util::TIZEN_PROFILE_WEARABLE;
+ break;
+ case 't':
+ case 'T':
+ profile = conv::util::TIZEN_PROFILE_TV;
+ break;
+ case 'i':
+ case 'I':
+ profile = conv::util::TIZEN_PROFILE_IVI;
+ break;
+ default: // common or unknown ==> ALL ARE COMMON.
+ profile = conv::util::TIZEN_PROFILE_COMMON;
+ }
+ free(profileName);
+
+ return profile;
+}
+
std::string conv::util::getDeviceType()
{
-#if defined(_TV_)
- return CONV_DEVICE_TYPE_TV;
-#elif defined(_MOBILE_)
- return CONV_DEVICE_TYPE_MOBILE;
-#elif defined(_WEARABLE_)
- return CONV_DEVICE_TYPE_WEARABLE;
-#else
- return CONV_DEVICE_TYPE_UNKNOWN;
-#endif
+ switch (conv::util::getTizenProfile()) {
+ case conv::util::TIZEN_PROFILE_TV:
+ return CONV_DEVICE_TYPE_TV;
+ case conv::util::TIZEN_PROFILE_MOBILE:
+ return CONV_DEVICE_TYPE_MOBILE;
+ case conv::util::TIZEN_PROFILE_WEARABLE:
+ return CONV_DEVICE_TYPE_WEARABLE;
+ default:
+ return CONV_DEVICE_TYPE_UNKNOWN;
+ }
}
std::string conv::util::getBtMacAddress()
std::string conv::util::getDeviceName()
{
std::string __deviceName;
-#if defined(_TV_) || defined(TIZEN_PROFILE_TV) || defined(TIZEN_TV) || defined(TIZEN_PRODUCT_TV)
+#if defined(TIZEN_PROFILE_TV) || defined(TIZEN_TV) || defined(TIZEN_PRODUCT_TV)
char* deviceName = vconf_get_str("db/menu/network/devicename/tv_name");
#else
- char* deviceName = vconf_get_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR);
+ char* deviceName;
+
+ if (conv::util::getTizenProfile() == conv::util::TIZEN_PROFILE_TV)
+ deviceName = vconf_get_str("db/menu/network/devicename/tv_name");
+ else
+ deviceName = vconf_get_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR);
#endif
if (deviceName == NULL) {
__deviceName = "Tizen";
if(__deviceId.empty()) {
__deviceId = Service::getUniqueId("127.0.0.1:8001");
- if(__deviceId.empty())
-#if defined(_TV_) || defined(TIZEN_PROFILE_TV) || defined(TIZEN_TV) || defined(TIZEN_PRODUCT_TV)
+ if(__deviceId.empty()) {
+#if defined(TIZEN_PROFILE_TV) || defined(TIZEN_TV) || defined(TIZEN_PRODUCT_TV)
__deviceId = getBtMacAddress();
#else
- __deviceId = getP2pMacAddress();
+ if (conv::util::getTizenProfile() == conv::util::TIZEN_PROFILE_TV)
+ __deviceId = getBtMacAddress();
+ else
+ __deviceId = getP2pMacAddress();
#endif
+ }
}
_D("device id : %s", __deviceId.c_str());
std::string sub = hostAddress.substr(FRONT_PROTOCOL_SIZE, pos - FRONT_PROTOCOL_SIZE);
return sub;
-}
\ No newline at end of file
+}
void miscStopTimer(int timer);
bool getPeerMac(const std::string &remoteIP, const int remotePort, char *buf);
std::string getIpAddress(std::string hostAddress);
+
+ 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;
+ extern tizen_profile_t getTizenProfile();
}
}
#endif
ret = wifi_direct_set_connection_state_changed_cb(_cb_connection, (void*)NULL);
_D("wifi_direct_set_connection_state_changed_cb() result=[%d]", ret);
+// CAUTION: TIZEN_TV and TIZEN_TV_PRODUCT has been deadcode in Tizen.org
#if defined(TIZEN_TV) && defined(TIZEN_PRODUCT_TV) && defined(ENABLE_EXTRA_INFO)
ret = wifi_direct_set_peer_info_connection_state_changed_cb(_cb_peer_info_connection, (void*)NULL);
_D("wifi_direct_set_peer_info_connection_state_changed_cb() result=[%d]", ret);
SET(client_depends "gio-2.0 dlog json-glib-1.0 capi-appfw-application bundle capi-system-info")
-IF("${PROFILE}" STREQUAL "mobile")
-ADD_DEFINITIONS("-D_MOBILE_")
-#SET(client_depends "${client_depends} security-server")
-ENDIF("${PROFILE}" STREQUAL "mobile")
-
-IF("${PROFILE}" STREQUAL "tv")
-ADD_DEFINITIONS("-D_TV_")
-SET(client_depends "${client_depends}")
-ENDIF("${PROFILE}" STREQUAL "tv")
-
pkg_check_modules(client_pkgs REQUIRED ${client_depends})
INCLUDE_DIRECTORIES(${client_pkgs_INCLUDE_DIRS})
LINK_DIRECTORIES(${client_pkgs_LIBRARY_DIRS})
Source1001: %{name}.manifest
Source1002: lib%{name}.manifest
-%define BUILD_PROFILE %{?profile}%{!?profile:%{?tizen_profile_name}}
-%define INTERNAL_ACL %{?TIZEN_PROFILE_TV:0}%{!?TIZEN_PROFILE_TV:1}
-
BuildRequires: cmake
BuildRequires: pkgconfig(gio-2.0)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: curl
BuildRequires: libcurl-devel
-%if "%{?BUILD_PROFILE}" == "tv"
-%if %{?INTERNAL_ACL} == 0
+%if "%{?TIZEN_PRODUCT_TV}" == "1"
BuildRequires: pkgconfig(capi-register-device)
-%endif
+%define INTERNAL_ACL 0
+%else
+%define INTERNAL_ACL 1
%endif
%define _userdatadir /opt/usr/data/d2d-conv-manager
%build
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-%cmake . -DMAJORVER=${MAJORVER} -DFULLVER=%{version} -DBIN_INSTALL_DIR:PATH=%{_bindir} -DPROFILE=%{?BUILD_PROFILE} -DD2D_INTERNAL_ACL=%{?INTERNAL_ACL}
+%cmake . -DMAJORVER=${MAJORVER} -DFULLVER=%{version} -DBIN_INSTALL_DIR:PATH=%{_bindir} -DD2D_INTERNAL_ACL=%{?INTERNAL_ACL}
%install