2 * Copyright (C) 2013 Intel Corporation
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
26 #include "hal-utils.h"
29 static bt_status_t socket_listen(btsock_type_t type, const char *service_name,
30 const uint8_t *uuid, int chan,
33 struct hal_cmd_socket_listen cmd;
36 return BT_STATUS_PARM_INVALID;
38 DBG("uuid %s chan %d sock %p type %d service_name %s flags 0x%02x",
39 btuuid2str(uuid), chan, sock, type, service_name, flags);
41 memset(&cmd, 0, sizeof(cmd));
43 /* type match IPC type */
49 memcpy(cmd.uuid, uuid, sizeof(cmd.uuid));
52 memcpy(cmd.name, service_name, strlen(service_name));
54 return hal_ipc_cmd(HAL_SERVICE_ID_SOCKET, HAL_OP_SOCKET_LISTEN,
55 sizeof(cmd), &cmd, NULL, NULL, sock);
58 static bt_status_t socket_connect(const bt_bdaddr_t *bdaddr, btsock_type_t type,
59 const uint8_t *uuid, int chan,
62 struct hal_cmd_socket_connect cmd;
65 return BT_STATUS_PARM_INVALID;
67 DBG("bdaddr %s uuid %s chan %d sock %p type %d flags 0x%02x",
68 bdaddr2str(bdaddr), btuuid2str(uuid), chan, sock, type, flags);
70 memset(&cmd, 0, sizeof(cmd));
72 /* type match IPC type */
78 memcpy(cmd.uuid, uuid, sizeof(cmd.uuid));
81 memcpy(cmd.bdaddr, bdaddr, sizeof(cmd.bdaddr));
83 return hal_ipc_cmd(HAL_SERVICE_ID_SOCKET, HAL_OP_SOCKET_CONNECT,
84 sizeof(cmd), &cmd, NULL, NULL, sock);
87 static btsock_interface_t socket_if = {
93 btsock_interface_t *bt_get_socket_interface(void)