Enable the connection request event for custom obex server 21/196521/1 accepted/tizen/unified/20190103.061728 submit/tizen/20190102.044100
authorDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 2 Jan 2019 04:04:55 +0000 (13:04 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 2 Jan 2019 04:04:55 +0000 (13:04 +0900)
Change-Id: Id4a07fa2018cfd5eba778e0655bf6292b560cbbb
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
bt-oal/bluez_hal/src/bt-hal-agent.c
bt-service-adaptation/services/bt-request-handler.c
bt-service-adaptation/services/device/bt-service-core-device.c
bt-service-adaptation/services/obex/bt-service-obex-server.c
bt-service-adaptation/services/obex/include/bt-service-obex-server.h

index fc15cf8..4e57787 100644 (file)
@@ -779,12 +779,18 @@ static gboolean __bt_hal_authorize_request(GapAgentPrivate *agent, GDBusProxy *d
        }
 
 #ifdef TIZEN_BT_HAL
-       if (!strcasecmp(uuid, BT_HAL_OPP_UUID) &&
-               (NULL != _bt_hal_gap_agent_find_osp_server_by_type(
-                               agent->osp_servers, BT_OSP_SERVER_OBEX))) {
-               INFO("OSP server for OPP found, send event");
-               __bt_hal_send_authorize_request_event(address, uuid);
-               goto done;
+       if (!strcasecmp(uuid, BT_HAL_OPP_UUID)) {
+               if (NULL != _bt_hal_gap_agent_find_osp_server_by_type(
+                               agent->osp_servers, BT_OSP_SERVER_OBEX)) {
+                       INFO("OSP server for OPP found, send event");
+                       __bt_hal_send_authorize_request_event(address, uuid);
+                       goto done;
+               } else {
+                       INFO("Native OPP server, auto accept");
+                       gap_agent_reply_authorize(agent,
+                                       GAP_AGENT_ACCEPT, NULL);
+                       goto done;
+               }
        }
 
        if (_is_rfcomm_server_uuid(uuid)) {
index e369320..05f8c69 100644 (file)
@@ -232,8 +232,7 @@ static gboolean __bt_is_sync_function(int service_function)
                        || service_function == BT_GATT_WATCH_CHARACTERISTIC
                        || service_function == BT_GATT_ACQUIRE_WRITE
 #endif
-                       || service_function == BT_AUDIO_SELECT_ROLE
-                       || service_function == BT_OBEX_SERVER_ACCEPT_CONNECTION)
+                       || service_function == BT_AUDIO_SELECT_ROLE)
                return TRUE;
        else
                return FALSE;
index e694ceb..e055615 100644 (file)
@@ -599,7 +599,14 @@ static void __bt_device_authorization_request_callback(event_dev_authorize_req_t
 #ifdef TIZEN_FEATURE_BT_OBEX
        case OPP_SERVICE_ID: {
                GVariant *param = NULL;
-               char *name = g_strdup(address); /* TODO: Retrieve and send correct name in OBEX conn auth req event */
+               char *name = NULL;
+
+               if (_bt_obex_server_is_custom() == false) {
+                       /* Allow the connection for native OPP server */
+                       break;
+               }
+
+               name = g_strdup(address);
 
                BT_INFO("Incoming OPP conn Req from device addr [%s]", address);
                _bt_obex_server_set_pending_conn_auth_device_addr(address);
index d74263a..56c6eab 100644 (file)
@@ -1452,38 +1452,6 @@ int _bt_obex_server_is_receiving(gboolean *receiving)
        return BLUETOOTH_ERROR_NONE;
 }
 
-gboolean __bt_obex_server_accept_timeout_cb(gpointer user_data)
-{
-       request_info_t *req_info;
-       GVariant *out_param1 = NULL;
-       int result = BLUETOOTH_ERROR_TIMEOUT;
-
-       /* Already reply in _bt_obex_transfer_started */
-       retv_if(agent_info.accept_id == 0, FALSE);
-
-       req_info = _bt_get_request_info(agent_info.accept_id);
-       if (req_info == NULL || req_info->context == NULL) {
-               BT_ERR("info is NULL");
-               return FALSE;
-       }
-
-       agent_info.accept_id = 0;
-       GArray *g_out_param1 = NULL;
-       g_out_param1 = g_array_new(FALSE, FALSE, sizeof(gchar));
-       if (out_param1 == NULL) {
-               out_param1 = g_variant_new_from_data((const GVariantType *)"ay",
-                               g_out_param1->data, g_out_param1->len,
-                               TRUE, NULL, NULL);
-       }
-
-       g_dbus_method_invocation_return_value(req_info->context,
-                       g_variant_new("(iv)", result, out_param1));
-       g_array_free(g_out_param1, TRUE);
-       _bt_delete_request_list(req_info->req_id);
-
-       return FALSE;
-}
-
 void _bt_obex_server_set_pending_conn_auth_device_addr(const char *address)
 {
        if (pending_auth_address)
@@ -1510,10 +1478,6 @@ int _bt_obex_server_accept_connection(int request_id)
 
        agent_info.accept_id = request_id;
 
-       g_timeout_add(BT_SERVER_ACCEPT_TIMEOUT,
-                       (GSourceFunc)__bt_obex_server_accept_timeout_cb,
-                       NULL);
-
        return BLUETOOTH_ERROR_NONE;
 }
 
@@ -1551,3 +1515,9 @@ int _bt_opp_get_server_progress(int transfer_id, guint8 *progress)
        BT_DBG("Percentage: %d", *progress);
        return BLUETOOTH_ERROR_NONE;
 }
+
+gboolean _bt_obex_server_is_custom(void)
+{
+       return (agent_info.server_type == BT_CUSTOM_SERVER) ? TRUE : FALSE;
+}
+
index 8cf27bf..d4dd3c5 100644 (file)
@@ -82,6 +82,8 @@ void _bt_obex_server_reply_accept(void);
 
 void _bt_obex_server_set_pending_conn_auth_device_addr(const char *address);
 
+gboolean _bt_obex_server_is_custom(void);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */