rfcomm_cb_data_t *info;
GIOChannel *data_io;
rfcomm_conn_info_t *conn_info = NULL;
- BT_DBG("%s %d", path, fd);
char address[BT_ADDRESS_STRING_SIZE];
+
+ BT_INFO("%s %d", path, fd);
+
_bt_convert_addr_type_to_string(address,
(unsigned char *)addr);
+
info = __find_rfcomm_info_from_path(path);
- if (info == NULL)
+ if (info == NULL) {
+ BT_ERR("rfcomm info is NULL");
return -1;
- conn_info = __get_conn_info_from_address(info, address);
+ }
+ conn_info = __get_conn_info_from_address(info, address);
if (conn_info == NULL) {
- BT_ERR("Device Address %s not found in connection list", address);
+ BT_ERR("connection info is NULL");
return -1;
}
+
conn_info->fd = fd;
- BT_DBG("connection info fd %d", conn_info->fd);
+
data_io = g_io_channel_unix_new(fd);
+
g_io_channel_set_encoding(data_io, NULL, NULL);
g_io_channel_set_flags(data_io, G_IO_FLAG_NONBLOCK, NULL);
+
conn_info->watch_id = g_io_add_watch(data_io,
G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
__client_data_received_cb, info);
if (info == NULL)
return -1;
+#ifdef TIZEN_DPM_ENABLE
+ if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED) {
+ char addr_str[20];
+
+ BT_ERR("Not allow to use SPP profile");
+
+ close(fd);
+ _bt_convert_addr_type_to_string(addr_str, addr->addr);
+ _bt_disconnect_profile(addr_str, info->uuid, NULL,NULL);
+
+ return -1;
+ }
+#endif
+
conn = g_new0(rfcomm_conn_t, 1);
conn->fd = fd;
memcpy(&conn->addr, addr, sizeof(bluetooth_device_address_t));