4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Atul Rai <a.rai@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
29 #include "bt-hal-log.h"
30 #include "bt-hal-msg.h"
31 #include "bt-hal-utils.h"
32 #include "bt-hal-rfcomm-dbus-handler.h"
34 static bt_status_t listen(btsock_type_t type, const char *service_name,
35 const uint8_t *uuid, int channel, int *sock_fd, int flags)
38 return BT_STATUS_UNSUPPORTED;
41 static bt_status_t connect(const bt_bdaddr_t *bd_addr, btsock_type_t type,
42 const uint8_t *uuid, int channel, int *sock_fd, int flags)
48 if (bd_addr == NULL || sock_fd == NULL) {
49 ERR("invalid parameters, bd_addr:%p, uuid:%p, channel:%d, sock_fd:%p",
50 bd_addr, uuid, channel, sock_fd);
51 return BT_STATUS_PARM_INVALID;
55 ERR("Currently we only support to connect using UUID");
56 return BT_STATUS_UNSUPPORTED;
59 INFO("channel: %d, sock_fd: %d, type: %d", channel, sock_fd, type);
63 /* Call rfcomm dbus handler to connect rfcomm client */
64 status = _bt_hal_dbus_handler_rfcomm_connect(
65 (unsigned char *)bd_addr->address,
66 (unsigned char *)uuid, sock_fd);
69 ERR("bt l2cap socket type not supported");
70 status = BT_STATUS_UNSUPPORTED;
73 ERR("bt sco socket not supported");
74 status = BT_STATUS_UNSUPPORTED;
77 ERR("unknown bt socket type:%d", type);
78 status = BT_STATUS_UNSUPPORTED;
90 static btsock_interface_t socket_if = {
91 .size = sizeof(socket_if),
96 btsock_interface_t *bt_get_socket_interface(void)