Implement bluetooth_rfcomm_listen() function 53/217753/6
authorWootak Jung <wootak.jung@samsung.com>
Thu, 14 Nov 2019 05:03:21 +0000 (14:03 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Mon, 18 Nov 2019 00:56:47 +0000 (00:56 +0000)
If user listens to rfcomm server by bluetooth_rfcomm_listen(),
connection requested callback should be occured not popup
when rfcomm connection request is come from client.

Change-Id: I688171b31c853e2761074f757f6a21fad1f7bcbd

15 files changed:
bt-oal/bluez_hal/inc/bt-hal-msg.h
bt-oal/bluez_hal/src/bt-hal-agent.c
bt-oal/bluez_hal/src/bt-hal-bluetooth.c
bt-oal/bluez_hal/src/bt-hal-device-dbus-handler.c
bt-oal/bluez_hal/src/bt-hal-device-dbus-handler.h
bt-oal/bluez_hal/src/bt-hal-gap-agent.c
bt-oal/bluez_hal/src/bt-hal-gap-agent.h
bt-oal/hardware/bluetooth.h
bt-oal/include/oal-device-mgr.h
bt-oal/include/oal-event.h
bt-oal/oal-adapter-mgr.c
bt-oal/oal-device-mgr.c
bt-service-adaptation/services/bt-service-common.c
bt-service-adaptation/services/obex/bt-service-obex-server.c
bt-service-adaptation/services/socket/bt-service-socket.c

index d30aaae..baa7977 100644 (file)
@@ -170,6 +170,9 @@ struct hal_ev_authorize_request {
 struct hal_ev_sock_conn_auth {
        uint8_t uuid[16];
        uint8_t bdaddr[6];
+       uint8_t name[249];
+       uint8_t path[249];
+       uint32_t fd;
 } __attribute__((packed));
 #endif //TIZEN_BT_HAL
 
index a71f26d..70d14e4 100644 (file)
@@ -266,7 +266,7 @@ static void __bt_hal_send_authorize_request_event(const gchar *address, const ch
 }
 
 #ifdef TIZEN_BT_HAL
-static void __bt_hal_send_rfcomm_authorize_request_event(const gchar *address, const char *uuid)
+static void __bt_hal_send_rfcomm_authorize_request_event(const gchar *address, const char *uuid, const char *name, char *path, int fd)
 {
        struct hal_ev_sock_conn_auth ev;
 
@@ -275,6 +275,11 @@ static void __bt_hal_send_rfcomm_authorize_request_event(const gchar *address, c
        memset(&ev, 0, sizeof(ev));
        _bt_hal_convert_addr_string_to_type(ev.bdaddr, address);
        _bt_hal_convert_uuid_string_to_type(ev.uuid, uuid);
+       if (name)
+               memcpy(ev.name, name, strlen(name) - 1);
+       if (path)
+               memcpy(ev.path, path, strlen(path) - 1);
+       ev.fd = fd;
 
        handle_stack_msg event_cb = _bt_hal_get_stack_message_handler();
        if (event_cb) {
@@ -723,6 +728,9 @@ static gboolean __bt_hal_authorize_request(GapAgentPrivate *agent, GDBusProxy *d
        GVariant *reply = NULL;
        GVariant *reply_temp = NULL;
        GVariant *tmp_value;
+#ifdef TIZEN_FEATURE_BT_RFCOMM_DIRECT
+       bt_hal_agent_osp_server_t *osp_server;
+#endif
 
        DBG("Authorize Request from Bluez Stack: UUID [%s]", uuid);
 
@@ -792,7 +800,7 @@ static gboolean __bt_hal_authorize_request(GapAgentPrivate *agent, GDBusProxy *d
 #ifdef TIZEN_BT_HAL
        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)) {
+                               agent->osp_servers, BT_OSP_SERVER_OBEX, NULL)) {
                        INFO("OSP server for OPP found, send event");
                        __bt_hal_send_authorize_request_event(address, uuid);
                        goto done;
@@ -804,11 +812,21 @@ static gboolean __bt_hal_authorize_request(GapAgentPrivate *agent, GDBusProxy *d
                }
        }
 
+#ifdef TIZEN_FEATURE_BT_RFCOMM_DIRECT
+       /* If user only listens(without accepts) to rfcomm server, occurs connection requested cb not popup */
+       osp_server = _bt_hal_gap_agent_find_osp_server_by_type(agent->osp_servers, BT_OSP_SERVER_RFCOMM, uuid);
+       if (osp_server) {
+               INFO("Found rfcomm osp server. path: %s, fd: %d", osp_server->path, osp_server->fd);
+               __bt_hal_send_rfcomm_authorize_request_event(address, uuid, name, osp_server->path, osp_server->fd);
+               goto done;
+       }
+#else
        if (_is_rfcomm_server_uuid(uuid)) {
-               __bt_hal_send_rfcomm_authorize_request_event(address, uuid);
+               __bt_hal_send_rfcomm_authorize_request_event(address, uuid, NULL, NULL, -1);
                goto done;
        }
 #endif
+#endif
 
        if (trust || !headed_plugin_info->plugin_headed_enabled) {
                INFO("Trusted or Headless device, so authorize\n");
index bc8fa72..3394a28 100644 (file)
@@ -351,10 +351,16 @@ static int get_service_connection_state(const bt_bdaddr_t *bd_addr, bt_service_i
        return _bt_hal_device_get_service_connection_state(bd_addr, rem_svc_id);
 }
 
-static int set_agent_osp_server(uint32_t type, uint8_t enable)
+static int register_agent_osp_server(uint32_t type, char *uuid, char *path, int fd)
 {
        DBG("");
-       return _bt_hal_device_set_osp_server(type, enable);
+       return _bt_hal_device_register_osp_server(type, uuid, path, fd);
+}
+
+static int unregister_agent_osp_server(uint32_t type, char *uuid)
+{
+       DBG("");
+       return _bt_hal_device_unregister_osp_server(type, uuid);
 }
 
 static int set_trusted_profile(bt_bdaddr_t *bd_addr, bt_trusted_profile_t profile, uint8_t trust)
@@ -462,7 +468,8 @@ static const bt_interface_t bluetooth_if = {
        .set_authorization = set_authorization,
 #ifdef TIZEN_BT_HAL
        .get_service_connection_state = get_service_connection_state,
-       .set_agent_osp_server = set_agent_osp_server,
+       .register_agent_osp_server = register_agent_osp_server,
+       .unregister_agent_osp_server = unregister_agent_osp_server,
        .set_trusted_profile = set_trusted_profile,
        .get_trusted_profile = get_trusted_profile,
        .enable_rssi_monitoring = enable_rssi_monitoring,
@@ -832,18 +839,24 @@ static void __bt_hal_handle_socket_authorize_request_event(void *buf, uint16_t l
        struct hal_ev_sock_conn_auth *ev = buf;
        bt_bdaddr_t bd_addr;
        bt_uuid_t uuid;
+       uint8_t name[249] = {0, };
+       uint8_t path[249] = {0, };
+       uint32_t fd;
 
        DBG("+");
 
        memcpy(bd_addr.address, ev->bdaddr, 6);
        memcpy(uuid.uu, ev->uuid, 16);
+       memcpy(name, ev->name, sizeof(name) - 1);
+       memcpy(path, ev->path, sizeof(name) - 1);
+       fd = ev->fd;
 
        if (!bt_hal_cbacks->socket_authorize_request_cb) {
                ERR("HAL User socket_authorize_request_cb is not set!!");
                return;
        }
 
-       bt_hal_cbacks->socket_authorize_request_cb(&bd_addr, &uuid);
+       bt_hal_cbacks->socket_authorize_request_cb(&bd_addr, &uuid, name, path, fd);
        DBG("-");
 }
 #endif
index f659ad8..7453f51 100644 (file)
@@ -1323,7 +1323,7 @@ int _bt_hal_device_get_service_connection_state(
        return 1;
 }
 
-int _bt_hal_device_set_osp_server(uint32_t type, gboolean enable)
+int _bt_hal_device_register_osp_server(uint32_t type, char *uuid, char *path, int fd)
 {
        GapAgentPrivate *agent = _bt_hal_get_adapter_agent();
        gboolean result = FALSE;
@@ -1332,11 +1332,24 @@ int _bt_hal_device_set_osp_server(uint32_t type, gboolean enable)
        if (!agent)
                return BT_STATUS_FAIL;
 
-       if (enable)
-               result = _bt_hal_gap_agent_register_osp_server(agent, type);
-       else
-               result = _bt_hal_gap_agent_unregister_osp_server(agent, type);
+       result = _bt_hal_gap_agent_register_osp_server(agent, type, uuid, path, fd);
+       if (!result)
+               return BT_STATUS_FAIL;
+
+       DBG("-");
+       return BT_STATUS_SUCCESS;
+}
+
+int _bt_hal_device_unregister_osp_server(uint32_t type, char *uuid)
+{
+       GapAgentPrivate *agent = _bt_hal_get_adapter_agent();
+       gboolean result = FALSE;
+
+       DBG("+");
+       if (!agent)
+               return BT_STATUS_FAIL;
 
+       result = _bt_hal_gap_agent_unregister_osp_server(agent, type, uuid);
        if (!result)
                return BT_STATUS_FAIL;
 
index b393709..9cea7bb 100644 (file)
@@ -66,8 +66,8 @@ int _bt_hal_device_get_connection_state(const bt_bdaddr_t *bd_addr);
 int _bt_hal_device_get_service_connection_state(
                const bt_bdaddr_t *bd_addr, bt_service_id_t rem_svc_id);
 
-int _bt_hal_device_set_osp_server(uint32_t type, gboolean enable);
-
+int _bt_hal_device_register_osp_server(uint32_t type, char *uuid, char *path, int fd);
+int _bt_hal_device_unregister_osp_server(uint32_t type, char *uuid);
 
 int _bt_hal_device_set_trusted_profile(const bt_bdaddr_t *bd_addr,
                bt_trusted_profile_t profile, uint8_t trust);
index 475cc16..47cbba4 100644 (file)
@@ -89,7 +89,8 @@ static void __bt_hal_free_osp_server(gpointer data)
        if (!server)
                return;
 
-       /* TODO: Free additional elements if present */
+       g_free(server->uuid);
+       g_free(server->path);
        g_free(server);
 
        DBG("-");
@@ -1046,7 +1047,7 @@ gboolean gap_agent_reply_authorize(GapAgentPrivate *agent, const guint accept,
 }
 
 #ifdef TIZEN_BT_HAL
-bt_hal_agent_osp_server_t *_bt_hal_gap_agent_find_osp_server_by_type(GSList *servers, unsigned int type)
+bt_hal_agent_osp_server_t *_bt_hal_gap_agent_find_osp_server_by_type(GSList *servers, unsigned int type, const char *uuid)
 {
        GSList *l;
        bt_hal_agent_osp_server_t *server;
@@ -1057,14 +1058,19 @@ bt_hal_agent_osp_server_t *_bt_hal_gap_agent_find_osp_server_by_type(GSList *ser
                if (server == NULL)
                        continue;
 
-               if (type == server->type)
+               /* No uuid in obex server */
+               if (type == BT_OSP_SERVER_OBEX
+                               && server->type == BT_OSP_SERVER_OBEX)
+                       return server;
+
+               if (g_strcmp0(server->uuid, uuid) == 0)
                        return server;
        }
 
        return NULL;
 }
 
-gboolean _bt_hal_gap_agent_register_osp_server(GapAgentPrivate *agent, unsigned int type)
+gboolean _bt_hal_gap_agent_register_osp_server(GapAgentPrivate *agent, unsigned int type, char *uuid, char *path, int fd)
 {
        bt_hal_agent_osp_server_t *server;
 
@@ -1079,13 +1085,18 @@ gboolean _bt_hal_gap_agent_register_osp_server(GapAgentPrivate *agent, unsigned
 
        server = g_malloc0(sizeof(bt_hal_agent_osp_server_t));
        server->type = type;
+       if (type == BT_OSP_SERVER_RFCOMM && uuid && path) {
+               server->uuid = g_strdup(uuid);
+               server->path = g_strdup(path);
+               server->fd = fd;
+       }
        priv->osp_servers = g_slist_append(priv->osp_servers, server);
 
        DBG("-");
        return TRUE;
 }
 
-gboolean _bt_hal_gap_agent_unregister_osp_server(GapAgentPrivate *agent, unsigned int type)
+gboolean _bt_hal_gap_agent_unregister_osp_server(GapAgentPrivate *agent, unsigned int type, char *uuid)
 {
        bt_hal_agent_osp_server_t *server;
 
@@ -1098,7 +1109,7 @@ gboolean _bt_hal_gap_agent_unregister_osp_server(GapAgentPrivate *agent, unsigne
        if (type >= BT_OSP_SERVER_MAX)
                return FALSE;
 
-       server = _bt_hal_gap_agent_find_osp_server_by_type(priv->osp_servers, type);
+       server = _bt_hal_gap_agent_find_osp_server_by_type(priv->osp_servers, type, uuid);
        if (server == NULL)
                return TRUE;
 
index b972bb6..67daab3 100644 (file)
@@ -29,7 +29,9 @@
 #ifdef TIZEN_BT_HAL
 typedef struct {
        unsigned int type;
-       /* TODO: Add more elements If and when required */
+       char *uuid;
+       char *path;
+       int fd;
 } bt_hal_agent_osp_server_t;
 #endif
 
@@ -119,10 +121,10 @@ gboolean gap_agent_reply_authorize(GapAgentPrivate *agent, const guint accept,
                GDBusMethodInvocation *context);
 
 #ifdef TIZEN_BT_HAL
-bt_hal_agent_osp_server_t *_bt_hal_gap_agent_find_osp_server_by_type(GSList *servers, unsigned int type);
+bt_hal_agent_osp_server_t *_bt_hal_gap_agent_find_osp_server_by_type(GSList *servers, unsigned int type, const char *uuid);
 
-gboolean _bt_hal_gap_agent_register_osp_server(GapAgentPrivate *agent, unsigned int type);
+gboolean _bt_hal_gap_agent_register_osp_server(GapAgentPrivate *agent, unsigned int type, char *uuid, char *path, int fd);
 
-gboolean _bt_hal_gap_agent_unregister_osp_server(GapAgentPrivate *agent, unsigned int type);
+gboolean _bt_hal_gap_agent_unregister_osp_server(GapAgentPrivate *agent, unsigned int type, char *uuid);
 #endif
 #endif //_BT_HAL_GAP_AGENT_H__
index 088a105..d48dc47 100644 (file)
@@ -457,7 +457,7 @@ typedef enum {
 
 #ifdef TIZEN_BT_HAL
 #define BT_OSP_SERVER_OBEX 0x00
-/* TODO: Add more types If and when required */
+#define BT_OSP_SERVER_RFCOMM 0x01
 #define BT_OSP_SERVER_MAX 0xFF
 
 /* Tizen BT discovery Types */
@@ -592,7 +592,7 @@ typedef void (*authorize_request_callback) (bt_bdaddr_t *remote_bd_addr, bt_serv
 
 #ifdef TIZEN_BT_HAL
 /* Service level Authorization request callback */
-typedef void (*sock_authorize_request_callback) (bt_bdaddr_t *remote_bd_addr, bt_uuid_t *uuid);
+typedef void (*sock_authorize_request_callback) (bt_bdaddr_t *remote_bd_addr, bt_uuid_t *uuid, uint8_t *name, uint8_t *path, uint32_t fd);
 
 /** Bluetooth ACL connection state */
 typedef enum {
@@ -844,10 +844,14 @@ typedef struct {
        int (*get_service_connection_state)(const bt_bdaddr_t *bd_addr, bt_service_id_t rem_svc_id);
 
        /*
-        * Enable/Disable osp server in gap agent.
-        * enable == 0/1 -> Register/Unregister osp server.
+        * Register osp server in gap agent.
         */
-       int (*set_agent_osp_server)(uint32_t type, uint8_t enable);
+       int (*register_agent_osp_server)(uint32_t type, char *uuid, char *path, int fd);
+
+       /*
+        * Unregister osp server in gap agent.
+        */
+       int (*unregister_agent_osp_server)(uint32_t type, char *uuid);
 
        /**
         * Set profile as trusted for remote device
index 025c761..2d1d583 100755 (executable)
@@ -36,19 +36,20 @@ extern "C" {
  */
 
 typedef enum {
-       CONN_TYPE_DEFAULT = 0xFF, /* represents that connection type can both BR/EDR and LE */
-       CONN_TYPE_BREDR = 0x00,
-       CONN_TYPE_LE = 0x01,
-} connection_type_e;
+       OAL_CONN_TYPE_DEFAULT = 0xFF, /* represents that connection type can both BR/EDR and LE */
+       OAL_CONN_TYPE_BREDR = 0x00,
+       OAL_CONN_TYPE_LE = 0x01,
+} oal_conn_type_e;
 
 /**
  * @brief OSP server type
  *
  * @see device_set_osp_server()
+ * @see device_register_osp_server()
  */
 typedef enum {
        OAL_OSP_SERVER_OBEX = 0x00,
-       /*TODO: Add more server type if and when required */
+       OAL_OSP_SERVER_RFCOMM
 } oal_osp_server_type_e;
 
 /**
@@ -124,7 +125,7 @@ oal_status_t device_set_alias(bt_address_t * addr, char * alias);
  * @see  OAL_EVENT_DEVICE_BONDING_SUCCESS
  * @see  OAL_EVENT_DEVICE_BONDING_FAILED
  */
-oal_status_t device_create_bond(bt_address_t * addr, connection_type_e transport);
+oal_status_t device_create_bond(bt_address_t * addr, oal_conn_type_e transport);
 
 /**
  * @brief Cancel already in-progress bonding procedure
@@ -330,19 +331,36 @@ gboolean device_get_acl_conn_state(bt_address_t * addr);
 gboolean device_get_svc_conn_state(bt_address_t * addr, oal_service_t svc_id);
 
 /**
- * @brief Set OSP server status in GAP agent
+ * @brief Register OSP server in GAP agent
  *
- * @details This API is to enable/disable OSP server in GAP agent. if OSP server is enabled,
+ * @details This API is to register OSP server in GAP agent. if OSP server is enabled,
  * connection authorization events are sent to application otherwise handled internally in HAL.
  *
- * @param[in] tpye : OSP Server type
- * @param[in] enable: 0 -> enable server, 1 -> Disable server
+ * @param[in] type: OSP Server type
+ * @param[in] uuid: UUID
+ * @param[in] path: Dbus path
+ * @param[in] fd: Socket fd
  *
  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
  *
  * @pre Adapter must be enabled with adapter_enable() followed by OAL_EVENT_ADAPTER_ENABLED
  */
-oal_status_t device_set_osp_server(oal_osp_server_type_e type, int enable);
+oal_status_t device_register_osp_server(oal_osp_server_type_e type, char *uuid, char *path, int fd);
+
+/**
+ * @brief Unregister OSP server in GAP agent
+ *
+ * @details This API is to unregister OSP server in GAP agent. if OSP server is enabled,
+ * connection authorization events are sent to application otherwise handled internally in HAL.
+ *
+ * @param[in] type: OSP Server type
+ * @param[in] uuid: UUID
+ *
+ * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
+ *
+ * @pre Adapter must be enabled with adapter_enable() followed by OAL_EVENT_ADAPTER_ENABLED
+ */
+oal_status_t device_unregister_osp_server(oal_osp_server_type_e type, char *uuid);
 
 /**
  * @brief Set profile trust info for remote device
index b095a8c..330d1e3 100644 (file)
@@ -254,6 +254,9 @@ typedef struct {
 typedef struct {
        bt_address_t address;
        oal_uuid_t uuid;
+       uint8_t name[249];
+       uint8_t path[249];
+       uint32_t fd;
 } event_socket_authorize_req_t;
 
 typedef struct {
index 65e6abd..e32572c 100644 (file)
@@ -71,7 +71,7 @@ extern void cb_device_ssp_request(bt_bdaddr_t *bd_addr, bt_bdname_t *bdname, uin
 extern void cb_device_authorize_request(bt_bdaddr_t *remote_bd_addr, bt_service_id_t service_d);
 extern void cb_device_trust_state_changed(bt_bdaddr_t *remote_bd_addr, bt_device_trust_state_t trusted);
 #ifdef TIZEN_BT_HAL
-extern void cb_socket_conn_authorize_request(bt_bdaddr_t *remote_bd_addr, bt_uuid_t *uuid);
+extern void cb_socket_conn_authorize_request(bt_bdaddr_t *remote_bd_addr, bt_uuid_t *uuid, uint8_t *name, uint8_t *path, uint32_t fd);
 static void cb_ble_state_change(bt_state_t status);
 extern void cb_device_le_conn_state_changed(bt_status_t status, bt_bdaddr_t *bd_addr,
                bt_le_conn_state_t state);
index df06cee..69ceaf3 100755 (executable)
@@ -119,7 +119,7 @@ oal_status_t device_set_alias(bt_address_t * addr, char * alias)
        return OAL_STATUS_SUCCESS;
 }
 
-oal_status_t device_create_bond(bt_address_t *addr, connection_type_e transport)
+oal_status_t device_create_bond(bt_address_t *addr, oal_conn_type_e transport)
 {
        int res;
        bdstr_t bdstr;
@@ -385,7 +385,7 @@ gboolean device_get_svc_conn_state(bt_address_t * addr, oal_service_t svc_id)
        return res;
 }
 
-oal_status_t device_set_osp_server(oal_osp_server_type_e type, int enable)
+oal_status_t device_register_osp_server(oal_osp_server_type_e type, char *uuid, char *path, int fd)
 {
        int res;
        uint32_t server_type;
@@ -399,14 +399,53 @@ oal_status_t device_set_osp_server(oal_osp_server_type_e type, int enable)
        case OAL_OSP_SERVER_OBEX:
                server_type = BT_OSP_SERVER_OBEX;
                break;
+       case OAL_OSP_SERVER_RFCOMM:
+               server_type = BT_OSP_SERVER_RFCOMM;
+               break;
+       default:
+               BT_ERR("unknown type: %d", type);
+               return OAL_STATUS_INVALID_PARAM;
+       }
+
+       res = blued_api->register_agent_osp_server(server_type, uuid, path, fd);
+       if (res != BT_STATUS_SUCCESS) {
+               BT_ERR("register_agent_osp_server error: [%s]", status2string(res));
+               return convert_to_oal_status(res);
+       }
+
+       return OAL_STATUS_SUCCESS;
+#else
+       BT_ERR("Not supported");
+       res = OAL_STATUS_NOT_SUPPORT;
+       return res;
+#endif
+}
+
+oal_status_t device_unregister_osp_server(oal_osp_server_type_e type, char *uuid)
+{
+       int res;
+       uint32_t server_type;
+
+       CHECK_OAL_INITIALIZED();
+
+       API_TRACE("type: %d", type);
+
+#ifdef TIZEN_BT_HAL
+       switch (type) {
+       case OAL_OSP_SERVER_OBEX:
+               server_type = BT_OSP_SERVER_OBEX;
+               break;
+       case OAL_OSP_SERVER_RFCOMM:
+               server_type = BT_OSP_SERVER_RFCOMM;
+               break;
        default:
                BT_ERR("unknown type: %d", type);
                return OAL_STATUS_INVALID_PARAM;
        }
 
-       res = blued_api->set_agent_osp_server(server_type, enable);
+       res = blued_api->unregister_agent_osp_server(server_type, uuid);
        if (res != BT_STATUS_SUCCESS) {
-               BT_ERR("set_agent_osp_server error: [%s]", status2string(res));
+               BT_ERR("unregister_agent_osp_server error: [%s]", status2string(res));
                return convert_to_oal_status(res);
        }
 
@@ -886,12 +925,15 @@ void cb_device_trust_state_changed(bt_bdaddr_t *bd_addr, bt_device_trust_state_t
 }
 
 #ifdef TIZEN_BT_HAL
-void cb_socket_conn_authorize_request(bt_bdaddr_t *bd_addr, bt_uuid_t *uuid)
+void cb_socket_conn_authorize_request(bt_bdaddr_t *bd_addr, bt_uuid_t *uuid, uint8_t *name, uint8_t *path, uint32_t fd)
 {
        event_socket_authorize_req_t *auth_req = g_new0(event_socket_authorize_req_t, 1);
 
        memcpy(auth_req->address.addr, bd_addr->address, 6);
        memcpy(auth_req->uuid.uuid, uuid->uu, 16);
+       memcpy(auth_req->name, name, sizeof(auth_req->name) - 1);
+       memcpy(auth_req->path, path, sizeof(auth_req->path) - 1);
+       auth_req->fd = fd;
 
        send_event_bda_trace(OAL_EVENT_SOCKET_AUTHORIZE_REQUEST, auth_req, sizeof(event_socket_authorize_req_t), (bt_address_t*)bd_addr);
 }
index d2e9ee8..573d842 100644 (file)
@@ -40,6 +40,7 @@
 #include "bt-service-common.h"
 
 #include <oal-manager.h>
+#include <oal-device-mgr.h>
 
 #ifdef TIZEN_FEATURE_BT_IPSP
 static GDBusProxy *ipsp_proxy;
@@ -560,6 +561,9 @@ int _bt_register_osp_server_in_agent(int type, char *uuid, char *path, int fd)
 #if TODO_40 /* Need to add this function */
        if (!_bt_agent_register_osp_server(type, uuid, path, fd))
                return BLUETOOTH_ERROR_INTERNAL;
+#else
+       if (device_register_osp_server(type, uuid, path, fd) != 0)
+               return BLUETOOTH_ERROR_INTERNAL;
 #endif
        return BLUETOOTH_ERROR_NONE;
 }
@@ -571,6 +575,9 @@ int _bt_unregister_osp_server_in_agent(int type, char *uuid)
 #if TODO_40 /* Need to add this function */
        if (!_bt_agent_unregister_osp_server(type, uuid))
                return BLUETOOTH_ERROR_INTERNAL;
+#else
+       if (device_unregister_osp_server(type, uuid) != 0)
+               return BLUETOOTH_ERROR_INTERNAL;
 #endif
        return BLUETOOTH_ERROR_NONE;
 }
index baa9690..483c71f 100644 (file)
@@ -1109,8 +1109,8 @@ int _bt_obex_server_allocate(char *sender, const char *dest_path, int app_pid, g
                agent_info.native_server->app_pid = app_pid;
                agent_info.server_type = BT_NATIVE_SERVER;
                if (OAL_STATUS_SUCCESS !=
-                       device_set_osp_server(OAL_OSP_SERVER_OBEX, FALSE))
-                       BT_ERR("device_set_osp_server failed");
+                       device_unregister_osp_server(OAL_OSP_SERVER_OBEX, NULL))
+                       BT_ERR("device_unregister_osp_server failed");
        } else {
                if (agent_info.custom_server) {
                        BT_ERR("obex custom server busy");
@@ -1125,8 +1125,8 @@ int _bt_obex_server_allocate(char *sender, const char *dest_path, int app_pid, g
                agent_info.custom_server->app_pid = app_pid;
                agent_info.server_type = BT_CUSTOM_SERVER;
                if (OAL_STATUS_SUCCESS !=
-                       device_set_osp_server(OAL_OSP_SERVER_OBEX, TRUE))
-                       BT_ERR("device_set_osp_server failed");
+                       device_register_osp_server(OAL_OSP_SERVER_OBEX, NULL, NULL, -1))
+                       BT_ERR("device_register_osp_server failed");
        }
 
        g_free(dst_path);
@@ -1153,8 +1153,8 @@ int _bt_obex_server_deallocate(int app_pid, gboolean is_native)
                        agent_info.server_type = BT_CUSTOM_SERVER;
 
                        if (OAL_STATUS_SUCCESS !=
-                               device_set_osp_server(OAL_OSP_SERVER_OBEX, TRUE))
-                               BT_ERR("device_set_osp_server failed");
+                               device_register_osp_server(OAL_OSP_SERVER_OBEX, NULL, NULL, -1))
+                               BT_ERR("device_register_osp_server failed");
                }
        } else {
                retv_if(agent_info.custom_server == NULL,
@@ -1174,8 +1174,8 @@ int _bt_obex_server_deallocate(int app_pid, gboolean is_native)
                        agent_info.server_type = BT_NATIVE_SERVER;
 
                        if (OAL_STATUS_SUCCESS !=
-                               device_set_osp_server(OAL_OSP_SERVER_OBEX, FALSE))
-                               BT_ERR("device_set_osp_server failed");
+                               device_unregister_osp_server(OAL_OSP_SERVER_OBEX, NULL))
+                               BT_ERR("device_unregister_osp_server failed");
                }
        }
 
index 359488c..a51dfde 100644 (file)
@@ -125,15 +125,21 @@ static void __handle_socket_authorization_request(event_socket_authorize_req_t *
        char address[BT_ADDRESS_STRING_SIZE];
        char uuid_str[BT_UUID_STRING_SIZE];
        int result = BLUETOOTH_ERROR_NONE;
+       char name[249] = {0, };
+       char path[249] = {0, };
+       int fd;
 
        BT_DBG("+");
 
        _bt_convert_addr_type_to_string(address, auth_event->address.addr);
        _bt_service_convert_uuid_type_to_string(uuid_str, auth_event->uuid.uuid);
-       BT_INFO("Address: %s, UUID: %s", address, uuid_str);
+       memcpy(name, auth_event->name, sizeof(auth_event->name) - 1);
+       memcpy(path, auth_event->path, sizeof(auth_event->path) - 1);
+       fd = auth_event->fd;
+       BT_INFO("Address: %s, UUID: %s, Name: %s, Path: %s, Fd: %d", address, uuid_str, name, path, fd);
        _bt_send_event(BT_RFCOMM_SERVER_EVENT,
                        BLUETOOTH_EVENT_RFCOMM_AUTHORIZE,
-                       g_variant_new("(iss)", result, address, uuid_str));
+                       g_variant_new("(issssn)", result, address, uuid_str, name, path, fd));
        BT_DBG("-");
 }