get device type instead of model name to check DA devices 76/320576/1
authorSohyeon Choi <shss.choi@samsung.com>
Mon, 23 Dec 2024 02:22:21 +0000 (11:22 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Wed, 5 Mar 2025 04:31:43 +0000 (13:31 +0900)
Change-Id: Iea47c7e3021278b7ba7acd2b2499a066acceea6f
Signed-off-by: Sohyeon Choi <shss.choi@samsung.com>
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
bt-oal/bluez_hal/src/bt-hal-agent.c
bt-service/services/adapter/bt-service-core-adapter.c
bt-service/services/audio/bt-service-audio.c
include/bt-internal-types.h

index 5b04b6f70e28ec6fdb408dea881d30c7a9415e3f..0cfea44e27ba23b3ea8dfd35bfa8cd52f6fd531c 100644 (file)
@@ -710,7 +710,7 @@ static gboolean __bt_hal_confirm_request(GapAgentPrivate *agent, GDBusProxy *dev
                DBG("Headless Confirmation");
 
                /* Reply the ssp confirmation automaticaly */
-               if (TIZEN_FEATURE_DA_REFERENCE && !TIZEN_FEATURE_FHUB_REFERENCE) {
+               if (TIZEN_FEATURE_DA_REFERENCE && !(headed_plugin_info->plugin_headed_enabled)) {
                        DBG("DA Headless Device. Auto Accept");
                        gap_agent_reply_confirmation(agent, GAP_AGENT_ACCEPT, NULL);
                        goto done;
index 7ff904a2421e4c97b2d229ad6f782af46ce848b4..5838065f568a1d319e23e94685f90d4c25f2ba35 100644 (file)
@@ -479,7 +479,7 @@ static gboolean __bt_enable_timeout_cb(gpointer user_data)
        timer_id = 0;
 
        ret = adapter_disable();
-       if (TIZEN_FEATURE_FHUB_REFERENCE)
+       if (TIZEN_FEATURE_DA_REFERENCE)
                if (ret != OAL_STATUS_SUCCESS)
                        _bt_adapter_set_status(BT_DEACTIVATED);
 
@@ -1896,6 +1896,7 @@ static void __bt_set_visible_mode(void)
                BT_ERR("Fail to get the timeout value");
 
        _bt_dpm_get_bluetooth_limited_discoverable_state(&discoverable_state);
+       BT_DBG("timeout [%d] discoverable_state [%d]", timeout, discoverable_state);
        if (timeout == -1 || discoverable_state == DPM_RESTRICTED) {
                if (_bt_set_discoverable_mode(
                                        BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE,
index 407d7ad4cfe86b634d203236d05da414735c5fef..4401a2c506282f4ff72e496234c491bb8f2e7383 100644 (file)
@@ -1288,8 +1288,8 @@ int _bt_audio_select_role(bluetooth_audio_role_t role)
 
        BT_DBG("+");
 
-       if (TIZEN_FEATURE_FHUB_REFERENCE) {
-               BT_INFO("Both role(Source/Sink) already enabled in Fhub. No need to select role");
+       if (TIZEN_FEATURE_DA_REFERENCE) {
+               BT_INFO("Both role(Source/Sink) already enabled in DA. No need to select role");
                return BLUETOOTH_ERROR_ALREADY_INITIALIZED;
        }
 
index a2399e84bcfc2680e4c6c468703e7e26717c6143..28b555ead1ae02d5e21200fd8a93d11546cc3ae7 100644 (file)
@@ -838,13 +838,19 @@ typedef enum {
        _MODEL_TW3 = 0x20,
        _MODEL_RPI3 = 0x40,
        _MODEL_ROBOT = 0x80,
-       _MODEL_FHUB = 0x100,
-       _MODEL_DA = 0x200,
 } tizen_model_t;
 
+typedef enum {
+       _DEV_UNKNOWN = 0,
+       _DEV_COMMON = 0x1,
+       _DEV_DA = 0x2,
+       _DEV_FHUB = 0x4,
+} tizen_device_t;
+
 /* For optimization, make this extern and define in a shared C file */
 extern tizen_profile_t profile;
 static tizen_model_t model = _MODEL_UNKNOWN;
+static tizen_device_t device = _DEV_UNKNOWN;
 extern bt_plugin_info_t *headed_plugin_info;
 
 /* Accessing system info */
@@ -925,24 +931,6 @@ static inline tizen_model_t get_tizen_model(void)
                model = _MODEL_RPI3;
        else if (!strcasecmp(model_name, "gems") || !strncasecmp(model_name, "ServingBot", 10))
                model = _MODEL_ROBOT;
-       else 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, "Smart Oven") ||
-                       !strcasecmp(model_name, "Smart AC") ||
-                       !strcasecmp(model_name, "AI Vision Refrigerator") ||
-                       !strncasecmp(model_name, "AI Home", 7))
-               model = _MODEL_DA;
        else
                model = _MODEL_COMMON;
 
@@ -951,6 +939,39 @@ static inline tizen_model_t get_tizen_model(void)
        return model;
 }
 
+static inline tizen_device_t get_tizen_device_type(void)
+{
+       char *device_type = NULL;
+
+       if (__builtin_expect(device != _DEV_UNKNOWN, 1))
+               return device;
+
+       system_info_get_platform_string("http://tizen.org/system/device_type", &device_type);
+
+       if (device_type == NULL) {
+               device = _DEV_COMMON;
+               return device;
+       }
+
+       if (!strcasecmp(device_type, "Refrigerator(Family Hub)"))
+               device = _DEV_FHUB;
+       else if (!strcasecmp(device_type, "Robot Vacuum") ||
+                       !strcasecmp(device_type, "System A/C") ||
+                       !strcasecmp(device_type, "Washer") ||
+                       !strcasecmp(device_type, "Dryer") ||
+                       !strcasecmp(device_type, "Cooktop") ||
+                       !strcasecmp(device_type, "Range") ||
+                       !strncasecmp(device_type, "Refrigerator", 12) ||
+                       !strcasecmp(device_type, "Appliance") ||
+                       !strcasecmp(device_type, "Oven"))
+               device = _DEV_DA;
+       else
+               device = _DEV_COMMON;
+
+       free(device_type);
+       return device;
+}
+
 static inline bool get_tizen_feature_supported(char *feature)
 {
        bool is_supported = false;
@@ -978,8 +999,8 @@ static inline bool get_tizen_feature_supported(char *feature)
 #define TIZEN_FEATURE_HID_DEVICE_SUPPORTED (get_tizen_feature_supported(BT_FEATURE_HID_DEVICE) == true)
 #define TIZEN_FEATURE_PBAP_SUPPORTED (get_tizen_feature_supported(BT_FEATURE_PBAP) == true)
 #define TIZEN_FEATURE_ROBOT_REFERENCE ((get_tizen_model()) == _MODEL_ROBOT)
-#define TIZEN_FEATURE_FHUB_REFERENCE ((get_tizen_model()) == _MODEL_FHUB)
-#define TIZEN_FEATURE_DA_REFERENCE (get_tizen_model() & (_MODEL_FHUB | _MODEL_DA))
+#define TIZEN_FEATURE_FHUB_REFERENCE ((get_tizen_device_type()) == _DEV_FHUB)
+#define TIZEN_FEATURE_DA_REFERENCE ((get_tizen_device_type()) & (_DEV_FHUB | _DEV_DA))
 
 #define CONTAINER_FILE "/run/systemd/container"
 #define DBUS_HOST_SYSTEM_BUS_ADDRESS "unix:path=/run/host/dbus/system_bus_socket"