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>
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"
46 GDBusProxy *rfcomm_proxy;
47 } rfcomm_function_data_t;
49 rfcomm_function_data_t *rfcomm_info;
52 static int __bt_rfcomm_terminate_client(int socket_fd)
54 return BLUETOOTH_ERROR_NONE;
58 int _bt_rfcomm_connect_using_uuid(int request_id,
59 bluetooth_device_address_t *device_address,
62 return BLUETOOTH_ERROR_NONE;
65 /* Range of the Channel : 0 <= channel <= 30 */
66 int _bt_rfcomm_connect_using_channel(int request_id,
67 bluetooth_device_address_t *device_address,
70 return BLUETOOTH_ERROR_NONE;
73 /* Be used in RFCOMM client /server */
74 int _bt_rfcomm_disconnect(int socket_fd)
76 return __bt_rfcomm_terminate_client(socket_fd);
79 /* Be used in RFCOMM client /server */
80 int _bt_rfcomm_write(int socket_fd, char *buf, int length)
82 return BLUETOOTH_ERROR_NONE;
85 int _bt_rfcomm_cancel_connect(void)
87 return BLUETOOTH_ERROR_NONE;
90 int _bt_rfcomm_is_connected(gboolean *connected)
92 BT_CHECK_PARAMETER(connected, return);
94 *connected = (client_list == NULL || g_slist_length(client_list) == 0) ?
97 return BLUETOOTH_ERROR_NONE;
100 int _bt_rfcomm_is_device_connected(bluetooth_device_address_t *device_address,
104 bt_rfcomm_info_t *client_info;
105 char address[BT_ADDRESS_STRING_SIZE] = { 0 };
107 BT_CHECK_PARAMETER(device_address, return);
108 BT_CHECK_PARAMETER(connected, return);
110 _bt_convert_addr_type_to_string(address, device_address->addr);
114 for (l = client_list; l != NULL; l = l->next) {
115 client_info = l->data;
117 if (client_info == NULL)
120 if (g_strcmp0(address, client_info->address) == 0) {
122 return BLUETOOTH_ERROR_NONE;
126 return BLUETOOTH_ERROR_NONE;
129 int _bt_rfcomm_client_disconnect_all(void)
132 bt_rfcomm_info_t *client_info;
134 for (l = client_list; l != NULL; l = l->next) {
135 client_info = l->data;
137 if (client_info == NULL)
140 _bt_rfcomm_disconnect(client_info->fd);
143 return BLUETOOTH_ERROR_NONE;