4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Hocheol Seo <hocheol.seo@samsung.com>
7 * Girishashok Joshi <girish.joshi@samsung.com>
8 * Chanyeol Park <chanyeol.park@samsung.com>
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
24 //#include <dbus/dbus-glib.h>
25 //#include <dbus/dbus.h>
29 #include <sys/socket.h>
32 #include "bluetooth-api.h"
33 #include "bt-internal-types.h"
35 #include "bt-service-common.h"
36 #include "bt-service-event.h"
37 #include "bt-service-util.h"
38 #include "bt-service-rfcomm-client.h"
39 #include "bt-service-rfcomm-server.h"
40 #include "bt-service-agent.h"
42 /* Range of RFCOMM server ID : 0 ~ 244 */
43 #define BT_RFCOMM_SERVER_ID_MAX 245
45 #define BT_RFCOMM_PROXY_ADDRESS "x00/bluez/rfcomm"
46 #define BT_RFCOMM_SOCKET_ADDRESS "/bluez/rfcomm"
52 } bt_rfcomm_event_info_t;
55 bt_rfcomm_server_info_t *_bt_rfcomm_get_server_info_using_uuid(char *uuid)
58 bt_rfcomm_server_info_t *server_info;
60 retv_if(uuid == NULL, NULL);
62 for (l = server_list; l != NULL; l = l->next) {
63 server_info = l->data;
65 if (server_info == NULL)
68 if (g_strcmp0(server_info->uuid, uuid) == 0)
75 int _bt_rfcomm_create_socket(char *sender, char *uuid)
77 return BLUETOOTH_ERROR_INTERNAL;
80 int __bt_rfcomm_server_get_address(bt_rfcomm_server_info_t *server_info)
82 return BLUETOOTH_ERROR_NONE;
85 int _bt_rfcomm_listen(int socket_fd, int max_pending, gboolean is_native)
87 return BLUETOOTH_ERROR_NONE;
90 int _bt_rfcomm_remove_socket(int socket_fd)
92 return BLUETOOTH_ERROR_NONE;
95 int _bt_rfcomm_server_disconnect(int data_fd)
97 return BLUETOOTH_ERROR_NONE;
100 /* To support the BOT */
101 int _bt_rfcomm_is_uuid_available(char *uuid, gboolean *available)
103 return BLUETOOTH_ERROR_NONE;
106 /* To support the BOT */
107 int _bt_rfcomm_accept_connection(void)
110 if (!_bt_agent_reply_authorize(TRUE))
111 return BLUETOOTH_ERROR_INTERNAL;
114 return BLUETOOTH_ERROR_NONE;
117 /* To support the BOT */
118 int _bt_rfcomm_reject_connection(void)
121 if (!_bt_agent_reply_authorize(FALSE))
122 return BLUETOOTH_ERROR_INTERNAL;
125 return BLUETOOTH_ERROR_NONE;
128 int _bt_rfcomm_server_disconnect_all_connection(void)
131 bt_rfcomm_server_info_t *server_info;
133 for (l = server_list; l != NULL; l = l->next) {
134 server_info = l->data;
136 if (server_info == NULL)
139 _bt_rfcomm_disconnect(server_info->data_fd);
142 return BLUETOOTH_ERROR_NONE;
145 int _bt_rfcomm_server_check_existence(gboolean *existence)
147 BT_CHECK_PARAMETER(existence, return);
149 if (server_list && g_slist_length(server_list) > 0) {
155 return BLUETOOTH_ERROR_NONE;
158 int _bt_rfcomm_server_check_termination(char *name)
161 bt_rfcomm_server_info_t *server_info;
163 BT_CHECK_PARAMETER(name, return);
165 for (l = server_list; l != NULL; l = l->next) {
166 server_info = l->data;
168 if (server_info == NULL)
171 if (g_strcmp0(server_info->sender, name) == 0) {
172 _bt_rfcomm_remove_socket(server_info->control_fd);
176 return BLUETOOTH_ERROR_NONE;