Fix profile check logic to distinguish ivi and iot 02/191902/3 accepted/tizen/unified/20181107.081902 submit/tizen/20181105.232950 submit/tizen/20181106.081159
authorWootak Jung <wootak.jung@samsung.com>
Thu, 25 Oct 2018 06:14:52 +0000 (15:14 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Fri, 26 Oct 2018 00:58:42 +0000 (09:58 +0900)
Change-Id: I8c4e2498567e7b802e9602d3f3cc95dbb4e90be7

common/include/bt-util.h
common/src/libraries/bt-util.c

index a927d5c..c768328 100644 (file)
@@ -123,7 +123,8 @@ typedef enum {
        _PROFILE_WEARABLE = 0x2,
        _PROFILE_TV = 0x4,
        _PROFILE_IVI = 0x8,
-       _PROFILE_COMMON = 0x10,
+       _PROFILE_IOT = 0x10,
+       _PROFILE_COMMON = 0x20,
 } tizen_profile_t;
 extern tizen_profile_t _get_tizen_profile();
 #define TIZEN_PROFILE_TV ((_get_tizen_profile()) == _PROFILE_TV)
index fc22b99..ef864ea 100644 (file)
@@ -1080,12 +1080,15 @@ char *_bt_util_vcard_create_from_id_list(const int *id_list, int count, const ch
 tizen_profile_t _get_tizen_profile()
 {
        static tizen_profile_t profile = _PROFILE_UNKNOWN;
-       char *profileName;
+       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':
@@ -1101,7 +1104,12 @@ tizen_profile_t _get_tizen_profile()
                        break;
                case 'i':
                case 'I':
-                       profile = _PROFILE_IVI;
+                       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;