Add auto accept and set trusted logic for robot 80/259180/1 accepted/tizen/unified/20210607.124412 submit/tizen/20210606.232858
authorWootak Jung <wootak.jung@samsung.com>
Wed, 2 Jun 2021 02:01:30 +0000 (11:01 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Wed, 2 Jun 2021 02:01:30 +0000 (11:01 +0900)
Change-Id: If99c752a1163c611eb461503093f5b6f4723c5fe

bt-oal/bluez_hal/src/bt-hal-agent.c
include/bt-internal-types.h

index 79e7310c7d0e877cdbe086c467db4b714d4d9796..1c89e726c5663fabde82367d98acb4f0c8b40166 100644 (file)
@@ -50,6 +50,7 @@
 
 #include "bt-hal-adapter-dbus-handler.h"
 #include "bt-hal-rfcomm-dbus-handler.h"
+#include "bt-hal-device-dbus-handler.h"
 #include "bt-hal-event-receiver.h"
 
 #include <bt-hal-agent.h>
@@ -712,6 +713,15 @@ static gboolean __bt_hal_confirm_request(GapAgentPrivate *agent, GDBusProxy *dev
                        gap_agent_reply_confirmation(agent, GAP_AGENT_ACCEPT, NULL);
                }
 
+               if (TIZEN_FEATURE_ROBOT_REFERENCE) {
+                       bt_bdaddr_t bdaddr;
+                       DBG("Robot Device. Auto Accept and Set Trusted");
+                       /* Reply the ssp confirmation automaticaly */
+                       gap_agent_reply_confirmation(agent, GAP_AGENT_ACCEPT, NULL);
+                       _bt_hal_convert_addr_string_to_type(bdaddr.address, address);
+                       _bt_hal_device_set_trust(&bdaddr, 1);
+               }
+
                __bt_hal_send_ssp_request_events(address, name, passkey,
                                device_class, BT_SSP_VARIANT_PASSKEY_CONFIRMATION);
        }
index 86415eaa7633459ed0514b5e64883d2fffd1142f..decd3037748cc2e476790162bdb0966668f98019 100644 (file)
@@ -802,6 +802,7 @@ typedef enum {
        _MODEL_TW2 = 0x10,
        _MODEL_TW3 = 0x20,
        _MODEL_RPI3 = 0x40,
+       _MODEL_ROBOT = 0x80,
 } tizen_model_t;
 
 /* For optimization, make this extern and define in a shared C file */
@@ -885,6 +886,8 @@ static inline tizen_model_t get_tizen_model(void)
                model = _MODEL_TW3;
        else if (!strcasecmp(model_name, "rpi3"))
                model = _MODEL_RPI3;
+       else if (!strcasecmp(model_name, "gems"))
+               model = _MODEL_ROBOT;
        else
                model = _MODEL_COMMON;
 
@@ -918,6 +921,7 @@ static inline bool get_tizen_feature_supported(char *feature)
 #define TIZEN_FEATURE_AUDIO_CALL_SUPPORTED (get_tizen_feature_supported(BT_FEATURE_AUDIO_CALL) == true)
 #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)
 
 #ifdef __cplusplus
 }