CAPI/Socket: Implement function bt_socket_listen_and_accept_rfcomm 10/22710/1
authorWu Jiangbo <jiangbox.wu@intel.com>
Tue, 10 Jun 2014 03:38:01 +0000 (11:38 +0800)
committerWu Jiangbo <jiangbox.wu@intel.com>
Tue, 10 Jun 2014 11:34:47 +0000 (19:34 +0800)
Change-Id: Iedd638a7c5464be5c5624427d72a26d8f91de4c5
Signed-off-by: Wu Jiangbo <jiangbox.wu@intel.com>
capi/bluetooth.c

index 53b4c0f..68e67f0 100644 (file)
@@ -4087,6 +4087,25 @@ int bt_socket_listen(int socket_fd, int max_pending_connections)
        return BT_SUCCESS;
 }
 
+int bt_socket_listen_and_accept_rfcomm(int socket_fd,
+                               int max_pending_connections)
+{
+       struct spp_context *spp_ctx;
+
+       spp_ctx = find_spp_context_from_socketfd(socket_fd);
+       if (spp_ctx == NULL)
+               return BT_ERROR_OPERATION_FAILED;
+
+       if (max_pending_connections > 0)
+               spp_ctx->max_pending = max_pending_connections;
+       else
+               spp_ctx->max_pending = -1;
+
+       spp_ctx->is_accept = true;
+
+       return BT_SUCCESS;
+}
+
 int bt_socket_set_connection_state_changed_cb(
                        bt_socket_connection_state_changed_cb callback,
                        void *user_data)