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.h>
31 #include "bluetooth-api.h"
32 #include "bt-internal-types.h"
34 #include "bt-service-common.h"
35 #include "bt-service-event.h"
36 #include "bt-service-util.h"
37 #include "bt-service-rfcomm-client.h"
38 #include "bt-service-rfcomm-server.h"
45 GDBusProxy *rfcomm_proxy;
46 } rfcomm_function_data_t;
48 rfcomm_function_data_t *rfcomm_info;
51 static int __bt_rfcomm_terminate_client(int socket_fd)
53 return BLUETOOTH_ERROR_NONE;
57 int _bt_rfcomm_connect_using_uuid(int request_id,
58 bluetooth_device_address_t *device_address,
61 return BLUETOOTH_ERROR_NONE;
64 /* Range of the Channel : 0 <= channel <= 30 */
65 int _bt_rfcomm_connect_using_channel(int request_id,
66 bluetooth_device_address_t *device_address,
69 return BLUETOOTH_ERROR_NONE;
72 /* Be used in RFCOMM client /server */
73 int _bt_rfcomm_disconnect(int socket_fd)
75 return __bt_rfcomm_terminate_client(socket_fd);
78 /* Be used in RFCOMM client /server */
79 int _bt_rfcomm_write(int socket_fd, char *buf, int length)
81 return BLUETOOTH_ERROR_NONE;
84 int _bt_rfcomm_cancel_connect(void)
86 return BLUETOOTH_ERROR_NONE;
89 int _bt_rfcomm_is_connected(gboolean *connected)
91 BT_CHECK_PARAMETER(connected, return);
93 *connected = (client_list == NULL || g_slist_length(client_list) == 0) ?
96 return BLUETOOTH_ERROR_NONE;
99 int _bt_rfcomm_is_device_connected(bluetooth_device_address_t *device_address,
103 bt_rfcomm_info_t *client_info;
104 char address[BT_ADDRESS_STRING_SIZE] = { 0 };
106 BT_CHECK_PARAMETER(device_address, return);
107 BT_CHECK_PARAMETER(connected, return);
109 _bt_convert_addr_type_to_string(address, device_address->addr);
113 for (l = client_list; l != NULL; l = l->next) {
114 client_info = l->data;
116 if (client_info == NULL)
119 if (g_strcmp0(address, client_info->address) == 0) {
121 return BLUETOOTH_ERROR_NONE;
125 return BLUETOOTH_ERROR_NONE;
128 int _bt_rfcomm_client_disconnect_all(void)
131 bt_rfcomm_info_t *client_info;
133 for (l = client_list; l != NULL; l = l->next) {
134 client_info = l->data;
136 if (client_info == NULL)
139 _bt_rfcomm_disconnect(client_info->fd);
142 return BLUETOOTH_ERROR_NONE;