2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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.
18 #include <dbus/dbus.h>
22 #include <sys/socket.h>
25 #include "bluetooth-api.h"
26 #include "bt-internal-types.h"
28 #include "bt-service-common.h"
29 #include "bt-service-event.h"
30 #include "bt-service-util.h"
31 #include "bt-service-rfcomm-client.h"
32 #include "bt-service-rfcomm-server.h"
33 #include "bt-service-agent.h"
35 /* Range of RFCOMM server ID : 0 ~ 244 */
36 #define BT_RFCOMM_SERVER_ID_MAX 245
38 #define BT_RFCOMM_PROXY_ADDRESS "x00/bluez/rfcomm"
39 #define BT_RFCOMM_SOCKET_ADDRESS "/bluez/rfcomm"
45 } bt_rfcomm_event_info_t;
48 bt_rfcomm_server_info_t *_bt_rfcomm_get_server_info_using_uuid(char *uuid)
51 bt_rfcomm_server_info_t *server_info;
53 retv_if(uuid == NULL, NULL);
55 for (l = server_list; l != NULL; l = l->next) {
56 server_info = l->data;
58 if (server_info == NULL)
61 if (g_strcmp0(server_info->uuid, uuid) == 0)
68 int _bt_rfcomm_create_socket(char *sender, char *uuid)
70 return BLUETOOTH_ERROR_INTERNAL;
73 int __bt_rfcomm_server_get_address(bt_rfcomm_server_info_t *server_info)
75 return BLUETOOTH_ERROR_NONE;
78 int _bt_rfcomm_listen(int socket_fd, int max_pending, gboolean is_native)
80 return BLUETOOTH_ERROR_NONE;
83 int _bt_rfcomm_remove_socket(int socket_fd)
85 return BLUETOOTH_ERROR_NONE;
88 int _bt_rfcomm_server_disconnect(int data_fd)
90 return BLUETOOTH_ERROR_NONE;
93 /* To support the BOT */
94 int _bt_rfcomm_is_uuid_available(char *uuid, gboolean *available)
96 return BLUETOOTH_ERROR_NONE;
99 /* To support the BOT */
100 int _bt_rfcomm_accept_connection(void)
103 if (!_bt_agent_reply_authorize(TRUE))
104 return BLUETOOTH_ERROR_INTERNAL;
107 return BLUETOOTH_ERROR_NONE;
110 /* To support the BOT */
111 int _bt_rfcomm_reject_connection(void)
114 if (!_bt_agent_reply_authorize(FALSE))
115 return BLUETOOTH_ERROR_INTERNAL;
118 return BLUETOOTH_ERROR_NONE;
121 int _bt_rfcomm_server_disconnect_all_connection(void)
124 bt_rfcomm_server_info_t *server_info;
126 for (l = server_list; l != NULL; l = l->next) {
127 server_info = l->data;
129 if (server_info == NULL)
132 _bt_rfcomm_disconnect(server_info->data_fd);
135 return BLUETOOTH_ERROR_NONE;
138 int _bt_rfcomm_server_check_existence(gboolean *existence)
140 BT_CHECK_PARAMETER(existence, return);
142 if (server_list && g_slist_length(server_list) > 0)
147 return BLUETOOTH_ERROR_NONE;
150 int _bt_rfcomm_server_check_termination(char *name)
153 bt_rfcomm_server_info_t *server_info;
155 BT_CHECK_PARAMETER(name, return);
157 for (l = server_list; l != NULL; l = l->next) {
158 server_info = l->data;
160 if (server_info == NULL)
163 if (g_strcmp0(server_info->sender, name) == 0)
164 _bt_rfcomm_remove_socket(server_info->control_fd);
168 return BLUETOOTH_ERROR_NONE;